@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600&family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --canvas: #ece9e3;
  --surface: #ffffff;
  --surface-2: #f7f3ed;
  --ink: #26282b;
  --muted: #6f7072;
  --brand: #2c3036;
  --brand-2: #4e5053;
  --brand-soft: #f3ece3;
  --accent: #f2ad1d;
  --accent-soft: #fff3d3;
  --blue: #2767a7;
  --danger: #c94c41;
  --warning: #a96f0b;
  --success: #07884a;
  --line: #d9dde2;
  --line-dark: #bac1c9;
  --shadow: 0 16px 45px rgba(11, 23, 40, .08);
  --shadow-sm: 0 5px 18px rgba(11, 23, 40, .055);
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--canvas); }
body {
  color: var(--ink);
  background: linear-gradient(rgba(11,23,40,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(11,23,40,.025) 1px, transparent 1px), var(--canvas);
  background-size: 32px 32px;
  font: 14px/1.5 'Inter', system-ui, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { color: var(--ink); font-family: 'Space Grotesk', sans-serif; }
h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.045em; }
h3 { margin: 0 0 18px; font-size: 17px; letter-spacing: -.02em; }
h4 { font-size: 13px; }
label { display: block; margin: 12px 0 6px; color: #48515e; font-size: 11px; font-weight: 700; }
code { padding: 2px 5px; color: var(--brand); background: var(--brand-soft); border-radius: 3px; }

.app-layout { min-height: 100vh; }
.sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 258px; padding: 24px 18px 18px; color: #d9e0e8; background: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px), var(--brand); background-size: 24px 24px; border-right: 1px solid #26364b; display: flex; flex-direction: column; }
.sidebar:before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--accent); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 5px 7px 32px; }
.brand-logo { width: 58px; height: 46px; padding: 2px; flex: 0 0 58px; background: #fff; display: grid; place-items: center; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand strong, .sidebar-brand span, .sidebar-user strong, .sidebar-user span { display: block; }
.sidebar-brand strong { max-width: 142px; overflow: hidden; color: #fff; font: 700 15px/1.2 'Space Grotesk'; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-brand span { margin-top: 5px; color: #8695a8; font: 500 8px/1 'IBM Plex Mono'; letter-spacing: .12em; text-transform: uppercase; }
.nav-label { display: block; padding: 0 12px 10px; color: #697b91; font: 600 9px/1 'IBM Plex Mono'; letter-spacing: .16em; }
.side-nav { display: grid; gap: 3px; }
.side-nav a { height: 43px; padding: 0 12px; color: #9aa8b9; border: 1px solid transparent; display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; position: relative; transition: .18s ease; }
.side-nav a:hover { color: #fff; background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.05); }
.side-nav a.active { color: #fff; background: #47494c; border-color: #616367; box-shadow: inset 3px 0 var(--accent); }
.side-nav a i { width: 22px; color: #62748a; font: 600 9px/1 'IBM Plex Mono'; font-style: normal; text-align: center; }
.side-nav a.active i { color: var(--accent); }
.side-nav a b { position: absolute; right: 12px; width: 5px; height: 5px; background: var(--accent); transform: rotate(45deg); }
.sidebar-register { margin: 22px 7px 0; padding: 10px 0; color: #52657c; border-top: 1px solid #26364b; border-bottom: 1px solid #26364b; display: flex; align-items: center; justify-content: space-between; font: 600 8px/1 'IBM Plex Mono'; letter-spacing: .12em; }
.sidebar-register b { color: var(--accent); font-size: 11px; }
.sidebar-user { margin-top: auto; padding: 18px 7px 0; border-top: 1px solid #26364b; display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; color: var(--brand); background: var(--accent); display: grid; place-items: center; font: 700 13px 'Space Grotesk'; clip-path: polygon(0 0,100% 0,100% 76%,76% 100%,0 100%); }
.sidebar-user strong { color: #fff; font-size: 11px; }
.sidebar-user span { margin-top: 2px; color: #718197; font: 500 8px 'IBM Plex Mono'; text-transform: uppercase; }
.sidebar-user span a { color: inherit; }
.sidebar-user form { margin-left: auto; }
.sidebar-user button { width: 31px; height: 31px; color: #91a0b2; background: transparent; border: 1px solid #304158; }
.sidebar-user button:hover { color: #fff; border-color: var(--accent); }

.workspace { min-height: 100vh; margin-left: 258px; }
.main-content { padding: 30px 34px 18px; }
.container { max-width: 1440px; margin: 0 auto; }
.mobile-header, .mobile-overlay { display: none; }
.public-layout { min-height: 100vh; padding: 24px; display: grid; place-items: center; }
.public-container { width: min(500px, 100%); }
.muted { color: var(--muted) !important; }
.right { text-align: right !important; }
.flex { display: flex; gap: 12px; align-items: center; }
.space { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.item-entry-grid { grid-template-columns: minmax(130px,.7fr) minmax(240px,2fr) minmax(90px,.55fr) minmax(130px,.7fr); }
.card { position: relative; margin: 0 0 16px; padding: 22px; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card:before { content: ''; position: absolute; inset: -1px auto auto -1px; width: 18px; height: 18px; border-top: 2px solid var(--brand); border-left: 2px solid var(--brand); pointer-events: none; }
.document-card:before { width: 52px; border-color: var(--accent); }
.grid > .card { margin-bottom: 2px; }
.page-heading { margin: 3px 0 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line-dark); }
.page-heading h2 { margin: 5px 0 6px; }
.page-heading p { margin: 0; }
.eyebrow, .section-code { color: #7b8490; font: 600 9px/1 'IBM Plex Mono'; letter-spacing: .14em; text-transform: uppercase; }
.section-code { display: block; margin-bottom: 7px; color: var(--warning); }

.dashboard-hero { position: relative; min-height: 258px; padding: 32px; overflow: hidden; color: #fff; background: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(115deg, var(--brand), #55575a); background-size: 32px 32px, 32px 32px, auto; border: 1px solid #67696c; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; box-shadow: var(--shadow); }
.dashboard-hero:before { content: ''; position: absolute; inset: 18px; border: 1px solid rgba(255,255,255,.08); pointer-events: none; }
.dashboard-hero:after { content: ''; position: absolute; top: 0; right: 88px; width: 8px; height: 118px; background: var(--accent); transform: skew(-28deg); opacity: .95; }
.hero-copy, .hero-actions { position: relative; z-index: 2; }
.hero-copy { max-width: 650px; }
.hero-copy .eyebrow { color: #95a7bd; }
.hero-copy h1 { margin: 15px 0 12px; color: #fff; font-size: clamp(36px, 5vw, 60px); line-height: .94; letter-spacing: -.06em; }
.hero-copy h1 em { color: var(--accent); font-style: normal; }
.hero-copy p { max-width: 580px; margin: 0; color: #aebacc; font-size: 12px; }
.hero-actions { min-width: 330px; display: grid; justify-items: end; gap: 20px; }
.system-status { color: #b9c5d4; font: 600 9px 'IBM Plex Mono'; letter-spacing: .11em; text-transform: uppercase; }
.system-status i { width: 7px; height: 7px; margin-right: 8px; background: #36d19a; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 4px rgba(54,209,154,.12); }
.hero-index { position: absolute; top: -30px; right: 18px; color: rgba(255,255,255,.045); font: 700 180px/1 'Space Grotesk'; }
.dashboard-hero .btn.ghost { color: #fff; background: rgba(255,255,255,.04); border-color: #43536a; box-shadow: none; }
.dashboard-hero .btn.ghost:hover { border-color: #78879a; }

.summary-grid { margin: 16px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line-dark); border: 1px solid var(--line-dark); }
.summary-card { position: relative; min-height: 128px; padding: 22px; overflow: hidden; background: var(--surface); }
.summary-card:after { content: ''; position: absolute; right: 17px; bottom: 17px; width: 8px; height: 8px; border-right: 1px solid #c2c8cf; border-bottom: 1px solid #c2c8cf; }
.summary-card h4, .summary-card p { margin: 0; }
.summary-card h4 { color: #737d89; font: 600 9px/1 'IBM Plex Mono'; letter-spacing: .1em; text-transform: uppercase; }
.summary-card p { margin-top: 14px; font: 700 26px/1.1 'Space Grotesk'; letter-spacing: -.045em; }
.summary-card:nth-child(2) p { color: var(--success); }
.summary-card:nth-child(3) p { color: var(--danger); }
.summary-date { font-size: 18px !important; }
.dashboard-stats .summary-card > span, .dashboard-stats .summary-card > a { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; }
.dashboard-stats .summary-card > a { color: var(--brand); font-weight: 700; }

.btn { min-height: 39px; padding: 8px 14px; color: #273241; background: #fff; border: 1px solid var(--line-dark); border-radius: 3px; box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; font-weight: 700; white-space: nowrap; transition: .15s ease; }
.btn:hover { color: var(--brand); border-color: #88929e; transform: translateY(-1px); }
.btn.primary { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 4px 4px 0 var(--accent); }
.btn.primary:hover { color: #fff; background: var(--brand-2); box-shadow: 3px 3px 0 var(--accent); transform: translate(1px,1px); }
.btn.danger { color: #ad3c34; background: #fff5f4; border-color: #e8bbb7; box-shadow: none; }
.btn.small { min-height: 30px; padding: 5px 10px; border-radius: 2px; font-size: 10px; }
.inline-form { margin: 0; display: inline-flex; }
.input, select, textarea { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid #cfd5db; border-radius: 3px; box-shadow: inset 0 1px 2px rgba(11,23,40,.03); outline: none; transition: .15s ease; }
.input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(22,41,66,.1); }
textarea.input { min-height: 88px; resize: vertical; }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: end; }
.toolbar .input, .toolbar select { min-width: 180px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.table-responsive { overflow-x: auto; border: 1px solid var(--line); border-radius: 2px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 13px; text-align: left; border-bottom: 1px solid #e7e9ec; vertical-align: middle; }
.table th { color: #727b86; background: #f2f3f4; font: 600 9px/1.2 'IBM Plex Mono'; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.table td { font-size: 11px; }
.table tr:last-child td { border-bottom: 0; }
.table tr:not(:first-child):hover td { background: #fafaf8; }
.table .input { min-width: 95px; min-height: 36px; padding: 7px 9px; }
.table .item-code-input { min-width: 130px; }
.badge { padding: 5px 9px; color: #4b5663; background: #f0f2f4; border: 1px solid #d9dde2; border-radius: 2px; display: inline-flex; align-items: center; gap: 6px; font: 700 9px/1 'IBM Plex Mono'; text-transform: uppercase; }
.badge:before { content: ''; width: 5px; height: 5px; background: currentColor; transform: rotate(45deg); }
.badge.success { color: #176e51; background: #e9f6f1; border-color: #bce0d2; }
.badge.info { color: #285f97; background: #edf4fb; border-color: #c5d9ec; }
.badge.warning { color: #8b5c00; background: #fff6df; border-color: #ead49d; }
.badge.danger { color: #aa4037; background: #fff0ef; border-color: #ebc0bc; }
.badge.neutral { color: #5f6873; background: #f2f3f4; }

.balance-box { padding: 13px 16px; text-align: right; background: var(--accent-soft); border: 1px solid #e8cf8c; border-radius: 3px; }
.balance-box span, .balance-box strong { display: block; }
.balance-box span { color: #7b692f; font: 600 9px 'IBM Plex Mono'; letter-spacing: .08em; text-transform: uppercase; }
.balance-box strong { margin-top: 3px; color: var(--brand); font: 700 22px 'Space Grotesk'; }
.statement-totals { margin: 22px 0; overflow: hidden; background: var(--line); border: 1px solid var(--line); display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; }
.statement-totals > div { padding: 16px; background: #f8f8f6; }
.statement-totals span, .statement-totals strong { display: block; }
.statement-totals span { color: var(--muted); font-size: 10px; }
.statement-totals strong { margin-top: 5px; font: 700 17px 'Space Grotesk'; }
.item-row { margin-bottom: 8px; }
.app-footer { padding: 18px 2px 5px; color: #87909a; font: 500 9px 'IBM Plex Mono'; }
.app-footer > span { margin-right: 8px; color: var(--brand); font-weight: 600; }
.app-footer small { float: right; color: #9ba2aa; }

.login-page { min-height: 100vh; padding: 26px; background: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px), var(--brand); background-size: 36px 36px; display: grid; place-items: center; }
.login-page:after { content: ''; position: fixed; inset: 0 0 0 auto; width: 33%; background: var(--accent); clip-path: polygon(82% 0,100% 0,100% 100%,0 100%); opacity: .96; pointer-events: none; }
.login-shell { position: relative; z-index: 1; width: min(1040px,100%); display: grid; grid-template-columns: 1fr 420px; align-items: center; gap: 86px; }
.login-intro { color: #d8e0ea; }
.login-mark { width: 86px; height: 70px; margin-bottom: 28px; padding: 3px; object-fit: contain; background: #fff; display: block; }
.login-intro > span { color: var(--accent); font: 600 9px 'IBM Plex Mono'; letter-spacing: .16em; }
.login-intro h1 { max-width: 560px; margin: 15px 0; color: #fff; font: 600 clamp(38px,5vw,58px)/.98 'Space Grotesk'; letter-spacing: -.055em; }
.login-intro p { max-width: 500px; color: #9eacbd; line-height: 1.75; }
.login-coordinates { max-width: 500px; margin-top: 30px; padding-top: 12px; color: #61758d; border-top: 1px solid #2a3b51; display: flex; justify-content: space-between; font: 600 8px 'IBM Plex Mono'; letter-spacing: .1em; }
.login-card { padding: 34px; box-shadow: 18px 18px 0 rgba(11,23,40,.18), var(--shadow); }
.login-card h2 { margin: 9px 0 4px; font-size: 25px; }
.login-card > p { margin: 0 0 22px; }
.login-card .btn.primary { width: 100%; margin-top: 9px; }
.login-card > div:last-child { color: var(--muted) !important; text-align: center !important; }

.reconcile-alert { margin: 14px 0; padding: 12px 15px; color: #176e51; background: #eaf6f1; border: 1px solid #bde0d2; border-left: 3px solid var(--success); font-size: 11px; font-weight: 700; }
.reconcile-top { align-items: stretch; }
.upload-card { display: flex; gap: 16px; align-items: flex-start; }
.upload-icon { width: 48px; height: 48px; flex: 0 0 48px; color: var(--brand); background: var(--accent); display: grid; place-items: center; font-size: 22px; font-weight: 700; clip-path: polygon(0 0,100% 0,100% 76%,76% 100%,0 100%); }
.upload-card h3 { margin-bottom: 5px; }
.upload-card p { margin: 0 0 13px; line-height: 1.55; }
.file-picker { margin: 0; display: inline-flex; }
.file-picker input { position: absolute; opacity: 0; pointer-events: none; }
.file-picker span { padding: 10px 13px; color: #fff; background: var(--brand); border-radius: 2px; font-size: 10px; font-weight: 700; cursor: pointer; }
.parse-status { margin-left: 10px; color: var(--muted); display: inline-block; font-size: 9px; }
.parse-status.working { color: var(--blue); }
.parse-status.success { color: var(--success); }
.parse-status.error { margin: 9px 0 0; color: var(--danger); display: block; }
.workflow-list { display: grid; gap: 13px; }
.workflow-list > div { display: flex; align-items: center; gap: 11px; }
.workflow-list b { width: 29px; height: 29px; color: var(--brand); background: var(--accent-soft); border: 1px solid #e8cf8c; display: grid; place-items: center; font: 600 9px 'IBM Plex Mono'; }
.workflow-list span strong, .workflow-list span small { display: block; }
.workflow-list span strong { font-size: 11px; }
.workflow-list span small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.segmented { padding: 3px; background: #e7eaed; display: flex; }
.segmented a { padding: 7px 10px; color: var(--muted); font-size: 9px; font-weight: 700; }
.segmented a.active { color: #fff; background: var(--brand); box-shadow: var(--shadow-sm); }
.table-sub { margin-top: 4px; color: var(--muted); display: block; font-size: 8px; }
.bank-credit { color: var(--success); font-weight: 700; }
.allocation-form { min-width: 490px; display: grid; grid-template-columns: minmax(210px,1fr) 105px auto; gap: 6px; }
.allocation-form .input { min-width: 0; }
.empty-state { padding: 30px; color: var(--muted); text-align: center; }

.setup-page { min-height: 100vh; padding: 40px 24px; background: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px), var(--brand); background-size: 36px 36px; }
.setup-shell { width: min(1120px,100%); margin: 0 auto; }
.setup-heading { position: relative; padding: 28px 30px; color: #d8e0ea; background: #24272c; border: 1px solid #484b50; display: grid; grid-template-columns: 118px 1fr; align-items: center; gap: 28px; overflow: hidden; }
.setup-heading:after { content: ''; position: absolute; top: 0; right: 62px; width: 7px; height: 100%; background: var(--accent); transform: skew(-24deg); }
.setup-heading img { position: relative; z-index: 1; width: 118px; height: 88px; padding: 7px; object-fit: contain; background: #fff; }
.setup-heading > div { position: relative; z-index: 1; }
.setup-heading .eyebrow { color: var(--accent); }
.setup-heading h1 { margin: 8px 0 5px; color: #fff; font-size: clamp(34px,5vw,54px); line-height: 1; letter-spacing: -.055em; }
.setup-heading p { max-width: 700px; margin: 0; color: #9eacbd; }
.setup-form { margin-top: 14px; display: grid; gap: 1px; background: var(--line-dark); border: 1px solid var(--line-dark); box-shadow: var(--shadow); }
.setup-section { min-width: 0; padding: 28px; background: rgba(255,255,255,.98); display: grid; grid-template-columns: 170px 1fr; gap: 30px; }
.setup-index { padding-right: 20px; border-right: 1px solid var(--line); }
.setup-index b, .setup-index span { display: block; }
.setup-index b { color: var(--accent); font: 700 30px/1 'Space Grotesk'; }
.setup-index span { margin-top: 8px; color: var(--brand); font: 600 9px 'IBM Plex Mono'; letter-spacing: .12em; text-transform: uppercase; }
.setup-fields small { margin-top: 5px; color: var(--muted); display: block; font-size: 9px; }
.setup-submit { padding: 22px 28px; background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.setup-submit p { margin: 0; color: var(--muted); font-size: 11px; }
.setup-alert { margin: 14px 0; padding: 13px 16px; color: #9c352e; background: #fff0ef; border: 1px solid #ebc0bc; border-left: 4px solid var(--danger); font-size: 11px; font-weight: 700; }
.logo-preview { width: 220px; height: 130px; margin-top: 12px; padding: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.settings-grid > .card { height: fit-content; }
.bank-register > .flex { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.bank-register h3 { margin-bottom: 4px; }
.bank-register p { margin: 0; }
.bank-count { padding: 7px 10px; color: var(--brand); background: var(--accent-soft); border: 1px solid #e8cf8c; font: 600 9px 'IBM Plex Mono'; letter-spacing: .08em; text-transform: uppercase; }
.bank-account-list { display: grid; gap: 10px; margin-top: 18px; }
.bank-account-card { position: relative; padding: 18px; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--line-dark); }
.bank-account-card:after { content: ''; position: absolute; top: -1px; right: -1px; width: 22px; height: 22px; border-top: 2px solid var(--line-dark); border-right: 2px solid var(--line-dark); pointer-events: none; }
.bank-account-card.is-primary { border-left-color: var(--accent); background: #fffdf7; }
.bank-account-card.is-primary:after { border-color: var(--accent); }
.bank-account-form { padding-right: 74px; }
.bank-card-heading { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bank-card-heading span, .bank-card-heading strong { display: block; }
.bank-card-heading span { color: var(--warning); font: 600 8px 'IBM Plex Mono'; letter-spacing: .12em; }
.bank-card-heading strong { margin-top: 3px; font: 700 16px 'Space Grotesk'; }
.bank-fields { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.bank-fields label { margin-top: 4px; }
.primary-toggle { margin: 0; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.bank-delete-form { position: absolute; right: 18px; bottom: 18px; }
.bank-add-card { margin-top: 18px; padding: 20px; background: #f2f3f4; border: 1px dashed var(--line-dark); }
.bank-add-card .btn.primary { margin-top: 14px; }

@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .item-entry-grid { grid-template-columns: 1fr 2fr 1fr 1fr; }
  .main-content { padding: 24px 22px; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .hero-actions { min-width: 0; justify-items: start; }
  .allocation-form { grid-template-columns: 1fr 90px auto; }
  .bank-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 800px) {
  body.menu-open { overflow: hidden; }
  .sidebar { width: 268px; transform: translateX(-105%); transition: .22s ease; }
  .menu-open .sidebar { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .mobile-header { position: sticky; z-index: 40; top: 0; height: 64px; padding: 0 15px; background: var(--brand); border-bottom: 3px solid var(--accent); display: flex; align-items: center; gap: 11px; }
  .menu-toggle { width: 38px; height: 38px; color: #fff; background: transparent; border: 1px solid #415169; }
  .mobile-brand { min-width: 0; color: #fff; display: flex; align-items: center; gap: 9px; }
  .mobile-brand img { width: 31px; height: 31px; object-fit: contain; }
  .mobile-brand strong { overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
  .quick-add { margin-left: auto; padding: 9px 11px; color: var(--brand); background: var(--accent); font-size: 10px; font-weight: 700; }
  .mobile-overlay { position: fixed; z-index: 45; inset: 0; visibility: hidden; opacity: 0; background: rgba(4,11,20,.78); display: block; transition: .2s; }
  .menu-open .mobile-overlay { visibility: visible; opacity: 1; }
  .main-content { padding: 18px 13px; }
  .grid-2, .grid-3, .item-entry-grid { grid-template-columns: 1fr; }
  .card { padding: 17px; }
  .flex.space { align-items: flex-start; gap: 12px; }
  .toolbar { align-items: stretch; }
  .toolbar .input, .toolbar select { min-width: 0; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .statement-totals { grid-template-columns: 1fr 1fr; }
  .table-responsive { overflow: auto; }
  .app-footer small { margin: 5px 0; float: none; display: block; }
  .row-actions { gap: 6px; }
  .login-page { padding: 18px; }
  .login-page:after { display: none; }
  .login-shell { max-width: 480px; grid-template-columns: 1fr; gap: 28px; }
  .login-intro h1 { font-size: 34px; }
  .login-intro p, .login-coordinates { display: none; }
  .login-mark { width: 72px; height: 56px; margin-bottom: 16px; }
  .login-card { padding: 26px; box-shadow: 9px 9px 0 var(--accent); }
  .setup-page { padding: 16px; }
  .setup-heading { padding: 22px; grid-template-columns: 78px 1fr; gap: 16px; }
  .setup-heading img { width: 78px; height: 62px; }
  .setup-heading:after { right: 24px; opacity: .35; }
  .setup-section { padding: 22px; grid-template-columns: 1fr; gap: 18px; }
  .setup-index { padding: 0 0 14px; border-right: 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
  .setup-index span { margin: 0; }
  .setup-submit { align-items: stretch; flex-direction: column; }
  .bank-account-form { padding-right: 0; }
  .bank-delete-form { position: static; margin-top: 10px; }
}
@media (max-width: 540px) {
  .dashboard-hero { min-height: 0; padding: 25px 21px; }
  .hero-copy h1 { font-size: 38px; }
  .hero-actions { width: 100%; }
  .hero-actions .row-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 112px; padding: 18px; }
  .summary-card p { font-size: 23px; }
  .flex.space { flex-direction: column; }
  .balance-box { width: 100%; text-align: left; }
  .quick-add { width: 35px; height: 35px; padding: 0; overflow: hidden; color: transparent; display: grid; place-items: center; }
  .quick-add:after { content: '+'; color: var(--brand); font-size: 18px; }
  .public-layout { padding: 12px; }
  .setup-heading { grid-template-columns: 1fr; }
  .setup-heading img { width: 70px; }
  .bank-fields { grid-template-columns: 1fr; }
  .bank-card-heading { align-items: flex-start; flex-direction: column; }
}
@media print {
  body { background: #fff; }
  .sidebar, .mobile-header, .mobile-overlay, .no-print { display: none !important; }
  .workspace { margin: 0; }
  .main-content { padding: 0; }
  .container { max-width: none; }
  .card { border: 0; box-shadow: none; }
  .card:before { display: none; }
  .table th, .table td { border: 1px solid #ddd; }
  .summary-grid { grid-template-columns: repeat(4,1fr); }
}
