:root {
  --blue: #1769ff;
  --blue-strong: #0756e8;
  --blue-soft: #edf4ff;
  --navy: #13213c;
  --ink: #202b3c;
  --muted: #718096;
  --line: #e5eaf2;
  --surface: #ffffff;
  --canvas: #f5f8fc;
  --green: #16a36a;
  --green-soft: #eafaf3;
  --red: #e64949;
  --red-soft: #fff0f0;
  --amber: #f59e0b;
  --shadow: 0 14px 38px rgba(34, 61, 105, .08);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.5 Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(23,105,255,.18); outline-offset: 2px; }

.shell { min-height: 100vh; display: flex; }
.sidebar { width: 236px; position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; padding: 24px 16px; background: #fff; border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 25px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #2d7bff, #0756e8); box-shadow: 0 8px 18px rgba(23,105,255,.25); font-size: 21px; transform: rotate(-3deg); }
.brand strong { display: block; color: var(--navy); font-size: 16px; letter-spacing: .02em; }
.brand small { display: block; margin-top: 1px; color: #a0aabc; font-size: 10px; }
.nav-title { margin: 15px 12px 8px; color: #a0aabc; font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.nav { display: grid; gap: 6px; }
.nav button { position: relative; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 11px; padding: 0 13px; color: #637189; background: transparent; text-align: left; font-weight: 650; }
.nav button:hover { color: var(--blue); background: #f5f8ff; }
.nav button.active { color: var(--blue); background: var(--blue-soft); }
.nav button.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 20px; border-radius: 0 9px 9px 0; background: var(--blue); }
.nav-icon { width: 20px; text-align: center; font-size: 17px; }
.side-tip { margin-top: auto; padding: 16px; border-radius: 14px; color: #56739d; background: linear-gradient(145deg, #f4f8ff, #e9f2ff); }
.side-tip strong { display: block; margin-bottom: 5px; color: #235792; }
.side-tip p { margin: 0; font-size: 11px; line-height: 1.65; }
.side-foot { padding: 15px 8px 0; color: #a1abba; font-size: 10px; }

.main { width: calc(100% - 236px); margin-left: 236px; }
.topbar { height: 74px; position: sticky; top: 0; z-index: 15; display: flex; align-items: center; padding: 0 clamp(20px, 4vw, 54px); border-bottom: 1px solid rgba(229,234,242,.88); background: rgba(255,255,255,.9); backdrop-filter: blur(16px); }
.crumb { color: #8d98aa; font-size: 12px; }
.crumb strong { color: var(--navy); }
.top-status { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #6c7a90; font-size: 12px; }
.save-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.sync-status { min-height: 28px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 99px; font-weight: 700; }
.sync-status.synced { color: #118256; background: var(--green-soft); }
.sync-status.syncing { color: #1769ff; background: var(--blue-soft); }
.sync-status.failed, .sync-status.offline { color: #b64646; background: var(--red-soft); }
.sync-status.dirty { color: #97620a; background: #fff7e4; }
.account-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offline-banner, .error-banner { padding: 9px clamp(20px, 4vw, 54px); text-align: center; font-size: 12px; }
.offline-banner { color: #98650d; background: #fff3d5; }
.error-banner { color: #a73d3d; background: #ffeded; }
.content { width: min(1460px, 100%); margin: 0 auto; padding: 30px clamp(20px, 4vw, 54px) 70px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.page-head h1 { margin: 0; color: var(--navy); font-size: 27px; letter-spacing: -.02em; }
.page-head p { margin: 7px 0 0; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.btn { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #dce3ee; border-radius: 9px; padding: 0 14px; color: #526178; background: #fff; font-weight: 700; white-space: nowrap; }
.btn:hover { border-color: #b9c7da; background: #fbfcfe; }
.btn.primary { color: #fff; border-color: var(--blue); background: var(--blue); box-shadow: 0 6px 15px rgba(23,105,255,.16); }
.btn.primary:hover { background: var(--blue-strong); }
.btn.success { color: #fff; border-color: var(--green); background: var(--green); }
.btn.danger { color: var(--red); border-color: #ffd1d1; background: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 31px; padding: 0 10px; font-size: 12px; }
.link-btn { border: 0; padding: 4px 6px; color: var(--blue); background: transparent; font-weight: 700; font-size: 12px; }
.link-btn.red { color: var(--red); }

.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 19px; }
.metric { position: relative; overflow: hidden; min-height: 104px; padding: 19px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 22px rgba(47,72,112,.045); }
.metric::after { content: ""; position: absolute; width: 70px; height: 70px; border-radius: 50%; right: -20px; top: -24px; background: var(--blue-soft); }
.metric span { color: #8290a5; font-size: 11px; }
.metric strong { display: block; margin-top: 5px; color: var(--navy); font-size: 24px; line-height: 1.2; }
.metric small { display: block; margin-top: 6px; color: #9aa5b5; font-size: 10px; }
.metric-sync { font-size: 20px !important; }

.card { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.card + .card { margin-top: 17px; }
.card-head { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 21px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; color: var(--navy); font-size: 16px; }
.card-head p { margin: 3px 0 0; color: #96a1b1; font-size: 11px; }
.card-body { padding: 20px; }
.tools { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.input-wrap { min-height: 39px; min-width: 220px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid #dde4ee; border-radius: 9px; background: #fff; }
.input-wrap:focus-within { border-color: #86afff; box-shadow: 0 0 0 3px rgba(23,105,255,.08); }
.input-wrap span { color: #9aa5b5; }
.input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
input, select, textarea { border: 1px solid #dce3ed; border-radius: 8px; color: var(--ink); background: #fff; }
input, select { height: 39px; padding: 0 11px; }
textarea { min-height: 78px; padding: 10px 11px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #b4bdca; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { height: 42px; padding: 0 13px; color: #69778b; background: #f7f9fc; text-align: left; font-size: 11px; white-space: nowrap; }
td { min-height: 47px; padding: 11px 13px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
tbody tr:hover { background: #fbfdff; }
tbody tr:last-child td { border-bottom: 0; }
.right { text-align: right; }
.money { color: var(--navy); font-variant-numeric: tabular-nums; font-weight: 750; }
.money.total { color: var(--blue); font-size: 15px; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 99px; color: #52657d; background: #eef2f7; font-size: 10px; font-weight: 700; white-space: nowrap; }
.tag.on { color: #118256; background: var(--green-soft); }
.tag.off { color: #8b96a7; background: #f0f2f5; }
.tag.all { color: #1961d5; background: var(--blue-soft); }
.gender { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; font-size: 10px; font-weight: 800; }
.gender.male { color: #2467d9; background: #eaf2ff; }
.gender.female { color: #d74d78; background: #ffedf3; }
.empty { padding: 60px 20px; color: #8895a8; text-align: center; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 15px; color: var(--blue); background: var(--blue-soft); font-size: 23px; }
.empty-action { margin-top: 16px; }
.spinner { width: 30px; height: 30px; margin: 0 auto 15px; border: 3px solid #dbe7fc; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 17px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.field { display: grid; gap: 7px; }
.field label { color: #68768b; font-size: 11px; font-weight: 700; }
.field.wide { grid-column: span 3; }
.required { color: var(--red); }
.participant-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.participant-toolbar strong { margin-right: auto; color: var(--navy); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 35px; }
.chip { min-height: 30px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px 0 11px; border: 1px solid #d8e6ff; border-radius: 8px; color: #245ca9; background: #f2f7ff; font-size: 12px; }
.chip button { width: 18px; height: 18px; border: 0; border-radius: 50%; padding: 0; color: #6e91c4; background: #e0ebfc; line-height: 1; }
.hint { margin-top: 10px; color: #95a1b2; font-size: 10px; }

.expense-table input, .expense-table select { width: 100%; min-width: 90px; height: 34px; font-size: 11px; }
.amount-entry { min-width: 155px; }
.amount-input-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 6px; }
.amount-input-row input { width: 100%; min-width: 0; height: 40px; padding: 0 9px; text-align: right; font-variant-numeric: tabular-nums; }
.amount-calculator-trigger { min-width: 40px; min-height: 40px; border: 1px solid #cfdcf0; border-radius: 9px; padding: 0; color: var(--blue); background: #f2f7ff; font-size: 16px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.amount-calculator-trigger:hover { border-color: #75a3f5; background: #eaf2ff; box-shadow: 0 0 0 3px rgba(23,105,255,.07); }
.amount-live-result { display: block; min-height: 16px; padding: 3px 2px 0; color: var(--blue); font-size: 10px; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }
.amount-entry.invalid input { border-color: #ef9a9a; background: #fff8f8; }
.amount-entry.invalid .amount-live-result { color: var(--red); }
.participant-cell { min-width: 210px; }
.participant-summary { width: 100%; min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid #dce3ed; border-radius: 8px; padding: 5px 9px; color: #53647c; background: #fff; text-align: left; font-size: 11px; }
.participant-summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expense-dropdown { position: absolute; z-index: 30; width: 300px; max-width: calc(100vw - 40px); margin-top: 5px; padding: 10px; border: 1px solid #dbe3ef; border-radius: 11px; background: #fff; box-shadow: 0 16px 38px rgba(29,49,82,.15); }
.check-row { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 0 7px; border-radius: 7px; color: #48586e; }
.check-row:hover { background: #f5f8fc; }
.check-row input { width: 15px; height: 15px; accent-color: var(--blue); }
.table-total td { background: #f8faff; color: var(--navy); font-weight: 750; }
.expression-note { margin: 10px 0 0; color: #8290a5; font-size: 10px; }
.mobile-expenses { display: none; }
.expense-mobile-card { margin: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.expense-mobile-head { display: flex; gap: 10px; justify-content: space-between; margin-bottom: 13px; }
.expense-mobile-head select { flex: 1; min-width: 0; font-weight: 700; }
.expense-mobile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 12px 0; }
.readonly-value { min-height: 39px; display: flex; align-items: center; justify-content: flex-end; padding: 0 11px; border: 1px solid #e3e8ef; border-radius: 8px; color: var(--blue); background: #f5f8fd; font-weight: 800; }

.calculator-backdrop { z-index: 130; }
.calculator-modal { width: min(410px, 100%); overflow: hidden; border: 1px solid rgba(255,255,255,.7); border-radius: 20px; background: #f7f9fc; box-shadow: 0 28px 90px rgba(7,24,53,.3); animation: modal-in .18s ease-out; }
.calculator-head { min-height: 68px; display: flex; align-items: center; gap: 15px; padding: 0 18px 0 21px; background: #fff; border-bottom: 1px solid var(--line); }
.calculator-head > div { display: grid; gap: 3px; }
.calculator-head strong { color: var(--navy); font-size: 17px; }
.calculator-head span { color: #8996a9; font-size: 10px; }
.calculator-head .modal-close { margin-left: auto; }
.calculator-display { min-height: 130px; display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; padding: 22px; background: linear-gradient(145deg, #edf5ff, #f8fbff); }
.calculator-expression { min-height: 25px; overflow-x: auto; color: #6d7f98; font-size: 18px; text-align: right; white-space: nowrap; scrollbar-width: none; }
.calculator-expression::-webkit-scrollbar { display: none; }
.calculator-result { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.calculator-result span { color: #8291a6; font-size: 10px; }
.calculator-result strong { color: var(--blue); font-size: 32px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.calculator-result strong.invalid { color: var(--red); font-size: 20px; }
.calculator-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; padding: 16px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.calc-key { min-height: 50px; border: 1px solid #dfe5ee; border-radius: 12px; color: var(--navy); background: #fff; box-shadow: 0 3px 8px rgba(34,61,105,.04); font-size: 18px; font-weight: 750; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.calc-key:hover { border-color: #b9c9df; background: #fbfdff; }
.calc-key:active { transform: translateY(1px); box-shadow: none; }
.calc-key.operator { color: var(--blue); border-color: #cfe0ff; background: var(--blue-soft); font-size: 21px; }
.calc-key.utility { color: #64738a; background: #eef2f7; font-size: 13px; }
.calculator-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding: 0 16px 17px; }
.calculator-actions .btn { min-height: 44px; }

.result-card { position: sticky; top: 91px; }
.result-total { padding: 21px; border-bottom: 1px solid var(--line); background: linear-gradient(145deg, #f7fbff, #edf5ff); }
.result-total span { color: #6e819c; font-size: 11px; }
.result-total strong { display: block; margin: 4px 0; color: var(--blue); font-size: 30px; font-variant-numeric: tabular-nums; }
.result-total small { color: #8d9bad; }
.person-result { border-bottom: 1px solid #edf0f5; }
.person-result:last-child { border-bottom: 0; }
.person-main { width: 100%; min-height: 58px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; border: 0; padding: 9px 20px; color: var(--ink); background: #fff; text-align: left; }
.person-main:hover { background: #fbfdff; }
.person-name { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.avatar { width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #2665c8; background: var(--blue-soft); font-size: 11px; }
.person-amount { color: var(--blue); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.detail-list { padding: 5px 20px 14px 58px; background: #fafcff; }
.detail-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; color: #728096; font-size: 10px; }
.detail-line strong { color: #53647c; }
.result-actions { display: grid; gap: 9px; padding: 16px 20px 20px; }
.warning { margin: 15px 20px 0; padding: 10px 12px; border-radius: 9px; color: #9b6510; background: #fff8e8; font-size: 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(13,25,46,.45); backdrop-filter: blur(3px); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 16px; background: #fff; box-shadow: 0 28px 80px rgba(6,20,43,.25); animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-head { min-height: 65px; display: flex; align-items: center; padding: 0 21px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; color: var(--navy); font-size: 17px; }
.modal-close { width: 34px; height: 34px; margin-left: auto; border: 0; border-radius: 9px; color: #7c899c; background: #f4f6f9; font-size: 20px; }
.modal-body { padding: 21px; }
.modal-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.modal-form .wide { grid-column: span 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 0 21px 21px; }
.picker-search { width: 100%; margin-bottom: 10px; }
.picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.picker-item { display: flex; align-items: center; gap: 10px; min-height: 47px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; }
.picker-item:hover { border-color: #aac7fb; background: #f9fbff; }
.picker-item input { width: 16px; height: 16px; accent-color: var(--blue); }
.picker-item small { color: #98a3b2; }
.draft-summary { display: grid; gap: 5px; padding: 16px; border-radius: 11px; background: var(--blue-soft); }
.draft-summary strong { color: var(--navy); font-size: 18px; }
.draft-summary span { color: #4c6384; }
.draft-summary small { color: #8193ad; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 200; transform: translate(-50%, 16px); padding: 11px 16px; border-radius: 10px; color: #fff; background: #1b2a40; box-shadow: 0 10px 32px rgba(12,26,48,.25); opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 8px; color: #708098; background: #f5f8fc; }
.boot-mark { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 19px; color: #fff; background: linear-gradient(145deg, #2d7bff, #0756e8); box-shadow: 0 14px 30px rgba(23,105,255,.23); font-size: 29px; }
.boot-screen strong { color: var(--navy); font-size: 17px; }
.boot-screen span { font-size: 11px; }

.login-page { min-height: 100vh; background: #fff; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-aside { position: relative; overflow: hidden; display: flex; align-items: center; padding: clamp(40px, 8vw, 110px); color: #fff; background: linear-gradient(145deg, #0756e8, #1973ff 70%, #51a1ff); }
.login-aside::before, .login-aside::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.login-aside::before { width: 530px; height: 530px; right: -210px; top: -140px; }
.login-aside::after { width: 380px; height: 380px; left: -170px; bottom: -180px; }
.login-aside-copy { position: relative; z-index: 2; max-width: 590px; }
.cloud-pill { display: inline-flex; padding: 7px 12px; border: 1px solid rgba(255,255,255,.28); border-radius: 99px; background: rgba(255,255,255,.1); font-size: 12px; }
.login-aside h1 { margin: 24px 0 20px; font-size: clamp(43px, 5vw, 74px); line-height: 1.08; letter-spacing: -.05em; }
.login-aside p { max-width: 440px; margin: 0; color: #dceaff; font-size: 16px; line-height: 1.8; }
.court-lines { position: absolute; right: 6%; bottom: 7%; width: 240px; height: 160px; transform: rotate(-9deg); opacity: .16; border: 3px solid #fff; }
.court-lines::before, .court-lines::after { content: ""; position: absolute; background: #fff; }
.court-lines::before { width: 3px; height: 100%; left: 50%; }
.court-lines::after { width: 100%; height: 3px; top: 50%; }
.login-panel { display: grid; place-items: center; padding: 36px; background: #fff; }
.login-card { width: min(420px, 100%); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; }
.login-brand strong { display: block; color: var(--navy); font-size: 17px; }
.login-brand small { color: #9ba7b8; font-size: 10px; letter-spacing: .13em; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 28px; padding: 4px; border-radius: 11px; background: #f1f5fb; }
.auth-tab { height: 38px; border: 0; border-radius: 8px; color: #748197; background: transparent; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.auth-tab.active { color: var(--blue); background: #fff; box-shadow: 0 2px 9px rgba(35, 74, 126, .11); }
.login-card h2 { margin: 0; color: var(--navy); font-size: 31px; }
.login-card > p { margin: 8px 0 28px; color: var(--muted); }
.login-form { display: grid; gap: 17px; }
.login-form label { display: grid; gap: 7px; color: #5f6d82; font-size: 11px; font-weight: 700; }
.login-form label[hidden] { display: none; }
.login-form input { height: 48px; }
.login-form .btn { height: 48px; margin-top: 4px; }
.login-warning, .login-error, .login-success { margin-bottom: 15px; padding: 11px 13px; border-radius: 9px; font-size: 11px; line-height: 1.6; }
.login-warning { color: #93600c; background: #fff5db; }
.login-error { color: #ad3f3f; background: var(--red-soft); }
.login-success { color: #177245; background: #e8f8ef; }
.login-security { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); color: #96a1b1; font-size: 10px; }

@media (max-width: 1100px) {
  .sidebar { width: 196px; }
  .main { width: calc(100% - 196px); margin-left: 196px; }
  .editor-grid { grid-template-columns: 1fr; }
  .result-card { position: static; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; flex-direction: row; align-items: center; padding: 10px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 0; flex: 0 0 auto; }
  .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .brand small, .nav-title, .side-tip, .side-foot { display: none; }
  .brand strong { font-size: 13px; }
  .nav { display: flex; margin-left: auto; }
  .nav button { width: auto; min-height: 37px; padding: 0 10px; white-space: nowrap; font-size: 11px; }
  .nav button.active::before { display: none; }
  .nav-icon { display: none; }
  .main { width: 100%; margin-left: 0; }
  .topbar { display: none; }
  .offline-banner, .error-banner { padding: 9px 14px; }
  .content { padding: 22px 14px 50px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .head-actions { justify-content: flex-start; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 88px; padding: 15px; }
  .metric strong { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.wide { grid-column: span 1; }
  .modal-form { grid-template-columns: 1fr; }
  .modal-form .wide { grid-column: span 1; }
  .picker-grid { grid-template-columns: 1fr; }
  .desktop-expenses { display: none; }
  .mobile-expenses { display: block; }
  .expense-dropdown { left: 0; width: min(320px, calc(100vw - 56px)); }
  .amount-entry { min-width: 0; }
  .amount-input-row { grid-template-columns: minmax(0, 1fr) 46px; }
  .amount-input-row input, .amount-calculator-trigger { min-height: 46px; }
  .calculator-modal { width: min(390px, calc(100vw - 20px)); }
  .calculator-backdrop { padding: 10px; backdrop-filter: none; }
  .calculator-modal { animation: none; box-shadow: 0 12px 34px rgba(7,24,53,.25); }
  .calculator-display { min-height: 115px; padding: 18px; }
  .calc-key { min-height: 48px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { min-height: 245px; padding: 32px 25px; align-items: flex-end; }
  .login-aside h1 { margin: 15px 0 9px; font-size: 38px; }
  .login-aside p { font-size: 13px; line-height: 1.55; }
  .login-panel { padding: 30px 22px 44px; }
  .login-brand { margin-bottom: 27px; }
}

@media (max-width: 470px) {
  .brand strong { display: none; }
  .summary-strip { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 23px; }
  .btn { padding: 0 11px; }
  .card-body, .card-head { padding-left: 14px; padding-right: 14px; }
}
