:root {
  color-scheme: light;
  --bg: #F4F5F7; --surface: #FFFFFF; --ink: #17202B; --muted: #5A6472; --line: #DCE0E6;
  --accent: #1D5C63; --accent-ink: #FFFFFF; --accent-soft: #E2EDEE;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --run: #2a78d6; --idle: #b9b8b3; --track: #ECEEF1; --focus: #1D5C63;
  --banner: #FFF4DA; --banner-ink: #6B4A00; --err: #A8322D;
  --sans: "IBM Plex Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11151B; --surface: #181E26; --ink: #E5E9EF; --muted: #9AA4B2; --line: #2A333F;
    --accent: #74B8BF; --accent-ink: #0E1A1C; --accent-soft: #1A2E31; --run: #3987e5; --idle: #6b6a66;
    --track: #232B35; --banner: #3A2E12; --banner-ink: #F5D58A; --err: #E48179; --focus: #74B8BF;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11151B; --surface: #181E26; --ink: #E5E9EF; --muted: #9AA4B2; --line: #2A333F;
  --accent: #74B8BF; --accent-ink: #0E1A1C; --accent-soft: #1A2E31; --run: #3987e5; --idle: #6b6a66;
  --track: #232B35; --banner: #3A2E12; --banner-ink: #F5D58A; --err: #E48179; --focus: #74B8BF;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }
h3 { font-size: 14px; margin: 0; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.eyebrow { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

/* ---- kerangka ---- */
.bar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.bar-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.brand { font-weight: 600; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
nav a { text-decoration: none; color: var(--muted); padding: 5px 10px; border-radius: 6px; font-weight: 500; }
nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.who { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 22px 60px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.banner { background: var(--banner); color: var(--banner-ink); border-radius: 6px; padding: 10px 14px; font-size: 13px; }
.err { color: var(--err); font-size: 13px; }

/* ---- kontrol ---- */
button, .btn { font: inherit; font-weight: 500; border-radius: 6px; padding: 7px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button.primer, .btn.primer { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.kecil, .btn.kecil { padding: 3px 10px; font-size: 12.5px; }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
label .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { width: auto; }
.pilih { display: flex; flex-wrap: wrap; gap: 6px; }
.pilih label { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-weight: 500; }
.pilih input:checked + span { color: var(--accent); font-weight: 600; }
.pilih label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; border-radius: 999px; padding: 3px 10px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---- tabel & data ---- */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 4px; white-space: nowrap; background: color-mix(in srgb, var(--c) 16%, transparent); }
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tile .n { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.meter { height: 8px; background: var(--track); border-radius: 3px; overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.seg { display: flex; height: 12px; border-radius: 3px; overflow: hidden; gap: 2px; min-width: 120px; }
.seg span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.list-prog { display: flex; flex-direction: column; }
.list-prog a.item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.list-prog a.item:first-child { border-top: none; }
.list-prog a.item:hover { background: var(--accent-soft); }
.list-prog .no { font-family: var(--mono); color: var(--muted); font-size: 12px; text-align: right; }

/* ---- form laporan ---- */
.ukuran { display: grid; grid-template-columns: minmax(0, 1fr) 110px 110px; gap: 8px 12px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
.ukuran:first-of-type { border-top: none; }
.skor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.aksi { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.aksi:first-child { border-top: none; }
.late { color: var(--critical); font-weight: 500; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding-block: 10px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.login { max-width: 380px; margin: 8vh auto 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 6px; font-size: 13px; z-index: 10; max-width: calc(100% - 32px); }
.empty { color: var(--muted); font-style: italic; }
@media (max-width: 640px) {
  .ukuran { grid-template-columns: 1fr 1fr; }
  .ukuran > :first-child { grid-column: 1 / -1; }
  .list-prog a.item { grid-template-columns: 28px minmax(0, 1fr); }
  .list-prog a.item > :last-child { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
