:root {
  --ink: #3b2a1f;
  --muted: #7c6655;
  --line: #decdbb;
  --surface: #fffaf4;
  --soft: #f4eadf;
  --primary: #8b5e34;
  --primary-dark: #5a3824;
  --accent: #c4945c;
  --ok: #4f7a52;
  --bad: #9b4234;
  --warn: #f7dfbf;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-body {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
  background: linear-gradient(140deg, #f7efe6 0%, #e8d5be 50%, #fffaf4 100%);
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(120, 82, 44, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.96);
  box-shadow: 0 18px 50px rgba(87, 55, 26, 0.16);
}

.login-panel img {
  width: min(260px, 100%);
}

.login-panel h1 {
  margin: 0;
  font-size: 24px;
}

.login-panel form {
  display: grid;
  gap: 12px;
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.login-error {
  margin: 0;
  color: #9d3b24;
  font-size: 13px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: #4c321f;
  color: #fff;
}

.brand {
  margin-bottom: 22px;
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #f6efe6;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  color: #f7eadc;
  text-decoration: none;
  padding: 10px 11px;
  border-radius: 8px;
  font-weight: 750;
}

nav a.active,
nav a:hover {
  background: #6b482d;
}

.sidebar-note {
  display: grid;
  gap: 4px;
  margin-top: 24px;
  padding: 12px;
  border: 1px solid rgba(255, 250, 244, 0.18);
  border-radius: 8px;
  color: #f7eadc;
}

.sidebar-note span {
  opacity: 0.75;
}

.logout-form {
  margin-top: 10px;
}

.logout-form button {
  width: 100%;
}

.channel-semaphore {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.channel-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.08);
  color: #f7eadc;
  font-size: 12px;
  font-weight: 850;
}

.channel-dot i {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: #d4a246;
  box-shadow: 0 0 0 3px rgba(212, 162, 70, 0.16);
}

.channel-dot.ok i {
  background: #51a35c;
  box-shadow: 0 0 0 3px rgba(81, 163, 92, 0.18);
}

.channel-dot.warn i {
  background: #d4a246;
}

.channel-dot.off i {
  background: #bd5b4d;
  box-shadow: 0 0 0 3px rgba(189, 91, 77, 0.16);
}

.top-channel-semaphore {
  display: flex;
  flex-wrap: wrap;
  margin-top: 8px;
}

.top-channel-semaphore .channel-dot {
  background: #fffaf4;
  border: 1px solid var(--line);
  color: var(--ink);
}

.sync-note {
  display: inline-flex;
  margin-top: 8px;
  color: rgba(247, 234, 220, 0.75);
  font-size: 11px;
  font-weight: 800;
}

.deduct-menu {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 250, 244, 0.16);
}

.deduct-menu summary {
  color: #fff3e4;
  font-size: 12px;
  font-weight: 900;
}

.deduct-menu-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.deduct-menu-list span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  padding: 7px;
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.08);
  opacity: 1;
}

.deduct-menu-list strong {
  color: #fff8ef;
  font-size: 12px;
}

.deduct-menu-list b {
  color: #f7d4a8;
  font-size: 12px;
}

.deduct-menu-list small {
  grid-column: 1 / -1;
  color: rgba(247, 234, 220, 0.72);
  font-size: 11px;
  line-height: 1.25;
}

main {
  min-width: 0;
  padding: 22px;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.quick-filter {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.85);
}

.year-total {
  display: grid;
  gap: 1px;
  min-width: 128px;
  padding: 5px 10px;
  border: 1px solid rgba(139, 94, 52, 0.22);
  border-radius: 6px;
  background: #fff4e6;
}

.year-total span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
}

.year-total strong {
  color: var(--primary-dark);
  font-size: 15px;
  line-height: 1.2;
}

form {
  margin: 0;
}

input,
select {
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

button.primary,
.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button.danger {
  border-color: #d4a59a;
  background: #fde2df;
  color: var(--bad);
}

button:hover,
.button:hover {
  border-color: var(--accent);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metrics a,
.metrics div,
.panel,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics a,
.metrics div {
  display: block;
  padding: 14px;
  color: var(--ink);
  text-decoration: none;
}

.metrics a:hover,
.metrics a.selected {
  border-color: var(--primary);
  background: #fff4e6;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.metrics strong {
  font-size: 24px;
}

.detail-two-columns {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.deductibility-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.deductibility-list div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
}

.deductibility-list strong {
  color: var(--primary-dark);
  font-size: 24px;
}

.deductibility-list span {
  color: var(--muted);
  font-weight: 750;
}

.deductibility-list b {
  color: var(--ok);
}

.metric-table-wrap {
  overflow: hidden;
}

.metric-table {
  min-width: 0;
  table-layout: fixed;
}

.metric-table th,
.metric-table td {
  padding: 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.metric-table th:first-child,
.metric-table td:first-child {
  width: 54px;
}

.metric-table th:nth-child(2),
.metric-table td:nth-child(2) {
  width: 112px;
}

.metric-table th:nth-child(4),
.metric-table td:nth-child(4),
.metric-table th:nth-child(5),
.metric-table td:nth-child(5),
.metric-table th:nth-child(6),
.metric-table td:nth-child(6) {
  width: 116px;
}

.savings-filter {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 170px auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.92);
}

.savings-filter label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.savings-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.saving-card {
  border-color: rgba(79, 122, 82, 0.38) !important;
  background: #f4fbef !important;
}

.saving-card strong {
  color: var(--ok);
}

.savings-layout {
  grid-template-columns: 390px minmax(0, 1fr);
}

.month-savings-grid {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.month-savings-grid a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  padding: 11px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
}

.month-savings-grid a:hover,
.month-savings-grid a.selected {
  border-color: var(--primary);
  background: #fff3e2;
}

.month-savings-grid span {
  font-weight: 850;
}

.month-savings-grid strong {
  color: var(--ok);
}

.month-savings-grid small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.savings-table {
  table-layout: fixed;
}

.savings-table th:first-child,
.savings-table td:first-child {
  width: 24%;
}

.savings-table th:nth-child(2),
.savings-table td:nth-child(2) {
  width: 72px;
}

.savings-table th:nth-child(3),
.savings-table td:nth-child(3) {
  width: 18%;
}

.savings-table th:nth-child(4),
.savings-table td:nth-child(4),
.savings-table th:nth-child(5),
.savings-table td:nth-child(5),
.savings-table th:nth-child(6),
.savings-table td:nth-child(6),
.savings-table th:nth-child(7),
.savings-table td:nth-child(7) {
  width: 116px;
}

.savings-note {
  margin-top: 16px;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.main-flow,
.side-panel {
  display: grid;
  gap: 16px;
}

.side-panel {
  position: sticky;
  top: 22px;
}

.panel {
  padding: 14px;
}

.action-panel {
  border-color: #c89c6d;
}

.section-head,
.table-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.section-head p,
.muted {
  margin: 0;
  color: var(--muted);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.upload-grid label,
.export-grid label,
.advanced-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.upload-grid input,
.upload-grid select,
.export-grid input,
.export-grid select,
.stack input,
.stack select,
.advanced-grid input {
  width: 100%;
}

.upload-grid button {
  align-self: end;
}

.advanced-fields {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.export-panel {
  background: #fff7ed;
  border-color: #d1b18c;
}

.export-grid {
  display: grid;
  gap: 10px;
}

.two-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

fieldset {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.choice {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-right: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.choice input {
  width: auto;
  height: auto;
}

.sepa-form {
  margin-top: 8px;
}

.sepa-form button {
  width: 100%;
}

.backup-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #d1b18c;
}

.backup-form button {
  width: 100%;
  background: #2f2924;
  color: #fffaf2;
}

.backup-form p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.backup-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.backup-list > strong {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

.backup-list a {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid #d1b18c;
  border-radius: 8px;
  background: #fffaf2;
  color: var(--ink);
  text-decoration: none;
}

.backup-list span {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 900;
}

.backup-list small {
  color: var(--muted);
}

.panel > .button {
  width: 100%;
  margin-top: 8px;
}

.status-list {
  display: grid;
  gap: 8px;
}

.status-list span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.status-list strong {
  color: var(--ink);
}

.setup-note {
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #f7dfbf;
  color: var(--primary-dark);
  font-size: 13px;
  line-height: 1.4;
}

.bar-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.compact-row {
  font-size: 13px;
}

details {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
}

summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 850;
}

.company-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.company-list a {
  display: grid;
  gap: 3px;
  padding: 10px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.company-list a.selected {
  background: #f8ead8;
  border-color: var(--primary);
}

.company-list span {
  color: var(--muted);
  font-size: 13px;
}

.user-edit-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.user-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-edit-row input,
.user-edit-row select,
.user-edit-row button {
  width: 100%;
}

.compact-choice {
  margin: 0;
  min-height: 38px;
}

.stack {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.table-wrap {
  overflow: auto;
}

.table-title {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.table-title span {
  color: var(--muted);
  font-weight: 750;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.bulk-actions-copy {
  display: grid;
  gap: 2px;
  text-align: right;
}

.bulk-actions-copy strong {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.bulk-actions form {
  margin: 0;
}

.bulk-actions button {
  min-height: 34px;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: var(--primary-dark);
  color: #fff;
  font-size: 12px;
  text-transform: uppercase;
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  max-width: 280px;
}

tr.warning td {
  background: var(--warn);
}

tr.clickable-row {
  cursor: pointer;
}

tr.clickable-row:hover td {
  background: #fff4e6;
}

.tag,
.state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f0dfcb;
  font-weight: 800;
  font-size: 12px;
}

.row-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #efe0cf;
  color: var(--primary-dark);
  font-weight: 900;
}

.state.approvata,
.state.rimborsata {
  color: var(--ok);
  background: #dff5eb;
}

.state.respinta,
.state.errore {
  color: var(--bad);
  background: #fde2df;
}

.row-actions form {
  display: flex;
  gap: 6px;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions button {
  width: 36px;
  padding: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.detail-body {
  display: block;
}

.detail-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 360px);
  gap: 16px;
  align-items: start;
}

.media-column {
  display: grid;
  gap: 12px;
}

.receipt-preview {
  display: grid;
  place-items: center;
  min-height: 360px;
  max-height: 500px;
  overflow: hidden;
  padding: 20px;
  background: #fff;
  border-color: #d8c8b7;
}

.receipt-preview img {
  display: block;
  width: auto;
  max-width: min(100%, 360px);
  max-height: 460px;
  border-radius: 6px;
  object-fit: contain;
}

.empty-preview {
  display: grid;
  place-items: center;
  min-height: 320px;
  width: 100%;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.detail-panel {
  display: grid;
  gap: 10px;
  font-size: 12px;
}

.supplier-block {
  display: grid;
  gap: 7px;
}

.supplier-block h2 {
  font-size: 16px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.supplier-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.supplier-list div {
  min-height: 44px;
  padding: 7px;
}

.detail-list div {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.detail-list dd {
  margin: 0;
  text-align: left;
  font-weight: 750;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.expense-strip {
  display: grid;
  gap: 12px;
  background: #f1eadf;
  border-color: #cdb79e;
}

.expense-strip h2 {
  font-size: 17px;
}

.expense-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.expense-list div {
  background: #fffaf4;
  min-height: 58px;
}

.detail-list dd small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.wide-detail {
  grid-column: 1 / -1;
}

.detail-note {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
}

.detail-note p,
.detail-note ul {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.note-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.note-heading form {
  margin: 0;
}

.ai-note-button {
  min-width: 42px;
  min-height: 34px;
  padding: 0 10px;
  border-color: #b98242;
  background: #2f2924;
  color: #fffaf2;
}

.ai-note-button span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #c4945c;
  color: #2f2924;
  font-size: 11px;
  font-weight: 950;
}

.editable-note form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.editable-note textarea {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.note-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.warning-note {
  background: #fff4e6;
  color: var(--primary-dark);
}

.detail-actions {
  display: grid;
  gap: 8px;
}

.detail-actions form {
  display: flex;
  gap: 8px;
}

.detail-actions button {
  flex: 1;
}

@media (max-width: 1100px) {
  .page-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-two-columns {
    grid-template-columns: 1fr;
  }

  .savings-filter,
  .savings-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .savings-layout {
    grid-template-columns: 1fr;
  }

  .expense-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .receipt-preview {
    min-height: 300px;
    max-height: 420px;
  }

  .receipt-preview img {
    max-width: min(100%, 320px);
    max-height: 380px;
  }

  .side-panel {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  * {
    min-width: 0;
  }

  html,
  body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  body {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    width: 100%;
    max-width: 100vw;
    padding: 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .brand img {
    max-width: 210px;
  }

  nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  nav a {
    white-space: nowrap;
    padding: 9px 10px;
  }

  .sidebar-note {
    display: none;
  }

  main {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    padding: 14px;
    overflow-x: hidden;
  }

  .detail-main {
    padding: 14px;
  }

  .sidebar > *,
  main > * {
    max-width: 100%;
  }

  .topline,
  .quick-filter,
  .section-head,
  .table-title {
    display: grid;
    justify-content: stretch;
  }

  h1 {
    font-size: 27px;
  }

  .quick-filter input,
  .quick-filter select,
  .quick-filter button,
  .savings-filter,
  .savings-filter label,
  input,
  select,
  button,
  .button {
    width: 100%;
    max-width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .savings-filter,
  .savings-metrics {
    grid-template-columns: 1fr;
  }

  .page-grid,
  .main-flow,
  .side-panel,
  .upload-grid,
  .advanced-grid,
  .two-cols,
  .user-edit-row {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: grid;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    flex: 0 0 112px;
    color: var(--muted);
    font-weight: 850;
  }

  .row-actions form {
    width: 100%;
  }

  .row-actions {
    display: grid;
  }

  .row-actions button {
    width: 100%;
  }

  .bulk-actions {
    justify-content: stretch;
  }

  .bulk-actions button {
    width: 100%;
  }

  .receipt-preview {
    min-height: 260px;
    max-height: 340px;
    padding: 12px;
  }

  .receipt-preview img {
    max-width: min(100%, 260px);
    max-height: 300px;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .expense-list {
    grid-template-columns: 1fr;
  }

  .detail-actions form {
    display: grid;
  }
}
