/* Arkib Fail Cukai: review interface for LHDN archive digitisation.
   Fonts are self-hosted (no external requests on LHDN's network). */

/* Two families only: Public Sans (a typeface made for government services)
   for everything, IBM Plex Mono for literal readings and barcodes. */
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
    --board: #F4F5F3;      /* page background */
    --sheet: #FFFFFF;      /* panels */
    --sheet-2: #F7F8F6;    /* quiet fills, table headers */
    --ink: #27313B;        /* text: softened, not black */
    --ink-2: #5F6B76;      /* secondary text */
    --rule: #E1E4E0;       /* borders */
    --stamp: #33508A;      /* actions, "read" */
    --stamp-soft: #EEF2F8;
    --officer: #B0362C;    /* uncertain, failed */
    --officer-soft: #FBEEEC;
    --ok: #2F6B45;         /* verified */
    --ok-soft: #EBF4EE;
    --manila: #EBE0BF;     /* folder tabs only */
    --manila-ink: #5A4716;
    --withheld: #8A939B;
    --focus: #33508A;
    --logo-plate: transparent;
    --shadow: 0 1px 2px rgb(16 24 40 / .04), 0 1px 3px rgb(16 24 40 / .04);

    --font-ui: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-raw: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
    --radius-panel: 8px;
    --radius-control: 6px;
}

/* Day is the default whatever the OS says; night is chosen with the toggle. */
:root[data-theme="dark"] {
    --board: #14191F; --sheet: #1B2129; --sheet-2: #20272F; --ink: #D9DEE3; --ink-2: #98A3AE;
    --rule: #2C353F; --stamp: #9DB3E3; --stamp-soft: #222C3B; --officer: #EE9A90; --officer-soft: #33221F;
    --ok: #8CC9A0; --ok-soft: #1C2D23; --manila: #4A4230; --manila-ink: #EBDDB4; --withheld: #8A949E;
    --focus: #9DB3E3; --logo-plate: #F4F5F3; --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--board); color: var(--ink);
    font-family: var(--font-ui); font-size: .9375rem; line-height: 1.55; font-weight: 400;
    font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: var(--stamp); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.0625rem; }
h3 { font-size: .9375rem; }
b, strong { font-weight: 600; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.raw { font-family: var(--font-raw); font-size: .8125rem; color: var(--ink-2); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Layout: left sidebar on wide screens, drawer + slim top bar on small ones */
:root { --sidebar-w: 15.5rem; --bar-h: 4rem; --foot-h: 2.5rem; } /* sidebar head and top bar share one height, so their rules line up */
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { height: 32px; width: auto; background: var(--logo-plate); border-radius: 4px; padding: 2px; flex: none; }
.brand-name { font-weight: 600; font-size: .9375rem; line-height: 1.2; }
.brand-name span { display: block; font-weight: 400; font-size: .75rem; line-height: 1.25; color: var(--ink-2); }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40; display: flex; flex-direction: column;
    background: var(--sheet); border-right: 1px solid var(--rule); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; height: var(--bar-h); box-sizing: border-box; flex: none; padding: 0 1rem; border-bottom: 1px solid var(--rule); }
.sidebar-head .brand { flex: 1; }
.info { position: relative; display: inline-flex; flex: none; }
.info-btn { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; padding: 0; border: 0; border-radius: 50%;
    background: none; color: var(--ink-2); cursor: pointer; }
.info-btn .nav-icon { width: 1.05rem; height: 1.05rem; }
.info-btn:hover, .info-btn[aria-expanded="true"] { background: var(--sheet-2); color: var(--ink); }
.info-tip { position: absolute; top: calc(100% + .4rem); right: -.25rem; z-index: 50; width: 13.5rem; padding: .55rem .7rem;
    background: var(--ink); color: var(--sheet); border-radius: var(--radius-control); font-size: .8125rem; line-height: 1.4;
    box-shadow: 0 6px 18px rgb(16 24 40 / .18); }
.info-tip[hidden] { display: none; }
.info-tip-wide { width: 20rem; display: grid; gap: .45rem; padding: .75rem .85rem; }
.info-tip-wide strong { font-weight: 600; }
.info-audit .info-btn { width: 2rem; height: 2rem; }
/* An ⓘ at the right end of a sidebar item (Access log). The tip floats beside the sidebar (placed by theme.js). */
.sidebar-nav li { position: relative; }
.sidebar-nav li:has(.nav-info) > a { padding-right: 2.4rem; }
.nav-info { position: absolute; top: 0; bottom: 0; right: .35rem; display: flex; align-items: center; }
.nav-info .info-btn { width: 1.75rem; height: 1.75rem; }
.info-tip-float { position: fixed; right: auto; z-index: 90; width: 20rem; max-width: calc(100vw - 1.5rem); }
.sidebar-close { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .6rem; }
/* Same height as the page footer, so the version and the copyright share one row. */
.sidebar-foot { flex: none; display: flex; align-items: center; height: var(--foot-h); box-sizing: border-box; padding: 0 .6rem; border-top: 1px solid var(--rule); }
.version-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%; padding: .3rem .6rem; border: 0;
    border-radius: var(--radius-control); background: none; color: var(--ink-2); font: inherit; text-align: left; cursor: pointer; }
.version-btn:hover { background: var(--sheet-2); color: var(--ink); }
.version-num { display: flex; align-items: center; gap: .4rem; font-family: var(--font-raw); font-size: .6875rem; }
.version-new { font-family: var(--font-ui); font-size: .625rem; font-weight: 600; padding: .05rem .35rem; border-radius: 999px; background: var(--stamp); color: var(--sheet); }
.version-new[hidden] { display: none; }
.copyright { margin: .35rem 0 0; padding: 0 .6rem; font-size: .6875rem; color: var(--ink-2); text-align: left; }
.copyright a { color: inherit; text-decoration: none; }
.copyright a:hover { color: var(--ink); text-decoration: underline; }
/* Bottom of the main page, centred under the content. */
/* Always at the bottom of the screen, level with the version in the sidebar; left-aligned with the page content. */
.page-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; justify-content: flex-start; padding: 0 1.25rem; height: var(--foot-h);
    box-sizing: border-box; background: color-mix(in srgb, var(--board) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--rule); }
body.has-sidebar .page-foot { left: var(--sidebar-w); }
@media (max-width: 1023px) { body.has-sidebar .page-foot { left: 0; } }
@media print { .page-foot { position: static; } }
.page-foot .copyright { margin: 0; padding: 0; }
body.has-sidebar .page > .page-foot { max-width: none; }
.version-log-foot { padding: .6rem 1.1rem; border-top: 1px solid var(--rule); }
.version-log-foot .copyright { padding: 0; margin: 0; }
.version-log { padding: 0; width: min(36rem, calc(100vw - 2rem)); max-height: min(80vh, 44rem); border: 1px solid var(--rule); border-radius: 12px;
    background: var(--sheet); color: var(--ink); box-shadow: 0 24px 60px rgb(16 24 40 / .25); }
.version-log[open] { display: flex; flex-direction: column; }
.version-log::backdrop { background: rgb(16 24 40 / .35); }
.version-log-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem .8rem; border-bottom: 1px solid var(--rule); }
.version-log-head h2 { font-size: 1.0625rem; }
.version-log-head p { margin: .15rem 0 0; font-size: .8125rem; }
.version-log-body { overflow-y: auto; padding: .4rem 1.1rem 1.1rem; }
.version-entry { padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.version-entry:last-child { border-bottom: 0; }
.version-entry h3 { display: flex; align-items: center; gap: .6rem; font-size: .875rem; margin-bottom: .5rem; }
.version-entry time { font-weight: 400; font-size: .8125rem; color: var(--ink-2); }
.version-tag { font-family: var(--font-raw); font-size: .8125rem; }
.version-entry ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.version-entry li { display: grid; grid-template-columns: 4.75rem 1fr; gap: .6rem; align-items: baseline; font-size: .8125rem; line-height: 1.45; }
.kind { justify-self: start; font-size: .6875rem; font-weight: 500; padding: .05rem .4rem; border-radius: 4px; border: 1px solid var(--rule); color: var(--ink-2); }
.kind-feat { border-color: transparent; background: var(--stamp-soft); color: var(--stamp); }
.kind-fix, .kind-security { border-color: transparent; background: var(--sheet-2); color: var(--ink); }
.kind-breaking { border-color: transparent; background: var(--officer-soft); color: var(--officer); }
.nav-group { font-size: .6875rem; font-weight: 500; color: var(--ink-2); padding: .9rem .6rem .35rem; letter-spacing: .01em; }
.nav-group:first-child { padding-top: .25rem; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.sidebar-nav a { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: var(--radius-control);
    color: var(--ink-2); text-decoration: none; font-size: .875rem; font-weight: 500; }
.sidebar-nav a:hover { background: var(--sheet-2); color: var(--ink); }
.sidebar-nav a[aria-current="page"] { background: var(--stamp-soft); color: var(--stamp); }
.nav-icon { width: 1.15rem; height: 1.15rem; flex: none; }
/* Top bar: section title left; language, theme, account right. */
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem; height: var(--bar-h); box-sizing: border-box; padding: 0 1.25rem;
    margin-left: var(--sidebar-w); background: color-mix(in srgb, var(--sheet) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.appbar-menu { display: none; }
/* Page heading on top, breadcrumb under it. */
.appbar-title { flex: 0 1 auto; display: flex; flex-direction: column; justify-content: center; gap: .1rem; min-width: 0; white-space: nowrap; }
.appbar-h1 { font-size: 1.125rem; font-weight: 600; line-height: 1.25; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.appbar-h1 .tab { font-size: .9375rem; padding: 0 .55rem; }
.appbar-crumbs ol { display: flex; align-items: center; gap: .35rem; margin: 0; padding: 0; list-style: none; font-size: .75rem; line-height: 1.3; color: var(--ink-2); overflow: hidden; }
.appbar-crumbs li + li::before { content: "›"; margin-right: .35rem; color: var(--ink-2); opacity: .6; }
.appbar-crumbs a { color: var(--ink-2); text-decoration: none; }
.appbar-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.appbar-tools { margin-left: 0; flex: none; display: flex; align-items: center; gap: .5rem; }

.user-menu { position: relative; }
.user-button { display: inline-flex; align-items: center; gap: .55rem; font: inherit; background: none; border: 1px solid transparent; border-radius: 999px;
    padding: .2rem .5rem .2rem .2rem; cursor: pointer; color: var(--ink); }
.user-button:hover, .user-button[aria-expanded="true"] { background: var(--sheet-2); border-color: var(--rule); }
.avatar { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; flex: none;
    background: var(--stamp-soft); color: var(--stamp); font-size: .6875rem; font-weight: 600; letter-spacing: .02em; }
.avatar-lg { width: 2.5rem; height: 2.5rem; font-size: .8125rem; }
.user-button-text { display: grid; text-align: left; line-height: 1.2; }
.user-name { font-size: .8125rem; font-weight: 500; }
.user-roles, .user-email { font-size: .6875rem; color: var(--ink-2); }
.chev { width: 14px; height: 14px; color: var(--ink-2); }
.user-panel { position: absolute; right: 0; top: calc(100% + .4rem); width: 16rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-panel);
    box-shadow: 0 16px 40px -16px rgb(16 24 40 / .25); padding: .9rem; display: grid; gap: .75rem; z-index: 50; }
.user-panel[hidden] { display: none; }
.user-panel-head { display: flex; gap: .65rem; align-items: center; }
.user-panel-roles { font-size: .75rem; }
.user-panel-signout { display: flex; width: 100%; align-items: center; gap: .5rem; font: inherit; font-size: .8125rem; font-weight: 500; color: var(--ink);
    background: none; border: 0; border-top: 1px solid var(--rule); padding: .65rem 0 0; cursor: pointer; }
.user-panel-signout:hover { color: var(--officer); }
.user-panel-signout .nav-icon { width: 1rem; height: 1rem; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgb(16 24 40 / .35); z-index: 65; }
.sidebar-backdrop[hidden] { display: none; }

body.has-sidebar .page { margin-left: var(--sidebar-w); max-width: none; }
body.has-sidebar .page > * { max-width: 1320px; }

@media (max-width: 1023px) {
    .appbar { margin-left: 0; padding: 0 .6rem; gap: .4rem; height: 3.5rem; }
    .appbar-crumbs, .user-button-text, .chev { display: none; }
    .appbar-h1 { font-size: 1rem; }
    .appbar-tools .theme-toggle span { display: none; }
    .appbar-tools .theme-toggle { padding: .35rem; }
    .appbar-menu, .sidebar-close { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 0; border-radius: var(--radius-control);
        background: none; color: var(--ink); cursor: pointer; }
    .appbar-menu:hover, .sidebar-close:hover { background: var(--sheet-2); }
    .sidebar { transform: translateX(-102%); box-shadow: 0 0 40px rgb(16 24 40 / .18); width: min(18rem, 86vw); visibility: hidden; z-index: 70; }
    .sidebar.is-open { transform: none; visibility: visible; }
    body.has-sidebar .page { margin-left: 0; }
    body.nav-open { overflow: hidden; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 1023px) {
    .sidebar { transition: transform .22s ease, visibility 0s linear .22s; }
    .sidebar.is-open { transition: transform .22s ease, visibility 0s; }
}
@media print { .sidebar, .appbar, .sidebar-backdrop, .user-panel { display: none !important; } body.has-sidebar .page { margin-left: 0; } }

select { font: inherit; width: 100%; padding: .5rem .625rem; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--sheet); color: var(--ink); }
input[type="date"] { font: inherit; width: 100%; padding: .45rem .625rem; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--sheet); color: var(--ink); }
.log-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem 1rem; align-items: end; }
.log-filter-actions { display: flex; gap: .5rem; }
.log-table td { font-size: .9375rem; }
.is-bad { color: var(--officer); font-weight: 600; }
.snippet { display: block; font-size: .9375rem; overflow-wrap: anywhere; }
.snippet mark { background: var(--manila); color: inherit; border-radius: 2px; padding: 0 .1rem; }
.second-look { display: grid; gap: .3rem; justify-items: start; margin-top: .2rem; padding: .6rem .75rem; border-radius: 8px;
    background: var(--stamp-soft); font-size: .9375rem; }
.second-look-title { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; color: var(--stamp); }
.second-look-icon { width: 1rem; height: 1rem; }
.btn-small { padding: .3rem .7rem; font-size: .9375rem; }
.progress-body { display: grid; gap: .6rem; }
.bar { height: .5rem; border-radius: 999px; background: var(--sheet-2); border: 1px solid var(--rule); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--spark-from), var(--spark-to)); transition: width .4s ease; }
.badge { display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; border-radius: 999px;
    background: var(--stamp); color: var(--sheet); font-size: .6875rem; font-weight: 600; line-height: 1; }
.badge-muted { background: var(--sheet-2); color: var(--ink-2); border: 1px solid var(--rule); height: auto; padding: .1rem .5rem; }
.badge-on-btn { background: var(--sheet); color: var(--stamp); margin-left: .25rem; }
.nav-badge { margin-left: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-panel); box-shadow: var(--shadow); padding: 1rem 1.15rem; display: grid; gap: .2rem; }
.tile-label { font-size: .8125rem; color: var(--ink-2); }
.tile-value { font-size: 1.75rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.tile-sub { font-size: .75rem; color: var(--ink-2); }
.tile-warn .tile-value { color: var(--officer); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
:root { --chart-bar: #33508A; }
:root[data-theme="dark"] { --chart-bar: #6B8BE8; }
.bars { width: 100%; height: auto; display: block; margin-top: .5rem; }
.bars .bar { fill: var(--chart-bar); }
.bars .bar-hover { fill: transparent; }
.bars .bar-hit:hover .bar-hover { fill: color-mix(in srgb, var(--chart-bar) 8%, transparent); }
.bars-base { stroke: var(--rule); stroke-width: 1; }
.bars-label { fill: var(--ink-2); font-size: 11px; font-family: var(--font-ui); }
.chart-total { font-size: .8125rem; }
.chart-table { margin-top: .75rem; font-size: .8125rem; }
.chart-table summary { cursor: pointer; color: var(--stamp); }
.check-list { list-style: none; margin: 0; display: grid; gap: .35rem; }
.check-list li { display: flex; align-items: center; gap: .75rem; }
.check-list label { display: inline-flex; align-items: center; gap: .5rem; margin: 0; font-weight: 400; font-size: .875rem; }
.queue-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .6rem 1rem; margin-bottom: 1rem;
    background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-panel); font-size: .8125rem; }
.queue-bar .spacer { flex: 1; }
.kbd { font-family: var(--font-raw); font-size: .6875rem; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; background: var(--sheet-2); color: var(--ink); }
.viewer-tools { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; padding: .6rem .75rem 0; }
.viewer-tools button { font: inherit; font-size: .75rem; font-weight: 500; min-width: 1.9rem; height: 1.9rem; padding: 0 .55rem; border: 1px solid var(--rule);
    border-radius: var(--radius-control); background: var(--sheet); color: var(--ink-2); cursor: pointer; }
.viewer-tools button:hover { color: var(--ink); border-color: var(--ink-2); }
.viewer-tools button[aria-pressed="true"] { background: var(--stamp-soft); color: var(--stamp); border-color: color-mix(in srgb, var(--stamp) 40%, var(--rule)); }
.zoom-level { font-size: .75rem; color: var(--ink-2); min-width: 2.75rem; text-align: center; font-variant-numeric: tabular-nums; }
.tools-sep { width: 1px; height: 1.2rem; background: var(--rule); margin: 0 .3rem; }
.viewer.is-contrast .sheet img { filter: contrast(1.45) brightness(1.04); }
.viewer.show-master .sheet-inner svg { display: none; }
.viewer-note { font-size: .75rem; color: var(--ink-2); padding: .4rem .75rem 0; }
.sheet-inner { transition: width .15s ease; }
.thumbs-strip { padding-top: .5rem; }
.thumbs-strip button { display: grid; justify-items: center; gap: .15rem; padding: .25rem; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--sheet); }
.thumbs-strip button img { width: 2.6rem; height: 3.6rem; object-fit: cover; object-position: top; border-radius: 2px; }
.thumbs-strip button span { font-size: .6875rem; color: var(--ink-2); }
.thumbs-strip button[aria-selected="true"] { border-color: var(--stamp); box-shadow: 0 0 0 1px var(--stamp); }
img.is-loading { background: linear-gradient(90deg, var(--sheet-2) 25%, var(--rule) 50%, var(--sheet-2) 75%); background-size: 200% 100%; min-height: 12rem; }
@media (prefers-reduced-motion: no-preference) { img.is-loading { animation: shimmer 1.4s linear infinite; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.link-button { font: inherit; font-size: .8125rem; font-weight: 500; color: var(--stamp); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.reveal-form { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.panel-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem; cursor: pointer; list-style: none; }
.panel-summary::-webkit-details-marker { display: none; }
.panel-summary h2 { font-size: .9375rem; }
details[open] > .panel-summary { border-bottom: 1px solid var(--rule); }
.timeline { list-style: none; margin: 0; padding: .75rem 1.25rem 1rem; display: grid; gap: .55rem; }
.tl { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .1rem .9rem; font-size: .8125rem; position: relative; }
.tl-when { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-detail { grid-column: 2; font-size: .75rem; }
.tl-problem .tl-what { color: var(--officer); }
.tl-signoff .tl-what { color: var(--ok); font-weight: 500; }
.shortcuts { border: 1px solid var(--rule); border-radius: var(--radius-panel); background: var(--sheet); color: var(--ink); padding: 1.25rem; width: min(26rem, calc(100vw - 2rem));
    box-shadow: 0 24px 60px -20px rgb(16 24 40 / .35); }
.shortcuts::backdrop { background: rgb(16 24 40 / .35); }
.shortcuts dl { display: grid; gap: .5rem; margin: 1rem 0; }
.shortcuts dl div { display: grid; grid-template-columns: 6rem 1fr; gap: .75rem; font-size: .8125rem; align-items: baseline; }
.shortcuts dd { margin: 0; color: var(--ink-2); }
@media print {
    .sidebar, .appbar, .ai-spark, .queue-bar, .viewer-tools, .thumbs-strip, .fld details, .correct-form, .second-look form, .actions, .signoff form, .reveal-form, .notice { display: none !important; }
    body, .panel, .tile { background: #fff !important; box-shadow: none !important; }
    .review { grid-template-columns: 1fr 1fr; }
    .viewer { position: static; }
    .sheet { max-height: none; overflow: visible; }
    details > *:not(summary) { display: block; }
}
.tax-timeline { list-style: none; margin: 0; padding: .5rem 1.25rem 1rem; }
.tax-timeline li { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.tax-timeline li:last-child { border-bottom: 0; }
.tax-year { font-size: 1.125rem; font-weight: 600; color: var(--stamp); font-variant-numeric: tabular-nums; }
.tax-doc { display: grid; gap: .2rem; font-size: .875rem; }
.bell-button { position: relative; }
.bell-button svg { width: 16px; height: 16px; }
.bell-dot { position: absolute; top: 4px; right: 5px; width: .5rem; height: .5rem; border-radius: 50%; background: var(--officer); border: 2px solid var(--sheet); }
.bell-dot[hidden] { display: none; }
.bell-panel { width: 20rem; gap: .35rem; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: .35rem; border-bottom: 1px solid var(--rule); }
.bell-item { display: grid; gap: .1rem; padding: .5rem .5rem; border-radius: var(--radius-control); text-decoration: none; color: var(--ink); font-size: .8125rem; }
.bell-item:hover { background: var(--sheet-2); }
.bell-item.is-unread { background: var(--stamp-soft); }
.bell-item .muted { font-size: .75rem; }
.bell-problem > span:first-child { color: var(--officer); }
.notice { position: relative; }
.notice-close { position: absolute; top: .35rem; right: .5rem; background: none; border: 0; font-size: 1.1rem; color: var(--ink-2); cursor: pointer; }
.toast { transition: opacity .5s ease, transform .5s ease; }
.toast.is-gone { opacity: 0; transform: translateY(-4px); pointer-events: none; }
/* Smart search: centre of the top bar. Pages and folders match in the browser; records go to /search. */
.smart-search { position: relative; flex: 1 1 20rem; max-width: 32rem; margin: 0 auto; }
.ss-field { display: flex; align-items: center; gap: .5rem; height: 2.25rem; padding: 0 .55rem 0 .7rem; border: 1px solid var(--rule);
    border-radius: 10px; background: var(--sheet-2); color: var(--ink-2); cursor: text; transition: background .12s, border-color .12s; }
.ss-field:focus-within { background: var(--sheet); border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-soft); }
.ss-field .nav-icon { width: 1rem; height: 1rem; flex: none; }
.ss-field input { flex: 1; min-width: 0; height: 100%; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important;
    font-size: .875rem; color: var(--ink); outline: none; }
.ss-field input::placeholder { color: var(--ink-2); opacity: .85; }
.ss-kbd { flex: none; font-size: .6875rem; }
.ss-field:focus-within .ss-kbd { display: none; }
.ss-panel { position: absolute; top: calc(100% + .35rem); left: 0; right: 0; min-width: 22rem; z-index: 60; overflow: hidden;
    background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 14px 36px rgb(16 24 40 / .16); }
.ss-panel[hidden] { display: none; }
.ss-list { list-style: none; margin: 0; padding: .35rem; max-height: 24rem; overflow-y: auto; }
.ss-row { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .5rem .6rem; border: 0; border-radius: var(--radius-control);
    background: none; color: var(--ink); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.ss-list [aria-selected="true"] .ss-row { background: var(--stamp-soft); }
.ss-icon { display: grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; border-radius: 8px; background: var(--sheet-2); color: var(--ink-2); }
.ss-icon .nav-icon { width: 1rem; height: 1rem; }
.ss-list [aria-selected="true"] .ss-icon { background: var(--sheet); color: var(--stamp); }
.ss-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ss-label { font-size: .875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-label mark { background: none; color: var(--stamp); font-weight: 600; padding: 0; }
.ss-hint { font-size: .75rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-badge { flex: none; font-size: .6875rem; font-weight: 500; padding: .1rem .45rem; border-radius: 4px; border: 1px solid var(--rule); color: var(--ink-2); }
.ss-badge-search { border-color: transparent; background: var(--stamp-soft); color: var(--stamp); }
.ss-empty { padding: .9rem .8rem; font-size: .875rem; color: var(--ink-2); }
.ss-foot { display: flex; gap: 1rem; margin: 0; padding: .45rem .9rem; border-top: 1px solid var(--rule); font-size: .6875rem; color: var(--ink-2); }
.ss-foot .kbd + .kbd { margin-left: .15rem; }
.ss-mobile { display: none !important; }
@media (max-width: 1023px) {
    .appbar-title { flex: 1 1 auto; }
    .smart-search { display: none; position: fixed; top: .4rem; left: .5rem; right: .5rem; max-width: none; margin: 0; z-index: 70; }
    .smart-search.is-open { display: block; }
    .smart-search .ss-field { height: 2.75rem; background: var(--sheet); box-shadow: 0 6px 20px rgb(16 24 40 / .14); }
    .ss-kbd { display: none; }
    .ss-panel { min-width: 0; }
    .ss-foot { display: none; }
    .ss-mobile { display: grid !important; }
}
.idle-warning { border: 1px solid var(--rule); border-radius: var(--radius-panel); padding: 1.25rem; width: min(28rem, calc(100vw - 2rem)); background: var(--sheet); color: var(--ink); }
.idle-warning::backdrop { background: rgb(16 24 40 / .45); }
.idle-warning p { margin: .6rem 0 1rem; font-size: .875rem; color: var(--ink-2); }
.who-inline { display: inline-flex; gap: .6rem; align-items: center; }
.roles-set { border: 1px solid var(--rule); border-radius: var(--radius-control); padding: .75rem 1rem; display: grid; gap: .35rem; }
.roles-set legend { font-size: .8125rem; font-weight: 500; padding: 0 .3rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 400; font-size: .875rem; margin: 0; }
.check-out { white-space: pre-wrap; margin: .5rem 0 0; font-size: .75rem; }
.proposal { padding: 1rem 1.25rem; border-bottom: 1px solid var(--rule); display: grid; gap: .5rem; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.diff pre { margin: .25rem 0 0; padding: .6rem; background: var(--sheet-2); border: 1px solid var(--rule); border-radius: var(--radius-control); font-size: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16rem; overflow: auto; }
.json-edit { width: 100%; font-family: var(--font-raw); font-size: .8125rem; padding: .6rem; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--sheet); color: var(--ink); }
textarea { font: inherit; }
@media (max-width: 640px) { .diff { grid-template-columns: 1fr; } }
.pager { display: flex; gap: 1.25rem; align-items: center; justify-content: center; }

/* Room at the bottom for the fixed footer. */
.page { max-width: 1440px; margin: 0 auto; padding: 1.75rem 1.25rem calc(var(--foot-h) + 2.5rem); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin-top: .25rem; }

/* --- Notices ------------------------------------------------------------- */
.notice { padding: .7rem 1rem; border-radius: var(--radius-control); margin-bottom: 1rem; border: 1px solid; font-size: .875rem; }
.notice-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.notice-error { background: var(--officer-soft); border-color: color-mix(in srgb, var(--officer) 25%, transparent); }

/* --- Controls ------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; gap: .375rem; font: inherit; font-size: .875rem; font-weight: 500; padding: .5rem .95rem; border-radius: var(--radius-control); border: 1px solid var(--stamp); background: var(--stamp); color: var(--sheet); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn-quiet { background: var(--sheet); color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover { border-color: var(--ink-2); filter: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
label { font-weight: 500; font-size: .8125rem; color: var(--ink); display: block; margin-bottom: .3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="file"], input[type="number"] {
    font: inherit; width: 100%; padding: .5rem .625rem; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--sheet); color: var(--ink);
}
.field-hint { font-size: .8125rem; color: var(--ink-2); margin-top: .25rem; }
.field-error { color: var(--officer); font-size: .9rem; margin-top: .25rem; }
.form-stack { display: grid; gap: 1rem; max-width: 36rem; }

/* --- Panels -------------------------------------------------------------- */
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-panel); box-shadow: var(--shadow); }
.panel-body { padding: 1rem 1.25rem; }
.panel > h2, .panel > header { padding: .8rem 1.25rem; border-bottom: 1px solid var(--rule); font-size: .9375rem; }

/* --- Register (folder list): a ledger, with the folder tab as the key ---- */
.register { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-panel); overflow: hidden; box-shadow: var(--shadow); }
.register th { text-align: left; font-size: .8125rem; color: var(--ink-2); font-weight: 500; padding: .625rem 1rem; border-bottom: 1px solid var(--rule); background: var(--sheet-2); }
.register td { padding: .75rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.register tr:last-child td { border-bottom: 0; }
.register td.num, .register th.num { text-align: right; }
/* Folder barcode chip. Centred on the text line beside it, with one fixed gap. */
.tab { display: inline-flex; align-items: center; vertical-align: middle; position: relative; top: -.06em; height: 1.45em; margin-left: .45rem;
    background: var(--manila); color: var(--manila-ink); font-family: var(--font-raw); font-weight: 500; font-size: .8125rem; line-height: 1;
    padding: 0 .5rem; border-radius: 4px; text-decoration: none; white-space: nowrap; }
/* Chips that stand alone: folder links, the heading, lists of barcodes. */
a.tab, .appbar-h1 .tab, h1 .tab { margin-left: 0; }
/* Never stretched by a grid or flex parent. */
.tab { justify-self: start; align-self: center; flex: none; }
.tab-list { margin: 0 .3rem .2rem 0; }
a.tab:hover { filter: brightness(.97); }
h1 .tab { font-size: 1.125rem; padding: 0 .65rem; }
.empty { padding: 2.5rem 1.25rem; text-align: center; }
.empty p + p { margin-top: .5rem; }

/* --- Status marks -------------------------------------------------------- */
.mark { display: inline-flex; align-items: center; gap: .35rem; font-size: .8125rem; font-weight: 500; white-space: nowrap; }
.mark::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; flex: none; }
.mark-read, .mark-pass, .mark-in_review, .mark-transcribed { color: var(--stamp); }
.mark-uncertain, .mark-fail, .mark-failed, .mark-partial, .mark-double_reviewer { color: var(--officer); }
.mark-withheld, .mark-skipped, .mark-blank, .mark-pending, .mark-captured, .mark-awaiting_template { color: var(--withheld); }
.mark-verified, .mark-archived, .mark-auto_accept_candidate { color: var(--ok); }
.mark-single_reviewer, .mark-processing, .mark-preprocessed, .mark-classified { color: var(--ink-2); }
.basis { font-size: .75rem; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 999px; padding: 0 .5rem; white-space: nowrap; }
.basis-confirmed { color: var(--ok); border-color: currentColor; }

/* --- Folder view --------------------------------------------------------- */
.folder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1.25rem; align-items: start; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .875rem; padding: 1rem 1.25rem; }
.thumb { border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--sheet-2); overflow: hidden; }
.thumb-img { aspect-ratio: 1 / 1.41; display: flex; align-items: center; justify-content: center; background: var(--board); }
.thumb-img img { width: 100%; height: 100%; object-fit: contain; }
.thumb-meta { padding: .5rem .625rem; font-size: .875rem; display: grid; gap: .125rem; }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { border-bottom: 1px solid var(--rule); }
.doc-list li:last-child { border-bottom: 0; }
.doc-list a { display: grid; gap: .2rem; padding: .875rem 1.25rem; text-decoration: none; color: var(--ink); }
.doc-list a:hover { background: var(--sheet-2); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* --- Review: the page viewer and the field register side by side -------- */
.review { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.viewer { position: sticky; top: 4.5rem; }
.viewer-tabs { display: flex; gap: .25rem; padding: .625rem .75rem 0; flex-wrap: wrap; }
.viewer-tabs button { font: inherit; border: 1px solid var(--rule); border-bottom: 0; background: var(--sheet-2); color: var(--ink); padding: .3rem .75rem; border-radius: var(--radius-control) var(--radius-control) 0 0; cursor: pointer; }
.viewer-tabs button[aria-selected="true"] { background: var(--sheet); font-weight: 500; color: var(--stamp); }
.sheet { position: relative; margin: 0 .75rem .75rem; border: 1px solid var(--rule); background: #fff; max-height: calc(100vh - 11.5rem); overflow: auto; }
.sheet img { display: block; width: 100%; height: auto; }
.sheet-inner { position: relative; }
.sheet-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.box { fill: transparent; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: pointer; }
.box-read { stroke: rgb(51 80 138 / .75); }
.box-uncertain { stroke: #B0362C; stroke-dasharray: 6 4; }
.box-withheld { stroke: #8A939B; stroke-dasharray: 2 4; }
.box.is-active { stroke-width: 3; fill: rgb(235 224 191 / .45); }
.viewer-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8125rem; padding: 0 .75rem .75rem; color: var(--ink-2); }
.viewer-legend .swatch { display: inline-block; width: 1.25rem; height: .7rem; border: 2px solid; vertical-align: middle; margin-right: .3rem; }

.doc-summary { display: grid; gap: .75rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem 1.25rem; }
.facts dt { font-size: .8125rem; color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 600; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .25rem .75rem; padding: .6rem 1.25rem; border-bottom: 1px solid var(--rule); align-items: baseline; }
.checks li:last-child { border-bottom: 0; }
.checks .code { font-family: var(--font-raw); font-size: .8125rem; color: var(--ink-2); }
.checks .detail { grid-column: 2 / -1; font-size: .8125rem; color: var(--ink-2); overflow-wrap: anywhere; }

.section-head { padding: .9rem 1.25rem .35rem; font-size: .8125rem; font-weight: 500; color: var(--ink-2); }
.fields { list-style: none; margin: 0; padding: 0; }
.fld { display: grid; grid-template-columns: 10rem minmax(0, 1fr) auto; gap: .25rem 1rem; padding: .625rem 1.25rem; border-top: 1px solid var(--rule); scroll-margin-top: 1rem; }
.fld.is-active { background: color-mix(in srgb, var(--manila) 35%, var(--sheet)); }
.fld-label { font-weight: 500; font-size: .875rem; }
.fld-label small { display: block; font-weight: 400; color: var(--ink-2); font-size: .75rem; }
.fld-reading { display: grid; gap: .25rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.fld-value { font-size: .9375rem; font-weight: 600; }
.fld-value.is-empty { color: var(--withheld); font-weight: 400; font-style: italic; }
.fld-raw { overflow-wrap: anywhere; }
.fld-raw .unclear { background: var(--officer-soft); color: var(--officer); border-radius: 2px; padding: 0 .1rem; }
.fld-crop { max-width: min(100%, 16rem); max-height: 2.75rem; border: 1px solid var(--rule); background: #fff; justify-self: start; }
.fld-meta { font-size: .8125rem; color: var(--ink-2); }
.fld-flags { margin: .1rem 0 0; padding-left: 1.1rem; font-size: .8125rem; color: var(--officer); }
.fld details { grid-column: 2 / -1; }
.fld summary { cursor: pointer; color: var(--stamp); font-weight: 500; font-size: .8125rem; width: max-content; }
.correct-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem; margin-top: .5rem; align-items: end; }
.correct-form label { font-size: .875rem; }

.annotations { display: grid; gap: .5rem; padding: 1rem 1.25rem; }
.annotation { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: .75rem; }
.ink-chip { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: baseline; border: 1px solid var(--rule); }

.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: .6rem 1.25rem; border-bottom: 1px solid var(--rule); font-size: .875rem; }
.history li:last-child { border-bottom: 0; }

.signoff { border-color: color-mix(in srgb, var(--stamp) 35%, var(--rule)); }
.signoff .panel-body { display: grid; gap: .75rem; }

.ref-table { width: 100%; border-collapse: collapse; }
.ref-table th, .ref-table td { text-align: left; padding: .6rem 1.25rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ref-table th { font-size: .8125rem; font-weight: 500; color: var(--ink-2); background: var(--sheet-2); }
.ref-table td { font-size: .875rem; }
.ref-table td.raw { white-space: nowrap; }
.bands { border-collapse: collapse; font-size: .9375rem; justify-self: start; width: auto; }
.bands td { padding: .15rem 1rem .15rem 0; }

.stack { display: grid; gap: 1.25rem; }
.login { max-width: 26rem; width: 100%; margin: 0 auto; }
/* Signed-out pages (sign-in, MyDigital ID): centred in the space above the fixed footer; scrolls if taller. */
body:not(.has-sidebar) .page { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; min-height: 100dvh;
    box-sizing: border-box; padding-top: 2rem; padding-bottom: calc(var(--foot-h) + 2rem); }
body:not(.has-sidebar) .page-foot { justify-content: center; }
body:not(.has-sidebar) .page-foot .copyright { text-align: center; }
.login .brand { justify-content: center; margin-bottom: 1.25rem; }
.login .brand img { height: 56px; }
.or { display: flex; align-items: center; gap: .75rem; color: var(--ink-2); font-size: .875rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.btn-id { background: var(--sheet); color: var(--ink); border-color: var(--rule); justify-content: flex-start; flex-wrap: wrap; width: 100%; }
.btn-id .id-icon { color: var(--stamp); flex: none; }
.mockup-tag { margin-left: auto; font-size: .6875rem; font-weight: 500; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 999px; padding: 0 .5rem; }
.login-wide { max-width: 52rem; }
.mydid { display: grid; gap: 1.25rem; }
.mydid-title { display: flex; align-items: center; gap: .5rem; font-size: 1.5rem; }
.mydid-title .id-icon { width: 30px; height: 30px; color: var(--stamp); }
.mydid-grid { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.mydid h2 { font-size: 1.0625rem; margin: .25rem 0 .5rem; }
.steps { margin: 0 0 1rem; padding-left: 1.25rem; display: grid; gap: .4rem; }
.qr-placeholder { margin: 0; display: grid; gap: .5rem; justify-items: center; padding: .75rem; border: 1px dashed var(--rule); border-radius: var(--radius-control); color: var(--ink-2); }
.qr-placeholder svg { width: 100%; height: auto; max-width: 200px; fill: currentColor; opacity: .55; }
@media (max-width: 640px) { .mydid-grid { grid-template-columns: 1fr; } }
.theme-toggle { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: .75rem; font-weight: 500; background: none; border: 1px solid var(--rule); color: var(--ink-2); border-radius: 999px; padding: .2rem .65rem; cursor: pointer; }
.theme-toggle:hover { background: var(--sheet-2); }
.theme-toggle svg { width: 14px; height: 14px; }
.theme-toggle-icon { width: 2rem; height: 2rem; padding: 0; justify-content: center; }
.theme-toggle-icon svg { width: 15px; height: 15px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.login-tools { display: flex; justify-content: flex-end; gap: .5rem; margin-bottom: .5rem; }
.locale-form { display: inline; }

/* AI sparkle, after Taxmarc's Sparkle assistant: floating gradient button,
   soft glow, slow pulse, accent dot. Glows and greets once after sign-in. */
:root { --spark-from: #4A65A1; --spark-to: #2B3F6B; }
:root[data-theme="dark"] { --spark-from: #6F8AC8; --spark-to: #33508A; }
.ai-spark { position: fixed; right: 1.5rem; bottom: calc(var(--foot-h) + 1rem); z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: .75rem; }
.ai-launcher { position: relative; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
    background: linear-gradient(135deg, var(--spark-from), var(--spark-to));
    box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--spark-from) 70%, transparent); }
.ai-launcher::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .2); }
.ai-launcher .spark-icon { width: 1.25rem; height: 1.25rem; position: relative; }
.ai-launcher-glow { position: absolute; inset: -4px; border-radius: 50%; background: color-mix(in srgb, var(--spark-from) 35%, transparent); filter: blur(10px); opacity: 0; }
.ai-launcher:hover .ai-launcher-glow, .ai-launcher:focus-visible .ai-launcher-glow { opacity: 1; }
.spark-dot { position: absolute; top: -1px; right: -1px; width: .6rem; height: .6rem; border-radius: 50%; background: #D8B766; border: 2px solid var(--sheet); }
.spark-tile { position: relative; flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 10px; color: #fff;
    background: linear-gradient(135deg, var(--spark-from), var(--spark-to)); }
.spark-tile .spark-icon { width: 1.1rem; height: 1.1rem; }

.ai-greeting { max-width: min(22rem, calc(100vw - 3rem)); background: var(--sheet); color: var(--ink); border: 1px solid var(--rule); border-radius: 14px 14px 4px 14px;
    padding: .65rem .9rem; font-size: .875rem; font-weight: 500; box-shadow: 0 12px 32px -16px rgb(16 24 40 / .25); }
.ai-greeting.is-gone { opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s linear .5s; }

.ai-panel { width: min(22rem, calc(100vw - 3rem)); background: var(--sheet); color: var(--ink); border: 1px solid var(--rule); border-radius: 16px;
    padding: 1rem; display: grid; gap: .875rem; box-shadow: 0 20px 48px -20px rgb(16 24 40 / .3); }
.ai-panel[hidden] { display: none; }
.ai-panel-head { display: flex; align-items: center; gap: .75rem; }
.ai-panel-title { font-weight: 600; }
.ai-panel-sub { font-size: .8125rem; color: var(--ink-2); overflow-wrap: anywhere; }
.ai-close { margin-left: auto; font: inherit; font-size: 1.4rem; line-height: 1; background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: .25rem .5rem; border-radius: 6px; }
.ai-close:hover { background: var(--sheet-2); }
.ai-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0; }
.ai-stats div { background: var(--sheet-2); border-radius: 8px; padding: .5rem .6rem; }
.ai-stats dt { font-size: .75rem; color: var(--ink-2); }
.ai-stats dd { margin: 0; font-size: 1.125rem; font-weight: 600; }
.ai-note { font-size: .875rem; color: var(--ink-2); }

@media (prefers-reduced-motion: no-preference) {
    .ai-launcher .spark-icon { animation: pulse-node 3.2s ease-in-out infinite; }
    .ai-launcher, .ai-launcher-glow { transition: transform .3s ease, opacity .3s ease; }
    .ai-launcher:hover { transform: scale(1.05); }
    .ai-launcher:active { transform: scale(.95); }
    .is-celebrating .ai-launcher { animation: spark-arrive .7s cubic-bezier(.2, .7, .3, 1) both; }
    .is-celebrating .ai-launcher-glow { animation: spark-bloom 2.4s ease-out .3s both; }
    .ai-greeting { animation: greet-in .5s cubic-bezier(.2, .7, .3, 1) .35s both; }
}
@keyframes spark-arrive { 0% { transform: scale(.4) rotate(-90deg); opacity: 0; } 70% { transform: scale(1.12) rotate(8deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes spark-bloom { 0% { opacity: 0; transform: scale(.6); } 35% { opacity: 1; transform: scale(1.6); } 100% { opacity: 0; transform: scale(1); } }
@keyframes greet-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Taxmarc's pulse-node curve, with a higher floor so the icon never vanishes. */
@keyframes pulse-node { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media print { .ai-spark { display: none; } }

.demo-login { margin-top: 1rem; display: grid; gap: .5rem; background: var(--sheet-2); box-shadow: none; }
.panel.demo-login > h2 { font-size: .9375rem; }
/* A heading inside an already padded panel body is not a panel header. */
.panel.panel-body > h1, .panel.panel-body > h2 { padding: 0; border: 0; }
/* Demo accounts: three compact tiles in a row (name, then roles). */
.demo-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.25rem, 1fr)); gap: .5rem; margin-top: .25rem; }
.demo-buttons form { display: contents; }
.demo-tile { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; width: 100%; padding: .55rem .7rem; text-align: left; cursor: pointer;
    border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--sheet); color: var(--ink); font: inherit; }
.demo-tile strong { font-size: .8125rem; font-weight: 600; }
.demo-tile span { font-size: .6875rem; color: var(--ink-2); line-height: 1.35; }
.demo-tile:hover { border-color: var(--stamp); background: var(--stamp-soft); }
.demo-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

@media (max-width: 1100px) {
    .review, .folder-grid { grid-template-columns: 1fr; }
    .viewer { position: static; }
    .sheet { max-height: 70vh; }
}
/* Review actions bar: phones only. */
.m-actions { display: none; }
@media (max-width: 640px) {
    /* The fields come before the checks: they are what the officer works on. */
    .review .stack { display: flex; flex-direction: column; }
    .review .stack > * { order: 3; }
    .review .stack > .doc-summary { order: 0; }
    .review .stack > .s-fields { order: 1; }
    .review .stack > .s-checks { order: 2; }
    .review .stack > .signoff { order: 4; }
    .m-actions { display: flex; align-items: center; gap: .5rem; position: fixed; left: 0; right: 0; bottom: var(--foot-h); z-index: 26;
        padding: .55rem .75rem; background: var(--sheet); border-top: 1px solid var(--rule); box-shadow: 0 -6px 18px rgb(16 24 40 / .08); }
    .m-actions-count { flex: 1; font-size: .8125rem; color: var(--ink-2); }
    .m-actions .btn { padding: .45rem .8rem; font-size: .875rem; }
    body:has(.m-actions) .page { padding-bottom: calc(var(--foot-h) + 5.5rem); }
    body:has(.m-actions) .ai-spark { bottom: calc(var(--foot-h) + 4.5rem); }
    .checks li { grid-template-columns: 2.25rem 1fr; }
    .checks li > :nth-child(n+3) { grid-column: 2; }
    .fld { grid-template-columns: 1fr; }
    .fld details { grid-column: 1; }
    .correct-form { grid-template-columns: 1fr; }
    .register thead { display: none; }
    /* Each folder as a compact card: tab and status on top, figures in two columns. */
    .register tr { display: grid; grid-template-columns: 1fr 1fr; padding: .75rem 1rem; gap: .2rem 1rem; border-bottom: 1px solid var(--rule); }
    .register tr:last-child { border-bottom: 0; }
    .register td { border: 0; padding: 0; font-size: .8125rem; }
    .register td:first-child { grid-column: 1 / -1; margin-bottom: .2rem; }
    .register td.cell-branch { grid-column: 1 / -1; color: var(--ink-2); }
    .register td.num { text-align: left; }
    .register td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-2); }
    .annotation { grid-template-columns: 1fr; }
    .ref-table td.raw { white-space: normal; }
}
@media (prefers-reduced-motion: no-preference) {
    .fld, .box { transition: background-color .15s ease, stroke-width .15s ease, fill .15s ease; }
}

/* Folder handover */
.handover { margin-top: 1.25rem; padding: 1rem 1.25rem; }
.handover h2 { font-size: .9375rem; margin-bottom: .35rem; }
.handover p { margin: .15rem 0; }
.handover-now { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.handover-form { position: relative; }
.handover-form > summary { list-style: none; cursor: pointer; }
.handover-form > summary::-webkit-details-marker { display: none; }
.handover-form[open] > form { margin-top: .75rem; width: min(26rem, calc(100vw - 4rem)); }
.handover-history { margin-top: .75rem; font-size: .875rem; }
.handover-history summary { cursor: pointer; color: var(--ink-2); }
.handover-history ol { margin: .5rem 0 0; padding-left: 1.1rem; display: grid; gap: .5rem; }

/* Dashboard: the officer's own day, one quiet row */
.today { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; margin: 0 0 1.25rem; padding: .75rem 1.1rem; border: 1px solid var(--rule); border-radius: var(--radius-panel); background: var(--sheet); }
.today h2 { font-size: .875rem; margin: 0; }
.today dl { display: flex; gap: 2rem; flex-wrap: wrap; margin: 0; }
.today dl > div { display: flex; align-items: baseline; gap: .5rem; }
.today dt { font-size: .8125rem; color: var(--ink-2); }
.today dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.today dd .muted { font-weight: 400; font-size: .8125rem; }

/* Folder cover sheet: one A4 page, black on white, printed from the folder page */
.cover-body { background: var(--board); }
.cover-tools { display: flex; justify-content: flex-end; max-width: 210mm; margin: 1rem auto 0; padding: 0 1rem; }
.cover { box-sizing: border-box; max-width: 210mm; min-height: 270mm; margin: 1rem auto 2rem; padding: 18mm 16mm; background: #fff; color: #111; box-shadow: 0 6px 24px rgb(16 24 40 / .12); display: flex; flex-direction: column; gap: 9mm; }
.cover-head { display: flex; align-items: center; gap: 1rem; border-bottom: 1px solid #ccc; padding-bottom: 5mm; }
.cover-head h1 { font-size: 1.5rem; margin: 0; }
.cover-app { margin: 0; font-size: .875rem; color: #555; }
.cover-code { text-align: center; }
.cover-code .barcode { max-width: 100%; height: auto; }
.cover-barcode { margin: .35rem 0 0; font-family: var(--font-raw); font-size: 1.5rem; letter-spacing: .12em; }
.cover-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 2rem; margin: 0; }
.cover-facts dt { font-size: .75rem; color: #555; }
.cover-facts dd { margin: 0; font-weight: 600; }
.cover-docs { width: 100%; border-collapse: collapse; font-size: .875rem; }
.cover-docs th, .cover-docs td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid #ddd; vertical-align: top; }
.cover-docs th { font-size: .75rem; color: #555; font-weight: 500; }
.cover-foot { margin-top: auto; font-size: .75rem; color: #555; border-top: 1px solid #ccc; padding-top: 4mm; }
.cover-foot p { margin: 0 0 .25rem; }
.cover-foot .copyright { text-align: left; padding: 0; margin: 0; }
@page { size: A4; margin: 0; }
@media print {
    .cover-body { background: #fff; }
    .cover-tools { display: none; }
    .cover { box-shadow: none; margin: 0; min-height: 297mm; max-width: none; }
}

/* Page tabs (LHDN inputs) */
.page-tabs { display: flex; gap: .25rem; margin: 0 0 1.25rem; border-bottom: 1px solid var(--rule); }
.page-tabs a { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .9rem; margin-bottom: -1px; border-bottom: 2px solid transparent;
    color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .9375rem; }
.page-tabs a:hover { color: var(--ink); }
.page-tabs a[aria-current="page"] { color: var(--stamp); border-bottom-color: var(--stamp); }
/* What LHDN must furnish */
.requests { list-style: none; margin: 0; padding: 0; }
.requests > li { padding: .9rem 1.25rem; border-top: 1px solid var(--rule); display: grid; gap: .3rem; }
.requests > li p { margin: 0; }
.request-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.request-label { font-weight: 500; color: var(--ink); }
.requests-compact > li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .6rem 1.25rem; }

/* Benchmark page */
.bench-run { display: flex; gap: .5rem; align-items: center; }
.bench-run select { width: auto; }
.bench-meta { margin: -.5rem 0 1rem; font-size: .8125rem; }
.bench-stages td:nth-child(4) { white-space: nowrap; }
.bench-bar { display: inline-block; vertical-align: middle; width: 6rem; height: .5rem; margin-right: .45rem; border-radius: 4px; background: var(--sheet-2); overflow: hidden; }
.bench-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--chart-bar); }
.bench-inputs { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.bench-out { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 0; }
.bench-out dt { font-size: .75rem; color: var(--ink-2); }
.bench-out dd { margin: .15rem 0 0; font-size: 1.375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.register tr.is-current td { background: var(--stamp-soft); }
@media (max-width: 640px) { .bench-inputs, .bench-out { grid-template-columns: 1fr; } .bench-bar { width: 4rem; } }
/* A register table inside a panel: the panel already draws the frame. */
.panel > .register { border: 0; border-radius: 0; box-shadow: none; }
.table-scroll { overflow-x: auto; }
.table-scroll > .register { border: 0; border-radius: 0; box-shadow: none; }
.bench-stages th, .bench-stages td { padding-left: .75rem; padding-right: .75rem; }

/* Knowledge base: document-by-year matrix and list */
.kb-notice { border: 1px solid var(--rule); background: var(--sheet); font-size: .875rem; color: var(--ink-2); }
.kb-notice p { margin: 0; }
.kb-notice p + p { margin-top: .3rem; }
.kb-matrix { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.kb-matrix th, .kb-matrix td { padding: .45rem .6rem; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.kb-matrix thead th { font-size: .75rem; font-weight: 500; color: var(--ink-2); background: var(--sheet-2); white-space: nowrap; }
.kb-matrix thead th.kb-y { text-align: center; }
.kb-matrix td:nth-child(2) { color: var(--ink-2); min-width: 9rem; max-width: 15rem; }
.kb-group th { background: var(--sheet); font-size: .75rem; font-weight: 600; color: var(--ink); padding-top: .9rem; }
.kb-cell { text-align: center; white-space: nowrap; padding-left: .35rem !important; padding-right: .35rem !important; }
.kb-y-before { background: color-mix(in srgb, var(--sheet-2) 60%, transparent); }
.kb-code { font-family: var(--font-raw); font-weight: 500; font-size: .8125rem; color: var(--ink); text-decoration: none; }
a.kb-code:hover { text-decoration: underline; color: var(--stamp); }
.kb-empty { color: var(--rule); }
.kb-chips { display: inline-flex; gap: .2rem; flex-wrap: wrap; justify-content: center; text-decoration: none; }
.kb-chip { display: inline-flex; align-items: baseline; gap: .25rem; padding: .05rem .4rem; border-radius: 4px; font-size: .6875rem; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.kb-chip small { font-size: .625rem; font-weight: 400; opacity: .85; }
.kb-chip-form { background: var(--stamp-soft); color: var(--stamp); }
.kb-chip-notes { background: var(--manila); color: var(--manila-ink); }
.kb-chip-guide { background: var(--sheet-2); color: var(--ink); border: 1px solid var(--rule); }
a.kb-chips:hover .kb-chip { filter: brightness(.95); }
.kb-need { display: inline-block; padding: .05rem .4rem; border-radius: 4px; font-size: .6875rem; border: 1px dashed var(--officer); color: var(--officer); white-space: nowrap; }
.kb-row-need td:nth-child(2) { color: var(--ink); }
.kb-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; font-size: .75rem; }
.kb-filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; gap: .75rem; align-items: end; }
.kb-filter-actions { display: flex; gap: .4rem; }
.kb-docs td { font-size: .8125rem; vertical-align: top; }
.kb-actions { white-space: nowrap; }
.kb-actions a + a { margin-left: .6rem; }
.kb-foot { margin-top: .75rem; font-size: .75rem; }
@media (max-width: 900px) { .kb-filters { grid-template-columns: 1fr 1fr; } }
.notice-update { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid var(--stamp); background: var(--stamp-soft); color: var(--ink); }
/* Narrow screens: the copyright wraps to two lines, so the footer grows instead of clipping it. */
@media (max-width: 640px) {
    .page-foot { height: auto; min-height: var(--foot-h); padding-top: .45rem; padding-bottom: .45rem; }
    .page-foot .copyright { text-align: center; line-height: 1.4; }
    .page { padding-bottom: calc(var(--foot-h) + 3rem); }
}
