:root {
  --navy: #0f2a5c; --navy2: #16357a; --blue: #2563eb; --blue-d: #1d4ed8; --blue-l: #eaf1ff;
  --bg: #f3f5fa; --card: #fff; --line: #e3e8f0; --line2: #cfd7e4; --text: #1b2434; --muted: #64708a;
  --green: #15803d; --green-l: #dcfce7; --red: #b91c1c; --red-l: #fee2e2; --amber: #b45309; --amber-l: #fef3c7;
  --radius: 10px; --shadow: 0 1px 2px rgba(15,42,92,.06), 0 4px 14px rgba(15,42,92,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
a { color: var(--blue-d); text-decoration: none; } a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, var(--navy), #1d4ed8); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 30px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-card .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-card h1 { font-size: 22px; color: var(--navy); }
.login-card p { margin: 0 0 20px; color: var(--muted); }
.login-card .hint { margin-top: 16px; padding: 10px 12px; background: var(--amber-l); color: #7c4a03; border-radius: 8px; font-size: 12.5px; }
.logo-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--blue); display: grid; place-items: center; flex: none; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: none; background: var(--navy); color: #cbd7f0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: #fff; font-weight: 700; font-size: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand small { display: block; font-weight: 400; color: #8fa5d4; font-size: 11px; }
.nav { padding: 8px 10px 24px; }
.nav-group { margin-top: 14px; }
.nav-title { padding: 4px 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #7c92c6; font-weight: 600; }
.nav a { display: block; padding: 7px 12px; border-radius: 7px; color: #cbd7f0; margin: 1px 0; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: var(--blue); color: #fff; font-weight: 600; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.topbar .spacer { flex: 1; }
.burger { display: none; background: none; border: 0; padding: 6px; border-radius: 6px; }
.burger:hover { background: var(--bg); }
.co-select { min-width: 190px; max-width: 280px; }
.user-chip { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 8px; border-radius: 8px; position: relative; }
.user-chip:hover { background: var(--bg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-l); color: var(--blue-d); display: grid; place-items: center; font-weight: 700; }
.user-chip .who { line-height: 1.2; } .user-chip .who small { display: block; }
.menu { position: absolute; right: 0; top: 100%; margin-top: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 50; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; }
.menu button:hover { background: var(--bg); }
.content { padding: 20px; max-width: 1500px; width: 100%; margin: 0 auto; }
.scrim { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 21px; color: var(--navy); }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card h3 { font-size: 15px; margin-bottom: 10px; color: var(--navy); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line2); background: #fff; color: var(--text); font-weight: 600; white-space: nowrap; min-height: 36px; }
.btn:hover { background: #f6f8fc; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: var(--blue-d); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; } .btn.success:hover { filter: brightness(.93); }
.btn.danger { background: #fff; border-color: #f0b7b7; color: var(--red); } .btn.danger:hover { background: var(--red-l); }
.btn.sm { padding: 4px 10px; min-height: 28px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue-d); } .btn.ghost:hover { background: var(--blue-l); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- inputs ---------- */
.fi, .combo-input { width: 100%; padding: 8px 10px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; min-height: 36px; }
.fi:focus, .combo-input:focus { outline: 2px solid rgba(37,99,235,.35); border-color: var(--blue); }
.fi:disabled, .combo-input:disabled { background: #f0f2f7; color: #6b7690; }
textarea.fi { min-height: 64px; resize: vertical; }
.fi.err, .combo.err .combo-input { border-color: var(--red); background: #fff6f6; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: #3b4863; }
.field .help { font-size: 12px; color: var(--muted); }
.field .req { color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; font-weight: 600; }
.check input { width: 18px; height: 18px; }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.alert.err { background: var(--red-l); color: var(--red); } .alert.warn { background: var(--amber-l); color: #7c4a03; }
.alert.ok { background: var(--green-l); color: var(--green); } .alert.info { background: var(--blue-l); color: var(--blue-d); }

/* ---------- combo ---------- */
.combo { position: relative; }
.combo-list { position: fixed; z-index: 400; background: #fff; border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 8px 24px rgba(15,42,92,.18); max-height: 260px; overflow-y: auto; }
.combo-opt { padding: 7px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.combo-opt small { white-space: nowrap; }
.combo-opt:hover, .combo-opt.hl { background: var(--blue-l); }
.combo-opt.sel { font-weight: 700; }
.combo-empty { padding: 10px; color: var(--muted); }

/* ---------- filter bar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 12px 14px; margin-bottom: 12px; }
.filters .field { width: 170px; } .filters .field.date { width: 150px; }
.filters .field.wideish { width: 230px; }

/* ---------- table ---------- */
.tbl-card { overflow: hidden; }
.tbl-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl-tools .search { flex: 1; min-width: 180px; max-width: 360px; }
.tbl-tools .count { color: var(--muted); font-size: 13px; margin-left: auto; }
/* a long table scrolls inside its own box, so its column headings stay in view (sticky) and never scroll away with the rows */
.tbl-wrap { overflow: auto; max-height: calc(100vh - 240px); -webkit-overflow-scrolling: touch; }
.modal .tbl-wrap { max-height: calc(100vh - 300px); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { background: #f6f8fc; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #4a5875; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--line); }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--blue-d); }
.tbl th .arrow { color: var(--blue); margin-left: 3px; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid #eef1f6; vertical-align: middle; white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.tbl tbody tr:hover { background: #f8faff; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tfoot td { background: #f6f8fc; font-weight: 700; border-top: 2px solid var(--line2); }
.r { text-align: right; font-variant-numeric: tabular-nums; } .c { text-align: center; }
.nowrap { white-space: nowrap; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 6px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager .info { color: var(--muted); font-size: 13px; margin-right: auto; }
.neg { color: var(--red); font-weight: 600; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #e8edf5; color: #3b4863; white-space: nowrap; }
.badge.Active, .badge.Approved, .badge.Posted, .badge.Closed, .badge.Increase { background: var(--green-l); color: var(--green); }
.badge.Inactive, .badge.Cancelled, .badge.Decrease, .badge.Out { background: var(--red-l); color: var(--red); }
.badge.Draft, .badge.Hold, .badge.Partial { background: var(--amber-l); color: var(--amber); }
.badge.Open, .badge.Completed { background: var(--blue-l); color: var(--blue-d); }
.typebadge { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 700; background: #eef2ff; color: #3730a3; }

/* ---------- dashboard ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { padding: 16px; display: block; color: inherit; position: relative; overflow: hidden; }
.stat:hover { text-decoration: none; border-color: var(--blue); }
.stat .lbl { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .val { font-size: 26px; font-weight: 700; color: var(--navy); margin-top: 4px; line-height: 1.15; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.stat .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue); }
.stat.warn .bar { background: #dc2626; } .stat.warn .val { color: var(--red); }
.stat.g .bar { background: #16a34a; } .stat.a .bar { background: #d97706; } .stat.p .bar { background: #7c3aed; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; }
.bars .row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; margin: 9px 0; font-size: 13px; }
.bars .track { background: #edf1f8; border-radius: 6px; height: 12px; overflow: hidden; }
.bars .fill { height: 100%; background: linear-gradient(90deg, #2563eb, #60a5fa); border-radius: 6px; }
.bars .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- documents ---------- */
.doc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; }
.kv .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv .v { font-weight: 600; word-break: break-word; }
.grid-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; min-width: 640px; }
.grid th { background: #f6f8fc; font-size: 12px; text-transform: uppercase; color: #4a5875; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 5px 4px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.grid td .fi, .grid td .combo-input { min-height: 34px; padding: 6px 8px; }
.trk { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.trk .trk2 { display: flex; gap: 6px; } .trk .trk2 label { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); flex: 1; min-width: 0; }
.trk .trk2 .fi { min-width: 0; padding: 4px 4px; font-size: 12px; }
.grid td.calc { text-align: right; padding-right: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid td.calc.bad { color: var(--red); font-weight: 700; }
.grid .del { border: 0; background: none; color: #9aa5bb; font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.grid .del:hover { background: var(--red-l); color: var(--red); }
.totals-box { margin-left: auto; width: 320px; max-width: 100%; margin-top: 12px; }
.totals-box div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals-box .grand { font-size: 17px; font-weight: 700; border-top: 2px solid var(--navy); margin-top: 4px; padding-top: 8px; color: var(--navy); }
.action-bar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 16px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); margin: 16px -20px -20px; }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(12,22,45,.55); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.modal.wide { max-width: min(1100px, 96vw); } .modal.sm { max-width: 440px; }
/* a window that shows a table (ledger, report, statement lines) opens wide enough to show every column without sideways scrolling */
.modal:has(table.tbl) { width: max-content; min-width: min(720px, 96vw); max-width: min(1500px, 97vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; color: var(--navy); }
.modal-head .x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); padding: 2px 8px; border-radius: 6px; } .modal-head .x:hover { background: var(--bg); }
.modal-body { padding: 16px 18px; max-height: calc(100vh - 190px); overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 500; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: 10px; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: pop .18s ease-out; }
.toast.ok { background: #15803d; } .toast.err { background: #b91c1c; } .toast.info { background: #1d4ed8; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line2); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { background: var(--blue-l); color: var(--blue-d); padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.perm-yes { color: var(--green); font-weight: 700; } .perm-no { color: #b6bfd0; }
pre.json { background: #f6f8fc; padding: 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; margin: 6px 0 0; max-height: 240px; overflow: auto; }

/* ---------- responsive ---------- */
.dash-grid > * { min-width: 0; }
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid { grid-template-columns: minmax(0, 1fr); } .form-grid, .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 120; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; visibility: hidden; }
  .sidebar.open { transform: none; visibility: visible; box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 110; }
  .burger { display: block; }
  .content { padding: 14px 12px; }
  .action-bar { margin: 16px -12px -14px; }
  .co-select { min-width: 0; max-width: 150px; }
  .user-chip .who { display: none; }
}
@media (max-width: 600px) {
  .cards { gap: 10px; } .stat { padding: 12px; } .stat .val { font-size: 20px; }
  .form-grid, .form-grid.cols2, .kv { grid-template-columns: 1fr; }
  .filters .field, .filters .field.date, .filters .field.wideish { width: calc(50% - 6px); }
  .page-head h1 { font-size: 18px; } .topbar { padding: 8px 10px; }
  .btn { padding: 8px 12px; } .modal-body { max-height: 68vh; }
  .bars .row { grid-template-columns: 90px 1fr auto; }
  .totals-box { width: 100%; }
}
@media print { .sidebar, .topbar, .action-bar, .btn-row, .filters, .tbl-tools, .pager { display: none !important; } .content { padding: 0; } }
.strong { font-weight: 700; }
.login-card.setup { max-width: 640px; }
.login-card .ver, .menu-ver { margin-top: 14px; text-align: center; color: var(--muted); font-size: 12px; }
.menu-ver { margin: 6px 0 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.brand .bn { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.brand img { flex: none; }
.pos { color: var(--green); font-weight: 600; }

/* ---------- GST banner (which tax applies, and why) ---------- */
.gstbox { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafcff; }
.gst-side { min-width: 190px; padding: 6px 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.gst-side small { display: block; font-size: 10.5px; letter-spacing: .07em; font-weight: 700; color: var(--muted); }
.gst-side b { display: block; font-family: Consolas, "Courier New", monospace; font-size: 14px; color: var(--navy); }
.gst-side span { display: block; font-size: 12.5px; color: var(--ink2, #334160); }
.gst-side em { display: block; font-style: normal; font-size: 11.5px; color: var(--amber); margin-top: 2px; }
.gst-arrow { align-self: center; font-size: 22px; font-weight: 800; color: var(--muted); }
.gst-result { flex: 1; min-width: 240px; padding: 8px 14px; border-radius: 10px; display: flex; flex-direction: column; justify-content: center; gap: 2px; font-weight: 700; }
.gst-result small { font-weight: 500; color: #33415c; font-size: 12.5px; }
.gst-result.intra { background: var(--green-l); border: 1px solid #a7e3bb; }
.gst-result.inter { background: #e4ecff; border: 1px solid #b7ccf8; }
.gst-result.wait { background: #f1f4fa; border: 1px dashed #c5cfe2; color: var(--muted); font-weight: 500; }
.gst-result .warnline { color: var(--amber); font-weight: 700; }
.gpill { display: inline-block; padding: 1px 9px; border-radius: 6px; background: #15803d; color: #fff; font-size: 13px; }
.gpill.i { background: #1d4ed8; }
.grid td.calc.dim, .grid th.dim { color: #b7c0d3; }
.totals-box div.dim { color: #a3adc2; }

/* ---------- dashboard: quick actions, auto-fitting cards, chart legend ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* ---------- setup wizard: business-type cards ---------- */
.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.preset { text-align: left; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 12px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; font: inherit; color: inherit; }
.preset:hover { border-color: #93b4f5; }
.preset.on { border-color: var(--blue); background: var(--blue-l); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.preset .pi { font-size: 24px; } .preset b { font-size: 13.5px; color: var(--navy); } .preset small { font-size: 12px; line-height: 1.35; }

/* hosted mode: sign-up link, trial pill, quick search palette */
.signup-cta { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted, #64748b); }
.signup-cta a { color: var(--primary, #1d4ed8); font-weight: 600; text-decoration: none; }
.trial-pill { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.trial-pill.warn { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.quick-find kbd { font: 11px/1 inherit; background: rgba(0,0,0,.06); border-radius: 4px; padding: 2px 5px; margin-left: 6px; }
@media (max-width: 720px) { .quick-find kbd, .trial-pill { display: none; } }
.palette { position: fixed; inset: 0; background: rgba(12,22,45,.45); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 0; }
.palette-box { background: #fff; width: 100%; max-width: 560px; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.3); padding: 12px; }
.palette-list { margin-top: 8px; max-height: 50vh; overflow: auto; }
.palette-list .pi { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.palette-list .pi small { color: #64748b; }
.palette-list .pi.sel, .palette-list .pi:hover { background: #eff6ff; }

/* inventory classes: RM / WIP / FG tags and the dashboard split bar */
.ctag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #e2e8f0; color: #475569; }
.ctag.rm { background: #fef3c7; color: #b45309; } .ctag.wip { background: #ede9fe; color: #6d28d9; } .ctag.fg { background: #dcfce7; color: #15803d; }
.ctag.trd { background: #dbeafe; color: #1d4ed8; } .ctag.pkg { background: #ccfbf1; color: #0f766e; } .ctag.cns { background: #e2e8f0; color: #475569; }
.ctag.spr { background: #ffe4e6; color: #be123c; } .ctag.svc { background: #f1f5f9; color: #64748b; }
.classbar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #eef2f7; margin: 6px 0 12px; }
.classbar .seg { display: block; height: 100%; background: #94a3b8; min-width: 4px; }
.classbar .seg.rm { background: #f59e0b; } .classbar .seg.wip { background: #8b5cf6; } .classbar .seg.fg { background: #22c55e; } .classbar .seg.trd { background: #3b82f6; }
.classbar .seg.pkg { background: #14b8a6; } .classbar .seg.cns { background: #94a3b8; } .classbar .seg.spr { background: #f43f5e; } .classbar .seg.svc { background: #cbd5e1; }
.classlist > div { display: grid; grid-template-columns: 150px 1fr auto 44px; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid #eef2f7; font-size: 13px; }
.badge.Pending, .badge.Normal { background: var(--amber-l); color: var(--amber); } .badge.Rejected, .badge.Urgent { background: var(--red-l); color: var(--red); } .badge.Normal { background: #e8edf5; color: #3b4863; }
.classlist > div:last-child { border-bottom: 0; } .classlist strong { text-align: right; } .classlist .muted:last-child { text-align: right; }

/* ---- Compliance ---- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a:hover { color: var(--blue-d); text-decoration: none; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--blue); }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--blue); color: #fff; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; font-weight: 600; color: #3b4863; }
.filters label .fi { min-width: 130px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.issues ul { margin: 6px 0 0 18px; padding: 0; } .issues + .issues { margin-top: 8px; }
.qlist { list-style: none; margin: 0; padding: 0; } .qlist li { padding: 7px 0; border-bottom: 1px solid var(--line); } .qlist li:last-child { border-bottom: 0; }
.cmp-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cmp-row:last-child { border-bottom: 0; }
.badge.s-generated, .badge.s-active, .badge.s-deposited, .badge.s-done, .badge.s-official, .badge.s-closed { background: var(--green-l); color: var(--green); }
.badge.s-pending, .badge.s-required, .badge.s-cross_checked, .badge.s-single_source, .badge.s-expiring, .badge.s-due-soon { background: var(--amber-l); color: var(--amber); }
.badge.s-overdue, .badge.s-expired, .badge.s-conflict, .badge.s-cancelled { background: var(--red-l); color: var(--red); }
.badge.s-unverified, .badge.s-not-applicable, .badge.s-not-required, .badge.s-upcoming { background: #e8edf5; color: #3b4863; }
.chip.s-official { background: var(--green-l); color: var(--green); } .chip.s-cross_checked, .chip.s-single_source, .chip.s-pending, .chip.s-required { background: var(--amber-l); color: var(--amber); }
.chip.s-conflict, .chip.s-overdue { background: var(--red-l); color: var(--red); } .chip.s-unverified, .chip.s-not-applicable, .chip.s-cancelled { background: #e8edf5; color: #3b4863; } .chip.s-generated { background: var(--green-l); color: var(--green); }
/* ---- work order reader / line-wise GST ---- */
.fi.conf-low, .combo.conf-low .combo-input { background: #fff3c4 !important; border-color: #d99100 !important; }
.fi.conf-med { background: #fffbe6; border-color: #e6c15a; }
.fi.suggested { font-style: italic; color: #1d4ed8; }
tr.conf-row-low > td { background: #fff8db; } tr.conf-row-med > td { background: #fffdf2; }
.wo-warn { font-size: 11.5px; color: #92400e; margin-top: 3px; max-width: 330px; }
.wo-bar { height: 8px; background: #e3e8f0; border-radius: 6px; overflow: hidden; margin-top: 10px; } .wo-bar > div { height: 100%; width: 0; background: var(--blue); transition: width .3s; }
table.wo-lines td { vertical-align: top; }

/* ---------- project control (Contractor CFO) ---------- */
.cards.five { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
.dash-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; } .dash-grid2 > * { min-width: 0; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; } .card-title h3 { margin: 0; }
.stat.warn .val { color: var(--red); } .stat.fc .lbl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.big { font-size: 26px; font-weight: 700; color: var(--navy); }
.hl { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.hl.GREEN { background: var(--green-l); color: var(--green); } .hl.AMBER { background: var(--amber-l); color: var(--amber); } .hl.RED { background: var(--red-l); color: var(--red); } .hl.NA { background: #e8edf5; color: #3b4863; }
.sev { display: inline-block; min-width: 54px; text-align: center; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; }
.sev.RED { background: var(--red); color: #fff; } .sev.AMBER { background: #f59e0b; color: #fff; } .sev.INFO { background: #e8edf5; color: #3b4863; }
.tagchip { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .03em; }
.tagchip.Actual { background: var(--green-l); color: var(--green); } .tagchip.Calculated { background: var(--blue-l); color: var(--blue-d); } .tagchip.Forecast { background: #ede9fe; color: #5b21b6; } .tagchip.Assumption { background: var(--amber-l); color: var(--amber); }
.hl-tbl td { padding-top: 10px; padding-bottom: 6px; } .hl-tbl tr.why td { padding: 0 12px 10px; border-bottom: 1px solid var(--line); white-space: normal; max-width: none; } .hl-tbl tr.why:hover, .hl-tbl tr.click:hover + tr.why { background: #f8faff; }
.hl-tbl tr.click td { border-bottom: 0; }
ul.reasons { list-style: none; margin: 6px 0 0; padding: 0; } ul.reasons li { display: flex; gap: 8px; align-items: flex-start; margin: 3px 0; font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: #94a3b8; } .dot.RED { background: #dc2626; } .dot.AMBER { background: #f59e0b; } .dot.GREEN { background: #16a34a; }
.hcard { margin-bottom: 14px; border-left: 5px solid #94a3b8; } .hcard.GREEN { border-left-color: #16a34a; } .hcard.AMBER { border-left-color: #f59e0b; } .hcard.RED { border-left-color: #dc2626; }
.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert-row { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 9px 12px; }
.alert-row.RED { border-left-color: #dc2626; } .alert-row.AMBER { border-left-color: #f59e0b; } .alert-row.INFO { border-left-color: #94a3b8; } .alert-row:hover { background: #f8faff; }
.alert-row .at { flex: 1; min-width: 0; } .alert-row .aa { font-weight: 700; white-space: nowrap; } .alert-row .go { color: var(--muted); font-size: 18px; }
.hbars .hb { display: grid; grid-template-columns: 140px 1fr 90px; gap: 10px; align-items: center; margin: 9px 0; font-size: 13px; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .hb-v { text-align: right; font-variant-numeric: tabular-nums; }
.hb-t { position: relative; background: #edf1f8; border-radius: 6px; height: 14px; } .hb-f { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #2563eb, #60a5fa); }
.hb-f.red { background: linear-gradient(90deg, #dc2626, #f87171); } .hb-f.amb { background: linear-gradient(90deg, #d97706, #fbbf24); } .hb-m { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--navy); border-radius: 2px; }
.cfo-svg { width: 100%; height: auto; max-height: 260px; display: block; }
.stepdot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 13px; background: #fff; border: 2px solid #cbd5e1; color: #fff; } .stepdot.done { background: #16a34a; border-color: #16a34a; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; } .subtab { padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line2); background: #fff; font-weight: 600; } .subtab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip { border: 1px solid transparent; cursor: pointer; } .chip.on { background: var(--navy); color: #fff; } .chip.static { cursor: default; } .chip.static.g { background: var(--green-l); color: var(--green); } .chip.static.a { background: var(--amber-l); color: var(--amber); } .chip.static.r { background: var(--red-l); color: var(--red); }
.rtype { font-weight: 700; } .rtype.Normal { color: var(--blue-d); } .rtype.Retention { color: #7c3aed; } .rtype.TDS { color: #b45309; } .rtype.Other { color: #475569; }
.rstat, .tstat, .mstat, .vstat { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; background: #e8edf5; color: #3b4863; white-space: nowrap; }
.rstat.Open { background: var(--blue-l); color: var(--blue-d); } .rstat.Overdue { background: var(--amber-l); color: var(--amber); } .rstat.Partial { background: #ede9fe; color: #5b21b6; } .rstat.Closed { background: var(--green-l); color: var(--green); }
.tstat.Expected { background: var(--amber-l); color: var(--amber); } .tstat.Received { background: var(--blue-l); color: var(--blue-d); } .tstat.Verified { background: var(--green-l); color: var(--green); } .tstat.Mismatch { background: var(--red-l); color: var(--red); }
.mstat.Matched { background: var(--green-l); color: var(--green); } .mstat.PossibleMatch { background: var(--amber-l); color: var(--amber); } .mstat.Unmatched { background: var(--red-l); color: var(--red); }
.vstat.ok, .vstat.warning { background: var(--green-l); color: var(--green); } .vstat.duplicate { background: var(--amber-l); color: var(--amber); } .vstat.error { background: var(--red-l); color: var(--red); }
.badge.Planning { background: #ede9fe; color: #5b21b6; }
.rules { margin: 6px 0; padding-left: 20px; } .rules li { margin: 6px 0; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; } .rep h3 { margin-bottom: 4px; } .rep p { min-height: 44px; }
.ask-form input { flex: 1; } .ask-feed { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.ask-q { align-self: flex-end; max-width: 80%; background: var(--navy); color: #fff; padding: 9px 14px; border-radius: 14px 14px 2px 14px; }
.ask-a { align-self: stretch; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); } .ans-t { margin: 0 0 10px; font-size: 15px; line-height: 1.5; }
.ans details { margin: 8px 0; } .ans summary { cursor: pointer; color: var(--blue-d); font-weight: 600; } ul.hist { margin: 8px 0 0; padding-left: 18px; }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; } .stepper .st { display: flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 20px; background: #e8edf5; color: #64708a; font-size: 12.5px; font-weight: 600; }
.stepper .st span { width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #3b4863; display: grid; place-items: center; font-size: 12px; } .stepper .st.now { background: var(--blue); color: #fff; } .stepper .st.done { background: var(--green-l); color: var(--green); }
.stmt-lines tr.sel td { background: #eaf1ff; } .stmt-lines td input[type=radio] { width: 16px; height: 16px; }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.kind { text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; } .kind:hover { border-color: #93b4f5; } .kind.on { border-color: var(--blue); background: var(--blue-l); } .kind small { color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) { .cards.five { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } .dash-grid2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .cards.five { grid-template-columns: 1fr 1fr !important; } .hbars .hb { grid-template-columns: 90px 1fr 70px; } .big { font-size: 22px; } .ask-q { max-width: 95%; } }

/* ---------- Quick Quotation (urgent, on-the-spot, mobile-first) ---------- */
.qq-card { max-width: 720px; }
.qq-lines { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.qq-line { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fafcff; }
.qq-line-top { display: flex; align-items: center; gap: 8px; }
.qq-line-top input { flex: 1; }
.qq-del { flex: none; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.qq-del:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.qq-line-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.qq-line-total { font-weight: 700; padding: 7px 0; }
.qq-total-row { display: flex; justify-content: flex-end; margin-top: 12px; }
.qq-total { font-size: 15px; }
.qq-total strong { font-size: 17px; }
.qq-create { width: 100%; font-size: 16px; padding: 12px; }
.pos-scan { width: 100%; font-size: 17px; padding: 12px 14px; }
.pos-hits { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.pos-hits:empty { display: none; }
.pos-hit { display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; padding: 10px 12px; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font: inherit; }
.pos-hit:hover { background: #eaf1ff; }
.pos-n { width: 84px; text-align: right; }
.pos-total { display: flex; gap: 14px; align-items: baseline; font-size: 15px; } .pos-total strong { font-size: 24px; }
.pos-bill { width: 100%; font-size: 17px; padding: 14px; }
.pos-cart { margin-top: 12px; }
@media (max-width: 600px) {
  .qq-line-nums { grid-template-columns: 1fr 1fr; }
  .qq-total-row { justify-content: flex-start; }
}

/* =====================================================================================================================
   FRIENDLY LAYER (2026-09-29): simple menu, "+ Create", Home, folded "More" sections, phone bottom bar.
   Everything below only adds to / softens the styles above; the data and the pages themselves are unchanged.
   ===================================================================================================================== */
:root { --radius: 12px; --shadow: 0 1px 2px rgba(15,42,92,.05), 0 6px 20px rgba(15,42,92,.06); --tone-g: #16a34a; --tone-b: #2563eb; --tone-a: #d97706; --tone-p: #7c3aed; --tone-n: #475569; }
body { font-size: 14.5px; }
.card { border-color: #e6eaf2; }
.btn { border-radius: 10px; transition: background .12s, box-shadow .12s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.primary { box-shadow: 0 1px 2px rgba(29,78,216,.35); }
.fi, .combo-input { border-radius: 10px; }
.tbl tbody tr { transition: background .1s; }
.page-head h1 { font-size: 22px; letter-spacing: -.01em; }
.tbl td, .tbl th { padding-top: 10px; padding-bottom: 10px; }
:focus-visible { outline: 2px solid rgba(37,99,235,.55); outline-offset: 2px; }

/* sidebar: icons, calmer groups, a footer switch between the simple and the full menu */
.sidebar { background: linear-gradient(180deg, #0f2a5c 0%, #0c2148 100%); }
.nav { padding-bottom: 8px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; }
.nav a .ni { width: 22px; text-align: center; font-size: 15px; flex: none; filter: saturate(.85); }
.nav-title { padding-top: 10px; }
.nav-foot { margin-top: auto; padding: 10px 12px 16px; position: sticky; bottom: 0; background: #0c2148; border-top: 1px solid rgba(255,255,255,.08); }
.nav-toggle { width: 100%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #dbe6ff; padding: 8px 10px; border-radius: 9px; font-weight: 600; }
.nav-toggle:hover { background: rgba(255,255,255,.14); }
.nav-hint { margin-top: 8px; font-size: 11.5px; color: #8fa5d4; line-height: 1.35; }

.co-name { font-weight: 700; color: var(--navy); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .co-lbl { display: none; } }
/* top bar "+ Create" and the create sheet */
.create-btn { padding: 8px 16px; }
.create-sheet { position: fixed; inset: 0; z-index: 900; background: rgba(12,22,45,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.create-box { width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.35); padding: 18px 18px 20px; }
.create-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.create-head h2 { font-size: 18px; color: var(--navy); }
.create-head .x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); padding: 2px 10px; border-radius: 8px; } .create-head .x:hover { background: var(--bg); }
.create-grid, .start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ctile { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 92px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff;
  color: var(--text); text-align: left; text-decoration: none; position: relative; overflow: hidden; }
.ctile:hover { text-decoration: none; border-color: var(--tone-b); box-shadow: var(--shadow); transform: translateY(-1px); }
.ctile .ci { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; background: #eef2f9; }
.ctile b { font-size: 14px; line-height: 1.2; color: var(--navy); }
.ctile.g .ci { background: #dcfce7; } .ctile.b .ci { background: #dbeafe; } .ctile.a .ci { background: #fef3c7; } .ctile.p .ci { background: #ede9fe; } .ctile.n .ci { background: #e2e8f0; }
.ctile.more { border-style: dashed; background: #fafcff; }

/* Home */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.hero h1 { font-size: 26px; color: var(--navy); letter-spacing: -.01em; } .hero .sub { color: var(--muted); margin-top: 2px; } .hero-date { color: var(--muted); font-size: 13px; }
.start-grid { margin-bottom: 16px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.start-grid .ctile { min-height: 84px; }
.cards.kpis .stat { padding: 18px 18px 16px; } .cards.kpis .stat .val { font-size: 30px; }
.attention { margin-bottom: 16px; }
.attention .alerts { gap: 8px; }
.attention .alert-row { text-decoration: none; color: inherit; padding: 11px 14px; border-radius: 12px; }
.attention .alert-row .ai { font-size: 18px; flex: none; } .attention .alert-row.RED { background: #fff7f7; } .attention .alert-row.AMBER { background: #fffaf0; }
.allclear { padding: 14px; border-radius: 12px; background: var(--green-l); color: var(--green); font-weight: 600; }
details.more-stats { margin-bottom: 16px; } details.more-stats > summary { cursor: pointer; font-weight: 700; color: var(--navy); padding: 6px 2px 12px; list-style: none; }
details.more-stats > summary::before, details.more > summary::before, details.more-card > summary::before { content: '\25B8'; display: inline-block; width: 18px; color: var(--muted); transition: transform .12s; }
details[open] > summary::before { transform: rotate(90deg); }
details.more-stats > summary::-webkit-details-marker, details.more > summary::-webkit-details-marker, details.more-card > summary::-webkit-details-marker { display: none; }

/* folded "More" parts of a form or dialog */
details.more { margin-top: 14px; border-top: 1px dashed var(--line2); padding-top: 10px; }
details.more > summary, details.more-card > summary { cursor: pointer; font-weight: 700; color: var(--navy); list-style: none; padding: 4px 0; }
details.more-card > summary small { font-weight: 500; color: var(--muted); }
details.more > .form-grid { margin-top: 12px; }
details.more-card .more-body { margin-top: 12px; } .more-h { margin: 14px 0 8px; font-size: 13px; color: var(--navy); } .more-h:first-child { margin-top: 0; }

/* the GST banner: one calm line, the reasoning on demand */
.gstbox.compact { padding: 8px 10px; margin-top: 10px; gap: 8px; align-items: center; background: #fafcff; }
.gstbox.compact:not(.open) .gst-side, .gstbox.compact:not(.open) .gst-arrow { display: none; }
.gstbox.compact:not(.open) .gst-result { padding: 4px 10px; min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.gstbox.compact:not(.open) .gst-result small { display: none; }
.gstbox.compact .gst-toggle { margin-left: auto; font-weight: 600; }

/* Reports home */
.rhub-group { margin-bottom: 22px; } .rhub-group h2 { font-size: 17px; color: var(--navy); } .rhub-sub { margin: 2px 0 10px; font-size: 13px; }
.rhub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rcard { display: flex; flex-direction: column; gap: 4px; padding: 13px 15px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--text); }
.rcard:hover { text-decoration: none; border-color: var(--blue); box-shadow: var(--shadow); } .rcard b { color: var(--navy); } .rcard span { color: var(--muted); font-size: 12.5px; }

/* phone bottom bar (hidden on wide screens) */
.bottombar { display: none; }
@media (max-width: 900px) {
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; background: #fff; border-top: 1px solid var(--line); align-items: stretch; justify-content: space-around;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 18px rgba(15,42,92,.08); }
  .bb-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 2px; font-size: 11px; font-weight: 600; color: var(--muted); background: none; border: 0; border-radius: 10px; text-decoration: none; }
  .bb-tab .bi { font-size: 19px; line-height: 1.1; } .bb-tab.active { color: var(--blue-d); background: var(--blue-l); } .bb-tab:hover { text-decoration: none; }
  .bb-plus { flex: none; width: 54px; height: 54px; margin: -20px 6px 0; border-radius: 50%; border: 4px solid #fff; background: var(--blue); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 6px 16px rgba(37,99,235,.45); }
  .content { padding-bottom: 92px; }
  .action-bar { bottom: 60px; }
  .toasts { bottom: 76px; }
  .create-btn { display: none; }
  .create-sheet { align-items: flex-end; padding: 0; } .create-box { border-radius: 20px 20px 0 0; max-width: none; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .create-grid, .start-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ctile { min-height: 78px; padding: 10px; gap: 6px; } .ctile .ci { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; } .ctile b { font-size: 12.5px; }
  .hero h1 { font-size: 22px; } .hero-date { display: none; }
  .cards.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .cards.kpis .stat { padding: 12px 12px 10px; } .cards.kpis .stat .val { font-size: 21px; } .cards.kpis .stat .lbl { font-size: 11px; } .cards.kpis .stat .sub { font-size: 11.5px; }
}
@media (max-width: 600px) {
  .fi, .combo-input, select.fi { font-size: 16px; }                         /* no zoom-in when a field is tapped on iPhone */
  .btn { min-height: 40px; } .btn.sm { min-height: 32px; }
  .ctile { min-height: 84px; }
}

/* =====================================================================================================================
   MODERN DESIGN SYSTEM (2026-09-29): colour, type, icons, KPI cards, charts, login, and card layouts for phones.
   ===================================================================================================================== */
:root {
  --navy: #0b1f4d; --navy2: #122a63; --blue: #2563eb; --blue-d: #1d4ed8; --blue-l: #e8f0ff; --indigo: #4f46e5;
  --bg: #f4f6fb; --card: #fff; --line: #e6eaf2; --line2: #d2d9e6; --text: #172033; --muted: #66738d;
  --green: #15803d; --green-l: #dcfce7; --red: #b91c1c; --red-l: #fee2e2; --amber: #b45309; --amber-l: #fef3c7;
  --radius: 16px; --shadow: 0 1px 2px rgba(16,32,80,.04), 0 8px 24px rgba(16,32,80,.06); --shadow-lg: 0 16px 40px rgba(16,32,80,.14);
  --grad: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
}
body { font-family: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); letter-spacing: -.003em; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { letter-spacing: -.012em; }
.ico { flex: none; vertical-align: middle; }
#content > * { animation: fadeUp .22s ease-out both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { #content > *, .toast { animation: none !important; } .btn, .ctile { transition: none !important; } }

/* cards, buttons, badges */
.card { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn { font-weight: 600; letter-spacing: 0; }
.btn.primary { background: var(--grad); border-color: transparent; box-shadow: 0 4px 12px rgba(37,99,235,.28); }
.btn.primary:hover { filter: brightness(1.06); background: var(--grad); }
.btn.success { box-shadow: 0 4px 12px rgba(21,128,61,.22); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.card h3 { font-size: 15.5px; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; } .card-title h3 { margin: 0; } .card-title a { font-size: 13px; font-weight: 600; }

/* top bar and sidebar */
.topbar { background: rgba(255,255,255,.86); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.sidebar { background: linear-gradient(180deg, #0b1f4d 0%, #0a1a40 100%); width: 256px; }
.brand { padding: 18px 18px 16px; }
.nav a { color: #b9c8ea; font-weight: 500; position: relative; }
.nav a .ni { color: #8fa8dd; display: inline-grid; place-items: center; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; } .nav a:hover .ni { color: #fff; }
.nav a.active { background: rgba(79,110,255,.22); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #6b8cff; }
.nav a.active .ni { color: #9db4ff; }
.nav-title { color: #6f89c9; letter-spacing: .1em; font-size: 10.5px; }
.logo-mark { background: var(--grad); border-radius: 12px; box-shadow: 0 4px 12px rgba(37,99,235,.4); }
.avatar { background: var(--grad); color: #fff; }
.create-btn svg, .quick-find svg { margin-right: 2px; }
.co-name { font-size: 15px; }

/* KPI cards with an icon chip, trend chip and sparkline */
.stat { border-radius: var(--radius); }
.stat.has-ico { padding: 16px 16px 14px; }
.stat-ico { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-l); color: var(--blue-d); }
.stat.g .stat-ico { background: #dcfce7; color: #15803d; } .stat.a .stat-ico { background: #fef3c7; color: #b45309; } .stat.p .stat-ico { background: #ede9fe; color: #6d28d9; }
.stat.warn .stat-ico { background: #fee2e2; color: #b91c1c; } .stat.b .stat-ico { background: #e0ecff; color: #1d4ed8; }
.stat.has-ico .lbl { padding-right: 48px; font-size: 12px; }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px 8px; margin-top: 8px; flex-wrap: wrap; }
.stat .spark { width: 72px; height: 26px; flex: none; margin-left: auto; }
.delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; } .delta.up { background: #dcfce7; color: #15803d; } .delta.down { background: #fee2e2; color: #b91c1c; }

/* dashboard layout and charts */
.dash-main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; margin-bottom: 14px; align-items: stretch; } .dash-main > * { min-width: 0; margin-bottom: 0; }
.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-bottom: 14px; } .chart-row > * { min-width: 0; }
.recent-card { margin-bottom: 14px; } .dash-grid2 { margin-bottom: 14px; }
.chart-svg { width: 100%; height: auto; display: block; } .chart-svg .ct { font-size: 11px; fill: #8a96ad; } .chart-svg .cg { stroke: #e9edf5; stroke-width: 1; }
.chart .legend { margin-top: 6px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { position: relative; width: 150px; height: 150px; flex: none; margin: 0 auto; } .donut-svg { width: 100%; height: 100%; display: block; }
.donut-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.donut-mid b { font-size: 19px; color: var(--navy); line-height: 1.1; } .donut-mid small { font-size: 11px; color: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 7px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; } .donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; } .donut-legend span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .donut-legend b { font-variant-numeric: tabular-nums; }
.bars.rank .row { grid-template-columns: minmax(90px, 1.4fr) 2fr auto; } .bars.rank .row span:first-child { display: flex; align-items: center; gap: 8px; }
.bars.rank em { font-style: normal; font-size: 11px; font-weight: 700; width: 20px; height: 20px; border-radius: 50%; background: var(--blue-l); color: var(--blue-d); display: grid; place-items: center; flex: none; }
.bars .fill { background: linear-gradient(90deg, #2563eb, #7c9cff); }
.attention .alert-row { border-left-width: 0; border-radius: 12px; background: #f8faff; border: 1px solid var(--line); }
.attention .alert-row .ai { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: #e8edf7; color: #475569; }
.attention .alert-row.RED .ai { background: #fee2e2; color: #b91c1c; } .attention .alert-row.AMBER .ai { background: #fef3c7; color: #b45309; } .attention .alert-row.INFO .ai { background: #e0ecff; color: #1d4ed8; }
.attention .alert-row.RED { background: #fff8f8; border-color: #fbd0d0; } .attention .alert-row.AMBER { background: #fffbf0; border-color: #f8e2a8; }
.allclear { display: flex; gap: 10px; align-items: center; }
.ctile .ci { color: var(--navy); } .ctile.g .ci { color: #15803d; } .ctile.b .ci { color: #1d4ed8; } .ctile.a .ci { color: #b45309; } .ctile.p .ci { color: #6d28d9; } .ctile.n .ci { color: #334155; }
.ctile { border-radius: 16px; } .ctile:hover { border-color: #b7c9f7; }
.hero h1 { font-size: 27px; }

/* tables: calmer header, softer lines */
.tbl th { background: #f8fafd; color: #5b6880; font-size: 11.5px; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
.tbl td { border-bottom: 1px solid #f0f3f8; }
.tbl tbody tr:hover { background: #f7f9fe; }
.tbl-card { border-radius: var(--radius); }
.tbl-tools { background: #fff; }
.tbl tfoot td { background: #f8fafd; }

/* login: brand panel + card */
.login-wrap { background: radial-gradient(1200px 600px at 10% -10%, #3b62f2 0%, transparent 60%), radial-gradient(900px 500px at 100% 110%, #6d4df0 0%, transparent 55%), linear-gradient(135deg, #0b1f4d, #142e75); }
.login-shell { display: flex; align-items: stretch; justify-content: center; gap: 0; width: 100%; max-width: 980px; border-radius: 24px; overflow: hidden; box-shadow: 0 30px 70px rgba(0,0,0,.35); background: #fff; }
.login-side { flex: 1.05; padding: 38px 36px; color: #e8efff; background: linear-gradient(160deg, rgba(255,255,255,.10), rgba(255,255,255,.02)), var(--grad); display: none; flex-direction: column; gap: 22px; justify-content: center; }
.login-side .logo { display: flex; align-items: center; gap: 12px; font-size: 20px; color: #fff; } .login-side .logo-mark { background: rgba(255,255,255,.18); box-shadow: none; }
.login-side h2 { font-size: 26px; line-height: 1.25; color: #fff; text-wrap: balance; }
.login-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; } .login-side li { display: flex; gap: 10px; align-items: center; font-size: 14.5px; }
.login-side li span { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; flex: none; }
.login-shell .login-card { box-shadow: none; border-radius: 0; max-width: none; flex: 1; min-width: 0; padding: 40px 36px; align-self: center; }
@media (min-width: 900px) { .login-side { display: flex; } .login-shell .login-card { max-width: 440px; } }
@media (max-width: 899px) { .login-shell { max-width: 420px; } .login-shell .login-card { padding: 28px 22px; } }

.more-wrap { position: relative; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; min-width: 240px; max-width: 92vw; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.more-menu .btn.mi { border: 0; background: none; box-shadow: none; justify-content: flex-start; width: 100%; white-space: normal; text-align: left; font-weight: 600; border-radius: 9px; }
.more-menu .btn.mi:hover { background: var(--bg); } .more-menu .btn.mi.danger { color: var(--red); } .more-menu .btn.mi.danger:hover { background: var(--red-l); }
.filters-toggle { display: none; }
/* ---------- phones: cards instead of wide tables, a comfortable one-column form ---------- */
@media (max-width: 700px) {
  .filters-toggle { display: inline-flex; width: 100%; justify-content: flex-start; }
  .filters.collapsed > .field { display: none; } .filters { padding: 10px; gap: 10px; }
  .filters:not(.collapsed) .filters-toggle { margin-bottom: 2px; background: var(--blue-l); border-color: #bcd0fb; color: var(--blue-d); }
  .tbl-tools select { display: none; }
  .dash-main { grid-template-columns: minmax(0, 1fr); }
  .tbl-wrap { max-height: none; overflow: visible; }
  .tbl-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .tbl-tools { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; padding: 8px 10px; gap: 8px; }
  .tbl-tools .search { max-width: none; min-width: 100%; order: -1; } .tbl-tools .count { margin-left: 0; }
  .pager { background: #fff; border: 1px solid var(--line); border-radius: 14px; }
  table.tbl.stack, .tbl.stack tbody, .tbl.stack tfoot { display: block; width: 100%; }
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 0 0 10px; box-shadow: 0 1px 2px rgba(16,32,80,.04); }
  .tbl.stack tbody tr.click:active { background: #f1f5ff; }
  .tbl.stack td { display: block; padding: 0; border: 0; white-space: normal; max-width: none; overflow: visible; text-overflow: clip; text-align: left !important; min-width: 0; word-break: break-word; }
  .tbl.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 1px; }
  .tbl.stack td:first-child { grid-column: 1 / -1; font-size: 15px; font-weight: 700; } .tbl.stack td:first-child::before { display: none; }
  .tbl.stack td:empty, .tbl.stack td[data-label="#"], .tbl.stack td.hide-m { display: none; }
  .tbl.stack td.empty { grid-column: 1 / -1; text-align: center !important; padding: 20px 0; } .tbl.stack td.empty::before { display: none; }
  .tbl.stack td:not([data-label]) { grid-column: 1 / -1; text-align: left !important; }
  .tbl.stack tfoot tr { background: #f1f5ff; }
  /* line-item grids on a form become one card per line */
  .grid-wrap { overflow: visible; }
  table.grid { min-width: 0; display: block; } .grid thead { display: none; } .grid tbody { display: block; }
  .grid tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; position: relative; box-shadow: 0 1px 2px rgba(16,32,80,.04); }
  .grid td { display: block; padding: 0; border: 0; min-width: 0 !important; text-align: left; }
  .grid td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
  .grid td:first-child { grid-column: 1 / -1; padding-right: 34px; } .grid td.calc { text-align: left; padding-right: 0; white-space: normal; } .grid td.hide-m { display: none; }
  .grid td.calc:empty, .grid td:has(> span.muted:only-child) { display: none; } .grid td.calc.bad { color: var(--red); }
  .grid td.delc { position: absolute; top: 8px; right: 6px; width: auto !important; }
  .grid td .fi, .grid td .combo-input { min-height: 42px; }
  .trk { min-width: 0; }
  .totals-box { width: 100%; margin-top: 8px; } .form-grid .field.wide { grid-column: 1 / -1; }
  .card-pad { padding: 14px; }
  .page-head h1 { font-size: 21px; }
  .btn-row { width: 100%; } .btn-row .btn { flex: 1 1 auto; }
  .action-bar .btn { flex: 1 1 40%; }
  .kv { gap: 10px 16px; }
  .modal { border-radius: 18px 18px 0 0; margin-top: auto; } .overlay { align-items: flex-end; padding: 0; } .modal:has(table.tbl) { width: 100%; min-width: 0; max-width: 100%; }
  .modal-body { max-height: 72vh; }
  .stat.has-ico { padding: 13px 12px 11px; } .stat-ico { width: 34px; height: 34px; right: 10px; top: 10px; border-radius: 10px; } .stat.has-ico .lbl { padding-right: 38px; }
  .stat .spark { width: 64px; } .delta { font-size: 11px; padding: 2px 6px; }
  .donut-wrap { justify-content: center; }
  .login-wrap { padding: 12px; }
}

/* =====================================================================================================================
   DESIGN SYSTEM v3 - restrained and consistent. One brand blue, neutral surfaces, colour only where it means something
   (green = good, amber = watch, red = problem). No decorative gradients, light shadows, modest corner radii.
   This block is last on purpose: it settles every earlier rule into one look.
   ===================================================================================================================== */
:root {
  --brand: #2563eb; --brand-d: #1d4ed8; --brand-l: #eef3ff; --brand-line: #c7d8fb;
  --navy: #0d2250; --blue: #2563eb; --blue-d: #1d4ed8; --blue-l: #eef3ff;
  --bg: #f5f7fa; --card: #fff; --line: #e4e8ef; --line2: #d3d9e3; --text: #162033; --muted: #5d6a82;
  --radius: 12px; --r-ctl: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05); --shadow-md: 0 8px 24px rgba(16, 24, 40, .12); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --grad: none;
}
body { font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
.strong, b, strong { font-weight: 650; }
h1 { font-weight: 700; } h2, h3 { font-weight: 650; }
.r, .val, .big, td.calc, .totals-box, .donut-mid b, .kv .v { font-variant-numeric: tabular-nums; }

/* buttons */
.btn { min-height: 38px; padding: 7px 14px; border-radius: var(--r-ctl); border: 1px solid var(--line2); background: #fff; color: var(--text); font-weight: 600; box-shadow: none; }
.btn:hover { background: #f4f6fa; border-color: #c3cad8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: none; } .btn.primary:hover { background: var(--brand-d); border-color: var(--brand-d); filter: none; }
.btn.success { background: #15803d; border-color: #15803d; color: #fff; box-shadow: none; }
.btn.danger { background: #fff; color: var(--red); border-color: #f1c0c0; } .btn.danger:hover { background: var(--red-l); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand-d); } .btn.ghost:hover { background: var(--brand-l); }
.btn.sm { min-height: 30px; padding: 3px 10px; font-size: 12.5px; }
.btn:focus-visible, .fi:focus-visible, a:focus-visible, .ctile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* cards, headings, page header */
.card { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); background: #fff; }
.card h3, .card-title h3 { font-size: 15px; color: var(--text); }
.page-head { margin-bottom: 16px; } .page-head h1 { font-size: 22px; color: var(--text); letter-spacing: -.01em; } .page-head .sub { color: var(--muted); font-size: 13px; }

/* inputs and forms */
.fi, .combo-input { min-height: 40px; border-radius: var(--r-ctl); border: 1px solid var(--line2); padding: 8px 12px; background: #fff; }
.fi:hover, .combo-input:hover { border-color: #b9c2d3; }
.fi:focus, .combo-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .16); }
.fi:disabled, .combo-input:disabled { background: #f1f4f8; color: #7a879c; }
.field > label { font-size: 12.5px; font-weight: 600; color: #344054; } .field .help { color: var(--muted); font-size: 12px; }
.fi.err, .combo.err .combo-input { border-color: var(--red); background: #fff8f8; box-shadow: none; }
.combo-list { border-radius: var(--r-ctl); box-shadow: var(--shadow-md); border-color: var(--line); }
.combo-opt { padding: 8px 12px; } .combo-opt:hover, .combo-opt.hl { background: var(--brand-l); }
.alert { border-radius: var(--r-ctl); padding: 10px 14px; }

/* badges: soft, with a dot */
.badge { font-size: 11.5px; font-weight: 600; padding: 2px 9px 2px 8px; }

/* tables */
.tbl-card { border-radius: var(--radius); }
.tbl th { background: #f8fafc; color: #5d6a82; font-size: 11.5px; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid #eef1f6; }
.tbl tbody tr:hover { background: #f8fafc; } .tbl tbody tr.click:hover { background: #f3f7ff; }
.tbl tfoot td { background: #f8fafc; }
.tbl-tools { padding: 12px 14px; }

/* sidebar */
.sidebar { background: #0d2250; width: 248px; transition: width .16s ease; }
.brand { padding: 16px 16px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand .bn { font-size: 15.5px; } .brand small { color: #90a6d6; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.logo-mark, .avatar { background: var(--brand); box-shadow: none; color: #fff; }
.nav { padding: 10px 10px 8px; }
.nav-group { margin-top: 12px; }
.nav-title { font-size: 10.5px; letter-spacing: .09em; color: #7d93c4; padding: 4px 12px; }
.nav a { padding: 8px 12px; border-radius: 8px; color: #c2d0ee; font-weight: 500; font-size: 13.5px; gap: 10px; }
.nav a .ni { color: #8ea6dc; width: 20px; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; } .nav a:hover .ni { color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .13); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #5b8def; } .nav a.active .ni { color: #fff; }
.nav-foot { background: #0d2250; padding: 10px 12px 14px; }
.nav-toggle { border-radius: 8px; border-color: rgba(255, 255, 255, .16); background: transparent; font-size: 13px; }
.drawer-x, .sb-toggle { display: none; }
@media (min-width: 901px) {
  .sb-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
  .sb-toggle:hover { background: var(--bg); color: var(--text); }
  .sb-collapsed .sidebar { width: 68px; }
  .sb-collapsed .brand { justify-content: center; padding: 14px 0; } .sb-collapsed .brand-text, .sb-collapsed .nav-title, .sb-collapsed .nav a > span:not(.ni), .sb-collapsed .nav-toggle, .sb-collapsed .nav-hint { display: none; }
  .sb-collapsed .nav { padding: 8px 8px; } .sb-collapsed .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .08); }
  .sb-collapsed .nav a { justify-content: center; padding: 10px 0; } .sb-collapsed .nav a .ni { width: auto; }
  .sb-collapsed .nav-foot { padding: 8px; border-top: 0; }
}
@media (max-width: 1100px) and (min-width: 901px) { .sidebar { width: 224px; } }

/* header */
.topbar { min-height: 56px; padding: 8px 20px; background: #fff; backdrop-filter: none; border-bottom: 1px solid var(--line); gap: 10px; }
.create-btn { padding: 7px 14px; }
.quick-find { min-width: 38px; } .quick-find svg { margin: 0; }
.co-name { font-size: 14.5px; font-weight: 650; color: var(--text); }
.user-chip:hover { background: var(--bg); } .menu { border-radius: 12px; box-shadow: var(--shadow-md); }

/* Home */
.hero { margin-bottom: 14px; } .hero h1 { font-size: 24px; color: var(--text); }
.ctile { border-radius: var(--radius); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); color: var(--text); transition: border-color .12s, background .12s; }
.ctile:hover { border-color: var(--brand-line); background: #fafcff; box-shadow: var(--shadow); transform: none; }
.ctile .ci, .ctile.g .ci, .ctile.b .ci, .ctile.a .ci, .ctile.p .ci, .ctile.n .ci { background: var(--brand-l); color: var(--brand-d); border-radius: 10px; }
.ctile b { color: var(--text); font-size: 13.5px; font-weight: 600; }
.ctile.more { background: transparent; border-style: dashed; box-shadow: none; } .ctile.more .ci { background: #eef1f6; color: var(--muted); }
.start-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.start-grid .ctile { flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; min-height: 56px; padding: 10px 16px 10px 12px; }
.start-grid .ctile .ci { width: 34px; height: 34px; }
.start-grid .ctile:first-child { background: var(--brand); border-color: var(--brand); } .start-grid .ctile:first-child b { color: #fff; }
.start-grid .ctile:first-child .ci { background: rgba(255, 255, 255, .18); color: #fff; } .start-grid .ctile:first-child:hover { background: var(--brand-d); border-color: var(--brand-d); }
.stat { border-radius: var(--radius); box-shadow: var(--shadow); }
.stat .lbl { font-size: 11.5px; letter-spacing: .05em; color: var(--muted); }
.stat .val { color: var(--text); font-weight: 700; font-size: 26px; letter-spacing: -.01em; }
.stat .sub { color: var(--muted); font-size: 12.5px; }
.cards.kpis .stat { padding: 18px; } .cards.kpis .stat .val { font-size: 30px; margin-top: 6px; }
.stat-ico, .stat.g .stat-ico, .stat.a .stat-ico, .stat.p .stat-ico, .stat.b .stat-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-l); color: var(--brand-d); }
.stat.warn .stat-ico { background: var(--red-l); color: var(--red); }
.stat .bar { background: var(--brand); } .stat.g .bar, .stat.a .bar, .stat.p .bar { background: var(--brand); }
.delta { font-size: 11.5px; }
.bars .fill { background: var(--brand); } .bars .track { background: #edf0f5; }
.attention .alert-row { border-radius: var(--r-ctl); background: #fff; border: 1px solid var(--line); padding: 10px 12px; }
.attention .alert-row:hover { background: #f8fafc; }
.attention .alert-row.RED { background: #fff; border-color: #f3c6c6; } .attention .alert-row.AMBER { background: #fff; border-color: #f2dc9d; }
.attention .alert-row .ai { width: 34px; height: 34px; border-radius: 9px; }
.allclear { background: #f0fdf4; color: #166534; border-radius: var(--r-ctl); padding: 12px 14px; font-weight: 600; }
.chart-card, .recent-card { box-shadow: var(--shadow); }
.dash-main { gap: 14px; }
@media (max-width: 1180px) { .dash-main { grid-template-columns: minmax(0, 1fr); } }

/* tabs, segmented controls, dropdowns, modals, toasts */
.tabs { border-bottom: 1px solid var(--line); } .tabs a { font-weight: 600; font-size: 13.5px; padding: 9px 14px; } .tabs a.active { color: var(--brand-d); border-bottom-color: var(--brand); }
.seg { border-radius: var(--r-ctl); } .seg button.active { background: var(--brand); }
.subtab { border-radius: 999px; font-weight: 600; font-size: 13px; padding: 6px 14px; } .subtab.on { background: var(--brand-l); border-color: var(--brand-line); color: var(--brand-d); }
.chip.on { background: var(--brand); }
.more-menu, .menu { border-radius: 12px; box-shadow: var(--shadow-md); }
.modal { border-radius: 14px; box-shadow: var(--shadow-lg); } .modal-head { padding: 14px 18px; } .modal-head h2 { font-size: 16.5px; color: var(--text); font-weight: 650; }
.overlay { background: rgba(15, 23, 42, .5); }
.toast { background: #1f2937; color: #fff; border-radius: 10px; box-shadow: var(--shadow-md); border-left: 4px solid #3b82f6; padding: 11px 14px; font-size: 13.5px; }
.toast.ok { background: #1f2937; border-left-color: #22c55e; } .toast.err { background: #1f2937; border-left-color: #ef4444; } .toast.info { background: #1f2937; border-left-color: #3b82f6; }
.create-box { border-radius: 16px; box-shadow: var(--shadow-lg); }
.palette-box { border-radius: 14px; box-shadow: var(--shadow-lg); }
.gstbox.compact { border-radius: var(--r-ctl); background: #fafbfd; }

/* login: flat, calm */
.login-wrap { background: #0d2250; }
.login-shell { border-radius: 16px; box-shadow: var(--shadow-lg); }
.login-side { background: var(--brand-d); } .login-card, .login-shell .login-card { border-radius: 0; box-shadow: none; }
.login-side .logo-mark { background: rgba(255, 255, 255, .16); }

/* loading and empty states */
.skel { padding: 4px 0; } .skel-bar { height: 22px; background: #e8ecf3; border-radius: 8px; margin-bottom: 10px; animation: skel 1.4s ease-in-out infinite; } .skel-bar.sm { height: 13px; }
.skel-bar.w40 { width: 40%; } .skel-bar.w70 { width: 70%; }
.skel-block { height: 116px; background: #eceff5; border-radius: var(--radius); margin: 14px 0; animation: skel 1.4s ease-in-out infinite; } .skel-block.short { height: 72px; }
@keyframes skel { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .skel-bar, .skel-block { animation: none; } }
.empty { padding: 8px; } .empty-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 12px; color: var(--muted); text-align: center; } .empty-box svg { color: #a3aec2; }

/* ---------- phones and small tablets ---------- */
@media (max-width: 900px) {
  .sidebar { width: min(84vw, 300px); transition: transform .2s; }
  .drawer-x { display: inline-grid; place-items: center; margin-left: auto; width: 36px; height: 36px; border: 0; background: transparent; color: #c2d0ee; border-radius: 8px; }
  .topbar { padding: 8px 12px; min-height: 52px; }
  .content { padding: 14px 14px 96px; }
}
@media (max-width: 700px) {
  .quick-find .qf-text, .quick-find kbd { display: none; }
  .quick-find { width: 40px; padding: 0; }
  .btn { min-height: 42px; } .btn.sm { min-height: 34px; }
  .fi, .combo-input { min-height: 44px; }
  .page-head h1 { font-size: 20px; }
  /* Home on a phone: greeting, what needs attention, the money, then the quick actions, then the rest */
  .dash { display: flex; flex-direction: column; }
  .dash-main { display: contents; }
  .dash > .hero { order: 0; } .dash > .card:not(.attention):not(.chart-card):not(.recent-card):not(.more-stats) { order: 0; }
  .dash .attention { order: 1; margin-bottom: 12px; } .dash .kpis { order: 2; } .dash .start-grid { order: 3; }
  .dash .chart-card { order: 4; margin-bottom: 12px; } .dash .chart-row { order: 5; } .dash .recent-card { order: 6; } .dash .dash-grid2 { order: 7; } .dash .more-stats { order: 8; }
  .start-grid { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 14px; padding: 2px 14px 6px; gap: 8px; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .start-grid::-webkit-scrollbar { display: none; }
  .start-grid .ctile { flex: 0 0 auto; scroll-snap-align: start; min-height: 52px; padding: 8px 14px 8px 10px; }
  .cards.kpis .stat { padding: 14px 12px 12px; } .cards.kpis .stat .val { font-size: clamp(18px, 5.6vw, 24px); overflow-wrap: anywhere; }
  .stat-ico { width: 30px; height: 30px; right: 10px; top: 10px; } .stat.has-ico .lbl { padding-right: 34px; }
  .create-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .create-box { border-radius: 16px 16px 0 0; }
  .modal { border-radius: 16px 16px 0 0; }
}
@media (max-width: 700px) {
  .hero { margin-bottom: 10px; } .hero h1 { font-size: 20px; line-height: 1.25; } .hero .sub { font-size: 12.5px; }
  .attention { padding: 12px; } .attention h3 { font-size: 14px; margin-bottom: 8px; }
  .attention .alerts { gap: 6px; } .attention .alert-row { padding: 8px 10px; gap: 10px; }
  .attention .alert-row .ai { width: 30px; height: 30px; } .attention .alert-row .at b { font-size: 13.5px; line-height: 1.3; }
  .attention .alert-row .at small { display: -webkit-box !important; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; }
  .cards.kpis { gap: 8px; align-items: start; } .cards.kpis .stat .sub { font-size: 11.5px; line-height: 1.3; }
  .stat .spark { display: none; } .stat-foot { margin-top: 6px; }
  .start-grid { scroll-padding-left: 14px; }
}
@media (max-width: 359px) {
  .create-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding-left: 10px; padding-right: 10px; } .start-grid { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; }
  .topbar { gap: 6px; padding: 6px 8px; } .co-name { max-width: 38vw; }
  .bb-tab span:last-child { font-size: 10px; }
}