/* MiniDash design system: compact widget UI. Indigo / teal / amber on a light canvas. */
:root {
  --primary: #6366F1; --primary-d: #4F46E5; --primary-l: #EEF2FF;
  --secondary: #14B8A6; --tertiary: #F59E0B;
  --bg: #F3F4F6; --surface: #FFFFFF; --line: #E5E7EB; --line-2: #D1D5DB;
  --text: #111827; --text-2: #6B7280; --text-3: #9CA3AF;
  --ok: #10B981; --warn: #F59E0B; --err: #EF4444; --err-d: #DC2626;
  /* darker text tones for AA contrast on tinted chips / white (MiniDash hues, adjusted for legibility) */
  --ok-t: #047857; --warn-t: #92400E; --err-t: #B91C1C; --sec-t: #0F766E;
  --sh-1: 0 1px 2px rgba(0,0,0,.04); --sh-2: 0 2px 6px rgba(0,0,0,.06);
  --sh-3: 0 6px 16px rgba(0,0,0,.10); --sh-4: 0 12px 32px rgba(0,0,0,.14);
  --f-head: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 13px/20px var(--f-body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--primary-d); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ic { flex: none; vertical-align: -3px; }
small { font-size: 11px; line-height: 16px; }

/* type scale */
.t-head { font: 700 22px/28px var(--f-head); }
.t-sub { font: 600 17px/24px var(--f-head); }
.ov { font: 600 10px/14px var(--f-body); text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.help { font-size: 11px; line-height: 16px; color: var(--text-2); }
.help.err { color: var(--err-t); }
.muted { color: var(--text-2); }

/* layout */
.hdr { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.hdr-in { max-width: 960px; margin: 0 auto; padding: 8px 12px; display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font: 700 13px/16px var(--f-head); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand small { display: block; font: 500 11px/14px var(--f-body); color: var(--text-2); }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { padding: 6px 12px; border-radius: 8px; font: 600 12px/18px var(--f-body); color: var(--text-2); }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a[aria-current] { background: var(--primary-l); color: var(--primary-d); }
.hdr-r { display: flex; align-items: center; gap: 4px; }
.hdr-r .chip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .nav { order: 3; width: 100%; margin: 0; } .nav a { flex: 1; text-align: center; } .hdr-r { margin-left: auto; } }
.main { max-width: 960px; margin: 0 auto; padding: 16px 12px 32px; min-height: 60vh; }
.foot { max-width: 960px; margin: 0 auto; padding: 12px; text-align: center; color: var(--text-2); font-size: 11px; }
.stack { display: grid; gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.loading, .empty { padding: 24px; text-align: center; color: var(--text-2); }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; width: max-content; padding: 4px 0; }

/* widget */
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; box-shadow: var(--sh-1); }
.widget.p0 { padding: 0; overflow: hidden; }
a.widget { display: block; color: inherit; }
a.widget:hover { box-shadow: var(--sh-2); text-decoration: none; }
.kpi-v { font: 700 28px/34px var(--f-head); }
.kpi-v.pri { color: var(--primary-d); } .kpi-v.ok { color: var(--sec-t); } .kpi-v.warn { color: var(--warn-t); } .kpi-v.err { color: var(--err-t); }
.kpi-l { font: 500 11px/16px var(--f-body); color: var(--text-2); }
.rc { display: grid; gap: 8px; }
.rc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.rc-name { font: 600 15px/22px var(--f-head); }
.rc-sub { font-size: 12px; line-height: 18px; color: var(--text-2); }
.rc-judul { font-size: 12px; line-height: 18px; color: var(--text-2); font-style: italic; }
.rc-tags, .chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.rc-sesi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sesi-link { display: grid; gap: 4px; justify-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: inherit; }
.sesi-link:hover { background: var(--primary-l); border-color: var(--primary); text-decoration: none; }
.mini { padding: 8px; background: var(--bg); border-radius: 8px; }
.mini-v { font: 700 17px/24px var(--f-head); } .mini-v small { color: var(--text-2); font-weight: 500; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 9999px; font: 600 11px/16px var(--f-body); white-space: nowrap; }
.chip-pri { background: var(--primary-l); color: #4338CA; }
.chip-ok { background: rgba(16,185,129,.1); color: var(--ok-t); }
.chip-warn { background: rgba(245,158,11,.14); color: var(--warn-t); }
.chip-err { background: rgba(239,68,68,.1); color: var(--err-t); }
.chip-neutral { background: var(--bg); color: #4B5563; }

/* buttons: 28 / 36 / 44, hit area extended to 44 via ::after */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: 600 13px/20px var(--f-body); cursor: pointer; }
.btn::after { content: ""; position: absolute; inset: -4px 0; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: #fff; color: var(--primary-d); border-color: var(--primary); } .btn-secondary:hover { background: var(--primary-l); }
.btn-ghost { color: var(--text-2); } .btn-ghost:hover { background: var(--line); }
.btn-danger { background: var(--err); color: #fff; } .btn-danger:hover { background: var(--err-d); }
.btn.danger:hover { color: var(--err-t); }
.btn-sm { min-height: 28px; padding: 0 8px; font-size: 12px; } .btn-sm::after { inset: -8px -2px; }
.btn-lg { min-height: 44px; padding: 0 16px; } .btn-lg::after { inset: 0; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-sp { display: inline-block; width: 68px; }
.linkbtn { background: none; border: 0; padding: 8px 0; color: var(--primary-d); font: 600 12px var(--f-body); cursor: pointer; }

/* inputs: 36px */
.inp { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--text); font: 400 13px var(--f-body); }
textarea.inp { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 20px; }
.inp:hover { border-color: var(--text-3); }
.inp:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,.12); }
.inp:disabled { background: var(--bg); border-color: var(--line); color: var(--text-2); }
.inp-num { width: 72px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.fld { display: grid; gap: 4px; }
.fld > span { font: 600 11px/16px var(--f-body); color: var(--text-2); display: flex; justify-content: space-between; }
.fld em { font-style: normal; font-weight: 500; }
.chk { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.chk input { width: 16px; height: 16px; accent-color: var(--primary); }
fieldset.tim { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 12px; display: grid; gap: 8px; margin: 0; }
fieldset.tim legend { font: 600 11px var(--f-body); color: var(--text-2); padding: 0 4px; }
.search { position: relative; display: block; }
.search .ic { position: absolute; left: 10px; top: 11px; color: var(--text-3); pointer-events: none; }
.search .inp { padding-left: 32px; }
.bar-row { display: flex; gap: 8px; align-items: center; } .grow { flex: 1; }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.tab { flex: 1; min-height: 32px; padding: 4px 12px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font: 600 12px/18px var(--f-body); white-space: nowrap; text-align: center; cursor: pointer; display: grid; place-items: center; }
.tab:hover { background: var(--bg); text-decoration: none; }
.tab[aria-current] { background: var(--primary-l); color: var(--primary-d); }

/* list rows (40px min) */
.lrow { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lrow:first-child { border-top: 0; }
.lrow.col { display: block; }
.lr-line { display: flex; align-items: center; gap: 8px; }
.lr-main { flex: 1; min-width: 0; } .lr-main small { display: block; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.lr-sub { font-size: 11px; line-height: 16px; color: var(--text-2); margin-top: 2px; }
.num { min-width: 36px; text-align: right; font: 700 15px/22px var(--f-head); font-variant-numeric: tabular-nums; }
.lr-det { margin-top: 4px; font-size: 12px; } .lr-det summary { cursor: pointer; color: var(--primary-d); font-weight: 600; padding: 4px 0; }
.kv { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 2px; }
.kv li { display: flex; justify-content: space-between; gap: 8px; } .kv span { color: var(--text-2); }
.note { background: var(--bg); border-radius: 8px; padding: 8px; white-space: pre-wrap; margin-top: 4px; }

/* score form */
.fh { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); min-height: 48px; }
.srow-l { font-weight: 500; } .srow-l small { display: block; color: var(--text-2); }
.total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: var(--primary-l); }
.total > div:first-child { flex: 1; }
.total-v { font: 700 28px/34px var(--f-head); color: var(--primary-d); font-variant-numeric: tabular-nums; } .total-v small { font-size: 13px; color: var(--text-2); font-weight: 500; }
progress.bar { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px; margin-top: 6px; border: 0; background: #fff; border-radius: 0; overflow: hidden; }
progress.bar::-webkit-progress-bar { background: #fff; } progress.bar::-webkit-progress-value { background: var(--primary); }
progress.bar::-moz-progress-bar { background: var(--primary); }
.fb { padding: 12px; } .fa { display: flex; gap: 8px; justify-content: space-between; padding: 0 12px 12px; flex-wrap: wrap; } .fa .notice { flex: 1; }

/* notice, toast */
.notice { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 8px; font-size: 12px; line-height: 18px; }
.notice-err { background: rgba(239,68,68,.08); color: var(--err-t); border: 1px solid rgba(239,68,68,.25); }
.notice-warn { background: rgba(245,158,11,.1); color: var(--warn-t); border: 1px solid rgba(245,158,11,.3); }
.notice-ok { background: rgba(16,185,129,.1); color: var(--ok-t); }
#toasts { position: fixed; top: 64px; right: 12px; left: 12px; z-index: 80; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { background: #111827; color: #fff; padding: 8px 12px; border-radius: 8px; font-weight: 500; box-shadow: var(--sh-3); max-width: 360px; animation: fade .15s ease-out; }
.toast-err { background: var(--err-t); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* modal: bottom sheet on phones, centered on larger screens */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(17,24,39,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; background: #fff; padding: 16px; border-radius: 16px 16px 0 0; box-shadow: var(--sh-4); display: grid; gap: 12px; align-content: start; }
.modal-wide { max-width: 760px; }
@media (min-width: 600px) { .modal-bg { align-items: center; padding: 16px; } .modal { border-radius: 12px; } }
.mh { font: 600 17px/24px var(--f-head); } .mb { color: var(--text-2); }
.mf { display: flex; justify-content: flex-end; gap: 8px; }
.mbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* auth */
.auth { min-height: 60vh; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 380px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; }

/* berita acara (print sheet) */
.ps { background: #fff; color: #000; padding: 8px; font-size: 12px; line-height: 18px; display: grid; gap: 12px; }
.ps-head { text-align: center; border-bottom: 2px solid #000; padding-bottom: 8px; } .ps-head h2 { font: 700 14px/20px var(--f-head); } .ps-head p { font-size: 11px; }
.ps-id td { padding: 2px 4px 2px 0; vertical-align: top; } .ps-id td:first-child { width: 120px; font-weight: 700; } .ps-id td:nth-child(2) { width: 12px; }
.ps-t { width: 100%; border-collapse: collapse; text-align: center; } .ps-t th, .ps-t td { border: 1px solid #555; padding: 4px 6px; } .ps-t th { background: #eee; } .ps-t .l { text-align: left; }
.ps-res { border: 1px solid #555; padding: 8px; display: grid; gap: 4px; } .ps-num { font: 700 20px/26px var(--f-head); }
.ps-rev { border: 1px solid #555; } .ps-rev-h { padding: 4px 8px; background: #eee; border-bottom: 1px solid #555; } .ps-rev-b { padding: 8px; min-height: 56px; white-space: pre-wrap; }
.ps-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; text-align: center; margin-top: 12px; } .ps-sign .sp { height: 64px; }

@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@media print {
  @page { margin: 16mm; }
  body { background: #fff; }
  #app, #toasts, .no-print { display: none !important; }
  .modal-bg { position: static; background: none; display: block; padding: 0; }
  .modal { max-width: none; max-height: none; box-shadow: none; padding: 0; border-radius: 0; overflow: visible; }
}
