/* Layout idea: a formal, flat public-service interface. Light navbar, blue primary, thin borders, Poppins headings over Inter text, in the spirit of Malaysian government design guidance. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --ink: #0f172a;
  --muted: #475569;
  --line: #dde2ea;
  --brand: #2563eb;
  --brand-ink: #ffffff;
  --brand-deep: #1e3a8a;
  --brand-soft: #eaf1ff;
  --good: #15803d;
  --good-soft: #dcfce7;
  --warn: #a14d06;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --slate: #7c8aa0;
  --s1: #257de0;
  --s2: #f47230;
  --focus: #1d4ed8;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --font-display: 'Poppins', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --surface: #111a2c; --surface-2: #172136; --ink: #e6ecf5; --muted: #9aa8bf; --line: #25324a;
    --brand: #5b9bff; --brand-ink: #0b1220; --brand-deep: #bcd4ff; --brand-soft: #14264a;
    --good: #4ade80; --good-soft: #12301f; --warn: #fbbf24; --warn-soft: #3a2a0a; --bad: #f87171; --bad-soft: #3d1818;
    --info: #7db2ff; --info-soft: #14264a; --slate: #6b7a92; --s1: #338ced; --s2: #e76624; --focus: #93c5fd;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #111a2c; --surface-2: #172136; --ink: #e6ecf5; --muted: #9aa8bf; --line: #25324a;
  --brand: #5b9bff; --brand-ink: #0b1220; --brand-deep: #bcd4ff; --brand-soft: #14264a;
  --good: #4ade80; --good-soft: #12301f; --warn: #fbbf24; --warn-soft: #3a2a0a; --bad: #f87171; --bad-soft: #3d1818;
  --info: #7db2ff; --info-soft: #14264a; --slate: #6b7a92; --s1: #338ced; --s2: #e76624; --focus: #93c5fd;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i12 { width: 13px; height: 13px; }
svg.i16 { width: 16px; height: 16px; }
svg.i24 { width: 24px; height: 24px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.xs { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.notice { background: var(--warn-soft); color: var(--warn); font-size: 13px; text-align: center; padding: 7px 14px; border-bottom: 1px solid var(--line); font-weight: 500; }
.lg-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.lg-nav .in { max-width: 1160px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 38px; height: 38px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.brand .bn { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.15; }
.brand .bs { font-size: 12px; color: var(--muted); line-height: 1.2; }
.lg-main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 22px 16px 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; }
.lg-intro { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-family: var(--font-display); font-weight: 500; font-size: 13px; color: var(--brand); }
.lg-intro h1 { font-size: clamp(26px, 6.2vw, 42px); line-height: 1.18; font-weight: 600; letter-spacing: -.01em; }
.lg-intro .lead { color: var(--muted); font-size: 16px; max-width: 52ch; }
.flow { display: none; list-style: none; margin: 8px 0 0; padding: 0; flex-direction: column; gap: 0; max-width: 520px; }
.flow li { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.flow li::before { content: ''; position: absolute; left: 17px; top: 38px; bottom: 2px; width: 2px; background: var(--line); }
.flow li:last-child { padding-bottom: 0; }
.flow li:last-child::before { display: none; }
.flow .n { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--brand); color: var(--brand); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; background: var(--surface); flex: none; }
.flow b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 15.5px; }
.flow span.d { color: var(--muted); font-size: 14px; }
.lg-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); min-width: 0; }
.lg-card h2 { font-size: 24px; }
.lg-card .sub { color: var(--muted); margin-top: 4px; font-size: 14.5px; }
.hello { font-family: var(--font-display); color: var(--brand); font-weight: 500; font-size: 14px; }
.lang { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.lang button { padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.roles { display: flex; flex-direction: column; gap: 8px; }
.role { text-align: left; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1.5px solid var(--line); transition: border-color .15s, background .15s; }
.role:hover { border-color: var(--brand); }
.role[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.role .ico { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); flex: none; }
.role[aria-pressed="true"] .ico { background: var(--brand); color: var(--brand-ink); }
.role .tx { flex: 1; min-width: 0; }
.role b { font-size: 14.5px; font-weight: 600; display: block; line-height: 1.25; }
.role .d { font-size: 12.5px; color: var(--muted); line-height: 1.3; display: block; }
.role .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: var(--brand-ink); }
.role[aria-pressed="true"] .tick { background: var(--brand); border-color: var(--brand); }
.role .tick svg { opacity: 0; }
.role[aria-pressed="true"] .tick svg { opacity: 1; }
.see { background: var(--surface-2); border-radius: 8px; padding: 9px 12px; font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 600; }
.input { height: 46px; border-radius: 8px; border: 1px solid #a8b2c3; background: var(--surface); padding: 0 12px; width: 100%; }
textarea.input { height: auto; padding: 10px 12px; min-height: 96px; resize: vertical; }
select.input { padding-right: 8px; }
.input:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 28%, transparent); outline-offset: 0; }
.pw { position: relative; }
.pw .eye { position: absolute; right: 4px; top: 4px; width: 38px; height: 38px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 8px; font-weight: 600; font-size: 14.5px; border: 1px solid #a8b2c3; background: var(--surface); transition: background .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 86%, black); }
.btn.big { height: 50px; font-size: 16px; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.fine { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.linkbtn { color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.lg-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 14px 16px; text-align: center; font-size: 12.5px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
@media (min-width: 900px) {
  .lg-main { grid-template-columns: minmax(0, 1.05fr) minmax(0, 480px); gap: 64px; padding: 56px 24px 64px; align-items: start; }
  .lg-nav .in { padding: 14px 24px; }
  .flow { display: flex; }
  .lg-card { padding: 28px; }
  .lg-intro { padding-top: 12px; }
}

/* ---------- App shell ---------- */
.app { min-height: 100%; display: flex; }
.side { display: none; width: 256px; flex: none; background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; padding: 16px 12px; flex-direction: column; gap: 4px; overflow-y: auto; }
.side .brand { padding: 4px 8px 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; font-weight: 500; color: var(--muted); text-align: left; font-size: 14.5px; }
.nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav .badge { margin-left: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: 11.5px; padding: 1px 7px; font-weight: 700; }
.who { margin-top: auto; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .logo { width: 34px; height: 34px; }
.top h1 { font-size: 17px; font-weight: 600; line-height: 1.2; }
.top .where { font-size: 12px; color: var(--muted); line-height: 1.25; }
.simpill { background: var(--warn-soft); color: var(--warn); border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 3px 8px; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.page { padding: 16px 16px 110px; max-width: 1200px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
.tabbar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px; border-radius: 8px; font-size: 11.5px; font-weight: 500; color: var(--muted); position: relative; }
.tabbar button[aria-current="page"] { color: var(--brand-deep); font-weight: 600; background: var(--brand-soft); }
.tabbar span.l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .dot { position: absolute; top: 3px; right: calc(50% - 20px); background: var(--bad); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
@media (min-width: 900px) {
  .side { display: flex; }
  .tabbar { display: none; }
  .top { padding: 12px 28px; }
  .top .logo, .top .mobonly { display: none; }
  .page { padding: 24px 28px 48px; }
}

/* ---------- Common blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { font-size: 16.5px; }
.card .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card .head p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.pagehead { display: flex; flex-direction: column; gap: 6px; }
.pagehead h2 { font-size: clamp(22px, 5vw, 30px); font-weight: 600; line-height: 1.2; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13.5px; }
.crumbs button { color: var(--brand); font-weight: 600; padding: 2px 4px; border-radius: 6px; }
.crumbs button[aria-current="true"] { color: var(--ink); cursor: default; }
.ctx { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid #a8b2c3; background: var(--surface); font-size: 13.5px; font-weight: 500; }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip.tag { background: var(--brand-soft); border-color: transparent; color: var(--brand-deep); }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 8px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { padding: 6px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.mute { background: var(--surface-2); color: var(--muted); }
.pill.brand { background: var(--brand-soft); color: var(--brand-deep); }
.pill.sim { background: var(--warn-soft); color: var(--warn); letter-spacing: .04em; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: border-color .15s; }
button.tile:hover { border-color: var(--brand); }
.tile .lbl { font-size: 13.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tile .val { font-family: var(--font-display); font-weight: 600; font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .foot { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 20px; }
.tile.t-good .lbl svg { color: var(--good); }
.tile.t-info .lbl svg { color: var(--info); }
.tile.t-warn .lbl svg { color: var(--warn); }
.tile.t-bad .lbl svg { color: var(--bad); }
.tiles.mini .tile { box-shadow: none; padding: 12px; background: var(--surface); }
.tiles.mini .val { font-size: 22px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 980px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grid2.w21 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 11px 12px; border-radius: 8px; background: var(--surface-2); border-left: 4px solid var(--slate); width: 100%; }
.alert:hover { background: color-mix(in srgb, var(--surface-2) 70%, var(--line)); }
.alert.bad { border-left-color: var(--bad); }
.alert.warn { border-left-color: #d97706; }
.alert.info { border-left-color: var(--info); }
.alert b { display: block; font-size: 14.5px; font-weight: 600; }
.alert span { font-size: 13px; color: var(--muted); }
.alert .ai { margin-top: 2px; }
.alert.bad .ai { color: var(--bad); } .alert.warn .ai { color: var(--warn); } .alert.info .ai { color: var(--info); }

.readout { font-size: 13.5px; min-height: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .lbl-s { fill: var(--ink); font-weight: 600; }

.rows { display: flex; flex-direction: column; gap: 8px; }
.rowbtn { width: 100%; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid transparent; background: var(--surface-2); align-items: center; }
button.rowbtn:hover { border-color: var(--brand); }
.rowbtn.sel { border-color: var(--brand); background: var(--brand-soft); }
.rowbtn.dim { opacity: .55; }
.rowbtn .nm { font-weight: 600; font-size: 14.5px; display: flex; gap: 6px; align-items: center; min-width: 0; }
.rowbtn .nm small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.rowbtn .rt { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.rowbtn .rt small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.rowbtn .bar { grid-column: 1 / -1; }
.bar { height: 10px; border-radius: 5px; background: var(--surface); display: flex; gap: 2px; overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; border-radius: 3px; }
.bar .c { background: var(--good); } .bar .o { background: var(--slate); } .bar .v { background: var(--bad); } .bar .b { background: var(--brand); }

.tbl-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { padding: 10px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th.l, td.l { text-align: left; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
th button { font-weight: 600; display: inline-flex; gap: 4px; align-items: center; color: inherit; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--surface-2); }
tfoot td { font-weight: 700; border-bottom: 0; background: var(--surface-2); }
td.wrapc { white-space: normal; min-width: 180px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }

.empty { text-align: center; padding: 26px 14px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty .ei { width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.empty b { color: var(--ink); }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--info-soft); color: var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; border-left: 4px solid var(--info); }
.note svg { color: var(--info); margin-top: 1px; }
.note.warn { background: var(--warn-soft); border-left-color: #d97706; } .note.warn svg { color: var(--warn); }
.note.good { background: var(--good-soft); border-left-color: var(--good); } .note.good svg { color: var(--good); }

.case { width: 100%; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); align-items: center; }
.case:hover { border-color: var(--brand); }
.case .id { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.case .t { font-weight: 600; }
.case .m { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--muted); align-items: center; }
.case.late { border-left: 4px solid var(--bad); }
.work { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.work.late { border-left: 4px solid var(--bad); }

.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 60; animation: fi .18s ease-out; }
.ov { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 92%; background: var(--surface); border-radius: 16px 16px 0 0; display: flex; flex-direction: column; box-shadow: 0 -8px 32px rgba(0, 0, 0, .22); animation: up .22s cubic-bezier(.2, .8, .2, 1); }
.ov-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.ov-h h3 { font-size: 19px; }
.ov-b { padding: 6px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.ov-f { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.iconbtn { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
@media (min-width: 720px) {
  .ov { left: auto; top: 0; width: 480px; max-height: none; border-radius: 0; animation: left .22s cubic-bezier(.2, .8, .2, 1); }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes left { from { transform: translateX(40px); opacity: 0; } }
@keyframes fi { from { opacity: 0; } }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; text-align: right; }
.tl { list-style: none; margin: 0; padding: 0 0 0 4px; display: flex; flex-direction: column; gap: 12px; }
.tl li { position: relative; padding-left: 20px; font-size: 14px; }
.tl li::before { content: ''; position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.tl li::after { content: ''; position: absolute; left: 4px; top: 18px; bottom: -14px; width: 2px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl small { display: block; color: var(--muted); font-size: 12px; }
.steps { display: flex; list-style: none; margin: 0; padding: 0; gap: 4px; }
.steps li { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 500; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.steps li i { display: block; height: 6px; width: 100%; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); }
.steps li.done { color: var(--ink); } .steps li.done i { background: var(--brand); border-color: var(--brand); }
.steps li.now i { background: #f59e0b; border-color: #f59e0b; }
.stars { display: inline-flex; gap: 2px; }
.stars button { color: var(--line); padding: 2px; }
.stars button.on { color: #f59e0b; }
.stars svg { width: 28px; height: 28px; fill: currentColor; stroke: none; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 500; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); max-width: calc(100% - 32px); animation: up .2s ease-out; display: flex; gap: 8px; align-items: center; }
@media (min-width: 900px) { .toast { bottom: 28px; } }

.dircard { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.dirhead { display: flex; gap: 12px; align-items: center; padding: 14px; background: var(--brand-soft); }
.code { font-family: var(--font-display); font-weight: 600; background: var(--brand); color: var(--brand-ink); border-radius: 6px; padding: 3px 9px; font-size: 13.5px; white-space: nowrap; }
.code.n { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.dirrow { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.dirgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 760px) { .dirgrid { grid-template-columns: 1fr 1fr; } }

.wm { position: relative; }
.wm::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .08;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='160'><text x='20' y='90' font-family='sans-serif' font-weight='800' font-size='26' fill='%23808080' transform='rotate(-24 130 80)'>SIMULATION</text></svg>"); }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 9px 14px; font-weight: 500; font-size: 14px; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-pressed="true"] { color: var(--brand-deep); border-bottom-color: var(--brand); font-weight: 600; }
textarea.csv { width: 100%; min-height: 220px; font: 12.5px/1.4 ui-monospace, Menlo, monospace; border: 1px solid #a8b2c3; border-radius: 8px; padding: 10px; background: var(--surface-2); color: var(--ink); }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rcard { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rcard:hover:not([disabled]) { border-color: var(--brand); }
.rcard[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.rcard[disabled] { opacity: .6; cursor: not-allowed; }
.rgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 720px) { .rgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Hierarchy report ---------- */
.headline { font-family: var(--font-display); font-weight: 500; font-size: clamp(17px, 3.6vw, 22px); line-height: 1.4; margin-bottom: 14px; text-wrap: pretty; }
.bar.big { height: 16px; border-radius: 8px; }
.treemap { --tm-lo: #fff1e4; --tm-hi: #9a3412; --tm-on-lo: #0f172a; --tm-on-hi: #ffffff; }
.treemap.tm-rate { --tm-lo: #e6efff; --tm-hi: #1e40af; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .treemap { --tm-lo: #2b1f17; --tm-hi: #fb923c; --tm-on-lo: #e6ecf5; --tm-on-hi: #111827; }
  :root:not([data-theme="light"]) .treemap.tm-rate { --tm-lo: #172136; --tm-hi: #60a5fa; }
}
:root[data-theme="dark"] .treemap { --tm-lo: #2b1f17; --tm-hi: #fb923c; --tm-on-lo: #e6ecf5; --tm-on-hi: #111827; }
:root[data-theme="dark"] .treemap.tm-rate { --tm-lo: #172136; --tm-hi: #60a5fa; }
.treemap .tm { cursor: pointer; outline: none; }
.treemap .tm rect { transition: filter .12s; }
.treemap .tm:hover rect { stroke: var(--ink); stroke-width: 2; }
.treemap .tm:focus-visible rect { stroke: var(--focus); stroke-width: 3; }
.treemap .chart text { font-family: var(--font-body); }
.treemap text.t1 { font-size: 12.5px; font-weight: 700; }
.treemap text.t2 { font-size: 11.5px; font-weight: 500; }
.treemap text.tx-lo { fill: var(--tm-on-lo); }
.treemap text.tx-hi { fill: var(--tm-on-hi); }
.treemap text.hd { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.tm-legend { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.lg-grad { flex: 1; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--tm-lo), var(--tm-hi)); border: 1px solid var(--line); max-width: 260px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .fgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 980px) { .grid2.w12 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.chip b { font-variant-numeric: tabular-nums; }
.chip.on b { color: inherit; }

/* ===================== v4 additions ===================== */
:root { --good-line: color-mix(in srgb, var(--good) 45%, transparent); --warn-line: color-mix(in srgb, var(--warn) 45%, transparent); --bad-line: color-mix(in srgb, var(--bad) 45%, transparent); }
.navg { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 4px; }
.navg:first-child { padding-top: 4px; }
.ov-b .navg { padding: 12px 2px 4px; }
.dl { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; white-space: nowrap; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.dl.good { color: var(--good); background: var(--good-soft); } .dl.bad { color: var(--bad); background: var(--bad-soft); }
.cmpbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tile .foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.headline .big { font: 500 17px/1.5 var(--font-body); margin: 0 0 12px; }
.rag3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); text-align: left; background: var(--surface); }
.rg b { font: 600 24px/1.1 var(--font-display); } .rg span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.rg.bad { background: var(--bad-soft); border-color: var(--bad-line); } .rg.bad svg, .rg.bad b { color: var(--bad); }
.rg.warn { background: var(--warn-soft); border-color: var(--warn-line); } .rg.warn svg, .rg.warn b { color: var(--warn); }
.rg.good { background: var(--good-soft); border-color: var(--good-line); } .rg.good svg, .rg.good b { color: var(--good); }
details.how { display: block; font-size: 13.5px; } details.how summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: 4px 0; } details.how[open] > span { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.5; }
details.how .tbl-wrap { margin-top: 8px; }
h4.sub { font: 600 13px/1.3 var(--font-display); color: var(--muted); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.pris { display: flex; flex-direction: column; gap: 8px; }
.pri { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; background: var(--surface); }
.pri.bad { border-left-color: var(--bad); } .pri.warn { border-left-color: var(--warn); }
.pri > svg { flex: none; margin-top: 2px; } .pri.bad > svg { color: var(--bad); } .pri.warn > svg { color: var(--warn); }
.pri .pb { display: flex; flex-direction: column; gap: 4px; min-width: 0; } .pri .pb > span { font-size: 13.5px; color: var(--muted); } .pri .pa { margin-top: 6px; gap: 8px; }
.fu { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.rks { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.rk { display: flex; align-items: stretch; gap: 6px; }
.rk-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 28px 1fr auto; grid-template-areas: "n t v" "n s s" "b b b"; gap: 4px 10px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.rk-main:hover { border-color: var(--brand); background: var(--brand-soft); }
.rk-n { grid-area: n; font: 600 15px var(--font-display); color: var(--muted); text-align: center; }
.rk-t { grid-area: t; display: flex; flex-direction: column; min-width: 0; } .rk-t small { color: var(--muted); font-size: 12px; }
.rk-v { grid-area: v; text-align: right; font: 600 17px var(--font-display); display: flex; flex-direction: column; } .rk-v small { font: 400 11.5px var(--font-body); color: var(--muted); }
.rk-s { grid-area: s; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rk-b { grid-area: b; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; } .rk-b i { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.rk-act { display: flex; align-items: center; }
@media (min-width: 720px) { .rk-main { grid-template-columns: 32px 1.3fr 150px 1.2fr 140px; grid-template-areas: "n t v s b"; } }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; } .tabs button { display: inline-flex; align-items: center; gap: 6px; }
.mapgrid { display: grid; gap: 16px; margin: 12px 0; } @media (min-width: 720px) { .mapgrid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } }
.mappane { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); } .mappane h4 { margin-bottom: 4px; }
svg.map { width: 100%; height: auto; max-height: 420px; display: block; }
.map .halo { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.map .hx { cursor: pointer; outline: none; } .map .hx polygon { stroke-width: 2.5; transition: filter .15s; }
.map .hx:hover polygon, .map .hx:focus-visible polygon { filter: brightness(.96) drop-shadow(0 2px 4px rgba(0,0,0,.25)); stroke-width: 4; }
.map .hx.good polygon { fill: var(--good-soft); stroke: var(--good); } .map .hx.warn polygon { fill: var(--warn-soft); stroke: var(--warn); }
.map .hx.bad polygon { fill: var(--bad-soft); stroke: var(--bad); } .map .hx.na polygon { fill: var(--surface-2); stroke: var(--slate); }
.map text { fill: var(--ink); font-family: var(--font-body); pointer-events: none; } .map .h1 { font-weight: 700; font-size: 13.5px; } .map .h2 { font-weight: 700; font-size: 17px; font-family: var(--font-display); }
.map .h3 { font-size: 10.5px; font-weight: 600; } .map .h4 { font-size: 10px; fill: var(--muted); }
.map .hx.bad .h3 { fill: var(--bad); } .map .hx.warn .h3 { fill: var(--warn); } .map .hx.good .h3 { fill: var(--good); }
.map circle.zn { stroke: var(--surface); stroke-width: 1.5; } .map circle.zn.good { fill: var(--good); } .map circle.zn.warn { fill: var(--warn); } .map circle.zn.bad { fill: var(--bad); } .map circle.zn.na { fill: var(--slate); }
.maplg { margin: 4px 0 12px; flex-wrap: wrap; } .maplg i.lg { width: 14px; height: 14px; border-radius: 4px; border: 2px solid; display: inline-block; }
.maplg i.lg.bad { background: var(--bad-soft); border-color: var(--bad); } .maplg i.lg.warn { background: var(--warn-soft); border-color: var(--warn); } .maplg i.lg.good { background: var(--good-soft); border-color: var(--good); } .maplg i.dotz { width: 8px; height: 8px; border-radius: 50%; background: var(--slate); }
.cb { margin: 14px 0; } .cbr { display: grid; grid-template-columns: 18px 1fr 64px; gap: 8px; align-items: center; margin-top: 4px; } .cl { font-weight: 700; color: var(--muted); }
.cbb { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; } .cbb i { display: block; height: 100%; background: var(--s1); } .cbb.b i { background: var(--s2); } .cv { font-weight: 600; text-align: right; font-size: 13px; }
.syncchip { display: none; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
@media (min-width: 720px) { .syncchip { display: inline-flex; } }
.syncchip.good { color: var(--good); border-color: var(--good-line); background: var(--good-soft); } .syncchip.warn, .syncchip.bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); } .syncchip.info { color: var(--info); }
.tour { text-align: center; padding: 8px 4px; } .tour .tico { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-deep); margin-bottom: 10px; } .tour h3 { font-size: 19px; margin-bottom: 6px; } .tour p { color: var(--muted); line-height: 1.55; }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 14px; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); } .dots i.on { background: var(--brand); width: 22px; border-radius: 4px; }
dl.gl dt { font-weight: 600; } dl.gl dd { color: var(--muted); margin-bottom: 8px; }
.bubble { margin-top: 12px; background: var(--good-soft); border: 1px solid var(--good-line); border-radius: 14px 14px 14px 4px; padding: 10px 12px; max-width: 520px; } .bubble b { font-size: 13px; color: var(--good); } .bubble p { margin: 4px 0 6px; font-size: 14px; }
.trackbox { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; } .trackbox label { font-weight: 600; font-size: 13.5px; }
.npv img { margin-top: 8px; max-height: 160px; border-radius: 10px; border: 1px solid var(--line); }
.input.inline { display: inline-block; width: auto; min-height: 0; padding: 4px 8px; margin: 0 4px; }
.fgrid { display: grid; gap: 12px; } @media (min-width: 720px) { .fgrid { grid-template-columns: 1fr 1fr; } }

/* phone polish */
html { -webkit-text-size-adjust: 100%; } button, [role="button"], a, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (max-width: 899px) {
  .btn, .chip, .seg button, .tabs button, .rowbtn, .nav button, .linkbtn { min-height: 44px; }
  .btn.sm { min-height: 40px; } .input, select.input, textarea.input { font-size: 16px; min-height: 44px; }
  .tabbar button { min-height: 56px; } .iconbtn { min-width: 44px; min-height: 44px; }
  .top { gap: 6px; padding: 8px 12px; } .top h1 { font-size: 16px; } .top .where { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tbl-wrap { -webkit-overflow-scrolling: touch; box-shadow: inset -12px 0 10px -12px rgba(0,0,0,.25); }
  .headline .big { font-size: 16px; } .tiles { grid-template-columns: 1fr 1fr; }
}
button:active:not([disabled]) { transform: translateY(1px); }

/* print: only the brief */
@media print {
  .side, .top, .tabbar, .noprint, #toast, #ov, .scrim { display: none !important; }
  body, .app, .main, .page { background: #fff !important; display: block !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .sheet { border: 0 !important; padding: 0 !important; }
  @page { size: A4; margin: 12mm; }
}
.page > * { min-width: 0; }
svg.map { max-width: 440px; margin: 0 auto; }
