/* Sistem OC Lampu Jalan — MBSP navy + crest gold. Light and dark. */

@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/IBMPlexSans-var.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/IBMPlexMono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/IBMPlexMono-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #eef1f6; --surface: #ffffff; --surface-2: #f4f6fa; --line: #d6dde8; --line-strong: #b5c1d2;
  --fg: #111c2e; --muted: #53627a; --brand: #0d2650; --brand-2: #183a6e; --brand-fg: #ffffff;
  --rail: #091c3d; --rail-fg: #e8eef8; --gold: #e3b10b; --gold-ink: #3a2c00; --gold-soft: #fdf3cf;
  --accent: #1a4a8f; --accent-strong: #123a73; --accent-soft: #e2ebf8; --accent-fg: #ffffff;
  --ok: #16803c; --ok-soft: #ddf3e4; --bad: #c0352b; --bad-soft: #fbe4e1; --warn: #a35f05; --warn-soft: #fdf0d5;
  --info: #2457a6; --info-soft: #e1ebfa; --mute-soft: #e7ebf2;
  --shadow: 0 1px 2px rgba(13, 38, 80, .06), 0 4px 14px rgba(13, 38, 80, .07);
  --f-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 10px; --fs: 15px; --bw: 1px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #08111f; --surface: #0f1b2e; --surface-2: #14233a; --line: #22344f; --line-strong: #35507a;
  --fg: #e4ebf5; --muted: #97a6bd; --brand: #071530; --brand-2: #10264a; --brand-fg: #eef3fb;
  --rail: #050f22; --rail-fg: #dfe7f5; --gold: #f2c230; --gold-ink: #2b2000; --gold-soft: #3a2f0a;
  --accent: #6f9fe6; --accent-strong: #8db4ee; --accent-soft: #16294a; --accent-fg: #06142b;
  --ok: #4cc277; --ok-soft: #123222; --bad: #f07b70; --bad-soft: #3a1714; --warn: #e7a948; --warn-soft: #3a2a0d;
  --info: #7ea8ef; --info-soft: #152844; --mute-soft: #1b2a40;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #08111f; --surface: #0f1b2e; --surface-2: #14233a; --line: #22344f; --line-strong: #35507a;
  --fg: #e4ebf5; --muted: #97a6bd; --brand: #071530; --brand-2: #10264a; --brand-fg: #eef3fb;
  --rail: #050f22; --rail-fg: #dfe7f5; --gold: #f2c230; --gold-ink: #2b2000; --gold-soft: #3a2f0a;
  --accent: #6f9fe6; --accent-strong: #8db4ee; --accent-soft: #16294a; --accent-fg: #06142b;
  --ok: #4cc277; --ok-soft: #123222; --bad: #f07b70; --bad-soft: #3a1714; --warn: #e7a948; --warn-soft: #3a2a0d;
  --info: #7ea8ef; --info-soft: #152844; --mute-soft: #1b2a40;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25); color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-ui); font-size: var(--fs); line-height: 1.5; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; line-height: 1.25; }
p { margin: 0 0 12px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .87em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- header ---------- */
.topbar { background: var(--brand); color: var(--brand-fg); border-bottom: 3px solid var(--gold); padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar .brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.topbar .brand img { width: 42px; height: 42px; object-fit: contain; flex: none; }
.topbar .brand b { display: block; font-size: 17px; letter-spacing: .07em; text-transform: uppercase; }
.topbar .brand small { display: block; font-size: 12px; opacity: .78; }
.topbar .right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 8px; background: var(--brand-2); border-radius: 99px; padding: 4px 12px 4px 4px; font-size: 13px; }
.who .av { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; font: 700 11px var(--f-mono); }
.who small { display: block; font-size: 11px; opacity: .75; line-height: 1.1; }
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand-2); color: inherit; text-decoration: none; }
.bell:hover, .bell[aria-current] { background: var(--gold); color: var(--gold-ink); }
.bell .count { position: absolute; top: -3px; right: -5px; background: var(--bad); color: #fff; border-radius: 99px; font: 700 10.5px var(--f-mono); padding: 1px 5px; border: 2px solid var(--brand); }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li + li { border-top: 1px solid var(--line); }
.notif-list a { display: grid; gap: 3px; padding: 12px 16px; color: inherit; text-decoration: none; }
.notif-list a:hover { background: var(--surface-2); }
.notif-list .unread a { border-left: 3px solid var(--info); padding-left: 13px; }
.notif-list .unread b { font-weight: 700; }
.notif-list .meta { font-size: 12px; color: var(--muted); }
.themesw { display: inline-flex; border: 1px solid rgba(255, 255, 255, .3); border-radius: 99px; overflow: hidden; }
.themesw button { border: 0; background: transparent; color: inherit; font-size: 12.5px; padding: 5px 10px; cursor: pointer; }
.themesw button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.linkbtn { background: none; border: 1px solid rgba(255, 255, 255, .3); color: inherit; border-radius: 99px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.rail { background: var(--rail); padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; gap: 8px; overflow-x: auto; }
.rail a { color: var(--rail-fg); text-decoration: none; border-radius: 99px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; white-space: nowrap; background: rgba(255, 255, 255, .1); display: inline-flex; gap: 8px; align-items: center; }
.rail a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); }
.rail .count { background: var(--bad); color: #fff; border-radius: 99px; font: 700 11px var(--f-mono); padding: 1px 7px; }

/* ---------- page ---------- */
main.page { max-width: 1280px; margin: 0 auto; padding-block: 22px 60px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page-head { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; letter-spacing: -.01em; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 75ch; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h2, .card-h h3 { font-size: 16px; }
.card-b { padding: 16px 18px; }
.card.narrow { max-width: 520px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 22px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 12.5px; color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: var(--bw) solid var(--line-strong); background: var(--surface); color: var(--fg); border-radius: 8px; padding: 8px 16px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { border: var(--bw) solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 9px 12px; width: 100%; }
.field input[type="file"] { padding: 7px 10px; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .hint.warn { color: var(--warn); font-weight: 600; }
.field .err { font-size: 12.5px; color: var(--bad); font-weight: 600; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 4px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; margin-bottom: 10px; padding: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.mute { background: var(--mute-soft); color: var(--muted); }
.tag { display: inline-block; font: 600 10.5px var(--f-mono); letter-spacing: .05em; text-transform: uppercase; border-radius: 4px; padding: 1px 6px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert p { margin: 2px 0 0; color: var(--fg); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; text-decoration: none; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--gold); }
.tabs a .n { font: 600 12px var(--f-mono); color: var(--muted); margin-left: 4px; }

.scroll-x { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 10px 14px; text-align: left; vertical-align: middle; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tbody tr:hover { background: var(--surface-2); }
.sub, .tbl .sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.empty { padding: 32px 18px; text-align: center; color: var(--muted); }

.secret { font: 600 18px var(--f-mono); letter-spacing: .04em; background: var(--gold-soft); color: var(--fg); border: 1px dashed var(--gold); border-radius: 8px; padding: 10px 14px; display: inline-block; user-select: all; }
.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 18px; flex-wrap: wrap; }

/* ---------- guest (login / register) ---------- */
.guest { min-height: 100vh; display: flex; flex-direction: column; }
.guest .topbar { justify-content: space-between; }
.guest main { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding-block: 40px 60px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.guest .card { width: 100%; max-width: 440px; }
.guest .card.wide { max-width: 760px; }
.guest h1 { font-size: 22px; }
.foot-note { text-align: center; color: var(--muted); font-size: 12.5px; padding: 16px; }


@media (max-width: 640px) {
  .topbar .brand small { display: none; }
  .who small { display: none; }
  .page-head h1 { font-size: 21px; }
}
.stat { font-size: 32px; font-weight: 600; letter-spacing: -.02em; margin: 2px 0; }
a.card { color: inherit; text-decoration: none; display: block; }
a.card:hover { border-color: var(--accent); }
/* Checkbox rows inside a .field: keep the box its natural size and the text readable. */
.field .check { font-size: 14px; font-weight: 400; color: var(--fg); }
.field .check input { width: auto; flex: none; padding: 0; }
a.linkbtn { text-decoration: none; display: inline-block; }

/* ---------- Phase 2: applications and units ---------- */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.choice-card { border: var(--bw) solid var(--line-strong); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.choice-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-card.off { opacity: .6; }
.choice-card .tag { align-self: flex-start; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { display: flex; gap: 8px; align-items: flex-start; border: var(--bw) solid var(--line-strong); border-radius: 8px; padding: 10px; cursor: pointer; }
.choice input { margin-top: 4px; }
.choice small { display: block; color: var(--muted); font-size: 12px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 520px) { .choice-row { grid-template-columns: 1fr; } }

.section-title { font-size: 18px; margin: 24px 0 12px; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 18px; }
.unit-card { background: var(--surface); border: var(--bw) solid var(--line); border-top: 4px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.unit-card.status-awaiting_schedule { border-top-color: var(--info); }
.unit-card h3 { font-size: 18px; }
.unit-card p { margin: 0; }
.stats { display: flex; gap: 14px; color: var(--muted); }
.stats b { color: var(--fg); }
.mini-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: 11.5px; color: var(--muted); }
.mini-steps li { border-top: 4px solid var(--mute-soft); padding-top: 3px; }
.mini-steps li.done { border-top-color: var(--ok); color: var(--fg); }
progress.meter { width: 100%; height: 10px; accent-color: var(--ok); }
.w-num { width: 80px; }
.num-input { width: 96px; border: var(--bw) solid var(--line-strong); border-radius: 6px; padding: 6px 8px; background: var(--surface); }
.grid-tbl td, .grid-tbl th { text-align: center; }
.grid-tbl td:first-child, .grid-tbl th:first-child { text-align: left; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.align-start { align-items: start; }
.lamp-tbl td { padding: 6px 8px; }

.wz { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 1060px) { .wz { grid-template-columns: 1fr; } }
.wz-side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 14px; }
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.stepper a { display: flex; gap: 10px; align-items: center; padding: 14px 12px; text-decoration: none; color: var(--fg); border-bottom: 3px solid transparent; min-width: 0; }
.stepper a[aria-current="step"] { border-bottom-color: var(--gold); }
.stepper .dot { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 600 13px var(--f-mono); border: 2px solid var(--line-strong); color: var(--muted); }
.stepper a.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.stepper a[aria-current="step"] .dot { border-color: var(--gold); }
.stepper .t { font-weight: 600; font-size: 14px; line-height: 1.2; }
.stepper .t small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
@media (max-width: 700px) { .stepper .t small { display: none; } .stepper a { flex-direction: column; justify-content: flex-start; text-align: center; padding: 10px 4px; gap: 5px; } .stepper .t { font-size: 11.5px; overflow-wrap: anywhere; hyphens: auto; } }
.todo { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.todo li { padding-left: 26px; position: relative; }
.todo li::before { content: "!"; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); font: 700 11px var(--f-mono); display: grid; place-items: center; }
.todo li.ok::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.todo li.later::before { content: "…"; background: var(--info-soft, #e8f0fb); color: var(--info, #1d4ed8); }

.legend-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line); }
.save-status { margin-left: auto; font-weight: 600; color: var(--ok); }
.save-status.bad, [data-photo-status].bad, [data-doc-status].bad { color: var(--bad); }
[data-doc-status]:empty { display: none; }
.tag-wajib { border-color: var(--bad); color: var(--bad); }
.acc { border-top: 1px solid var(--line); }
.acc-h { display: flex; justify-content: space-between; gap: 10px; padding: 12px 18px; background: var(--surface-2); font-size: 15px; }
.it { border-top: 1px solid var(--line); padding: 12px 18px; }
.it:target { background: var(--gold-soft); }
.ih { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.ih .k { color: var(--muted); padding-top: 2px; font-weight: 600; }
.ih .need { display: block; font-size: 12px; color: var(--warn); font-weight: 600; margin-top: 2px; }
.ih .err { display: block; }
@media (max-width: 640px) { .ih { grid-template-columns: 32px minmax(0, 1fr); } .ih .seg { grid-column: 2; } }
.seg { display: inline-flex; border: var(--bw) solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { min-width: 42px; height: 36px; display: grid; place-items: center; font-weight: 700; cursor: pointer; color: var(--muted); background: var(--surface); }
.seg label + input + label { border-left: 1px solid var(--line-strong); }
.seg input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: -2px; }
.seg input:checked + label.seg-ok { background: var(--ok); color: #fff; }
.seg input:checked + label.seg-x { background: var(--bad); color: #fff; }
.seg input:checked + label.seg-na { background: var(--muted); color: var(--surface); }
.seg input:disabled + label { opacity: .35; cursor: not-allowed; }
.it-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 0 52px; }
.it-row input:not([type="radio"]) { border: var(--bw) solid var(--line-strong); border-radius: 6px; padding: 6px 8px; background: var(--surface); min-width: 0; }
.it-extra { margin: 8px 0 0 52px; }
.it-extra summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13.5px; }
.it-extra textarea { width: 100%; border: var(--bw) solid var(--line-strong); border-radius: 6px; padding: 6px 8px; background: var(--surface); margin-top: 8px; }
@media (max-width: 640px) { .it-row, .it-extra { margin-left: 0; } }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photo { margin: 0; position: relative; }
.photo img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.photo figcaption { font-size: 10.5px; color: var(--muted); }
.photo-del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; cursor: pointer; font-weight: 700; line-height: 22px; padding: 0; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; }
html.js .nojs-only { display: none; }

.doc-group { font-size: 15px; margin-top: 8px; }
.doc { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: start; border: var(--bw) solid var(--line); border-radius: 8px; padding: 12px 14px; }
.doc.off { opacity: .6; }
.doc .n { width: 28px; height: 28px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-weight: 600; }
.doc .t { font-weight: 600; }
.doc .d { font-size: 13px; color: var(--muted); }
.doc .file { margin-top: 6px; overflow-wrap: anywhere; }
.doc-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.doc-form input[type="date"] { border: var(--bw) solid var(--line-strong); border-radius: 6px; padding: 5px 8px; background: var(--surface); }
.doc-form input[type="file"] { max-width: 100%; }
.linkhint { color: var(--info); margin-top: 6px; }
@media (max-width: 640px) { .doc { grid-template-columns: 28px minmax(0, 1fr); } .doc-status { grid-column: 2; } }
.declaration { border: var(--bw) solid var(--line); border-radius: 8px; padding: 12px 14px; }

/* Phase 3: MBSP queue, deadlines, inspection, fixes */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis a.card { text-decoration: none; color: inherit; }
.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }
.deadline { display: inline-flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.queue tr.late td { background: var(--bad-soft); }
.queue td .sub { display: block; }
.prev { border-left: 3px solid var(--warn); padding: 6px 10px; margin: 8px 0 0; background: var(--warn-soft); border-radius: 4px; }
.prev .sub { display: block; }
.it .ih .t .sub { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.acc-h .row { gap: 8px; flex-wrap: nowrap; }
fieldset.approve { border: var(--bw) solid var(--ok); border-radius: 8px; padding: 12px 14px; margin: 0; }
fieldset.approve legend { font-weight: 700; color: var(--ok); padding: 0 6px; }
.review-form { margin-top: 8px; flex-wrap: wrap; }
.review-form input { flex: 1 1 180px; min-width: 0; border: var(--bw) solid var(--line-strong); border-radius: 6px; padding: 5px 8px; background: var(--surface); color: var(--fg); }
.inline-form input { width: 14em; max-width: 100%; border: var(--bw) solid var(--line-strong); border-radius: 6px; padding: 4px 8px; background: var(--surface); color: var(--fg); font: inherit; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history li { border-left: 3px solid var(--line-strong); padding-left: 10px; }
.history .sub { display: block; }
.unit-card .deadline { margin-bottom: 4px; }
@media (max-width: 640px) { .acc-h { flex-wrap: wrap; gap: 6px; } }
/* The queue becomes a list of cards on phones, so Tindakan is always visible. */
@media (max-width: 700px) {
  .queue thead { display: none; }
  .queue, .queue tbody, .queue tr, .queue td { display: block; width: 100%; }
  .queue tr { border-bottom: 1px solid var(--line); padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .queue td { padding: 0; border: 0; }
  .queue td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .queue td[data-label="Skim"], .queue td[data-label="Status"], .queue td[data-label="Tindakan"] { grid-column: 1 / -1; }
  .queue td[data-label="Tindakan"]::before { display: none; }
  .queue td.r { text-align: left; }
  .queue td.r .btn { width: 100%; }
}
.stack > .todo { padding: 0; margin: 0; }
@media (max-width: 640px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }
.member-req { border: var(--bw) solid var(--line); border-radius: 8px; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
.member-req .sub { display: block; }
.search-input { border: var(--bw) solid var(--line-strong); border-radius: 6px; padding: 6px 10px; background: var(--surface); color: var(--fg); font: inherit; min-width: 14em; }

/* Stage 2: mixed lamp types, pelan pindaan, MBSP firm check */
.choice-type { display: flex; flex-direction: column; gap: 8px; }
.choice-type .field { max-width: 180px; }
.amend { gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.amend:last-of-type { border-bottom: 0; }
.amend-add { margin-top: 8px; }
.amend-add summary { cursor: pointer; color: var(--accent); font-size: 13.5px; }
.amend-add form { margin-top: 10px; }
.firm-check { margin-bottom: 16px; }
.firm-check.check-update_requested { border-color: var(--warn); }
.firm-check.check-pending { border-color: var(--info); }
.add-units { flex-wrap: wrap; align-items: center; }
.add-units .field { margin: 0; }

/* Stage 3: pole map and list */
.pole-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .pole-layout { grid-template-columns: 1fr; } }
.pole-map { height: 460px; border-radius: var(--r); border: var(--bw) solid var(--line); background: var(--surface-2); }
@media (max-width: 700px) { .pole-map { height: 340px; } }
.pole-map-tools { flex-wrap: wrap; align-items: center; }
.seg input:checked + label.seg-pick { background: var(--accent); color: var(--accent-fg); }
.pole-tbl tr.on td { background: var(--accent-soft); }
.photo-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pole-photo { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pole-photo img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.pole-pin { position: relative; }
.pole-pin .dot { position: absolute; left: 4px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.pole-pin.on .dot { background: var(--gold); }
.pole-pin.draft .dot { background: var(--warn); }
.pole-pin .arrow { position: absolute; left: 11px; top: -10px; width: 4px; height: 16px; background: var(--fg); border-radius: 2px; transform-origin: 2px 23px; }
.pole-pin .knob { position: absolute; left: -6px; top: -8px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #1f2937; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); cursor: grab; touch-action: none; }
.pole-pin .knob:active { cursor: grabbing; }
.pole-pin.rot .arrow { z-index: 2; }
.pole-pin .no { position: absolute; left: 26px; top: 2px; font: 700 11px/1 var(--f-mono, monospace); background: var(--surface); color: var(--fg); padding: 2px 4px; border-radius: 4px; white-space: nowrap; box-shadow: 0 0 0 1px var(--line); }
.fp-pin { width: 18px; height: 18px; background: var(--gold); border: 2px solid var(--brand); transform: rotate(45deg); }

/* Stage 4: A1 angle slots, pole summary, section F */
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.slot { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.slot.done { border-style: solid; border-color: var(--ok); }
.sample summary { cursor: pointer; font-size: 12.5px; color: var(--accent); }
.sample img { display: block; margin-top: 6px; width: 200px; height: auto; border-radius: 6px; border: 1px solid var(--line); }
.pole-summary { margin: 12px 16px 0; padding: 12px; border-radius: 8px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 8px; }
.kv.compact > div { padding: 2px 0; }
.finding { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.finding.open { border-color: var(--warn); }
.finding.closed { opacity: .75; }

/* Stage 5: hard copies */
.doc-status { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 640px) { .doc-status { align-items: flex-start; } }

/* Stage 7: Panduan (carta alir) */
.panduan-card { margin-top: 16px; }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-width: 820px; }
.fl-step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding-bottom: 22px; break-inside: avoid; }
.fl-step:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 4px; width: 2px; background: var(--line-strong); }
.fl-step:not(:last-child)::after { content: ""; position: absolute; left: 12px; bottom: 2px; border: 5px solid transparent; border-top: 7px solid var(--line-strong); border-bottom: 0; }
.fl-no { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font: 700 14px var(--f-mono); flex: none; }
.fl-node { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; background: var(--surface); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.fl-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; justify-content: space-between; }
.fl-kind { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.fl-where { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.fl-where::before { content: "Menu: "; color: var(--muted); font-weight: 400; }
.fl-body { margin: 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 3px; }
.fl-branches { display: flex; flex-wrap: wrap; gap: 6px; }
.fl-br { font-size: 13px; border-radius: 6px; padding: 4px 9px; }
.fl-br.yes { background: var(--ok-soft); color: var(--ok); }
.fl-br.no { background: var(--warn-soft); color: var(--warn); }
.fl-loop { font-size: 13px; font-weight: 600; color: var(--warn); }
.fl-start .fl-no, .fl-end .fl-no { background: var(--brand); color: var(--brand-fg); }
.fl-start .fl-node, .fl-end .fl-node { border-left-color: var(--brand); border-radius: 20px; }
.fl-end .fl-node { background: var(--ok-soft); border-left-color: var(--ok); }
.fl-decision .fl-no { background: var(--gold); color: var(--gold-ink); border-radius: 4px; transform: rotate(45deg) scale(.85); }
.fl-decision .fl-no > span { display: inline-block; transform: rotate(-45deg); }
.fl-decision .fl-node { border-left-color: var(--gold); }
.fl-system .fl-no { background: var(--mute-soft); color: var(--muted); }
.fl-system .fl-node { border-left-color: var(--muted); background: var(--surface-2); }
.fl-other .fl-no { background: var(--surface); color: var(--muted); border: 2px dashed var(--line-strong); }
.fl-other .fl-node { border-style: dashed; border-left-style: solid; border-left-color: var(--line-strong); background: var(--surface-2); }
.lanes { border-collapse: separate; border-spacing: 6px; min-width: 760px; width: 100%; font-size: 13.5px; }
.lanes thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; padding: 4px 6px; }
.lanes tbody th { text-align: left; white-space: nowrap; font-weight: 600; display: flex; align-items: center; gap: 8px; padding-right: 6px; }
.lanes tbody th .fl-no { width: 26px; height: 26px; font-size: 12px; }
.lanes td { vertical-align: top; width: 23%; }
.lane-box { display: block; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.lane-perunding { border-left: 4px solid var(--accent); }
.lane-mbsp { border-left: 4px solid var(--gold); }
.lane-admin { border-left: 4px solid var(--brand-2); }
.lane-sistem { border-left: 4px solid var(--muted); background: var(--surface-2); }
.status-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 8px 24px; }
.status-legend li { display: grid; grid-template-columns: 290px auto; gap: 10px; align-items: center; }
.status-legend .chip { justify-self: start; }
@media (max-width: 640px) { .status-legend { grid-template-columns: 1fr; } .status-legend li { grid-template-columns: 1fr; gap: 2px; } }
.print-doc { background: #fff; color: var(--fg); max-width: 900px; margin: 0 auto; padding: 24px 16px 40px; }
.print-doc h2 { font-size: 18px; margin: 22px 0 8px; }
.print-bar { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.print-head { display: flex; gap: 16px; align-items: center; border-bottom: 3px solid var(--gold); padding-bottom: 14px; }
.print-head img { width: 64px; height: auto; }
.print-head h1 { font-size: 24px; margin: 2px 0; }
.print-head small { color: var(--muted); }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  .no-print { display: none !important; }
  .print-doc { max-width: none; padding: 0; }
  .print-page + .print-page { break-before: page; }
  .lanes { min-width: 0; font-size: 11.5px; }
  .fl-step { padding-bottom: 14px; }
  .fl-body { font-size: 12.5px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Username login: show-password toggle */
.reveal-wrap { position: relative; display: block; }
.reveal-wrap input { width: 100%; padding-right: 84px; }
.reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; padding: 6px 8px; }

/* Account menu in the top bar */
.acct { position: relative; }
.acct > summary { list-style: none; cursor: pointer; user-select: none; }
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover, .acct[open] > summary { box-shadow: 0 0 0 2px var(--gold); }
.acct .caret { width: 0; height: 0; border: 5px solid transparent; border-top: 6px solid currentColor; border-bottom: 0; margin-left: 2px; opacity: .8; transition: transform .15s; }
.acct[open] .caret { transform: rotate(180deg); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 1000; width: 270px; max-width: calc(100vw - 24px); background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 28px rgba(0, 0, 0, .18); padding: 6px; display: flex; flex-direction: column; }
.acct-id { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.acct-id b { color: var(--fg); font-size: 14px; }
.acct-menu > a, .acct-menu button[type="submit"] { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; color: var(--fg); text-decoration: none; font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; }
.acct-menu > a:hover, .acct-menu button[type="submit"]:hover { background: var(--surface-2); }
.acct-menu form { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.acct-menu form button[type="submit"] { color: var(--bad); font-weight: 600; }
.acct-theme { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 10px; font-size: 14px; }
.acct-theme .themesw { border-color: var(--line-strong); display: flex; }
.acct-theme .themesw button { color: var(--fg); flex: 1; padding: 6px 8px; }
.coord-map { height: 340px; border-radius: var(--r); border: var(--bw) solid var(--line); background: var(--surface-2); }
@media (max-width: 700px) { .coord-map { height: 280px; } }

/* Skim page: one summary card per lamp type, then type tabs */
.type-sums { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 8px; }
.type-sum.on { border-color: var(--gold); }
.type-sum h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.status-counts { flex-wrap: wrap; gap: 6px; }
.sum-nums { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; }
.sum-nums dt { font-size: 12px; color: var(--muted); }
.sum-nums dd { margin: 0; font-size: 20px; font-weight: 600; }
.watts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; }
.type-tabs { margin: 18px 0 4px; }
.type-group > .section-title { flex-wrap: wrap; gap: 10px; }
.type-group > .section-title h2 { font-size: 18px; margin: 0; }
@media (max-width: 520px) { .sum-nums { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.type-counts { display: flex; flex-direction: column; gap: 4px; }
.type-counts a { color: inherit; text-decoration: none; white-space: nowrap; }
.type-counts a:hover b { text-decoration: underline; }

/* Percentage through the OC journey (x-progress) */
.pct { display: grid; gap: 3px; min-width: 120px; }
.pct > summary { display: grid; gap: 3px; cursor: pointer; list-style: none; }
.pct > summary::-webkit-details-marker { display: none; }
.pct .meter { height: 8px; accent-color: var(--info); }
.pct.ok .meter { accent-color: var(--ok); }
.pct.warn .meter { accent-color: var(--warn); }
.pct-n { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pct-n b { color: var(--fg); font-size: 13.5px; }
.pct-steps { margin: 2px 0 0; color: var(--muted); }
.pct.lg .meter { height: 12px; }
.pct.lg .pct-n b { font-size: 20px; }
.sum-head { flex-wrap: wrap; gap: 10px; align-items: center; }
.sum-head h2 { font-size: 18px; margin: 0; }
.sum-overall { display: grid; gap: 2px; width: min(320px, 100%); }
.w-pct { min-width: 150px; }
.doc-ticks { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 10px; }

/* Collapsible sections (x-fold): title + status chips in the header; finished sections start closed. */
.fold > summary { list-style: none; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold-h { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--surface-2); }
.fold-h::before { content: "▸"; flex: none; color: var(--muted); font-size: 13px; transition: transform .15s; }
.fold[open] > .fold-h::before { transform: rotate(90deg); }
.fold-h:hover { background: var(--mute-soft); }
.fold-h:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fold-t { margin: 0; font-size: 15px; flex: 1; min-width: 0; }
.fold-t .sub { display: block; font-weight: 400; }
.fold-s { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.fold.card { padding: 0; overflow: hidden; }
.fold.card > .fold-h { background: transparent; border-bottom: 1px solid transparent; }
.fold.card[open] > .fold-h { border-bottom-color: var(--line); }
.fold.acc { border-top: 1px solid var(--line); }
.fold-tools { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 0; }
.fold-group + .fold-group { margin-top: 12px; }
.fold-group > .fold-b { padding: 12px 0 4px; }
.fold.card > .fold-b > .scroll-x { margin: 0; }
.fold-pad { padding: 14px 18px; }
@media (max-width: 640px) { .fold-h { flex-wrap: wrap; padding: 10px 14px; } .fold-s { justify-content: flex-start; } }
@media print { .fold > .fold-h::before { display: none; } }
