:root {
  --bg: #f7f4ee;
  --panel: #ffffff;
  --ink: #101923;
  --muted: #5a6570;
  --line: #d9d1c4;
  --brand: #4f7555;
  --brand-2: #18212b;
  --warn: #a45d20;
  --bad: #9b2f2f;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button {
  border: 0;
  background: var(--brand-2);
  color: #fff;
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
button.secondary { background: var(--brand); }
button.ghost { background: #e7dfd3; color: var(--ink); }
button.danger { background: var(--bad); }
button:disabled { opacity: .55; cursor: not-allowed; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
.side { background: #18212b; color: #fff; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { font-size: 1.2rem; font-weight: 800; margin-bottom: 18px; }
.app-version { display: inline-flex; margin-left: 5px; padding: 2px 7px; border-radius: 99px; background: rgba(255,255,255,.16); color: #fff; font-size: .7rem; vertical-align: middle; }
.mobile-version { display: block; margin-bottom: 7px; color: var(--muted); font-size: .76rem; font-weight: 800; }
.nav { display: grid; gap: 16px; }
.nav-group { display: grid; gap: 3px; }
.nav-group-label { padding: 0 0.7rem 4px; color: #9eabb8; font-size: .66rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.nav button { width: 100%; text-align: left; background: transparent; border-radius: 6px; padding: 0.55rem 0.7rem; }
.nav button.nested { position: relative; padding-left: 1.55rem; color: #d6dde4; font-size: .9rem; }
.nav button.nested::before { content: "↳"; position: absolute; left: .72rem; color: #91a09a; }
.nav button.active, .nav button:hover { background: rgba(255,255,255,.14); }
.main { padding: 26px; min-width: 0; }
.topbar { display: none; margin-bottom: 14px; }
.page-head { margin-bottom: 18px; }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.page-head-row p { margin-bottom: 0; }
h1 { margin: 0; font-size: 2rem; line-height: 1.15; }
h2 { margin: 0 0 14px; font-size: 1.25rem; }
p { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
label { display: grid; gap: 6px; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cfc6b8;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 0.65rem;
  min-height: 40px;
}
textarea { min-height: 76px; resize: vertical; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.repeat-section { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 0; }
.repeat-section legend { padding: 0 6px; color: var(--ink); font-size: .82rem; font-weight: 800; text-transform: uppercase; }
.repeat-list { display: grid; gap: 10px; }
.repeat-row { display: grid; gap: 10px; align-items: end; }
.tenant-row { grid-template-columns: minmax(0, 1fr) auto; }
.rent-row { grid-template-columns: minmax(145px, .8fr) minmax(145px, .8fr) minmax(180px, 1.4fr) auto; }
.settings-lists-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.settings-list-field { align-self: start; min-width: 0; }
.settings-item-row { grid-template-columns: minmax(0, 1fr) auto; }
.insurance-types-maintenance { max-width: 760px; }
.remove-row { min-height: 40px; }
.add-row { margin-top: 10px; }
.field-help { margin: 0 0 10px; font-size: .85rem; }
.empty-repeat { margin: 0; padding: 8px 0; font-size: .9rem; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; }
td.actions-cell { white-space: nowrap; width: 1%; }
.certificate-urgent td, .renewal-urgent td { background: #ffe8e8; color: #6d1d1d; }
.certificate-urgent .pill, .renewal-urgent .pill { background: #f6bcbc; color: #5b1515; }
.status { padding: 10px 12px; border-radius: 6px; background: #eef4ed; color: #243d29; }
.status.warn { background: #fff2dc; color: #6a3b0f; }
.status.bad { background: #ffe8e8; color: #6d1d1d; }
.pill { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 99px; background: #eef0f1; font-size: .78rem; font-weight: 700; }
.lock-pill { background: #ffe8e8; color: #6d1d1d; }
.audit-history { margin: 8px 0 0; max-width: 360px; white-space: pre-wrap; font: inherit; font-size: .82rem; color: var(--muted); }
.amount-link { border: 0; padding: 0; color: var(--brand); background: transparent; text-decoration: underline; }
.sort-head {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  text-transform: uppercase;
}
.sort-head span { color: var(--brand); font-size: .85rem; }
.filter-panel { margin-bottom: 10px; }
.filter-actions { display: flex; align-items: end; }
.filter-summary { margin: 12px 0 0; }
.report-mode-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.report-groups { display: grid; gap: 12px; }
.report-group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.report-group-summary { display: grid; grid-template-columns: auto minmax(170px, 1fr) minmax(360px, 1fr); gap: 14px; align-items: center; padding: 16px 18px; cursor: pointer; list-style: none; }
.report-group-summary::-webkit-details-marker { display: none; }
.report-group-summary:hover { background: #fbf9f5; }
.report-toggle { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-2); color: #fff; font-size: 1.2rem; line-height: 1; transition: transform .15s ease; }
.report-group[open] .report-toggle { transform: rotate(45deg); }
.report-group-label { font-size: 1.05rem; }
.report-total-grid { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 12px; }
.report-total { display: grid; gap: 2px; font-weight: 800; }
.report-total small { color: var(--muted); font-size: .7rem; text-transform: uppercase; }
.report-lines { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.report-category { padding-top: 16px; }
.report-category + .report-category { margin-top: 4px; border-top: 1px solid var(--line); }
.report-category-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 4px 12px; cursor: pointer; list-style: none; }
.report-category-head::-webkit-details-marker { display: none; }
.report-category-head:hover { color: var(--brand); }
.category-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.category-toggle { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #e7dfd3; color: var(--ink); font-size: 1rem; line-height: 1; transition: transform .15s ease; }
.report-category[open] .category-toggle { transform: rotate(45deg); }
.report-category-head small { color: var(--muted); }
.report-category-items { padding-bottom: 12px; }
.report-category table { margin-top: 0; }
.report-transaction { cursor: pointer; }
.report-transaction:hover td { background: #f5f8f4; }
.report-transaction:focus { outline: 3px solid rgba(79, 117, 85, .35); outline-offset: -3px; }
.hmrc-summary { border-top: 5px solid var(--brand); }
.hmrc-summary-toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.hmrc-summary-toggle::-webkit-details-marker { display: none; }
.hmrc-summary-toggle > span:last-child { display: grid; gap: 2px; }
.hmrc-summary-toggle strong { font-size: 1.1rem; }
.hmrc-summary-toggle small { color: var(--muted); }
.hmrc-summary-disabled { border-top-color: #9ca3aa; background: #f4f2ed; }
.hmrc-summary-disabled .hmrc-summary-toggle { cursor: not-allowed; }
.hmrc-summary-disabled .hmrc-toggle-icon { background: #747d85; font-size: .9rem; }
.hmrc-lock-reasons { margin: 14px 0 0; }
.hmrc-toggle-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 1.25rem; line-height: 1; transition: transform .15s ease; }
.hmrc-summary[open] .hmrc-toggle-icon { transform: rotate(45deg); }
.hmrc-summary-body { padding-top: 18px; margin-top: 16px; border-top: 1px solid var(--line); }
.hmrc-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 14px; }
.hmrc-heading h2 { margin-bottom: 4px; }
.hmrc-heading p { margin: 0; }
.hmrc-context { display: grid; grid-template-columns: repeat(3, minmax(105px, 1fr)); gap: 8px; min-width: min(440px, 48%); }
.hmrc-context span { display: grid; gap: 3px; padding: 10px; border-radius: 6px; background: #eef4ed; }
.hmrc-context small { color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.hmrc-table { min-width: 880px; }
.hmrc-table th:nth-child(1) { width: 70px; }
.hmrc-table th:nth-child(3) { width: 150px; }
.hmrc-table th:nth-child(4) { width: 270px; }
.hmrc-amount { font-weight: 800; white-space: nowrap; }
.hmrc-manual td { background: #faf8f3; color: var(--muted); }
.fine-print { margin: 12px 0 0; font-size: .82rem; }
.hmrc-submit { margin-top: 20px; padding-top: 20px; border-top: 3px solid var(--brand); }
.hmrc-submit h3 { margin: 0 0 6px; font-size: 1.15rem; }
.hmrc-submit > p { margin-top: 0; }
.add-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.add-button span { font-size: 1.65rem; line-height: 1; font-weight: 500; transform: translateY(-1px); }
.icon-button { min-width: 42px; padding: .45rem .7rem; font-size: 1.35rem; line-height: 1; }
.entry-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(16, 25, 35, .28);
}
.entry-dialog::backdrop { background: rgba(16, 25, 35, .52); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; }
.muted { color: var(--muted); }
.hide { display: none !important; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.attachment-list strong { flex-basis: 100%; color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.attachment-link { background: #eef0f1; color: var(--ink); padding: .45rem .65rem; }
.attachment-link:disabled { color: var(--muted); background: #f3eee6; }

/* Refined application navigation */
.app-shell { grid-template-columns: 252px 1fr; }
.side {
  background: linear-gradient(180deg, #18242e 0%, #121b23 100%);
  padding: 20px 16px 24px;
  box-shadow: 8px 0 28px rgba(16, 25, 35, .08);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 4px 18px; margin-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark { display: inline-grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: #fff; box-shadow: 0 7px 16px rgba(0,0,0,.2); font-size: .82rem; font-weight: 900; letter-spacing: .04em; }
.brand-copy { display: grid; min-width: 0; gap: 3px; }
.brand-copy strong { font-size: .94rem; letter-spacing: -.01em; }
.brand-copy small { color: #9fabb4; font-size: .7rem; font-weight: 650; }
.app-version { margin-left: 4px; padding: 1px 6px; border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.08); color: #dfe6eb; font-size: .63rem; }
.nav { gap: 20px; }
.nav-group-label { display: flex; align-items: center; gap: 9px; padding: 0 10px 6px; color: #86949f; font-size: .64rem; font-weight: 850; letter-spacing: .11em; }
.nav-group-label::after { content: ""; height: 1px; flex: 1; background: rgba(255,255,255,.08); }
.nav button { min-height: 39px; color: #e1e7eb; border-radius: 8px; padding: .58rem .72rem; font-size: .91rem; font-weight: 650; transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease; }
.nav button:hover { background: rgba(255,255,255,.075); color: #fff; transform: translateX(2px); }
.nav button.active { background: var(--brand); color: #fff; box-shadow: 0 6px 15px rgba(0,0,0,.18), inset 3px 0 rgba(255,255,255,.22); }
.nav button.active:hover { background: #587f5e; transform: none; }
.nav button:focus-visible { outline: 2px solid #b9d1bd; outline-offset: 2px; }
.nav button.nested { width: calc(100% - 13px); min-height: 34px; margin-left: 13px; padding: .42rem .65rem .42rem 1.25rem; border-left: 1px solid rgba(255,255,255,.14); border-radius: 0 7px 7px 0; color: #aeb9c1; font-size: .82rem; font-weight: 600; }
.nav button.nested::before { content: ""; left: .5rem; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: #71827a; transform: translateY(-50%); }
.nav button.nested.active { border-left-color: #8daf93; background: rgba(79,117,85,.34); color: #fff; box-shadow: none; }
.nav button.nested.active::before { background: #b9d1bd; }
.mobile-brand { display: flex; align-items: center; gap: 9px; }
.mobile-brand > span:last-child { display: grid; gap: 1px; }
.mobile-brand strong { font-size: .88rem; }
.mobile-brand small { color: var(--muted); font-size: .66rem; font-weight: 800; }
.mobile-nav-label { display: grid; grid-template-columns: auto minmax(150px, 1fr); align-items: center; gap: 9px; color: var(--muted); font-size: .68rem; white-space: nowrap; }
.mobile-nav-label select { min-height: 38px; padding: .48rem 2rem .48rem .65rem; border-color: var(--line); font-size: .86rem; font-weight: 700; text-transform: none; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, rgba(79,117,85,.2), transparent 34%), linear-gradient(145deg, #18242e, #101820); }
.login-card { width: min(430px, 100%); display: grid; gap: 22px; padding: 30px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.35); }
.login-card h1 { font-size: 1.8rem; }
.login-card p { margin: 7px 0 0; }
.login-brand { display: flex; align-items: center; gap: 11px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.login-brand > span:last-child { display: grid; gap: 2px; }
.login-brand strong { color: var(--ink); }
.login-brand small { color: var(--muted); font-size: .7rem; font-weight: 800; }
.login-form { display: grid; gap: 14px; }
.login-form button { margin-top: 3px; }
.login-help { font-size: .78rem; text-align: center; }
.account-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.account-panel h2 { margin-bottom: 5px; }
.account-panel p { margin: 0; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.dashboard-kpi { display: grid; gap: 7px; min-height: 142px; padding: 18px; border: 1px solid var(--line); border-top: 4px solid #77858f; border-radius: 10px; background: var(--panel); color: var(--ink); text-align: left; box-shadow: 0 5px 16px rgba(16,25,35,.045); }
.dashboard-kpi:hover { border-color: #b8c3ba; background: #fbfcfa; transform: translateY(-2px); box-shadow: 0 9px 24px rgba(16,25,35,.08); }
.dashboard-kpi > span { color: var(--muted); font-size: .72rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.dashboard-kpi > strong { align-self: center; font-size: clamp(1.45rem, 2.2vw, 2rem); letter-spacing: -.035em; }
.dashboard-kpi small { color: var(--muted); font-size: .75rem; font-weight: 600; line-height: 1.35; }
.dashboard-kpi.positive { border-top-color: var(--brand); }
.dashboard-kpi.negative { border-top-color: var(--bad); }
.dashboard-kpi.positive > strong { color: #365b3c; }
.dashboard-kpi.negative > strong { color: var(--bad); }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 14px; }
.dashboard-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.dashboard-section-head h2 { margin-bottom: 3px; }
.dashboard-section-head p { margin: 0; font-size: .84rem; }
.dashboard-action-list, .recent-list { display: grid; }
.dashboard-action { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; width: 100%; padding: 11px 5px; border-bottom: 1px solid #eee8df; border-radius: 0; background: transparent; color: var(--ink); text-align: left; }
.dashboard-action:last-child { border-bottom: 0; }
.dashboard-action:hover { background: #f8f7f3; padding-left: 9px; padding-right: 9px; }
.dashboard-action > span:nth-child(2) { display: grid; gap: 2px; }
.dashboard-action small { color: var(--muted); font-size: .76rem; font-weight: 600; }
.dashboard-action > span:last-child { color: #89939a; font-size: 1.35rem; }
.dashboard-action-icon { width: 9px; height: 9px; border-radius: 50%; background: #d59a45; box-shadow: 0 0 0 4px #fff2dc; }
.dashboard-action-icon.urgent { background: var(--bad); box-shadow: 0 0 0 4px #ffe8e8; }
.dashboard-empty { display: grid; gap: 4px; padding: 24px 8px; color: var(--muted); text-align: center; }
.dashboard-empty strong { color: #365b3c; }
.shortcut-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.shortcut-grid button { display: grid; gap: 4px; min-height: 90px; padding: 13px; border: 1px solid #d8ded8; background: #f4f7f3; color: var(--ink); text-align: left; }
.shortcut-grid button:hover { border-color: #aebfad; background: #edf4ec; }
.shortcut-grid button strong { color: #365b3c; }
.shortcut-grid button span { color: var(--muted); font-size: .75rem; font-weight: 600; line-height: 1.3; }
.cashflow-panel, .recent-panel { margin-top: 0; }
.cashflow-chart { display: grid; gap: 6px; }
.cashflow-row { display: grid; grid-template-columns: 64px minmax(150px, 1fr) minmax(150px, 1fr) 105px; align-items: center; gap: 12px; padding: 8px 6px; border-top: 1px solid #eee8df; }
.cashflow-row:first-child { border-top: 0; }
.cashflow-row > div { display: grid; gap: 4px; }
.cashflow-row small { color: var(--muted); font-size: .7rem; font-weight: 700; }
.cashflow-row > span { justify-self: end; font-weight: 800; }
.cashflow-row .positive { color: #365b3c; }
.cashflow-row .negative { color: var(--bad); }
.cashflow-row meter { width: 100%; height: 8px; border: 0; background: #ebe7df; }
.cashflow-row meter::-webkit-meter-bar { height: 8px; border: 0; border-radius: 99px; background: #ebe7df; }
.cashflow-row .income-meter::-webkit-meter-optimum-value { border-radius: 99px; background: var(--brand); }
.cashflow-row .expense-meter::-webkit-meter-optimum-value { border-radius: 99px; background: #c28655; }
.cashflow-row .income-meter::-moz-meter-bar { background: var(--brand); }
.cashflow-row .expense-meter::-moz-meter-bar { background: #c28655; }
.recent-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 11px 5px; border-bottom: 1px solid #eee8df; border-radius: 0; background: transparent; color: var(--ink); text-align: left; }
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover { background: #f8f7f3; }
.recent-row > span:nth-child(2) { display: grid; gap: 2px; }
.recent-row small { color: var(--muted); font-size: .75rem; font-weight: 600; }
.transaction-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-size: 1.05rem; }
.transaction-mark.income { background: #e8f2e7; color: #365b3c; }
.transaction-mark.expense { background: #f7ebe1; color: #8c552e; }
.recent-amount { white-space: nowrap; }
.recent-amount.income { color: #365b3c; }
.recent-amount.expense { color: #8c552e; }

@media (max-width: 1200px) {
  .settings-lists-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .side { display: none; }
  .main { padding: 14px; }
  .topbar { display: grid; grid-template-columns: auto minmax(190px, 1fr); align-items: center; gap: 18px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 4px 14px rgba(16,25,35,.06); }
  .topbar .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: .7rem; box-shadow: none; }
  .page-head-row { align-items: flex-start; }
  .page-head-row > div { min-width: 0; }
  .add-button { width: 42px; height: 42px; }
  .grid { grid-template-columns: 1fr; }
  .settings-lists-grid { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
  .report-group-summary { grid-template-columns: auto 1fr; gap: 10px; padding: 14px; }
  .report-total-grid { grid-column: 1 / -1; }
  .report-lines { padding: 0 10px 10px; }
  .hmrc-heading { display: grid; }
  .hmrc-context { min-width: 0; width: 100%; grid-template-columns: 1fr; }
  .hmrc-table { min-width: 0; }
  table { min-width: 0; }
  thead { display: none; }
  tr { display: block; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 8px; background: #fff; }
  td { display: grid; grid-template-columns: 42% 1fr; gap: 10px; border: 0; padding: 7px 2px; }
  td::before { content: attr(data-label); color: var(--muted); font-weight: 800; font-size: .75rem; text-transform: uppercase; }
  td.actions-cell { width: auto; white-space: normal; display: flex; }
  td.actions-cell::before { display: none; }
  .entry-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); padding: 14px; }
  .tenant-row, .rent-row { grid-template-columns: 1fr; }
  .remove-row { justify-self: start; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .cashflow-row { grid-template-columns: 56px 1fr 90px; }
  .cashflow-row > div { grid-column: 2 / -1; }
  .cashflow-row > span { grid-column: 3; grid-row: 1; }
}

@media (max-width: 520px) {
  .topbar { grid-template-columns: 1fr; gap: 9px; }
  .mobile-nav-label { grid-template-columns: auto 1fr; }
  .login-shell { padding: 12px; }
  .login-card { padding: 22px; }
  .account-panel { display: grid; }
  .dashboard-kpis { grid-template-columns: 1fr; }
  .dashboard-kpi { min-height: 124px; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .dashboard-section-head { align-items: stretch; }
  .cashflow-row { grid-template-columns: 1fr auto; gap: 7px; }
  .cashflow-row > div { grid-column: 1 / -1; }
  .cashflow-row > span { grid-column: 2; grid-row: 1; }
  .recent-row { grid-template-columns: auto minmax(0, 1fr); }
  .recent-amount { grid-column: 2; justify-self: start; }
}
