:root {
  --green-950: #0b3028;
  --green-800: #175c4b;
  --green-700: #23725e;
  --green-100: #dff0e9;
  --green-50: #eff8f4;
  --gold: #f2bd4b;
  --ink: #15221e;
  --muted: #6c7a75;
  --line: #dfe7e3;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --red: #c94d54;
  --red-soft: #fae9ea;
  --blue: #3c6f96;
  --blue-soft: #e8f0f6;
  --shadow: 0 16px 45px rgba(21, 51, 42, 0.08);
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { width: 100%; max-width: 100%; min-height: 100%; overflow-x: hidden; background: var(--canvas); touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { width: 100%; max-width: 100%; margin: 0; min-width: 0; min-height: 100vh; overflow-x: hidden; background: var(--canvas); touch-action: pan-x pan-y; }
#app, .app-shell, .workspace, .content { width: 100%; max-width: 100%; min-width: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
h2 { margin-bottom: 0; font-size: 1.35rem; }
h3 { margin-bottom: .35rem; font-size: 1.1rem; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.optional { color: var(--muted); font-size: .76rem; font-weight: 500; }
.eyebrow { display: block; margin-bottom: .35rem; color: var(--green-700); font-size: .72rem; font-weight: 800; letter-spacing: .105em; text-transform: uppercase; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; padding: .7rem 1rem; border: 1px solid transparent; border-radius: 12px;
  font-weight: 750; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--green-800); box-shadow: 0 8px 18px rgba(23, 92, 75, .2); }
.button-primary:hover { background: var(--green-700); }
.button-soft { color: var(--green-800); border-color: var(--line); background: white; }
.button-wide { width: 100%; }
.text-button { border: 0; color: var(--green-700); background: transparent; font-weight: 750; }
.icon-button { width: 36px; height: 36px; margin-left: auto; border: 0; border-radius: 10px; color: white; background: rgba(255,255,255,.08); }

label { display: grid; gap: .42rem; color: #35443f; font-size: .82rem; font-weight: 750; }
input, select, textarea {
  width: 100%; min-height: 43px; padding: .7rem .82rem; border: 1px solid #d7e1dc; border-radius: 11px;
  outline: 0; color: var(--ink); background: white; transition: border .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(35,114,94,.11); }
fieldset { margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 .3rem; font-size: .8rem; font-weight: 800; color: var(--muted); }

.login-layout { display: grid; grid-template-columns: 1.2fr .8fr; min-height: 100vh; background: var(--green-950); }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding: clamp(3rem, 8vw, 8rem); color: white; }
.login-brand::before { content: ""; position: absolute; inset: auto -12% -38% 18%; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.018); }
.login-brand::after { content: ""; position: absolute; top: 0; right: 8%; width: 1px; height: 38%; background: linear-gradient(transparent, rgba(242,189,75,.5)); }
.login-brand > * { position: relative; z-index: 1; }
.login-brand .eyebrow { color: var(--gold); }
.login-brand h1 { margin-bottom: 1.35rem; line-height: .98; font-family: Georgia, serif; font-weight: 500; }
.login-brand p { max-width: 660px; color: rgba(255,255,255,.72); font-size: 1.03rem; line-height: 1.75; }
.brand-mark { width: 43px; height: 43px; border-radius: 12px; }
.brand-mark-large { width: 66px; height: 66px; margin-bottom: 2.4rem; border-radius: 19px; box-shadow: 0 16px 40px rgba(0,0,0,.22); }
.login-features { display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; margin-top: 2rem; color: rgba(255,255,255,.8); font-size: .84rem; font-weight: 650; }
.login-panel { display: grid; place-items: center; padding: clamp(1.4rem, 5vw, 5rem); background: #f7faf8; }
.login-card { width: min(410px, 100%); padding: clamp(1.5rem, 3vw, 2.6rem); border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow); }
.login-card h2 { margin-bottom: .5rem; font-size: 1.7rem; }
.login-card > label { margin-top: 1rem; }
.login-card .button { margin-top: 1.5rem; }
.demo-note { margin-top: 1rem; padding: .8rem 1rem; border-radius: 10px; color: #786023; background: #fff8e8; font-size: .78rem; line-height: 1.5; }
.mobile-brand { display: none; align-items: center; gap: .75rem; margin-bottom: 2rem; color: var(--green-950); }
.alert { padding: .8rem 1rem; border-radius: 10px; font-size: .82rem; }
.alert-error { color: #912f36; background: var(--red-soft); }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 1.3rem 1rem; color: white; background: var(--green-950); }
.sidebar-brand { display: flex; align-items: center; gap: .8rem; padding: .2rem .5rem 1.8rem; }
.sidebar-brand div { display: grid; }
.sidebar-brand strong { font-size: .95rem; }
.sidebar-brand span { color: rgba(255,255,255,.55); font-size: .72rem; }
.sidebar nav { display: grid; gap: .28rem; }
.nav-item { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .78rem .85rem; border: 0; border-radius: 11px; color: rgba(255,255,255,.68); background: transparent; font-size: .83rem; font-weight: 650; text-align: left; transition: background .15s, color .15s; }
.nav-item span { display: grid; place-items: center; width: 24px; height: 24px; font-size: 1.15rem; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: var(--green-700); box-shadow: inset 3px 0 var(--gold); }
.sidebar-foot { display: flex; align-items: center; gap: .65rem; margin-top: auto; padding: .9rem .4rem 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-foot > div:not(.avatar) { display: grid; overflow: hidden; }
.sidebar-foot strong, .sidebar-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot strong { font-size: .76rem; }
.sidebar-foot span { color: rgba(255,255,255,.55); font-size: .68rem; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 35px; height: 35px; border-radius: 50%; color: var(--green-950); background: var(--gold); font-weight: 900; }
.workspace { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 88px; padding: 1.1rem clamp(1.2rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); }
.topbar .eyebrow { margin-bottom: .15rem; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.connection { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .65rem; border-radius: 999px; color: var(--green-700); background: var(--green-50); font-size: .73rem; font-weight: 750; }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #32a875; box-shadow: 0 0 0 3px rgba(50,168,117,.14); }
.connection.offline { color: #985f17; background: #fff4df; }
.connection.offline i { background: #e49b32; }
.password-banner { padding: .7rem clamp(1.2rem, 3vw, 2.5rem); color: #705316; background: #fff3d4; font-size: .8rem; text-align: center; }
.password-banner button { padding: 0; border: 0; color: var(--green-800); background: transparent; font-weight: 800; text-decoration: underline; }
.content { padding: clamp(1.1rem, 3vw, 2.5rem); }
.bottom-nav { display: none; }

.welcome-card { position: relative; display: flex; align-items: center; justify-content: space-between; overflow: hidden; min-height: 180px; padding: clamp(1.5rem, 4vw, 2.6rem); border-radius: 24px; color: white; background: linear-gradient(120deg, var(--green-950), var(--green-800)); box-shadow: var(--shadow); }
.welcome-card::after { content: ""; position: absolute; right: -5%; bottom: -80%; width: 320px; aspect-ratio: 1; border: 40px solid rgba(255,255,255,.04); border-radius: 50%; }
.welcome-card > * { position: relative; z-index: 1; }
.welcome-card .eyebrow { color: var(--gold); }
.welcome-card h1 { margin-bottom: .55rem; font-size: clamp(1.8rem, 3.5vw, 2.8rem); font-family: Georgia, serif; font-weight: 500; }
.welcome-card p { margin: 0; color: rgba(255,255,255,.68); }
.welcome-date { display: grid; place-items: center; width: 125px; padding: 1.1rem; border: 1px solid rgba(255,255,255,.13); border-radius: 18px; background: rgba(255,255,255,.07); }
.welcome-date strong { font-family: Georgia, serif; font-size: 1.1rem; text-align: center; }
.welcome-date span { color: var(--gold); font-weight: 800; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; margin: 1rem 0; }
.report-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { display: flex; align-items: center; gap: 1rem; min-width: 0; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(21,51,42,.04); }
.stat-icon { display: grid; place-items: center; flex: 0 0 auto; width: 45px; height: 45px; border-radius: 13px; color: var(--green-800); background: var(--green-100); font-size: 1.2rem; font-weight: 900; }
.stat-card.expense .stat-icon { color: var(--red); background: var(--red-soft); }
.stat-card.income .stat-icon { color: #1b8b61; background: #e3f5ed; }
.stat-card > div:last-child { display: grid; min-width: 0; }
.stat-card span, .stat-card small { color: var(--muted); font-size: .72rem; }
.stat-card strong { overflow: hidden; margin: .16rem 0; font-size: clamp(1.05rem, 2vw, 1.35rem); text-overflow: ellipsis; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); gap: 1rem; }
.panel { min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(21,51,42,.035); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; }
.transaction-list { padding: .2rem 1.35rem; }
.transaction-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: .8rem; padding: 1rem 0; border-bottom: 1px solid #edf1ef; }
.transaction-row:last-child { border-bottom: 0; }
.type-dot { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-weight: 900; }
.type-dot.income { color: #137951; background: #e3f5ed; }
.type-dot.expense { color: var(--red); background: var(--red-soft); }
.type-dot.transfer { color: var(--blue); background: var(--blue-soft); }
.transaction-main, .transaction-value { display: grid; min-width: 0; }
.transaction-main strong, .transaction-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-main strong { font-size: .82rem; }
.transaction-main span, .transaction-value span { color: var(--muted); font-size: .7rem; }
.transaction-value { text-align: right; }
.transaction-value strong { font-size: .82rem; }
.transaction-value.income strong, .money.income { color: #16835a; }
.transaction-value.expense strong, .money.expense { color: var(--red); }
.progress-list { display: grid; gap: 1.15rem; padding: 1.25rem 1.35rem; }
.progress-item > div:first-child { display: flex; justify-content: space-between; gap: .8rem; margin-bottom: .5rem; }
.progress-item strong { font-size: .76rem; }
.progress-item span, .progress-item small { color: var(--muted); font-size: .68rem; }
.progress-track { overflow: hidden; height: 7px; border-radius: 999px; background: #ebf0ed; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-700), var(--gold)); }

.summary-strip { display: flex; align-items: center; gap: 1.4rem; margin-bottom: 1rem; padding: .9rem 1.15rem; border: 1px solid var(--line); border-radius: 15px; background: white; font-size: .78rem; }
.summary-strip div:first-child { margin-right: auto; }
.summary-strip div:first-child span { font-size: 1.05rem; font-weight: 900; }
.summary-strip .income { color: #16835a; }
.summary-strip .expense { color: var(--red); }
.filters { display: grid; grid-template-columns: minmax(210px, 1.7fr) repeat(6, minmax(120px, .8fr)); gap: .65rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.filters input, .filters select, .toolbar-actions select { min-height: 39px; padding: .55rem .65rem; font-size: .74rem; }
.search-box { position: relative; display: flex; align-items: center; gap: .4rem; padding-left: .75rem; border: 1px solid #d7e1dc; border-radius: 11px; color: var(--muted); background: white; }
.search-box input { padding-left: 0; border: 0; box-shadow: none; }
.data-table { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.table-head, .table-row { display: grid; align-items: center; min-width: 900px; padding: .8rem 1rem; gap: .8rem; }
.table-head { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #f8faf9; font-size: .69rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.table-row { min-height: 60px; border-top: 1px solid #edf1ef; color: #394741; font-size: .75rem; }
.table-row:hover { background: #fbfdfc; }
.table-row strong, .table-row small { display: block; }
.table-row small { margin-top: .18rem; color: var(--muted); font-size: .66rem; }
.transaction-table .table-head, .transaction-table .table-row { grid-template-columns: 90px minmax(260px, 2.2fr) minmax(150px, 1fr) minmax(120px,.8fr) minmax(120px,.9fr) 64px; }
.row-actions { display: flex; justify-content: flex-end; gap: .3rem; }
.row-actions button { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; color: var(--green-800); background: white; }
.row-actions button:hover { background: var(--green-50); }

.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.report-toolbar h3 { margin-bottom: .25rem; font-size: 1.4rem; }
.report-toolbar p { margin: 0; font-size: .78rem; }
.toolbar-actions { display: flex; align-items: center; gap: .55rem; }
.report-table .table-head, .report-table .table-row { grid-template-columns: 82px minmax(230px,2fr) repeat(5,minmax(115px,1fr)); }
.report-table .table-row { min-width: 1120px; }
.report-table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; }
.table-note { margin: 0; padding: .75rem 1rem; color: var(--muted); background: #f8faf9; font-size: .72rem; text-align: center; }
.pka-table .table-head, .pka-table .table-row { grid-template-columns: 105px minmax(300px,2.5fr) 135px 125px 125px 90px 70px; }
.pka-table .table-row { min-width: 1000px; }
.table-row.archived, .book-card.archived { opacity: .58; }
.status-pill { display: inline-flex; padding: .25rem .55rem; border-radius: 999px; color: #6c7a75; background: #edf1ef; font-size: .65rem; font-style: normal; font-weight: 800; }
.status-pill.active { color: #16774f; background: #e3f5ed; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1rem; }
.book-card { display: grid; grid-template-columns: 44px 1fr; gap: .9rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 24px rgba(21,51,42,.04); }
.book-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; color: var(--green-800); background: var(--green-100); font-size: 1.2rem; }
.book-head span { color: var(--muted); font-size: .68rem; }
.book-head h3 { margin: .18rem 0 0; }
.book-balance, .book-foot { grid-column: 1 / -1; }
.book-balance { display: grid; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.book-balance span { color: var(--muted); font-size: .7rem; }
.book-balance strong { margin-top: .25rem; font-size: 1.4rem; }
.book-foot { display: flex; align-items: center; justify-content: space-between; }
.user-table .table-head, .user-table .table-row { grid-template-columns: minmax(190px,1.2fr) 110px minmax(280px,2fr) 90px 60px; }
.permission-summary { color: var(--muted); line-height: 1.5; }
.audit-list { padding: .2rem 1.2rem; }
.audit-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: .8rem; padding: 1rem 0; border-bottom: 1px solid #edf1ef; }
.audit-row:last-child { border-bottom: 0; }
.audit-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--green-800); background: var(--green-100); font-weight: 900; }
.audit-row div { display: grid; }
.audit-row strong { font-size: .78rem; }
.audit-row span, .audit-row time { color: var(--muted); font-size: .68rem; }
.settings-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.65fr); gap: 1rem; }
.form-panel, .security-panel { padding: 1.35rem; }
.form-panel { display: grid; gap: 1rem; }
.form-panel .panel-head { margin: -1.35rem -1.35rem 0; }
.form-panel fieldset { display: grid; gap: .8rem; }
.security-panel p { color: var(--muted); font-size: .82rem; line-height: 1.65; }
.security-panel hr { margin: 1.5rem 0; border: 0; border-top: 1px solid var(--line); }
.empty-state { display: grid; place-items: center; padding: 3rem 1rem; color: var(--muted); text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: .8rem; border-radius: 50%; color: var(--green-700); background: var(--green-50); font-size: 1.4rem; }
.empty-state strong { color: var(--ink); }
.empty-state p { max-width: 360px; margin: .4rem 0 0; font-size: .76rem; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: rgba(7,31,25,.64); backdrop-filter: blur(5px); animation: fade .18s ease; }
.modal { width: min(470px, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.35rem; border-radius: 20px; background: white; box-shadow: 0 30px 80px rgba(0,0,0,.3); animation: rise .2s ease; }
.modal-medium { width: min(620px, 100%); }
.modal-wide { width: min(760px, 100%); }
.modal form { display: grid; gap: 1rem; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.45rem; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: #f1f4f2; font-size: 1.3rem; }
.modal-actions { position: sticky; bottom: -1.35rem; z-index: 2; display: flex; justify-content: flex-end; gap: .7rem; margin: 0 -1.35rem -1.35rem; padding: 1rem 1.35rem; border-top: 1px solid var(--line); background: rgba(255,255,255,.97); backdrop-filter: blur(8px); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.type-switch { display: grid; grid-template-columns: repeat(3,1fr); gap: .55rem; }
.type-switch label { display: block; }
.type-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.type-switch span { display: flex; justify-content: center; padding: .7rem; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: white; }
.type-switch input:checked + span { border-color: var(--green-700); color: var(--green-800); background: var(--green-50); box-shadow: 0 0 0 2px rgba(35,114,94,.08); }
.type-switch .expense input:checked + span { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.type-switch .transfer input:checked + span { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.money-input { display: flex; align-items: center; overflow: hidden; border: 1px solid #d7e1dc; border-radius: 11px; }
.money-input span { align-self: stretch; display: grid; place-items: center; padding: 0 .8rem; color: var(--green-800); background: var(--green-50); font-weight: 850; }
.money-input input { border: 0; border-radius: 0; box-shadow: none; font-size: 1.1rem; font-weight: 800; }
.check-row { display: flex; gap: 1.5rem; }
.check-row label, .permission-grid label, .toggle-line { display: flex; align-items: center; gap: .45rem; }
.check-row input, .permission-grid input, .toggle-line input { width: 17px; min-height: 17px; accent-color: var(--green-700); }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.permission-grid label { font-weight: 650; }

.toast { position: fixed; z-index: 200; right: 1.25rem; bottom: 1.25rem; max-width: min(390px, calc(100vw - 2rem)); padding: .85rem 1rem; border-radius: 12px; color: white; background: var(--green-950); box-shadow: 0 18px 45px rgba(0,0,0,.22); font-size: .78rem; font-weight: 700; opacity: 0; transform: translateY(15px); transition: .22s ease; }
.toast-show { opacity: 1; transform: translateY(0); }
.toast-error { background: #8e3037; }
.toast-warning { background: #936518; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(15px) scale(.985); } }

@media (max-width: 1180px) {
  .filters { grid-template-columns: repeat(3, 1fr); }
  .filters .search-box { grid-column: span 2; }
  .report-stats { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
  body { padding-bottom: 68px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { position: sticky; top: 0; z-index: 20; min-height: 70px; padding: .8rem 1rem; }
  .topbar h2 { font-size: 1.05rem; }
  .topbar .eyebrow { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions .button { min-height: 38px; padding: .55rem .72rem; font-size: .74rem; }
  .topbar-actions .button span { font-size: 1rem; }
  .connection { display: none; }
  .content { padding: 1rem; }
  .bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 50; display: grid; grid-template-columns: repeat(5,1fr); min-height: 66px; padding: .35rem max(.2rem, env(safe-area-inset-right)) max(.35rem, env(safe-area-inset-bottom)) max(.2rem, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); box-shadow: 0 -10px 30px rgba(21,51,42,.08); backdrop-filter: blur(12px); }
  .bottom-nav button { display: grid; place-items: center; align-content: center; gap: .1rem; border: 0; color: var(--muted); background: transparent; }
  .bottom-nav button span { font-size: 1.15rem; }
  .bottom-nav button small { max-width: 68px; overflow: hidden; font-size: .62rem; text-overflow: ellipsis; }
  .bottom-nav button.active { color: var(--green-700); font-weight: 850; }
  .stats-grid { grid-template-columns: 1fr; }
  .report-stats { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 1rem; }
  .report-toolbar { align-items: flex-start; }
  .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .login-layout { display: block; min-height: 100vh; background: #f7faf8; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 1rem; }
  .login-card { padding: 1.35rem; }
  .mobile-brand { display: flex; }
  .welcome-card { min-height: 160px; }
  .welcome-date { display: none; }
  .welcome-card p { font-size: .82rem; line-height: 1.5; }
  .report-stats { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; padding: .8rem; }
  .filters .search-box { grid-column: 1 / -1; }
  .summary-strip { flex-wrap: wrap; gap: .5rem 1rem; }
  .summary-strip div:first-child { flex-basis: 100%; }
  .report-toolbar { display: grid; }
  .toolbar-actions { justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: 1fr; }
  .type-switch { gap: .3rem; }
  .type-switch span { padding: .6rem .25rem; font-size: .72rem; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; padding-bottom: max(1.3rem, env(safe-area-inset-bottom)); }
  .transaction-row { grid-template-columns: 38px minmax(0,1fr); }
  .transaction-value { grid-column: 2; text-align: left; }
}

@media (max-width: 420px) {
  .topbar { gap: .5rem; min-height: 64px; padding: .65rem .75rem; }
  .topbar > div:first-child { min-width: 0; }
  .topbar .eyebrow { max-width: 52vw; font-size: .62rem; }
  .topbar h2 { overflow: hidden; font-size: .96rem; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { flex: 0 0 auto; gap: .35rem; }
  .topbar-actions .button-primary { width: 42px; min-width: 42px; padding: .5rem; overflow: hidden; font-size: 0; }
  .topbar-actions .button-primary span { font-size: 1.1rem; }
  .content { padding: .75rem; }
  .welcome-card { min-height: 145px; padding: 1.2rem; border-radius: 18px; }
  .welcome-card h1 { font-size: 1.55rem; }
  .stats-grid { gap: .75rem; margin: .75rem 0; }
  .panel { border-radius: 16px; }
  .panel-head { gap: .6rem; padding: 1rem; }
  .transaction-list, .progress-list, .audit-list { padding-right: 1rem; padding-left: 1rem; }
  .filters { grid-template-columns: 1fr; gap: .5rem; padding: .7rem; }
  .filters .search-box { grid-column: 1; }
  .book-grid { grid-template-columns: 1fr; }
  .summary-strip { padding: .8rem; }
  .bottom-nav { width: 100%; max-width: 100vw; }
  .bottom-nav button { min-width: 0; padding-right: .1rem; padding-left: .1rem; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .password-banner, .report-toolbar .toolbar-actions { display: none !important; }
  body { padding: 0; background: white; }
  .app-shell { display: block; }
  .content { padding: 0; }
  .panel { border: 0; box-shadow: none; }
}
