:root {
  --b9: #3e1d0b; --b8: #4f260f; --b7: #6b3518; --b6: #82451f; --b5: #9c5b30; --b4: #b98458; --b3: #d9b48f;
  --gold: #f0c77c; --gold2: #c8953f;
  --cream: #fdf8f2; --cream2: #f8ecdf; --cream3: #f3e2cf; --line: #ead7c2; --card: #fffdfa;
  --text: #3a2215; --muted: #8a6d5a; --green: #1f8a4c; --green-bg: #e3f4e8; --red: #d63b30; --red-bg: #fde6e3;
  --blue: #1d6fd1; --blue-bg: #e4eefb; --orange: #f08a1c; --orange-bg: #fdeedd; --purple: #7b3fc4; --purple-bg: #efe5fb; --teal: #138a8a; --teal-bg: #dff3f2;
  --radius: 12px; --shadow: 0 2px 10px rgba(80, 40, 15, .08); --shadow2: 0 8px 30px rgba(80, 40, 15, .18);
  --side: 240px; --top: 78px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--cream);
  background-image: radial-gradient(circle at 10% 20%, rgba(217,180,143,.15) 0 2px, transparent 3px), radial-gradient(circle at 70% 60%, rgba(217,180,143,.12) 0 2px, transparent 3px);
  background-size: 60px 60px, 90px 90px; }
a { color: var(--b6); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.brand-font { font-family: 'Cinzel', Georgia, serif; }

/* ---------- top bar ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 40; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: linear-gradient(180deg, var(--b7), var(--b9)); color: #fff; box-shadow: 0 3px 14px rgba(0,0,0,.25); border-radius: 0 0 18px 18px; }
.topbar .burger { background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; padding: 6px; display: none; }
.topbar .brand { flex: 1; display: flex; align-items: center; justify-content: center; gap: 14px; min-width: 0; cursor: pointer; }
.topbar .brand .logo { width: 54px; height: 54px; flex: none; }
.topbar .brand .t1 { font-family: 'Cinzel', Georgia, serif; font-weight: 700; font-size: 26px; letter-spacing: 1px; line-height: 1.05;
  background: linear-gradient(180deg, #fff3d6, var(--gold) 55%, var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand .ts { display: none; }
.topbar .brand .t2 { font-size: 13px; letter-spacing: 4px; text-transform: uppercase; opacity: .92; text-align: center; }
.topbar .clock { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.3; text-align: left; }
.topbar .clock i { font-size: 26px; }
.topbar .clock b { font-size: 15px; display: block; }
.topbar .user { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 999px; width: 42px; height: 42px; cursor: pointer; font-size: 18px; }
.usermenu { position: fixed; top: calc(var(--top) - 6px); right: 14px; z-index: 60; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow2); min-width: 220px; overflow: hidden; }
.usermenu .head { padding: 12px 14px; background: var(--cream2); font-size: 13px; }
.usermenu button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 11px 14px; border: 0; background: none; cursor: pointer; }
.usermenu button:hover { background: var(--cream2); }

/* ---------- sidebar ---------- */
.sidebar { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); z-index: 30; overflow-y: auto; padding: 14px 10px 30px;
  background: linear-gradient(180deg, var(--b7), var(--b9)); color: #fff; }
.sidebar a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px; border-radius: 10px; color: #fff; text-decoration: none; font-size: 14.5px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar a i { width: 24px; text-align: center; font-size: 17px; opacity: .95; }
.sidebar a:hover { background: rgba(255,255,255,.1); }
.sidebar a.active { background: var(--cream2); color: var(--b8); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.sidebar .co { margin: 4px 6px 14px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.08); font-size: 12.5px; cursor: pointer; }
.sidebar .co b { display: block; font-size: 14px; color: var(--gold); }
.scrim { position: fixed; inset: 0; background: rgba(30,12,4,.45); z-index: 25; }
main { margin-left: var(--side); padding: calc(var(--top) + 16px) 18px 40px; min-height: 100vh; min-width: 0; overflow-x: hidden; }

/* ---------- page pieces ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--cream2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; color: var(--b8); text-transform: uppercase; letter-spacing: .5px; display: flex; align-items: center; gap: 12px; }
.page-head .sp { flex: 1; }
.page-head .back { margin-right: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.card > .ch { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--cream2); border-bottom: 1px solid var(--line); }
.card > .ch h2 { margin: 0; font-size: 18px; color: var(--b8); font-weight: 600; }
.card > .ch.dark { background: linear-gradient(180deg, var(--b6), var(--b8)); color: #fff; border: 0; }
.card > .ch.dark h2 { color: #fff; text-transform: uppercase; letter-spacing: .4px; }
.card > .ch.green { background: linear-gradient(180deg, #2a9a55, #1c7c41); color: #fff; } .card > .ch.green h2 { color: #fff; }
.card > .ch.red { background: linear-gradient(180deg, #e04b3f, #c2342a); color: #fff; } .card > .ch.red h2 { color: #fff; }
.card > .ch .sp { flex: 1; }
.cb { padding: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split > *, .split-r > *, .grid > * { min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.split-r { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 12px; }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; }
.form.one { grid-template-columns: 1fr; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fld { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 10px; }
.split .fld, .split-r .fld { grid-template-columns: 118px minmax(0, 1fr); }
.fld.stack, .split .fld.stack, .split-r .fld.stack { grid-template-columns: 1fr; gap: 4px; }
.fld.full { grid-column: 1 / -1; }
.fld > label { font-weight: 600; font-size: 14px; }
.fld > label .req { color: var(--red); }
.fld > label .opt { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.inp, select.inp, textarea.inp { color: var(--text); width: 100%; padding: 9px 12px; border: 1px solid #dccab7; border-radius: 8px; background: #fff; outline: none; transition: border .15s, box-shadow .15s; min-height: 40px; }
textarea.inp { min-height: 74px; resize: vertical; }
.inp:focus { border-color: var(--b5); box-shadow: 0 0 0 3px rgba(156,91,48,.15); }
.inp[readonly], .inp:disabled { background: #f2ece6; color: #6d5848; }
.inp.num { text-align: right; }
.ig { display: flex; align-items: stretch; border: 1px solid #dccab7; border-radius: 8px; background: #fff; overflow: hidden; }
.ig:focus-within { border-color: var(--b5); box-shadow: 0 0 0 3px rgba(156,91,48,.15); }
.ig > span { display: grid; place-items: center; padding: 0 12px; color: var(--b8); background: #faf3ec; border-right: 1px solid #e6d6c4; }
.ig .inp { border: 0; box-shadow: none !important; border-radius: 0; }
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 8px; background: #f6efe8; cursor: pointer; font-size: 14px; border: 1px solid transparent; }
.radios input { accent-color: var(--b6); width: 17px; height: 17px; margin: 0; }
.radios label:has(input:checked) { background: var(--green-bg); border-color: #a9d9b9; color: #13643a; font-weight: 600; }
.radios.danger label:has(input[value="Expense"]:checked), .radios label:has(input[value="Inactive"]:checked), .radios label:has(input[value="Payment"]:checked) { background: var(--red-bg); border-color: #f2b2ab; color: #a62218; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 9px 16px; min-height: 40px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; font-weight: 500;
  background: linear-gradient(180deg, var(--b6), var(--b8)); color: #fff; box-shadow: 0 2px 6px rgba(80,40,15,.2); white-space: nowrap; text-decoration: none; font-size: 14.5px; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.lt { background: linear-gradient(180deg, #b47d55, #95603a); }
.btn.ghost { background: #fff; color: var(--b8); border-color: #dccab7; box-shadow: none; }
.btn.red { background: linear-gradient(180deg, #e8564a, #c9342a); }
.btn.green { background: linear-gradient(180deg, #2fa560, #1c7c41); }
.btn.blue { background: linear-gradient(180deg, #2f80e0, #1a63bd); }
.btn.orange { background: linear-gradient(180deg, #f59a37, #e07a10); }
.btn.purple { background: linear-gradient(180deg, #8d55d4, #6a33b0); }
.btn.teal { background: linear-gradient(180deg, #1fa3a3, #117c7c); }
.btn.big { min-height: 50px; font-size: 16.5px; font-weight: 600; padding: 10px 22px; }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btnbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 14px; }
.ib { width: 32px; height: 30px; border-radius: 7px; border: 0; color: #fff; cursor: pointer; display: inline-grid; place-items: center; font-size: 13px; margin: 0 2px; }
.ib.e { background: var(--blue); } .ib.d { background: var(--red); } .ib.v { background: #fff; color: var(--b8); border: 1px solid var(--line); } .ib.p { background: var(--b6); } .ib.g { background: var(--green); }
.linkbtn { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 4px; text-decoration: underline; font-size: 14px; }

/* ---------- tables ---------- */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { background: var(--cream3); color: var(--b9); font-weight: 600; text-align: left; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.t.dark th { background: linear-gradient(180deg, var(--b6), var(--b8)); color: #fff; }
table.t td { padding: 8px 10px; border-bottom: 1px solid #f1e5d8; vertical-align: middle; }
table.t tbody tr:nth-child(even) td { background: #fffaf4; }
table.t tbody tr:hover td { background: #fbf0e3; }
table.t td.n, table.t th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t td.c, table.t th.c { text-align: center; }
table.t tfoot td { font-weight: 700; background: var(--cream2); border-top: 2px solid var(--line); }
table.t tr.clickable { cursor: pointer; }
table.t .act { white-space: nowrap; text-align: center; }
table.t td .inp { min-height: 36px; padding: 6px 9px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tag.g { background: #29a35a; color: #fff; } .tag.r { background: #e5483d; color: #fff; } .tag.o { background: #f6a04d; color: #fff; } .tag.b { background: var(--blue-bg); color: var(--blue); }
.tag.lg { background: var(--green-bg); color: var(--green); } .tag.lr { background: var(--red-bg); color: var(--red); } .tag.gr { background: #eee; color: #555; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* ---------- stat cards ---------- */
.stat { border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); min-width: 0; }
.stat .ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; color: #fff; flex: none; background: var(--b6); }
.stat .lb { font-size: 13px; font-weight: 500; }
.stat .vl { font-size: 22px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.green { background: var(--green-bg); border-color: #c4e6cf; } .stat.green .ic { background: var(--green); } .stat.green .vl { color: #146c39; }
.stat.red { background: var(--red-bg); border-color: #f6c6c0; } .stat.red .ic { background: var(--red); } .stat.red .vl { color: #b4261c; }
.stat.blue { background: var(--blue-bg); border-color: #c5d9f3; } .stat.blue .ic { background: var(--blue); } .stat.blue .vl { color: #144e98; }
.stat.orange { background: var(--orange-bg); border-color: #f6d3ac; } .stat.orange .ic { background: var(--orange); } .stat.orange .vl { color: #b25a00; }
.stat.purple { background: var(--purple-bg); border-color: #dac8f2; } .stat.purple .ic { background: var(--purple); } .stat.purple .vl { color: #5b2a99; }
.stat.solid { color: #fff; border: 0; } .stat.solid .ic { background: rgba(255,255,255,.2); } .stat.solid .vl { color: #fff; }
.stat.solid.blue { background: linear-gradient(135deg, #3a8bea, #1d63bd); } .stat.solid.green { background: linear-gradient(135deg, #2cab5f, #187a3e); }
.stat.solid.red { background: linear-gradient(135deg, #ee5a4c, #c4322a); } .stat.solid.orange { background: linear-gradient(135deg, #f8a440, #e27b0f); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { flex: 1 1 140px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; color: var(--b8); font-size: 15px; }
.tabs button.on { background: linear-gradient(180deg, var(--b6), var(--b8)); color: #fff; border-color: transparent; }
.tabs.sm button { flex: 0 1 auto; padding: 8px 14px; font-size: 14px; }

/* ---------- home tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.tile { display: flex; align-items: center; gap: 16px; padding: 14px; border-radius: 16px; background: rgba(255,253,250,.95); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; text-decoration: none; color: var(--text); transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow2); }
.tile .ti { width: 74px; height: 74px; border-radius: 16px; display: grid; place-items: center; font-size: 32px; color: #fff3e2; background: linear-gradient(160deg, var(--b5), var(--b8)); flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.tile h3 { margin: 0 0 3px; font-size: 20px; color: var(--b8); font-weight: 700; }
.tile p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.tile .go { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: var(--cream3); display: grid; place-items: center; color: var(--b8); flex: none; }

/* ---------- auth / welcome ---------- */
.welcome { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 0 16px 40px; }
.welcome .wtop { width: 100%; max-width: 760px; text-align: center; padding: 18px; color: #fff; background: linear-gradient(180deg, var(--b7), var(--b9)); border-radius: 0 0 24px 24px; box-shadow: var(--shadow2); }
.welcome .wtop .t0 { font-family: 'Cinzel', Georgia, serif; font-size: 20px; }
.welcome .wtop .t1 { font-family: 'Cinzel', Georgia, serif; font-weight: 700; font-size: 42px; background: linear-gradient(180deg, #fff3d6, var(--gold) 55%, var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.biglogo { width: min(420px, 90%); margin: 26px auto 10px; display: block; }
.wcard { width: 100%; max-width: 520px; background: rgba(255,253,250,.97); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow2); }
.wcard h2 { margin: 0 0 16px; color: var(--b8); font-size: 24px; display: flex; align-items: center; justify-content: space-between; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 640px; }
.choice .c { background: rgba(255,253,250,.97); border: 1px solid var(--line); border-radius: 18px; padding: 22px 16px; text-align: center; box-shadow: var(--shadow); cursor: pointer; }
.choice .c .ci { width: 110px; height: 110px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 46px; color: #fff; background: radial-gradient(circle at 35% 30%, var(--b4), var(--b7)); }
.choice .c h3 { margin: 0 0 14px; font-size: 24px; color: var(--b9); }
.co-list { display: grid; gap: 8px; margin-bottom: 14px; }
.co-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.co-item:hover, .co-item.on { background: var(--cream2); border-color: var(--b4); }
.co-item .ci { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--cream3); color: var(--b7); }
.co-item b { display: block; font-size: 16px; }
.co-form .fld { grid-template-columns: 1fr; gap: 4px; }
.co-form .sec { grid-column: 1 / -1; background: var(--cream3); border-radius: 10px; padding: 10px 14px; font-weight: 600; color: var(--b8); font-size: 17px; margin-top: 6px; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(30,12,4,.5); display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow-y: auto; }
.modal { width: 100%; max-width: 640px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow2); overflow: hidden; animation: pop .15s ease-out; }
.modal.wide { max-width: 1000px; }
.modal .mh { display: flex; align-items: center; padding: 12px 16px; background: linear-gradient(180deg, var(--b6), var(--b8)); color: #fff; }
.modal .mh h3 { margin: 0; flex: 1; font-size: 18px; }
.modal .mh button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
.modal .mb { padding: 16px; }
.modal .mf { padding: 12px 16px; display: flex; gap: 10px; justify-content: flex-end; background: var(--cream2); border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: grid; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 10px; color: #fff; background: var(--b8); box-shadow: var(--shadow2); max-width: 360px; font-size: 14px; display: flex; gap: 10px; align-items: center; animation: pop .15s; }
.toast.ok { background: #1c7c41; } .toast.err { background: #c2342a; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- bill page ---------- */
.billsum .r { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: var(--cream2); border-radius: 8px; margin-bottom: 8px; gap: 10px; }
.billsum .r .inp { max-width: 170px; }
.billsum .r.total { background: linear-gradient(180deg, var(--b6), var(--b8)); color: #fff; font-size: 19px; font-weight: 700; }
.billsum .r.total .v { background: var(--cream); color: var(--b9); padding: 4px 14px; border-radius: 6px; }
.lastbal { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--cream2); border-radius: 10px; }
.lastbal i { font-size: 26px; color: var(--b8); }
.lastbal b { display: block; font-size: 19px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { font-weight: 600; }
.catlist { display: grid; gap: 6px; }
.catlist button { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; border: 0; background: #f8f2ec; cursor: pointer; text-align: left; }
.catlist button:hover { background: var(--cream3); }
.catlist.inc i { color: var(--green); } .catlist.exp i { color: var(--red); }
.acclist .a { display: flex; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.acclist .a:hover { background: #fbf3ea; }
.acclist .a.on { background: var(--cream2); box-shadow: inset -4px 0 0 var(--b7); }
.acclist .a i { font-size: 24px; color: var(--b7); width: 30px; text-align: center; }
.acclist .a b { display: block; }
.att-grid td { padding: 4px 6px !important; }
.att-grid select { min-height: 32px !important; padding: 3px 6px !important; width: 64px; }
.att-P { background: #e3f4e8 !important; } .att-A { background: #fde6e3 !important; } .att-L { background: #fff2d8 !important; } .att-H { background: #e4eefb !important; }
.photo { width: 120px; height: 140px; border-radius: 10px; background: #e9e1d8 center/cover; display: grid; place-items: center; color: #b9a99a; font-size: 60px; margin: 0 auto 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split-r { grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  :root { --top: 70px; }
  .topbar .burger { display: block; }
  .sidebar { transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow2); }
  body.nav-open .sidebar { transform: none; }
  main { margin-left: 0; }
  .topbar .clock { display: none; }
}
@media (max-width: 760px) {
  :root { --top: 64px; font-size: 14px; }
  main { padding: calc(var(--top) + 12px) 12px 30px; }
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar .brand .logo { width: 40px; height: 40px; }
  .topbar .brand .t1 { font-size: 24px; text-transform: uppercase; }
  .topbar .brand .tf { display: none; } .topbar .brand .ts { display: inline; }
  .topbar .brand .t2 { font-size: 10px; letter-spacing: 2px; }
  .topbar .user { width: 36px; height: 36px; }
  .form, .form.three, .g2, .g3 { grid-template-columns: 1fr; }
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fld, .split .fld, .split-r .fld { grid-template-columns: 1fr; gap: 4px; }
  .btnbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head h1 { font-size: 19px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { flex-direction: column; text-align: center; gap: 8px; padding: 14px 8px; }
  .tile .ti { width: 60px; height: 60px; font-size: 26px; }
  .tile h3 { font-size: 16px; }
  .tile p { font-size: 12px; }
  .tile .go { display: none; }
  .stat { padding: 10px; gap: 10px; }
  .stat .ic { width: 34px; height: 34px; font-size: 15px; }
  .stat .vl { font-size: 16px; }
  .stat .lb, .stat .small { font-size: 11.5px; }
  .page-head { padding: 10px 12px; }
  .card > .ch .inp { max-width: none !important; flex: 1 1 140px; }
  .welcome .wtop .t1 { font-size: 32px; }
  .choice { grid-template-columns: 1fr 1fr; gap: 10px; }
  .choice .c .ci { width: 80px; height: 80px; font-size: 34px; }
  .choice .c h3 { font-size: 18px; }
  .tabs button { flex: 1 1 45%; font-size: 13.5px; padding: 9px 8px; }
  .toasts { left: 12px; right: 12px; }
}

@media print {
  body { background: #fff; }
  .topbar, .sidebar, .no-print, .btn, .tabs, .ib { display: none !important; }
  main { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 0; }
}
