/* =====================================================================
   GoCart e-KEW.PS-8 — Design A "DAFTAR" (the living register)
   kit.css: tokens, type, shell, components. Ported from designs/a/kit.css (read designs/a/KIT.md); colours are theme tokens only.
   ===================================================================== */

/* ---------- Fonts (local, OFL) ---------- */
@font-face { font-family: "Newsreader"; src: url("/assets/fonts/Newsreader-opsz-wght.ttf") format("truetype"); font-weight: 200 800; font-style: normal; font-display: block; }
@font-face { font-family: "Newsreader"; src: url("/assets/fonts/Newsreader-Italic-opsz-wght.ttf") format("truetype"); font-weight: 200 800; font-style: italic; font-display: block; }
@font-face { font-family: "Plex Sans"; src: url("/assets/fonts/IBMPlexSans-wdth-wght.ttf") format("truetype"); font-weight: 100 700; font-stretch: 85% 100%; font-display: block; }
@font-face { font-family: "Plex Mono"; src: url("/assets/fonts/IBMPlexMono-Regular.ttf") format("truetype"); font-weight: 400; font-display: block; }
@font-face { font-family: "Plex Mono"; src: url("/assets/fonts/IBMPlexMono-Medium.ttf") format("truetype"); font-weight: 500; font-display: block; }

/* ---------- Tokens ---------- */
:root {
  /* Colours are NOT defined here: every colour token comes from the theme_tokens table (Theme.css() inlines :root). */
  --f-display: "Newsreader", Georgia, serif;
  --f-ui: "Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "Plex Mono", ui-monospace, monospace;
  --sh-sheet: 0 1px 0 var(--rule), 0 12px 24px -16px color-mix(in srgb, var(--ink) 18%, transparent);
  --sh-desk: 0 24px 48px -12px color-mix(in srgb, var(--ink) 28%, transparent), 0 2px 0 color-mix(in srgb, var(--ink) 6%, transparent);
  --ease: cubic-bezier(.2,.7,.1,1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  max-width: 1440px; margin: 0 auto; background: var(--paper); color: var(--ink);
  font: 400 15px/24px var(--f-ui); font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 13px; height: 13px; } svg.i.lg { width: 20px; height: 20px; }

/* ---------- Type ---------- */
.display { font: 500 56px/60px var(--f-display); font-variation-settings: "opsz" 72; letter-spacing: -.015em; margin: 0; }
.h1 { font: 600 36px/42px var(--f-display); font-variation-settings: "opsz" 48; letter-spacing: -.01em; margin: 0; }
.h2 { font: 600 24px/30px var(--f-display); font-variation-settings: "opsz" 24; margin: 0; }
.h3 { font: 600 18px/24px var(--f-ui); margin: 0; }
.lede { font-size: 16px; line-height: 26px; color: var(--ink-2); margin: 0; max-width: 72ch; text-wrap: pretty; }
.small { font-size: 13px; line-height: 20px; }
.muted { color: var(--ink-2); }
.micro { font: 600 11px/16px var(--f-ui); font-stretch: 85%; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.mono { font-family: var(--f-mono); font-size: 13px; letter-spacing: 0; }
.ref { font: 500 13px/18px var(--f-mono); color: var(--dakwat-deep); letter-spacing: .01em; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.marg { font: italic 400 15px/22px var(--f-display); font-variation-settings: "opsz" 14; color: var(--ink-2); }
.dbl-rule { height: 5px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }

/* ---------- Simulation strip (role switcher) ---------- */
.simbar { height: 40px; background: var(--ink); color: var(--bar-text); display: flex; align-items: center; gap: 14px; padding: 0 40px; font-size: 12px; }
.simbar .roles { display: flex; gap: 2px; }
.simbar .role { white-space: nowrap; height: 28px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--bar-text); font-size: 12px; font-weight: 500; }
.simbar .role.is-active { background: var(--paper); color: var(--ink); border-color: var(--paper); font-weight: 600; }
.simbar .role.is-active svg { color: var(--dakwat); }
.simbar .role.from-b { border-color: var(--bar-rule); border-style: dashed; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 20px 0 4px; }
.pager .pg { height: 40px; min-width: 96px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; border: 1px solid var(--ink); border-radius: 2px; background: var(--leaf); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.pager .pg.is-off { border-color: var(--rule); color: var(--ink-3); background: transparent; }
.pager .pg-now { font: 500 13px/1 var(--f-mono); color: var(--ink-2); }

.thumb { position: relative; flex: none; width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--rule); border-radius: 3px; background: var(--white); color: var(--ink-3); }
.thumb img { max-width: 34px; max-height: 34px; object-fit: contain; }
.thumb b { position: absolute; right: -6px; bottom: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--ink); color: var(--white); font: 600 11px/18px var(--f-mono); text-align: center; }
.thumbed { display: inline-flex; align-items: center; gap: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }

.rf-row { padding: 14px 0; border-top: 1px solid var(--rule-soft); }
.rf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.rf-head .eref { font: 500 16px/20px var(--f-mono); color: var(--dakwat-deep); text-decoration: none; }
.rf-head .rf-who { display: flex; flex-direction: column; margin-right: auto; }
.rf-row .tracker { margin-top: 12px; }

.narrow-only { display: none; }

/* ---------- Masthead ---------- */
.masthead { height: 64px; display: flex; align-items: center; gap: 22px; padding: 0 40px; background: var(--paper); position: sticky; top: 0; z-index: 40; }
.masthead::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink); }
.crest { width: 40px; height: 40px; object-fit: contain; }
.wordmark { display: flex; align-items: baseline; gap: 10px; }
.wordmark .go { font: 600 28px/1 var(--f-display); font-variation-settings: "opsz" 48; letter-spacing: -.02em; color: var(--ink); }
.wordmark .go em { font-style: italic; font-weight: 500; color: var(--dakwat); }
.mast-end { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.cartbtn { height: 44px; display: inline-flex; align-items: center; gap: 10px; padding: 0 16px 0 14px; background: var(--leaf); border: 1px solid var(--ink); border-radius: 2px; font-weight: 600; font-size: 13px; position: relative; white-space: nowrap; }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--meterai); color: var(--white); font: 600 12px/22px var(--f-ui); text-align: center; }
.usercard { display: flex; align-items: center; gap: 12px; padding-left: 14px; border-left: 1px solid var(--rule); }
.usercard .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--dakwat-tint); color: var(--dakwat); border: 1px solid var(--dakwat-line); }
.usercard .nm { font-weight: 600; font-size: 14px; line-height: 18px; }
.logout { height: 40px; width: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--rule); background: transparent; border-radius: 2px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }

/* ---------- Frame: rail + folio sheet ---------- */
.frame { display: grid; grid-template-columns: 248px minmax(0,1fr); padding-right: 40px; }
.rail { padding: 24px 0 24px 24px; display: flex; flex-direction: column; gap: 0; }
.itab { position: relative; display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 8px 18px; margin-bottom: 6px; background: var(--paper-dark); border: 1px solid var(--rule); border-right: 0; border-radius: 3px 0 0 3px; font-weight: 500; font-size: 14px; line-height: 18px; color: var(--ink-2); }
.itab .ix { font: 500 22px/1 var(--f-display); color: var(--ink-3); width: 18px; }
.itab.is-active { background: var(--leaf); color: var(--ink); font-weight: 600; margin-right: -1px; z-index: 2; box-shadow: -8px 8px 16px -14px color-mix(in srgb, var(--ink) 40%, transparent); }
.itab.is-active .ix { color: var(--dakwat); }
.itab.is-active::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--dakwat); border-radius: 3px 0 0 3px; }

/* --sp-*: the sheet's padding, also read by full-bleed bands inside it (.sec-b); --rule-x: where the red margin rules sit. */
.sheet { --sp-t: 28px; --sp-r: 48px; --sp-b: 56px; --sp-l: 76px; --rule-x: 44px; position: relative; margin: 16px 0 32px; background: var(--leaf); border: 1px solid var(--rule); border-radius: 0 4px 4px 4px; box-shadow: var(--sh-sheet); padding: var(--sp-t) var(--sp-r) var(--sp-b) var(--sp-l); min-height: 640px; }
.sheet::before { content: ""; position: absolute; top: 0; bottom: 0; left: var(--rule-x); width: 1px; background: color-mix(in srgb, var(--meterai) 30%, transparent); }
.sheet::after { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--rule-x) + 4px); width: 1px; background: color-mix(in srgb, var(--meterai) 18%, transparent); }
.pagehead { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 32px; padding-bottom: 14px; margin-bottom: 18px; position: relative; }
.pagehead::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink); }
.pagehead .lede { margin-top: 10px; }

/* ---------- Footer ---------- */
.foot { margin: 0 40px; padding: 16px 0 24px 208px; border-top: 1px solid var(--rule); font-size: 12px; line-height: 18px; color: var(--ink-2); }

/* ---------- Buttons ---------- */
.btn { height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border-radius: 2px; border: 1px solid var(--ink); background: var(--leaf); color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap; cursor: pointer; }
.btn-primary { background: var(--dakwat); border-color: var(--dakwat); color: var(--white); box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.btn-buku { background: var(--buku); border-color: var(--buku); color: var(--white); box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.btn-seal { background: transparent; border-color: var(--meterai); color: var(--meterai); }
.btn-seal-solid { background: var(--meterai); border-color: var(--meterai); color: var(--white); }
.btn-ghost { background: transparent; border-color: var(--rule); color: var(--ink-2); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--meterai); padding: 0 6px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; gap: 7px; }
.btn-xs { height: 30px; padding: 0 10px; font-size: 12px; gap: 6px; }
.btn.is-done { background: var(--buku-tint); border-color: var(--buku-line); color: var(--buku); box-shadow: none; }
.btn:focus-visible, .input:focus-visible { outline: 2px solid var(--dakwat); outline-offset: 2px; box-shadow: 0 0 0 5px var(--focus-ring); }

/* ---------- Form fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font: 600 12px/16px var(--f-ui); font-stretch: 85%; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.input, .select, .textarea { width: 100%; height: 46px; padding: 0 14px; background: var(--white); border: 1px solid var(--field-line); border-bottom: 2px solid var(--ink); border-radius: 2px; font-size: 15px; }
.input-icon { position: relative; } .input-icon svg { position: absolute; left: 14px; top: 15px; color: var(--ink-3); } .input-icon .input, .input-icon .select { padding-left: 40px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 22px; resize: none; }
.input[readonly] { background: var(--paper); border-bottom-color: var(--rule); color: var(--ink-2); }
.select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.qty { width: 64px; height: 34px; text-align: center; border: 1px solid var(--field-line); border-bottom: 2px solid var(--ink); border-radius: 2px; background: var(--white); font: 500 14px/1 var(--f-mono); }
.qty.edit { border-color: var(--dakwat); border-bottom-color: var(--dakwat); background: var(--white); color: var(--dakwat); box-shadow: 0 0 0 3px var(--dakwat-tint); }
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--ink); border-radius: 2px; height: 34px; background: var(--white); }
.stepper button { width: 32px; border: 0; background: transparent; font: 500 16px/1 var(--f-mono); color: var(--ink-2); }
.stepper span { min-width: 40px; display: grid; place-items: center; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); font: 500 14px/1 var(--f-mono); }
.req { color: var(--meterai); }

/* ---------- Ledger table ---------- */
.ledger { width: 100%; border-collapse: collapse; counter-reset: col; }
.ledger thead th { counter-increment: col; text-align: left; vertical-align: bottom; padding: 12px 16px 10px; font: 600 11px/15px var(--f-ui); font-stretch: 85%; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); position: relative; border-bottom: 5px double var(--ink); }
.ledger td { padding: 14px 16px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; font-size: 14px; line-height: 20px; }
.ledger tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--paper-dark) 35%, transparent); }
.ledger tbody tr:last-child td { border-bottom: 1px solid var(--ink); }
.ledger td.num, .ledger th.num { text-align: right; }
.ledger td.num { font: 500 15px/20px var(--f-mono); }
.ledger tr.is-sel td { background: var(--dakwat-tint) !important; }
.ledger .acts { display: flex; gap: 8px; justify-content: flex-end; }
.ledger.compact thead th { padding: 20px 12px 8px; } .ledger.compact thead th::before { left: 12px; } .ledger.compact thead th.num::before { right: 12px; }
.ledger.compact td { padding: 10px 12px; }

/* ---------- Status stamps (shape = statuses.stamp_style, colour = statuses.color_token) ---------- */
.stamp { --c: var(--ink); --t: var(--st-selesai-tint); display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 1.5px solid var(--c); border-radius: 2px; background: var(--t); color: var(--c); font: 600 11px/1 var(--f-ui); font-stretch: 85%; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; position: relative; }
.stamp svg { width: 12px; height: 12px; stroke-width: 2.2; }
/* waiting: open frame */
.ss-kelulusan { border-style: dashed; }
/* in progress: frame + left notch bar */
.ss-disyor, .ss-proses, .ss-sedia { padding-left: 14px; }
.ss-disyor::before, .ss-proses::before, .ss-sedia::before { content: ""; position: absolute; left: 3px; top: 3px; bottom: 3px; width: 4px; background: var(--c); border-radius: 1px; }
.ss-sedia { border-radius: 6px; }
/* decision: solid. Ditolak is ink-black with a red strike rule so it never reads as the crimson primary. */
.ss-lulus, .ss-tolak { background: var(--c); color: var(--white); }
.ss-tolak::after { content: ""; position: absolute; left: 5px; right: 5px; top: 50%; height: 2px; margin-top: -1px; background: var(--st-tolak-strike); }
/* terminal: double frame */
.ss-selesai { border: 3px double var(--c); }
.stamp.lg { height: 34px; font-size: 13px; padding: 0 14px; letter-spacing: .08em; }
.stamp.lg.ss-disyor, .stamp.lg.ss-proses, .stamp.lg.ss-sedia { padding-left: 20px; }
.stamp.tilt { transform: rotate(-2deg); }

/* ---------- Stock gauge (Cukup / Sederhana / Kritikal; Baki proportion) ---------- */
.gauge { display: inline-grid; grid-template-columns: repeat(3, 14px); gap: 2px; vertical-align: middle; }
.gauge i { height: 6px; background: var(--paper-deep); }
.gauge.g3 i { background: var(--buku); } .gauge.g2 i:nth-child(-n+2) { background: var(--tembaga); } .gauge.g1 i:first-child { background: var(--meterai); }
.baki { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; }

/* ---------- Catalogue plates ---------- */
.specgrid { display: grid; border-top: 1px solid var(--ink); border-left: 1px solid var(--rule); }
.specgrid > * { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.plate { position: relative; background: var(--leaf); padding: 14px 16px 16px; display: flex; flex-direction: column; }
.plate-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.plate-no { font: 500 12px/1 var(--f-mono); color: var(--dakwat-deep); white-space: nowrap; }
.plate-cat { font: 600 10px/1.2 var(--f-ui); font-stretch: 85%; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); text-align: right; }
.plate-img { position: relative; height: 150px; margin: 10px 0 12px; display: flex; align-items: flex-end; justify-content: center; background: radial-gradient(ellipse 70% 60% at 50% 55%, var(--white) 0%, transparent 70%); }
.plate-img img { position: relative; z-index: 1; max-height: 140px; max-width: 88%; object-fit: contain; filter: saturate(.55) sepia(.22) contrast(1.04) drop-shadow(0 10px 7px color-mix(in srgb, var(--ink) 22%, transparent)); margin-bottom: 6px; }
.plate-name { font: 500 17px/22px var(--f-display); font-variation-settings: "opsz" 18; margin: 0; min-height: 44px; text-wrap: balance; }
.plate-unit { font-size: 12px; color: var(--ink-2); margin: 4px 0 14px; }
.plate-unit b { color: var(--ink); font-weight: 600; }
.plate-act { margin-top: auto; display: flex; gap: 8px; align-items: center; }
.plate-act .btn { flex: 1; }
.plate.in-cart { background: var(--white); }
.plate.in-cart::before { content: ""; position: absolute; inset: -1px; border: 2px solid var(--dakwat); pointer-events: none; z-index: 2; }
.plate .tick { position: absolute; top: 40px; right: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--dakwat); color: var(--white); display: grid; place-items: center; z-index: 3; box-shadow: 0 0 0 3px var(--white); }

/* ---------- Notices (marginal note, not an accent rail) ---------- */
.note { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 18px; padding: 20px 22px; background: var(--paper); border: 1px solid var(--rule); border-top: 3px double var(--ink); }
.seal { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid currentColor; box-shadow: inset 0 0 0 4px var(--leaf), inset 0 0 0 5px currentColor; color: var(--dakwat); background: var(--leaf); }
.seal.red { color: var(--meterai); } .seal.green { color: var(--buku); } .seal.brass { color: var(--tembaga); }
.note p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; line-height: 22px; }

/* ---------- In-sheet tabs ---------- */


/* ---------- Stat strip ---------- */

/* ---------- Folio tracker (6 steps) ---------- */
.tracker { margin-top: 20px; }
.tracker-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.tracker-row { display: grid; grid-template-columns: repeat(var(--steps, 6), minmax(0,1fr)); position: relative; }
.tk { position: relative; padding: 12px 14px 12px; background: var(--paper); border: 1px solid var(--rule); margin-right: -1px; min-height: 76px; }
.tk .n { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--ink-3); font: 500 12px/1 var(--f-mono); color: var(--ink-3); margin-bottom: 8px; background: var(--leaf); }
.tk .t { font-weight: 600; font-size: 13px; line-height: 17px; color: var(--ink-3); }
.tk .r { font-size: 11px; line-height: 15px; color: var(--ink-3); margin-top: 2px; }
.tk.done { background: var(--leaf); border-color: var(--rule); box-shadow: inset 0 3px 0 var(--dakwat); }
.tk.done .n { background: var(--dakwat); border-color: var(--dakwat); color: var(--white); }
.tk.done .t { color: var(--ink); } .tk.done .r { color: var(--ink-2); }
.tk.done + .tk.done::before { content: ""; position: absolute; left: -12px; top: 23px; width: 24px; height: 1px; background: var(--dakwat); }
.tracker-row.all-done { background: repeating-linear-gradient(90deg, transparent 0 3px, color-mix(in srgb, var(--dakwat) 5%, transparent) 3px 4px); }
.tk.current { background: var(--white); border: 1.5px solid var(--tembaga); z-index: 1; }
.tk.current::after { content: ""; position: absolute; right: -1px; top: -1px; border-style: solid; border-width: 0 18px 18px 0; border-color: transparent var(--paper) var(--tembaga) transparent; filter: drop-shadow(-1px 1px 0 rgba(0,0,0,.08)); }
.tk.current .n { border-color: var(--tembaga); color: var(--tembaga); }
.tk.current .t { color: var(--ink); } .tk.current .r { color: var(--ink-2); }
.tk.rejected { background: var(--meterai-tint); border-color: var(--meterai); } .tk.rejected .t { color: var(--meterai); }

/* ---------- Modal: a sheet laid on the desk ---------- */
.has-modal { position: relative; }
.scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 42%, transparent); z-index: 50; }
.modal { position: absolute; z-index: 60; left: 50%; transform: translateX(-50%); background: var(--leaf); border: 1px solid var(--ink); border-radius: 4px; box-shadow: var(--sh-desk); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 16px; padding: 14px 24px; position: relative; background: var(--paper); }
.modal-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink); }
.modal-head .x { margin-left: auto; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 2px; background: var(--leaf); color: var(--ink-2); }
.modal-body { padding: 26px 28px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 18px 28px 22px; border-top: 1px solid var(--rule); background: var(--paper); }
.modal-foot .push { margin-left: auto; }

/* ---------- Annotation / signature blocks ---------- */
.annot { padding: 14px 0; padding: 14px 0; border-top: 1px solid var(--rule-soft); }
.annot .who { font: 600 11px/16px var(--f-ui); font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.annot .what { font: italic 400 16px/22px var(--f-display); margin: 3px 0 4px; }
.annot .when { font: 400 12px/1 var(--f-mono); color: var(--ink-3); border-top: 1px dotted var(--ink-3); padding-top: 6px; display: inline-block; }

/* ---------- Utility ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; }
.stack-8 > * + * { margin-top: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.kv dt { font: 600 11px/20px var(--f-ui); font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.kv dd { margin: 0; font-size: 13px; line-height: 20px; }

.kv.stack { grid-template-columns: 1fr; gap: 0; }
.kv.stack dt { line-height: 16px; margin-top: 8px; } .kv.stack dt:first-child { margin-top: 0; }
.kv.stack dd { font-size: 13px; line-height: 19px; }
.plate:not(.in-cart) .tick { display: none; }
.plate-act .btn { min-width: 0; padding: 0 10px; }
.tight { display: inline-flex; gap: 0; white-space: pre; }
.ledger.compact td { font-size: 13.5px; }

.ledger td.mono, .ledger .ref { white-space: nowrap; }
.cut { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--meterai); text-decoration-thickness: 1.5px; }

/* ---------- Polish pass: header ids, B banner, reset, subtab counts ---------- */
.simbar .reset { margin-left: 10px; height: 26px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid color-mix(in srgb, var(--bar-text) 35%, transparent); border-radius: 2px; background: transparent; color: var(--bar-text); font-size: 12px; }
.usercard .nm { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }

/* ---------- Records: the actionable request open as a folio, the rest filed as ledger entries ---------- */
.byline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-2); }
.byline strong { color: var(--ink); font-weight: 600; }
.byline .role { font: italic 400 16px/22px var(--f-display); color: var(--ink); }
.byline .dotsep { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); align-self: center; margin: 0 6px; }
.rec-open { position: relative; background: var(--white); border: 1px solid var(--ink); border-radius: 2px; box-shadow: var(--sh-desk); padding: 30px 32px 30px; margin-top: 8px; }
.rec-open::before { content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 5px; background: var(--tembaga); }
.ro-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.ro-head .eref { font: 500 28px/32px var(--f-mono); color: var(--dakwat-deep); letter-spacing: -.02em; }
.ro-head .byline { flex-basis: 100%; }
.ro-tuj { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 12px; align-items: baseline; margin: 18px 0 6px; }
.ro-tuj .marg { margin: 0; font-size: 19px; line-height: 27px; color: var(--ink); }
.rec-open .ledger td { font-size: 16px; line-height: 22px; padding: 16px 14px; }
.rec-open .ledger td.num { font-size: 16px; }
.rec-open .ledger thead th, .rec-filed .ledger thead th { font-size: 12px; padding-left: 14px; padding-right: 14px; }
.rec-open .ledger thead th::before, .rec-filed .ledger thead th::before { left: 14px; }
.rec-open .ledger thead th.num::before, .rec-filed .ledger thead th.num::before { left: auto; right: 14px; }
.rec-open .l2 { margin-top: 22px; padding: 18px 20px 20px; background: var(--dakwat-tint); border: 1px solid var(--dakwat); }
.l2row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; margin-top: 10px; }
.rec-open .tracker { margin-top: 26px; }
.rec-open .tk { min-height: 96px; padding: 14px 16px; }
.rec-open .tk .t { font-size: 15px; line-height: 20px; }
.rec-open .tk .r { font-size: 13px; line-height: 18px; }
.rec-open .tracker-head .micro { font-size: 12px; }
.filed-rule { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 14px; margin: 44px 0 0; color: var(--ink-3); }
.filed-rule::before, .filed-rule::after { content: ""; height: 5px; border-top: 1px solid var(--ink-3); border-bottom: 1px solid var(--ink-3); }
.tracker.mini .tracker-head { margin-bottom: 6px; }
.tracker.mini .tk { min-height: 0; padding: 10px 12px; display: grid; grid-template-columns: 24px minmax(0,1fr); column-gap: 10px; align-items: center; }
.tracker.mini .tk .n { grid-row: 1 / 3; margin: 0; }
.tracker.mini .tk .t { font-size: 14px; line-height: 18px; }
.tracker.mini .tk .r { font-size: 12.5px; line-height: 16px; margin: 0; }
.tracker.mini .tk.done + .tk.done::before { top: 50%; }

/* ---------- App additions (not in the static design): links, forms-as-buttons, flash, modal-as-page ---------- */
a { color: var(--dakwat-deep); }
a.btn, a.itab, a.cartbtn, a.subtab { text-decoration: none; }
a.cartbtn { color: var(--ink); }
button { cursor: pointer; }
.simbar form, .mast-end form, .inline-form { display: contents; }
.tracker-title { color: var(--ink); }
.plate-blank { width: 96px; height: 96px; display: grid; place-items: center; border: 1px dashed var(--rule); border-radius: 50%; color: var(--ink-3); margin-bottom: 14px; }
.flash { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; padding: 12px 16px; border: 1px solid var(--rule); border-top: 3px double var(--ink); background: var(--paper); font-size: 14px; }
.flash-ok svg { color: var(--buku); }
.flash-error { border-color: var(--meterai); background: var(--meterai-tint); }
.flash-error svg { color: var(--meterai); }
.field-error, .form-error { color: var(--meterai); font-size: 13px; line-height: 18px; }
.form-error { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--meterai); background: var(--meterai-tint); }
.page-actions { margin: 24px 0 0; }
.modal.is-page { position: relative; z-index: 0; left: auto; transform: none; max-width: 100%; margin: 8px auto 0; }
.modal-head .x { text-decoration: none; flex: none; }
.modal-head > div:not(.seal) { min-width: 0; overflow-wrap: break-word; }

/* ---------- Interaction states (app additions): focus, pending, screen-reader text ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:where(a, button, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--dakwat); outline-offset: 2px; }
.select:focus-visible, .textarea:focus-visible, .input:focus-visible { outline: 2px solid var(--dakwat); outline-offset: 1px; box-shadow: 0 0 0 5px var(--focus-ring); }
.btn:disabled { cursor: progress; }
.btn.is-pending { cursor: progress; opacity: .75; }
.btn.is-pending svg { animation: pending-pulse 1s ease-in-out infinite; }
@keyframes pending-pulse { 50% { opacity: .25; } }

/* ---------- Quantity stepper (ui/forms.ts qtyStepper; behaviour in app.js) ---------- */
.qty-step { display: inline-flex; align-items: stretch; height: 34px; border: 1px solid var(--ink); border-radius: 2px; background: var(--white); }
.qs-btn { width: 34px; flex: none; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--ink-2); touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.qs-btn svg { pointer-events: none; }
.qs-btn:hover { background: var(--paper); color: var(--ink); }
.qs-btn:active { background: var(--dakwat-tint); color: var(--dakwat); }
.qs-btn:focus-visible, .qs-box:focus-visible { outline: 2px solid var(--dakwat); outline-offset: -2px; }
.qs-box { width: 48px; min-width: 0; flex: 1 1 48px; padding: 0 2px; border: 0; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); background: transparent; text-align: center; font: 500 14px/1 var(--f-mono); }
.subtabs { display: flex; gap: 0; border-bottom: 1px solid var(--ink); margin-bottom: 28px; }
.subtab { display: inline-flex; align-items: center; gap: 9px; height: 48px; padding: 0 20px; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; font-weight: 500; font-size: 14px; color: var(--ink-2); background: transparent; border-radius: 3px 3px 0 0; }
.subtab.is-active { background: var(--leaf); border-color: var(--ink); color: var(--ink); font-weight: 600; box-shadow: inset 0 3px 0 var(--dakwat); }
.subtab .cnt { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--meterai); color: var(--white); font: 600 11px/20px var(--f-ui); text-align: center; }
.subtab.is-active .cnt { background: var(--dakwat); }
.subtab .pc { font: 600 13px/1 var(--f-mono); color: var(--meterai); padding: 0 1px; }
.subtab.is-active .pc { color: var(--dakwat); }
@media (scripting: enabled) {
  .qs-box { appearance: textfield; -moz-appearance: textfield; }
  .qs-box::-webkit-inner-spin-button, .qs-box::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
}
/* Without JS the -/+ buttons could not do anything: hide them and keep the browser's own number field. */
@media (scripting: none) { .qs-btn { display: none; } .qs-box { border: 0; width: 72px; } }

/* ---------- Cart badge bump + toasts (app.js) ---------- */
.badge.is-bumped { animation: badge-bump .5s var(--ease); }
@keyframes badge-bump { 35% { transform: scale(1.35); } }
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { margin: 0; padding: 12px 18px; border-radius: 2px; background: var(--ink); color: var(--white); box-shadow: var(--sh-desk); font-size: 14px; line-height: 20px; text-align: center; pointer-events: auto; animation: toast-in .22s var(--ease); }
.toast-error { background: var(--meterai); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .badge.is-bumped, .toast, .btn.is-pending svg { animation: none; } }

/* ---------- Tables scroll inside their own box on narrow windows (ui/components.ts tableScroll) ---------- */
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll.can-right { mask-image: linear-gradient(to right, black calc(100% - 48px), transparent); }
.table-scroll.can-left { mask-image: linear-gradient(to left, black calc(100% - 48px), transparent); }
.table-scroll.can-left.can-right { mask-image: linear-gradient(to right, transparent, black 48px, black calc(100% - 48px), transparent); }

/* =====================================================================
   Responsive. >=1440 is the design as drawn; each step below only takes away.
   1280-1439 tighter frame | 1024-1279 compact masthead | 768-1023 rail becomes a tab bar | <768 single column
   ===================================================================== */
@media (max-width: 1439px) {
  .frame { grid-template-columns: 200px minmax(0,1fr); padding-right: 28px; }
  .rail { padding-left: 16px; }
  .itab { gap: 10px; padding: 10px 14px; }
  .foot { margin: 0 28px; padding-left: 172px; }
  .sheet { --sp-r: 40px; --sp-l: 56px; --rule-x: 28px; }
  .ledger thead th { padding-left: 12px; padding-right: 12px; }
  .ledger thead th::before { left: 12px; }
  .ledger thead th.num::before { right: 12px; }
  .ledger td { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 1279px) {
  .simbar, .masthead { padding-left: 24px; padding-right: 24px; }
  .simbar .roles { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(to right, black calc(100% - 28px), transparent); }
  .simbar .roles::-webkit-scrollbar { display: none; }
  .simbar .role { flex: none; }
  .masthead { gap: 16px; }
  .cartbtn { padding: 0 12px; }
  .logout { width: 40px; padding: 0; justify-content: center; }
  .frame { padding-right: 24px; }
  .itab { padding: 10px 12px; font-size: 13.5px; }
  /* Below the 1280 layout a table keeps (at least) its 1280 width and scrolls; --table-min lowers it for small tables. */
  .table-scroll > table { min-width: var(--table-min, 920px); }
  .rq-ledger .table-scroll > table { min-width: 0; }
  .modal .table-scroll { --table-min: 680px; }
  .rec-open .table-scroll { --table-min: 620px; }
  .tracker.mini .tracker-row { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .tracker.mini .tk { margin-bottom: -1px; }
  .tracker.mini .tk.done + .tk.done::before { display: none; }
  .foot { margin: 0 24px; padding-left: 176px; }
}
@media (max-width: 1023px) {
  .simbar { gap: 10px; padding: 0 16px; }
  .masthead { height: auto; flex-wrap: wrap; row-gap: 10px; padding-top: 14px; padding-bottom: 19px; }
  .crest { width: 48px; height: 48px; }
  .usercard .nm span { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
  .frame { grid-template-columns: minmax(0,1fr); padding: 0 24px; }
  .rail { padding: 20px 0 0; display: block; }
  .rail nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; position: relative; z-index: 2; }
  .rail nav::-webkit-scrollbar { display: none; }
  .itab { flex: none; min-height: 48px; margin: 0; padding: 8px 16px; white-space: nowrap; border-right: 1px solid var(--rule); border-radius: 3px 3px 0 0; }
  .itab .ix { font-size: 18px; width: auto; }
  .itab.is-active { margin: 0; border-bottom-color: var(--leaf); box-shadow: none; }
  .itab.is-active::before { left: -1px; right: -1px; top: -1px; bottom: auto; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .sheet { margin-top: 0; border-radius: 0 0 4px 4px; min-height: 0; }
  .foot { margin: 0 24px; padding-left: 0; }
  .modal-foot { flex-wrap: wrap; }
  .tracker-row { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .tk { margin-bottom: -1px; }
  .tk.done + .tk.done::before { display: none; }
}
@media (max-width: 767px) {
  body { font-size: 15px; }
  .h1 { font-size: 28px; line-height: 34px; }
  .h2 { font-size: 21px; line-height: 27px; }
  .display { font-size: 40px; line-height: 44px; }
  .lede { font-size: 15px; line-height: 24px; }
  .simbar { padding: 0 12px; }
  .masthead { gap: 10px; padding: 10px 12px 15px; }
  .crest { width: 40px; height: 40px; }
  .wordmark .go { font-size: 27px; }
  .mast-end { gap: 8px; }
  .cartbtn { height: 40px; padding: 0 10px; gap: 6px; }
  .usercard { padding-left: 8px; }
  .usercard .av + div { display: none; }
  .frame { padding: 0 8px; }
  .rail { padding-top: 12px; }
  .itab { min-height: 44px; padding: 8px 12px; gap: 8px; }
  .sheet { --sp-t: 22px; --sp-r: 16px; --sp-b: 32px; --sp-l: 28px; --rule-x: 12px; margin-bottom: 24px; }
  .pagehead { grid-template-columns: minmax(0,1fr); gap: 16px; padding-bottom: 18px; margin-bottom: 20px; }
  .note { grid-template-columns: 40px minmax(0,1fr); gap: 12px; padding: 16px; }
  .note .seal { width: 40px; height: 40px; }
  .tracker-row, .tracker.mini .tracker-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .modal-head { padding: 18px 16px 16px; gap: 12px; }
  .modal-head .seal { display: none; }
  .modal-body { padding: 20px 16px; }
  .modal-foot { padding: 14px 16px 18px; }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-foot .push { display: none; }
  .btn { white-space: normal; text-align: center; height: auto; min-height: 44px; padding-top: 8px; padding-bottom: 8px; line-height: 18px; }
  .btn-sm { min-height: 40px; }
  .input, .select, .textarea { font-size: 16px; }
  .row { flex-wrap: wrap; }
  .rec-open { padding: 20px 16px; }
  .ro-tuj { grid-template-columns: minmax(0,1fr); gap: 4px; }
  .l2row { grid-template-columns: minmax(0,1fr); }
  .foot { margin: 0 12px; grid-template-columns: minmax(0,1fr); }
}
/* Phones and touch screens: every quantity button is a real finger target. */
@media (max-width: 767px), (pointer: coarse) {
  .qty-step { height: 44px; }
  .qs-btn { width: 44px; }
  .qs-box { width: 56px; font-size: 16px; }
}
@media (max-width: 767px) {
  .subtabs { overflow-x: auto; scrollbar-width: none; }
  .subtab { flex: none; padding: 0 14px; }
  .rq-ledger th:nth-child(3), .rq-ledger td:nth-child(3) { display: none; }
  .rq-serahan th:nth-child(1), .rq-serahan td:nth-child(1), .rq-serahan th:nth-child(4), .rq-serahan td:nth-child(4) { display: none; }
  .rq-serahan th:nth-child(3), .rq-serahan td:nth-child(3) { display: table-cell; }
  .rq-serahan th, .rq-serahan td { padding-left: 8px; padding-right: 8px; }
  .rq-serahan td .small { display: none; }
  .rq-serahan .thumbs { gap: 8px; max-width: 96px; }
  .rq-serahan table { table-layout: fixed; width: 100%; }
  .rq-serahan th:nth-child(3) { width: 108px; }
  .rq-serahan th:nth-child(5) { width: 92px; }
  .rq-serahan .narrow-only { display: block; margin-top: 4px; font-size: 11px; overflow-wrap: anywhere; }
}
