:root {
  /* Q-Beta Pulse — navy → teal → green taken from the logo; light ledger surfaces */
  --paper: #F3F7F8;
  --surface: #FFFFFF;
  --ink: #0D2240;
  --ink-2: #44566A;
  --ink-3: #7A8A99;
  --line: #DCE4EA;
  --line-2: #EBF1F4;
  --sky: #13919A;
  --sky-deep: #0B5F7E;
  --sky-wash: #E2F3F2;
  --navy: #0B2E5C;
  --pulse: #3CC85A;
  --green: #23905A;
  --amber: #C98A12;
  --red: #C2412D;
  --green-wash: #E3F5EA;
  --amber-wash: #FBF1DC;
  --red-wash: #F9E4E0;
  --radius: 6px;
  --font: "Schibsted Grotesk", system-ui, sans-serif;
  color-scheme: light;
  --green-ink: #1A6B42; --amber-ink: #7A5408; --red-ink: #8F2A1B; --red-line: #E7B8AF; --red-soft: #C2412D;
  --head: #F7FAFB; --head-2: #EEF4F6; --hover: #F6FAFB; --field: #FFFFFF;
  --btn: #0B2E5C; --btn-hover: #0B5F7E; --btn-fg: #FFFFFF; --on-dark: #FFFFFF;
  --side: #FFFFFF; --side-fg: #2C3E52; --side-muted: #8295A5; --side-line: #E3EAEF; --side-hover: #F0F6F7; --side-on: #E2F3F2; --side-strong: #0B2E5C;
  --scrim: rgba(11, 46, 92, 0.35); --shadow: rgba(11, 46, 92, 0.18);
  --brand-grad: linear-gradient(90deg, #0B2E5C, #13919A 55%, #3CC85A);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0C1824; --surface: #132232; --ink: #E3ECF2; --ink-2: #A8B8C6; --ink-3: #7D8FA0;
  --line: #24384A; --line-2: #1C2E3E; --sky: #3BB7BE; --sky-deep: #7FD0D6; --sky-wash: #143640;
  --navy: #9CC3EE; --pulse: #5BDA78; --green: #4CB37B; --amber: #E0A93A; --red: #E2664F;
  --green-wash: #163526; --amber-wash: #3A2E14; --red-wash: #3E1F19;
  --green-ink: #8BD8AC; --amber-ink: #F0C977; --red-ink: #F4A898; --red-line: #6B3A30; --red-soft: #F3B5A9;
  --head: #172839; --head-2: #1B2D3F; --hover: #172A3B; --field: #0C1824;
  --btn: #3BB7BE; --btn-hover: #7FD0D6; --btn-fg: #0C1824; --on-dark: #FFFFFF;
  --side: #101F2E; --side-fg: #C9D6E0; --side-muted: #7D90A0; --side-line: #1F3244; --side-hover: #172A3B; --side-on: #143640; --side-strong: #E3ECF2;
  --scrim: rgba(0, 0, 0, 0.6); --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --paper: #0C1824; --surface: #132232; --ink: #E3ECF2; --ink-2: #A8B8C6; --ink-3: #7D8FA0;
  --line: #24384A; --line-2: #1C2E3E; --sky: #3BB7BE; --sky-deep: #7FD0D6; --sky-wash: #143640;
  --navy: #9CC3EE; --pulse: #5BDA78; --green: #4CB37B; --amber: #E0A93A; --red: #E2664F;
  --green-wash: #163526; --amber-wash: #3A2E14; --red-wash: #3E1F19;
  --green-ink: #8BD8AC; --amber-ink: #F0C977; --red-ink: #F4A898; --red-line: #6B3A30; --red-soft: #F3B5A9;
  --head: #172839; --head-2: #1B2D3F; --hover: #172A3B; --field: #0C1824;
  --btn: #3BB7BE; --btn-hover: #7FD0D6; --btn-fg: #0C1824; --on-dark: #FFFFFF;
  --side: #101F2E; --side-fg: #C9D6E0; --side-muted: #7D90A0; --side-line: #1F3244; --side-hover: #172A3B; --side-on: #143640; --side-strong: #E3ECF2;
  --scrim: rgba(0, 0, 0, 0.6); --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
a { color: var(--sky-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 10px; }
h3 { font-size: 14px; font-weight: 650; margin: 14px 0 6px; }
p { margin: 0 0 8px; }
small, .muted { color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--side-line); color: var(--side-fg); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 18px 18px 14px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--side-line); }
.brand-mark { width: 34px; height: 34px; object-fit: contain; }
.brand b { color: var(--side-strong); font-size: 17px; letter-spacing: 0.01em; }
.brand small { display: block; color: var(--side-muted); font-size: 11.5px; }
.nav-tools { display: flex; justify-content: flex-end; padding: 8px 12px 0; }
.nav-collapse-all { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--side-muted); background: none; border: 1px solid var(--side-line); border-radius: 999px; cursor: pointer; font-family: inherit; transition: color .14s ease, background .14s ease, border-color .14s ease; }
.nav-collapse-all:hover { color: var(--side-fg); background: var(--side-hover); border-color: var(--side-muted); }
.nav-collapse-all .ca-ico { display: inline-flex; }
.nav { padding: 6px 10px 10px; flex: 1; }
.nav-grp { margin-bottom: 2px; }
.nav-group { display: flex; align-items: center; gap: 9px; width: 100%; margin: 8px 0 3px; padding: 5px 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--side-muted); background: none; border: 0; cursor: pointer; font-family: inherit; border-radius: 7px; transition: color .15s ease, background .15s ease; }
.nav-group:hover { color: var(--side-fg); background: var(--side-hover); }
.nav-group .grp-ico { display: inline-flex; opacity: .85; }
.nav-group .grp-ico svg { width: 15px; height: 15px; }
.nav-group .grp-label { flex: 1; text-align: left; }
.nav-group .chev { display: inline-flex; transition: transform .2s ease; opacity: .6; }
.nav-grp:not(.collapsed) .nav-group .chev { transform: rotate(90deg); }
.nav-grp .nav-items { max-height: 1200px; overflow: hidden; transition: max-height .24s ease, opacity .2s ease; opacity: 1; padding-left: 4px; }
.nav-grp.collapsed .nav-items { max-height: 0; opacity: 0; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--side-fg); font-size: 13.5px; transition: background .14s ease, color .14s ease; }
.nav a .nav-ico { display: inline-flex; color: var(--side-muted); transition: color .14s ease, transform .14s ease; flex: 0 0 auto; }
.nav a .nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: var(--side-hover); text-decoration: none; }
.nav a:hover .nav-ico { color: var(--side-fg); transform: translateX(1px); }
.nav a.on { background: var(--side-on); color: var(--side-strong); font-weight: 600; }
.nav a.on .nav-ico { color: var(--sky); }
.nav a.on::before { content: ""; position: absolute; left: -2px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--sky); }
.nav .pill { background: var(--red); color: var(--on-dark); border-radius: 10px; font-size: 11px; padding: 0 7px; flex: 0 0 auto; }
.side-foot { padding: 12px 18px; border-top: 1px solid var(--side-line); font-size: 12px; }
.tokens { display: flex; justify-content: space-between; color: var(--side-strong); }
.tokens.low { color: var(--red-soft); }
.main { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .who { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.support-banner { background: var(--amber-wash); color: var(--amber-ink); padding: 6px 28px; font-size: 13px; border-bottom: 1px solid var(--line); }
.page { padding: 22px 28px 60px; max-width: 1440px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin: 4px 0 0; max-width: 70ch; }

/* ---------- surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel.flush { padding: 0; }
.panel.flush > h2 { padding: 14px 18px 0; }
.grid { display: grid; gap: 16px; }
.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)); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 780px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .g2, .g3, .g4 { grid-template-columns: 1fr; } .page, .top { padding-left: 16px; padding-right: 16px; } }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.kpi .l { color: var(--ink-2); font-size: 12.5px; }
.kpi.alert .v { color: var(--red); }
.kpi-btn { text-align: left; cursor: pointer; font: inherit; transition: border-color .12s, box-shadow .12s, transform .08s; }
.kpi-btn:hover { border-color: var(--sky); box-shadow: 0 6px 18px -12px rgba(11,46,92,.4); }
.kpi-btn:active { transform: translateY(1px); }
.kpi-btn[aria-pressed=true] { border-color: var(--sky-deep); box-shadow: inset 0 0 0 1px var(--sky-deep); background: var(--sky-wash); }
.input { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; font-size: 13.5px; }
.input:focus { outline: none; border-color: var(--sky); }
/* training manual */
.video-wrap { min-height: 220px; display: grid; place-items: center; background: var(--paper); border-radius: 10px; overflow: hidden; }
.manual { display: grid; gap: 14px; margin-top: 16px; }
.manual-step { display: flex; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.manual-step .pic { flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--sky-wash); color: var(--sky-deep); display: grid; place-items: center; }
.manual-step .pic svg { width: 30px; height: 30px; }
.manual-step .body { flex: 1; min-width: 0; }
.manual-step h3 { margin: 0 0 3px; font-size: 16px; }
.manual-step .intro { margin: 0 0 8px; color: var(--ink-2); font-size: 14px; }
.manual-step ol { margin: 0; padding-left: 20px; display: grid; gap: 5px; font-size: 14px; color: var(--ink); }
.manual-step .tip { margin-top: 10px; font-size: 13px; color: var(--green); background: var(--green-wash); padding: 7px 11px; border-radius: 8px; }
/* data protection */
.acts { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.acts li { font-size: 13.5px; border-left: 3px solid var(--sky); padding-left: 10px; }
.principles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 10px; }
.principle { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.principle .pt { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.principle .pt .tick { color: var(--green); font-weight: 800; }
.principle .tenet { margin: 6px 0 4px; font-size: 13px; color: var(--ink-2); }
.principle .how { margin: 0; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 760px) { .principles { grid-template-columns: 1fr; } }
/* policies */
.pol-list { display: grid; gap: 10px; }
.pol-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pol-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.policy-doc { max-height: 52vh; overflow: auto; padding-right: 8px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.policy-doc h2 { font-size: 18px; margin: 4px 0 8px; }
.policy-doc h3 { font-size: 15px; margin: 14px 0 4px; color: var(--ink-2); }
.policy-doc ul { margin: 6px 0 6px 18px; } .policy-doc p { margin: 6px 0; }

/* ---------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 14px; font: inherit; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--sky-deep); font-weight: 600; }

/* ---------- tables */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--head); white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.t tr:hover td { background: var(--hover); }
.t .n, .t th.n { text-align: right; white-space: nowrap; }
.t tr.total td { font-weight: 700; border-top: 1px solid var(--ink); }
.t tr.grand td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.t tr.hdr td { background: var(--head-2); font-weight: 600; }
.t tr.indent td:first-child { padding-left: 26px; }
.t tr.click { cursor: pointer; }
.neg { color: var(--red); }
.empty { padding: 30px; text-align: center; color: var(--ink-3); }

/* ---------- status */
.st { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.st.posted, .st.approved, .st.paid, .st.matched, .st.filed, .st.active, .st.reimbursed, .st.ok { background: var(--green-wash); color: var(--green-ink); }
.st.pending_approval, .st.suggested, .st.partially_paid, .st.pending, .st.returned, .st.warn { background: var(--amber-wash); color: var(--amber-ink); }
.st.rejected, .st.void, .st.suspended, .st.locked, .st.unmatched, .st.block, .st.red { background: var(--red-wash); color: var(--red-ink); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.dot.green { background: var(--green); } .dot.amber { background: var(--amber); } .dot.red { background: var(--red); } .dot.grey { background: var(--ink-3); }

/* SLA fuse — the queue's signature element */
.fuse { position: relative; height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 120px; }
.fuse i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.fuse i.green { background: var(--green); } .fuse i.amber { background: var(--amber); } .fuse i.red { background: var(--red); }
.fuse-meta { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.rag-strip { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.rag-strip div { padding: 12px 16px; border-right: 1px solid var(--line); }
.rag-strip div:last-child { border-right: 0; }
.rag-strip b { font-size: 24px; display: block; }
.rag-strip .g b { color: var(--green); } .rag-strip .a b { color: var(--amber); } .rag-strip .r b { color: var(--red); }
.stages { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stage { font-size: 12px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-3); }
.stage.done { background: var(--green-wash); border-color: transparent; color: var(--green-ink); }
.stage.now { border-color: var(--sky-deep); color: var(--sky-deep); font-weight: 600; }

/* ---------- forms & buttons */
.btn { font: inherit; font-size: 13.5px; padding: 7px 13px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-fg); }
.btn.primary:hover { background: var(--btn-hover); }
.btn.accent { background: var(--sky-deep); border-color: var(--sky-deep); color: var(--on-dark); }
.btn.good { background: var(--green); border-color: var(--green); color: var(--on-dark); }
.btn.danger { color: var(--red); border-color: var(--red-line); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
input, select, textarea { font: inherit; font-size: 13.5px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--field); color: var(--ink); min-width: 0; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--sky-deep); }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.lines input, .lines select { width: 100%; padding: 5px 7px; }
.lines td { padding: 4px 4px; }

/* ---------- modal & toast */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: start center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 8px; width: min(760px, 100%); padding: 20px 22px; box-shadow: 0 20px 60px var(--shadow); }
.modal.wide { width: min(1100px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.x { background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--ink-3); }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--btn); color: var(--btn-fg); padding: 10px 14px; border-radius: 6px; max-width: 420px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--red); }

/* ---------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--surface); border-right: 1px solid var(--line); color: var(--ink-2); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { color: var(--navy); font-size: 40px; line-height: 1.08; max-width: 14ch; letter-spacing: -0.02em; }
.login-art .staff { position: absolute; left: 0; right: 0; bottom: 120px; height: 120px; }
.login-form { display: grid; place-items: center; padding: 40px 20px; }
.login-form form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }
.qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 6px; }
.codes { font-family: ui-monospace, monospace; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; background: var(--paper); padding: 10px 14px; border-radius: 6px; }
.pick { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; cursor: pointer; transition: border-color .12s, background .12s; }
.pick:hover { border-color: color-mix(in srgb, var(--sky) 40%, var(--line)); }
.pick:has(input:checked) { border-color: var(--sky-deep); background: var(--sky-wash); }
.pick input { margin-top: 3px; flex: none; }

/* ---------- role matrix */
.perm-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.perm-group h3 { margin: 0 0 6px; display: flex; justify-content: space-between; }
.perm { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; font-size: 13px; cursor: pointer; }
.perm code { color: var(--ink-3); font-size: 11.5px; }
.sod { background: var(--red-wash); color: var(--red-ink); border-radius: 6px; padding: 8px 12px; font-size: 13px; margin: 8px 0; }

/* ---------- document viewer (AFS / reports) */
.doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 56px; max-width: 920px; margin: 0 auto; }
.doc h1.sec { font-size: 20px; margin: 36px 0 2px; padding-top: 24px; border-top: 1px solid var(--line); }
.doc h2 { color: var(--sky-deep); margin-top: 20px; }
.doc .cover { text-align: center; padding: 60px 0 40px; }
.doc .cover h1 { font-size: 30px; }
.doc p { max-width: 75ch; white-space: pre-wrap; }
.doc table.t { margin: 6px 0 14px; }
.doc .kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; }
.doc .kv b { font-weight: 600; }

/* charts */
.chart { width: 100%; height: 190px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 110px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }
.bar-row .b { height: 10px; background: var(--sky); border-radius: 3px; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.msg { padding: 10px 14px; border-radius: 8px; max-width: 80ch; white-space: pre-wrap; }
.msg.me { background: var(--sky-wash); align-self: flex-end; }
.msg.ai { background: var(--paper); border: 1px solid var(--line); }
.flag { font-size: 12px; padding: 2px 6px; border-radius: 4px; margin: 2px 2px 0 0; display: inline-block; }
.flag.block { background: var(--red-wash); color: var(--red-ink); } .flag.warn { background: var(--amber-wash); color: var(--amber-ink); }
.check { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- v2: brand, strips, metrics, editors */
.brand-bar { height: 3px; background: var(--brand-grad); }
.login-logo { width: min(340px, 80%); }
/* password field with Show/Hide, forgot-password link */
div.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.pw { position: relative; display: flex; }
.pw input { flex: 1; padding-right: 62px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--sky-deep); font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.pw-toggle:hover { text-decoration: underline; }
.pw-toggle:focus-visible { outline: 2px solid var(--sky-deep); outline-offset: 1px; }
.forgot-link { align-self: flex-end; margin-top: -8px; font-size: 12.5px; }
.form-error { color: var(--red); font-size: 13px; margin: 0; }
.login-art .tag { color: var(--ink-3); font-size: 12.5px; }
.ai-fab { display: inline-flex; gap: 6px; align-items: center; background: var(--sky-wash); color: var(--sky-deep); border: 1px solid transparent; border-radius: 16px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.ai-fab:hover { border-color: var(--sky); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 40px var(--shadow); z-index: 40; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.drawer-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 14px; padding: 3px 11px; font: inherit; font-size: 12.5px; cursor: pointer; }
.chip.on { background: var(--navy); border-color: var(--navy); color: var(--btn-fg); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--sky-wash); color: var(--sky-deep); font-weight: 600; }
.seg.sm button { padding: 4px 9px; font-size: 12px; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scroll-snap-type: x proximity; }
.strip > * { scroll-snap-align: start; min-width: 0; }
.strip-label { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 8px; }
.strip-label h2 { margin: 0; font-size: 14px; }
.task { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: 10px 12px; color: var(--ink); text-decoration: none; }
.task:hover { text-decoration: none; border-color: var(--sky); }
.task.red { border-left-color: var(--red); } .task.green { border-left-color: var(--green); }
.task b { font-size: 20px; line-height: 1; min-width: 26px; }
.task small { display: block; color: var(--ink-3); }
.econ { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.econ:hover { border-color: var(--sky); }
.econ .v { font-size: 16px; font-weight: 700; color: var(--navy); }
.econ .l { font-size: 12px; color: var(--ink-2); }
.econ .t { font-size: 11.5px; color: var(--ink-3); }
.trend-up { color: var(--red); } .trend-down { color: var(--green); } .trend-flat { color: var(--ink-3); }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.metric { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px 8px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric:hover { border-color: var(--sky); }
.metric .l { font-size: 12px; color: var(--ink-2); padding-right: 18px; }
.metric .v { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.metric .d { font-size: 11.5px; }
.metric .d.good { color: var(--green); } .metric .d.bad { color: var(--red); } .metric .d.neutral { color: var(--ink-3); }
.metric .pin { position: absolute; top: 6px; right: 6px; border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 14px; padding: 2px; }
.metric .pin.on { color: var(--amber); }
.metric svg { width: 100%; height: 28px; margin-top: 4px; }
.cat-title { font-size: 12.5px; color: var(--ink-3); margin: 14px 0 6px; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; display: flex; flex-direction: column; gap: 10px; }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--sky); border: 2px solid var(--surface); }
.tl-item.approval::before { background: var(--green); } .tl-item.ledger::before { background: var(--navy); }
.tl-item small { color: var(--ink-3); }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 18px; }
.meta-grid div { min-width: 0; } .meta-grid small { display: block; color: var(--ink-3); } .meta-grid b { word-break: break-all; }
.uid { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--head-2); padding: 1px 6px; border-radius: 4px; }
.prompt-box { display: flex; gap: 8px; }
.prompt-box input { flex: 1; font-size: 14px; padding: 10px 12px; }
.tree { font-size: 13px; }
.tree details { margin-left: 12px; }
.tree summary { cursor: pointer; padding: 2px 0; }
.tree a { display: block; padding: 2px 0 2px 14px; }
.editor { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }
.sec-list { position: sticky; top: 70px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.sec-list label { display: flex; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.sec-list label:hover { background: var(--hover); }
.sec-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.sec-card.off { opacity: .55; }
.sec-card textarea { width: 100%; min-height: 110px; font-size: 14px; line-height: 1.55; }
.ai-tools { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.ai-tools button { font-size: 12px; padding: 3px 9px; border-radius: 12px; border: 1px solid var(--line); background: var(--sky-wash); color: var(--sky-deep); cursor: pointer; font-family: inherit; }
.ai-tools button:hover { border-color: var(--sky); }
.editable { position: relative; border-radius: 4px; }
.editable:hover { background: var(--hover); outline: 1px dashed var(--line); }
.editable .edit-btn { display: none; position: absolute; top: 0; right: 0; }
.editable:hover .edit-btn { display: inline-block; }
.edited-tag { font-size: 11px; color: var(--sky-deep); margin-left: 6px; }
.sig-pad { border: 1px dashed var(--ink-3); border-radius: 6px; background: var(--field); touch-action: none; width: 100%; max-width: 520px; height: 160px; }
.sig-img { max-height: 60px; max-width: 220px; background: #fff; border-radius: 4px; padding: 2px; }
.sigs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 10px; }
.sigs .s { border-top: 1px solid var(--ink); padding-top: 4px; font-size: 12.5px; }
.policy { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.policy small { color: var(--ink-3); }
.rec { font-size: 11px; color: var(--green-ink); background: var(--green-wash); border-radius: 8px; padding: 0 6px; margin-left: 6px; }
.callout { background: var(--sky-wash); border-left: 3px solid var(--sky); padding: 10px 14px; border-radius: 6px; margin: 8px 0 12px; line-height: 1.55; }
hr.pb { border: 0; border-top: 1px dashed var(--line); margin: 22px 0; }
.editable[data-key] { cursor: text; }
.doc-view { max-width: 860px; margin: 0 auto; }
.doc-view h1.sec { color: var(--navy); border-bottom: 2px solid var(--sky); padding-bottom: 4px; }
.pol-list { display: grid; gap: 6px; max-height: 52vh; overflow: auto; }
.pol-list label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.pol-list label.on { border-color: var(--sky); background: var(--sky-wash); }
.pol-list small { display: block; color: var(--ink-3); }
.folder { padding: 4px 8px; border-radius: 6px; cursor: pointer; display: block; }
.folder:hover, .folder.on { background: var(--sky-wash); }
/* Management report pack — designed on-screen view */
.pack { max-width: 920px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 8px 30px rgba(13,34,64,.08); }
.pack-cover { background: linear-gradient(135deg, #0B2E5C 0%, #0B5F7E 55%, #13919A 100%); color: #fff; padding: 48px 56px 40px; position: relative; }
.pack-cover::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: linear-gradient(90deg, #13919A, #3CC85A); }
.pack-cover img { height: 40px; filter: brightness(0) invert(1); opacity: .95; }
.pack-cover h1 { color: #fff; font-size: 32px; margin: 30px 0 6px; letter-spacing: -.01em; }
.pack-cover p { color: rgba(255,255,255,.85); margin: 0; }
.pack-cover .meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 26px; font-size: 12.5px; color: rgba(255,255,255,.8); }
.pack-body { padding: 26px 56px 48px; }
.pack-body h1.sec { font-size: 20px; color: var(--navy); margin: 34px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--sky); }
.pack-body p { max-width: 75ch; white-space: pre-wrap; line-height: 1.6; }
.pack-body .kv { display: grid; grid-template-columns: 1fr; gap: 4px; columns: 2; }
@media (max-width: 700px) { .pack-cover, .pack-body { padding-left: 20px; padding-right: 20px; } }
.sec-list .mv { margin-left: auto; display: flex; gap: 2px; }
.sec-list .mv button { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 0 3px; font-size: 12px; }
.sec-card .sec-data { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; max-height: 340px; overflow: auto; }
.sec-card .sec-data h1.sec { display: none; }
.dirty { color: var(--amber-ink, #9A6700); font-size: 12px; }
.st.verified, .st.issued, .st.confirmed, .st.delivered, .st.invoiced, .st.received, .st.billed, .st.converted, .st.accepted, .st.complete { background: var(--green-wash); color: var(--green-ink); }
.st.draft, .st.requested, .st.counting, .st.sent, .st.part_received, .st.part_delivered, .st.submitted, .st.pending_review, .st.disposal_pending { background: var(--amber-wash); color: var(--amber-ink); }
.st.terminated, .st.disposed, .st.written_off, .st.declined, .st.expired, .st.cancelled, .st.incomplete { background: var(--red-wash); color: var(--red-ink); }
/* HR & operations */
.profile-head { display: flex; gap: 16px; align-items: center; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--brand-grad, var(--sky)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 19px; flex: none; }
.idtag { font-family: ui-monospace, Menlo, monospace; font-weight: 700; color: var(--navy); background: var(--sky-wash); border-radius: 6px; padding: 2px 8px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px; }
.kv-grid small { display: block; color: var(--ink-3); }
.kv-grid b { font-weight: 600; word-break: break-word; }
.letter-preview { background: #fff; color: #1a1a1a; border: 1px solid var(--line); border-radius: 8px; padding: 22px 26px; font-size: 13.5px; line-height: 1.6; max-height: 58vh; overflow: auto; }
.letter-preview .addr { border: 1px solid #c9d3df; background: #f4f7fb; padding: 8px 12px; border-radius: 4px; display: inline-block; font-weight: 600; white-space: pre-line; }
.letter-preview .subj { font-weight: 700; text-decoration: underline; margin: 10px 0; }
.radio-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.radio-cards label { border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; display: block; }
.radio-cards label.on { border-color: var(--sky); background: var(--sky-wash); }
.radio-cards small { display: block; color: var(--ink-3); }
@media (max-width: 700px) { .radio-cards { grid-template-columns: 1fr; } }
.bar-mini { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; min-width: 70px; }
.bar-mini i { display: block; height: 100%; background: var(--sky); }
.bar-mini i.over { background: var(--green); }
.lines-grid input { width: 100%; }
.num-in { width: 90px; text-align: right; }

/* ===================================================================== ERP upgrade: header, menus, badges */
.top { gap: 12px; }
.top-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title .brand-mark.sm { width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; }
.icon-btn { display: inline-grid; place-items: center; min-width: 40px; height: 40px; border: 0; background: transparent; color: var(--ink); border-radius: 8px; cursor: pointer; position: relative; font: inherit; font-size: 20px; }
.icon-btn:hover { background: var(--hover); }
.search-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink-2); cursor: pointer; font: inherit; font-size: 13px; }
.search-btn:hover { border-color: var(--sky); }
kbd { font: 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--head); color: var(--ink-2); }
.badge { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.badge[hidden] { display: none; }
.avatar-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--ink); padding: 2px 4px; border-radius: 20px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; position: relative; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 40px var(--shadow); z-index: 40; padding: 6px 0; }
.dd-menu a, .dd-menu .dd-note { display: block; padding: 9px 14px; color: var(--ink); font-size: 13.5px; }
.dd-menu a:hover { background: var(--hover); text-decoration: none; }
.dd-menu .dd-note { color: var(--green-ink); font-size: 12.5px; }
.dd-head { padding: 8px 14px 10px; border-bottom: 1px solid var(--line-2); }
.dd-head small { display: block; color: var(--ink-3); }
.notif-menu { width: min(380px, 92vw); max-height: 70vh; overflow-y: auto; }
.notif { border-bottom: 1px solid var(--line-2); }
.notif small { display: block; color: var(--ink-2); margin-top: 2px; }
.notif.unread { background: var(--sky-wash); }
.notif.unread b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sky); margin-right: 6px; vertical-align: 1px; }
.dd-foot { text-align: center; font-weight: 600; color: var(--sky-deep) !important; }
.small-print { font-size: 12px; line-height: 1.45; }
.only-mobile { display: none !important; }
.tabbar { display: none; }
.nav-scrim { display: none; }

/* presence dots */
.pres { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); border: 2px solid var(--surface); }
.avatar .pres { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; }
.pres.online { background: var(--pulse, #3CC85A); } .pres.idle { background: var(--amber); } .pres.away { background: #8aa0b4; } .pres.offline { background: #c4ccd3; }

/* ===================================================================== messaging widget */
.chat-fab { position: fixed; right: 22px; bottom: 22px; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand-grad); color: #fff; box-shadow: 0 10px 28px rgba(11, 46, 92, .35); cursor: pointer; z-index: 45; display: grid; place-items: center; }
.chat-fab:hover { transform: translateY(-1px); }
.chat-fab .badge { top: -2px; right: -2px; }
body.chat-open .chat-fab { display: none; }
.chat-panel { position: fixed; right: 22px; bottom: 22px; width: 380px; height: min(620px, calc(100vh - 44px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px var(--shadow); z-index: 46; display: flex; flex-direction: column; overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); background: var(--head); min-height: 54px; }
.chat-head .conv-main { min-width: 0; }
.chat-head .conv-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .conv-main small { color: var(--ink-2); font-size: 12px; }
.chat-search { padding: 10px 12px; }
.chat-search input { width: 100%; }
.chat-list { flex: 1; overflow-y: auto; }
.conv { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.conv:hover, .conv.picked { background: var(--sky-wash); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-main small { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.conv.unread .conv-main b { font-weight: 800; }
.conv.unread .conv-main small { color: var(--ink); }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-meta small { color: var(--ink-3); font-size: 11.5px; }
.conv-meta .badge { position: static; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--paper); }
.day-sep { text-align: center; margin: 8px 0; }
.day-sep span { font-size: 11.5px; color: var(--ink-3); background: var(--surface); border: 1px solid var(--line-2); padding: 2px 10px; border-radius: 10px; }
.sys { text-align: center; font-size: 12px; color: var(--ink-3); }
.msg { max-width: 82%; display: flex; flex-direction: column; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 11.5px; color: var(--sky-deep); margin: 0 0 2px 4px; font-weight: 600; }
.bubble { padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; font-size: 14px; }
.msg.me .bubble { background: var(--sky); color: #fff; border-color: transparent; border-bottom-right-radius: 4px; }
.msg.them .bubble { border-bottom-left-radius: 4px; }
.msg.me .bubble a { color: #fff; text-decoration: underline; }
.msg.me .bubble .uid { background: rgba(255, 255, 255, .2); color: #fff; }
.bubble .at { color: var(--sky-deep); }
.msg.me .bubble .at { color: #fff; }
.bubble .file { display: block; margin-top: 4px; }
.msg .meta { font-size: 11px; color: var(--ink-3); margin: 2px 4px 0; }
.msg .meta a { color: var(--ink-3); }
.receipt { color: var(--sky-deep); font-weight: 600; }
.chat-compose { display: flex; gap: 6px; align-items: flex-end; padding: 8px; border-top: 1px solid var(--line); position: relative; background: var(--surface); }
.chat-compose textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 9px 10px; font: inherit; font-size: 14px; border-radius: 10px; }
.chat-compose .attach { font-size: 18px; }
.mention-list { position: absolute; bottom: 100%; left: 8px; right: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px var(--shadow); overflow: hidden; }
.mention-list button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 12px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.mention-list button:hover { background: var(--sky-wash); }
.chat-foot { padding: 10px 12px; border-top: 1px solid var(--line); }

/* ===================================================================== command palette */
.palette-scrim { place-items: start center; padding-top: 12vh; }
.palette { width: min(640px, 100%); background: var(--surface); border-radius: 12px; box-shadow: 0 24px 70px var(--shadow); overflow: hidden; border: 1px solid var(--line); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 18px; color: var(--ink-3); }
.palette-input input { flex: 1; border: 0; outline: none; font: inherit; font-size: 16px; background: transparent; color: var(--ink); padding: 4px 0; }
.palette-results { max-height: 52vh; overflow-y: auto; padding: 6px 0; }
.pg { padding: 8px 16px 4px; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.pi { display: flex; flex-direction: column; width: 100%; padding: 8px 16px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.pi small { color: var(--ink-2); font-size: 12.5px; }
.pi.on, .pi:hover { background: var(--sky-wash); }
.palette-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); }

/* ===================================================================== time control */
.timeline-bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; background: var(--head-2); position: relative; }
.timeline-bar span { height: 100%; }
.tl-active { background: var(--green); } .tl-idle { background: var(--amber); } .tl-hidden { background: #8aa0b4; } .tl-hibernation { background: repeating-linear-gradient(45deg, #5b6b7b, #5b6b7b 4px, #7d8b95 4px, #7d8b95 8px); }
.timeline-hours { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.legend-dots { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.legend-dots i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 140px; }
.week-bars .wb { display: flex; flex-direction: column-reverse; height: 100%; border-radius: 4px; overflow: hidden; background: var(--head-2); }
.week-bars small { text-align: center; display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 4px; }
.flag { font-size: 11px; padding: 1px 7px; border-radius: 9px; margin-right: 4px; background: var(--amber-wash); color: var(--amber-ink); white-space: nowrap; }
.flag.absent, .flag.long_hibernation { background: var(--red-wash); color: var(--red-ink); }
.notice { background: var(--sky-wash); border-left: 3px solid var(--sky); padding: 10px 14px; border-radius: 6px; font-size: 13px; color: var(--ink); }

/* ===================================================================== close checklist / budgets */
.progress { height: 8px; background: var(--head-2); border-radius: 5px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green); }
.task-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.task-row .ok { color: var(--green); font-size: 18px; } .task-row .no { color: var(--ink-3); font-size: 18px; } .task-row .na { color: var(--ink-3); }
.task-row small { color: var(--ink-2); display: block; }
.fav { color: var(--green-ink); } .unfav { color: var(--red-ink); }
.close-task { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.close-task:last-child { border-bottom: 0; }
.ct-mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--head-2); color: var(--ink-3); }
.close-task.done .ct-mark { background: var(--green-wash); color: var(--green-ink); }
.close-task.n_a .ct-mark { background: var(--line-2); }
.close-task.n_a .ct-body b { color: var(--ink-3); text-decoration: line-through; }
.ct-body small { line-height: 1.5; }
.ct-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--sky-wash); color: var(--ink-2); vertical-align: 1px; }
.tag.unfav { background: var(--red-wash); color: var(--red-ink); }
.notif-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none; }
.notif-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; }
.notif-row.unread .dot { background: var(--sky); }
.notif-row.unread b { color: var(--ink); }
.notif-row small { color: var(--ink-3); }
.scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 12px; max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.scope-grid label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; }
.scope-grid h4 { grid-column: 1 / -1; margin: 6px 0 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.ooo { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--amber-wash); color: var(--amber-ink); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.acting { font-size: 11.5px; color: var(--amber-ink); display: block; }
@media (max-width: 640px) {
  .close-task { grid-template-columns: 28px 1fr; }
  .ct-act { grid-column: 2; justify-content: flex-start; }
}
.secret-box { font: 13px ui-monospace, Menlo, monospace; background: var(--head-2); padding: 10px 12px; border-radius: 6px; word-break: break-all; user-select: all; }

/* ===================================================================== phones & tablets */
@media (max-width: 900px) {
  .only-mobile { display: initial !important; }
  .icon-btn.only-mobile { display: inline-grid !important; }
  .tabbar.only-mobile { display: flex !important; }
  .only-desktop { display: none !important; }
  .shell { display: block; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%; z-index: 60; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  body.nav-open .side { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 55; }
  .nav a { padding: 11px 12px; font-size: 15px; }
  .top { padding: 8px 10px; gap: 6px; position: sticky; top: 0; }
  .top .who { gap: 4px; }
  .page { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 21px; }
  .page-head > .row { width: 100%; }
  .page-head > .row .btn { flex: 1 1 auto; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 44; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; color: var(--ink-2); font-size: 11px; position: relative; }
  .tabbar a.on { color: var(--sky-deep); }
  .tabbar a:hover { text-decoration: none; }
  .tb-badge { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  .tb-badge[hidden] { display: none; }
  .chat-fab { display: none; }
  .chat-panel { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; z-index: 70; padding-bottom: env(safe-area-inset-bottom); }
  .scrim { z-index: 75; } #toasts { z-index: 80; bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
  .dd-menu { position: fixed; left: 8px; right: 8px; top: 56px; min-width: 0; width: auto; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs button { white-space: nowrap; }
  .seg { overflow-x: auto; max-width: 100%; }
  .strip { grid-auto-columns: minmax(220px, 80%); }
  .ai-fab { padding: 6px 10px; }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
  .btn { min-height: 40px; }
}
@media (max-width: 640px) {
  .scrim { padding: 0; place-items: stretch; }
  .modal, .modal.wide { width: 100%; min-height: 100%; border-radius: 0; padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); }
  .modal-head { position: sticky; top: -14px; background: var(--surface); padding: 10px 0; z-index: 2; }
  .form-grid { grid-template-columns: 1fr; }
  .palette-scrim { padding: 0; }
  .palette { min-height: 100%; border-radius: 0; }
  .palette-results { max-height: none; }
  /* list tables become cards: one row = one card, each cell "Label ··· value" */
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; padding: 6px 12px; background: var(--surface); }
  table.t.cards tr:hover td { background: transparent; }
  table.t.cards td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 14px; text-align: right; }
  table.t.cards td::before { content: attr(data-label); color: var(--ink-3); font-size: 12.5px; text-align: left; flex: none; max-width: 45%; }
  table.t.cards td[data-label=""]::before { content: none; }
  table.t.cards td[data-label=""] { justify-content: flex-end; }
  table.t.cards td:first-child { font-weight: 600; }
  .panel.flush table.t.cards { padding: 8px; }
  .tbl-wrap:has(> table.cards) { overflow: visible; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .kpi .v { font-size: 19px; }
}
.st.revoked, .st.failed, .st.expired { background: var(--red-wash); color: var(--red-ink); }
.st.paused, .st.scheduled { background: var(--amber-wash); color: var(--amber-ink); }
.st.current { background: var(--green-wash); color: var(--green-ink); }

/* ===================================================================== financial statements & daily TB */
.fs-tabs { margin-bottom: 12px; overflow-x: auto; flex-wrap: nowrap; }
.fs-tabs button { white-space: nowrap; }
.tab-badge { display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 5px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10.5px; line-height: 16px; }
.fs-bar { display: flex; flex-direction: column; gap: 10px; }
.fs-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.fs-row .f { margin: 0; flex-direction: row; align-items: center; gap: 6px; }
.fs-row select { max-width: 320px; }
.fs-lab { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.fs-var { gap: 6px; font-size: 13px; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.fs-status { margin-top: 10px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px solid var(--line-2); padding-top: 8px; }
.st.final { background: var(--green-wash); color: var(--green-ink); }
.st.provisional { background: var(--amber-wash); color: var(--amber-ink); }
.st.live { background: var(--sky-wash); color: var(--sky-deep); }
.fs-kpis { margin-bottom: 14px; }
.fs-kpis .kpi small { display: block; margin-top: 2px; }
.kpi.warnk .v { color: var(--amber-ink); }
.fs-title { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 14px 16px 6px; }
.fs-title h2 { margin: 0; }
.fs-wrap { overflow-x: auto; }
.fs-table th { white-space: nowrap; }
.fs-table th.cmp, .fs-table th.prior_year, .fs-table th.prior_period, .fs-table th.budget { color: var(--ink-3); }
.fs-table td:first-child, .fs-table th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 220px; }
.fs-table tr.hdr td:first-child { background: var(--head-2); }
.fs-table tr.ind td:first-child { padding-left: 26px; }
.fs-table tr.total.sub td { border-top: 1px solid var(--line); }
.fs-table tr.drillable { cursor: pointer; }
.fs-table tr.drillable:hover td { background: var(--sky-wash); }
.fs-table tr.drillable:focus-visible { outline: 2px solid var(--sky); outline-offset: -2px; }
.fs-table .caret { display: inline-block; width: 14px; color: var(--ink-3); transition: transform .15s; }
.fs-table tr[aria-expanded="true"] .caret { transform: rotate(90deg); }
.fs-table tr.drill td { background: var(--paper, var(--bg)); font-size: 12.5px; color: var(--ink-2); }
.fs-table tr.drill td:first-child { padding-left: 32px; background: var(--paper, var(--bg)); }
.fs-table tr.restated td { background: var(--amber-wash); }
.fs-more { margin-top: 14px; }
.fs-more summary { cursor: pointer; color: var(--sky-deep); font-weight: 600; margin-bottom: 8px; }
.chart.wf { height: 200px; }
.legend.wrap { flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.fs-stack { display: grid; gap: 16px; }
.fs-bar-stack { display: flex; height: 22px; border-radius: 5px; overflow: hidden; margin-top: 6px; background: var(--head-2); }
.fs-bar-stack i { display: block; height: 100%; }
.check { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.check:last-of-type { border-bottom: 0; }
.ck-mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.check.ok .ck-mark { background: var(--green-wash); color: var(--green-ink); }
.check.error .ck-mark { background: var(--red-wash); color: var(--red-ink); }
.check.warn .ck-mark { background: var(--amber-wash); color: var(--amber-ink); }
.check.info .ck-mark { background: var(--sky-wash); color: var(--sky-deep); }
.check small { color: var(--ink-2); }
.notice.good { background: var(--green-wash); border-left-color: var(--green); margin-bottom: 12px; }
.notice.warn { background: var(--amber-wash); border-left-color: var(--amber); margin-bottom: 12px; }
.notice.bad { background: var(--red-wash); border-left-color: var(--red); margin-bottom: 12px; }
.notice details { margin-top: 8px; }
.notice summary { cursor: pointer; font-weight: 600; }
.run-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; align-items: center; }
.sched-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.sched { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.sched.off { opacity: .7; }
.grid.g5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.tb-sparks { margin-bottom: 14px; }
.tbk svg { width: 100%; height: 28px; margin-top: 4px; display: block; }
.tb-days tr[data-day] { cursor: pointer; }
.tb-days tr.restated td { background: var(--amber-wash); }
.tb-days tr.live td:first-child { box-shadow: inset 3px 0 0 var(--sky); }
@media (max-width: 900px) {
  .grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fs-table td:first-child, .fs-table th:first-child { min-width: 170px; max-width: 200px; white-space: normal; }
}
@media (max-width: 640px) {
  .fs-row select, .fs-row .seg { max-width: 100%; }
  .fs-row .f { width: 100%; }
  .fs-lab { width: 100%; }
  .fs-table { font-size: 12.5px; }
  .fs-table td:first-child, .fs-table th:first-child { min-width: 150px; max-width: 160px; }
}
.tab-badge[hidden] { display: none; }
.fs-opts > summary { list-style: none; cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 13px; }
.fs-opts > summary::-webkit-details-marker { display: none; }
.fs-opts > summary::after { content: "▾"; margin-left: auto; color: var(--ink-3); }
.fs-opts[open] > summary::after { content: "▴"; }
.fs-opts > summary .btn { pointer-events: none; }
.fs-opts[open] > summary { margin-bottom: 10px; }
@media (min-width: 641px) { .fs-opts > summary { display: none; } }

/* ===================================================================== loan management */
.kpi.sm { padding: 10px 12px; }
.kpi.sm .v { font-size: 18px; }
.kpi.sm .l { font-size: 11.5px; }

/* ---------- billing & packages */
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; }
.chk.sm { font-size: 12.5px; display: flex; padding: 2px 0; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 12px; }
.feat { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.feat.base { background: var(--sky-wash); border-color: color-mix(in srgb, var(--sky) 30%, var(--line)); }
.feat input[type=checkbox] { width: 16px; height: 16px; flex: none; }
.feat b { font-size: 13.5px; }
.feat small { display: block; margin-top: 1px; }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.panel.mode { border: 1px solid var(--line); }
.panel.mode.on { border-color: var(--sky); box-shadow: inset 0 0 0 1px var(--sky); }
.mode-big { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 2px; }
.mode-big small { font-size: 14px; font-weight: 600; color: var(--ink-3); }
.panel.quote { display: flex; align-items: center; gap: 24px; margin-top: 16px; flex-wrap: wrap; }
.quote .q-pts { font-size: 20px; font-weight: 700; }
.quote .q-amt { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 8px; }
.quote .q-amt .was { font-size: 15px; font-weight: 500; color: var(--ink-3); text-decoration: line-through; }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; max-height: 50vh; overflow: auto; margin-top: 8px; }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.perm-group legend { font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 0 4px; }

/* ---------- AI human-intervention acknowledgement */
.ai-ack { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }

/* ---------- Live Activity */
.la-strip { display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; border-radius: 8px; padding: 9px 14px; overflow: hidden; }
:root[data-theme="dark"] .la-strip, :root:not([data-theme="light"]) .la-strip { background: #0a1a30; }
.la-live { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; color: #ff6b5e; flex: none; animation: la-blink 1.6s infinite; }
@keyframes la-blink { 50% { opacity: .35; } }
.la-ticker { flex: 1; overflow: hidden; white-space: nowrap; }
.la-track { display: inline-block; white-space: nowrap; will-change: transform; animation: la-scroll 40s linear infinite; }
.la-head { display: inline-block; padding: 0 28px; font-size: 13px; }
.la-head::before { content: "◆"; color: var(--pulse); margin-right: 10px; font-size: 9px; vertical-align: middle; }
@keyframes la-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.la-strip:hover .la-track { animation-play-state: paused; }
.la-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 900px) { .la-grid { grid-template-columns: 1fr; } }
.la-feed { max-height: 60vh; overflow: auto; }
.la-item { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line-2); animation: la-in .4s ease; }
@keyframes la-in { from { opacity: 0; transform: translateY(-6px); background: var(--sky-wash); } }
.la-item.notable { background: linear-gradient(90deg, var(--green-wash), transparent 70%); border-radius: 6px; }
.la-ic { font-size: 18px; width: 26px; text-align: center; flex: none; }
.la-body { flex: 1; font-size: 13.5px; }
.la-obj { color: var(--sky-deep); font-weight: 600; }
.la-item time { font-size: 11.5px; flex: none; }
.pres-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line-2); }
.pres-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ink-3); }
.pres-dot.active { background: var(--green); box-shadow: 0 0 0 3px var(--green-wash); }
.pres-dot.idle { background: var(--amber); }
.pres-dot.hidden { background: var(--ink-3); }
.pres-dot.away { background: var(--line); }

/* ---------- Point of Sale */
.pos { display: grid; grid-template-columns: 1fr 360px; gap: 16px; }
@media (max-width: 860px) { .pos { grid-template-columns: 1fr; } }
.pos-search { width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; background: var(--field); color: var(--ink); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pos-tile { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; transition: transform .1s, border-color .1s; }
.pos-tile:hover { transform: translateY(-2px); border-color: var(--sky); }
.pos-tile b { font-size: 13.5px; } .pos-tile span { color: var(--sky-deep); font-weight: 700; }
.pos-cart { position: sticky; top: 80px; align-self: start; }
.pos-lines { max-height: 40vh; overflow: auto; margin: 6px 0; }
.pos-line { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.pos-line > div:first-child { flex: 1; } .pos-lt { font-weight: 700; } .pos-qty { width: 46px; padding: 2px 4px; }
.pos-rm { border: 0; background: none; color: var(--red); font-size: 18px; cursor: pointer; }
.pos-totals > div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.pos-totals .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-size: 18px; }
.pos-pay { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn.pay { padding: 14px 6px; font-weight: 700; color: #fff; border: 0; }
.btn.pay.cash { background: var(--green); } .btn.pay.card { background: var(--sky-deep); } .btn.pay.mm { background: var(--amber); }
.receipt { font-family: ui-monospace, monospace; max-width: 300px; margin: 0 auto; }
.receipt .r-line { display: flex; justify-content: space-between; padding: 2px 0; font-size: 13px; }

/* ---------- KYC / AML */
.sev-high { color: var(--red); } .sev-medium { color: var(--amber-ink); } .sev-low { color: var(--ink-2); }
tr.flagged-row { background: linear-gradient(90deg, var(--red-wash), transparent 60%); }

/* ---------- scan & import */
.drop { display: block; border: 2px dashed var(--line); border-radius: 12px; padding: 28px; text-align: center; cursor: pointer; background: var(--paper); transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--sky); background: var(--sky-wash); }
.ocr-text { white-space: pre-wrap; font-size: 12px; background: var(--paper); border: 1px solid var(--line-2); border-radius: 6px; padding: 10px; max-height: 240px; overflow: auto; }
a.feat { text-decoration: none; justify-content: space-between; }
a.feat span { color: var(--sky-deep); font-weight: 600; }

/* Detailed GL — grouped by account with running balances */
.gl-detail .gl-acct td { background: var(--side-on, #E2F3F2); color: var(--ink); padding-top: 9px; padding-bottom: 7px; border-top: 1.5px solid var(--line); }
.gl-detail .gl-sub td { border-top: 1px solid var(--line); background: #F6FAFB; }
.gl-detail .gl-rev td { color: var(--muted); text-decoration: line-through; opacity: .75; }
.gl-detail .gl-desc { max-width: 260px; white-space: normal; }
.gl-detail tfoot .total td { border-top: 2px solid var(--ink); font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gl-detail .gl-sub td { background: rgba(255,255,255,.03); } }

/* Segment plan cards (Billing & package) */
.plan-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; background: var(--surface); }
.plan-card.pop { border-color: var(--sky); box-shadow: 0 16px 40px -28px rgba(11,46,92,.45); }
.plan-card.on { outline: 2px solid var(--teal, #134E4A); }
.plan-badge { position: absolute; top: -10px; left: 16px; background: var(--brand-grad); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.plan-seg { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.plan-card h3 { font-size: 15px; margin: 2px 0 6px; letter-spacing: -.01em; }
.plan-price { font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); line-height: 1; }
.plan-price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.plan-meta { font-size: 12px; margin: 4px 0 8px; }
.plan-tag { font-size: 12.5px; color: var(--ink-2, var(--muted)); margin: 0 0 10px; min-height: 34px; }
.plan-hl { margin: 0 0 14px; padding: 0; list-style: none; font-size: 12.5px; color: var(--ink-2, var(--muted)); flex: 1; }
.plan-hl li { padding: 3px 0 3px 18px; position: relative; }
.plan-hl li::before { content: "✓"; position: absolute; left: 0; top: 3px; color: var(--green); font-weight: 800; font-size: 11px; }
.plan-card .btn { width: 100%; justify-content: center; }
.addons { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
