:root {
  --bg: #f5f8fc; --surface: #fff; --ink: #102847; --muted: #5b6b82; --line: #d5dde8;
  --navy: #071a35; --navy-2: #16355f; --gold: #f5b800; --gold-2: #ffc61a; --tint: #e4ebf5;
  --danger: #b42318; --ok: #3f7a1c;
  --font-sans: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.55 var(--font-sans); }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
a { color: var(--navy-2); }
.brand { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 700; white-space: nowrap; }
.brand span { color: var(--gold); }

/* tata letak */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100%; }
.side { display: flex; flex-direction: column; gap: 14px; padding: 16px 12px; color: #fff; background: var(--navy);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 2px 8px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.navsec { display: flex; flex-direction: column; gap: 2px; }
.navgroup { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 12px 10px 4px; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.55); text-align: left; cursor: pointer; }
.navgroup:hover { color: #fff; }
.navgroup svg { flex: none; transition: transform .15s ease; }
.navsec.closed .navgroup svg { transform: rotate(-90deg); }
.navitems { display: flex; flex-direction: column; gap: 2px; margin-left: 12px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.14); }
.navsec.closed .navitems { display: none; }
.stack-gap { display: flex; flex-direction: column; gap: 16px; }
details.card > summary { cursor: pointer; }
.nav a { display: block; padding: 8px 10px; border-radius: 8px; color: rgba(255,255,255,.82); text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: var(--navy-2); color: var(--gold); font-weight: 600; }
.nav a[data-k="aktivitas"] { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-badge { flex: none; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold); color: var(--navy); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.nav-badge[hidden] { display: none; }
.account { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.14); font-size: 13px; }
.account b { display: block; padding: 0 10px; font-weight: 600; }
.account small { display: block; padding: 0 10px 6px; color: rgba(255,255,255,.65); text-transform: capitalize; }
.account button { all: unset; display: block; width: 100%; padding: 8px 10px; border-radius: 8px; color: rgba(255,255,255,.82); cursor: pointer; box-sizing: border-box; }
.account button:hover { background: rgba(255,255,255,.08); }
.main { padding: 24px; min-width: 0; }
.view { display: flex; flex-direction: column; gap: 16px; max-width: 1120px; margin: 0 auto; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* komponen */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.card > h2 { margin-bottom: 10px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.two { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.stat b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.hero { background: var(--navy); border-color: var(--navy); color: #fff; }
.stat.hero b { color: var(--gold); } .stat.hero span { color: rgba(255,255,255,.75); }
.stat.alert b { color: var(--danger); }
.manual { padding: 0; overflow: hidden; }
.manual-frame { display: block; width: 100%; height: calc(100vh - 150px); min-height: 480px; border: 0; }
.manual-phone { display: none; margin: 0; padding: 16px; color: var(--muted); }
@media (max-width: 760px) { .manual-frame { display: none; } .manual-phone { display: block; } }
a.stat { display: block; color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--navy); box-shadow: 0 2px 8px rgba(7, 26, 53, .12); }
a.stat span { text-decoration: underline; text-underline-offset: 3px; }
.btn { display: inline-block; font: inherit; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--navy-2); }
.btn.primary { font-weight: 700; color: var(--navy); background: var(--gold); border-color: var(--gold); }
.btn.primary:hover { background: var(--gold-2); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small { padding: 3px 9px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--navy-2); outline-offset: 1px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 12px; font-weight: 600; background: var(--tint); color: var(--navy-2); text-transform: capitalize; white-space: nowrap; }
.tag.bad { background: #fdecea; color: var(--danger); }
.tag.good { background: #edf5e6; color: var(--ok); }
.tag.warn { background: #fff4d1; color: #7a5a00; }
.muted { color: var(--muted); } .small { font-size: 13px; } .pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 10px 0; }
.err { color: var(--danger); font-size: 13px; min-height: 0; margin: 0; }
.okmsg { color: var(--ok); font-size: 13px; margin: 0; }
#demobar .imp { margin-bottom: 14px; border-radius: 8px; }
.imp { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: #f5b800; color: #102847; padding: 8px 16px; font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.phone-only { display: none !important; }

/* formulir */
form.stack { display: flex; flex-direction: column; gap: 10px; }
label.f { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; min-height: 72px; }
input[type=checkbox] { width: auto; }
.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.pw { position: relative; }
.pw input { padding-right: 40px; }
.eye { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); display: grid; place-items: center; width: 30px; height: 30px;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.eye:hover { color: var(--ink); }
.eye svg { width: 18px; height: 18px; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--navy); }
.login .card { width: min(380px, 100%); padding: 24px; }
.login .brand { color: var(--ink); margin-bottom: 4px; font-size: 22px; }
.login .brand span { color: #b98a00; }

/* tanya regulasi */
.chat { display: flex; flex-direction: column; height: calc(100vh - 118px); min-height: 420px; padding: 0; }
.log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.msg.user { align-self: flex-end; max-width: 85%; background: var(--tint); padding: 8px 13px; border-radius: 12px 12px 3px 12px; white-space: pre-wrap; }
.msg.bot .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot .pending { color: var(--muted); }
.cite { display: inline-block; min-width: 20px; padding: 0 5px; margin-inline: 1px; font-size: 12px; line-height: 18px; text-align: center; color: var(--navy-2); border: 1px solid var(--navy-2); border-radius: 5px; text-decoration: none; }
details.sources { margin-top: 10px; }
summary { cursor: pointer; color: var(--muted); }
.src { padding: 9px 0; border-top: 1px solid var(--line); }
.src p { margin: 4px 0 0; color: var(--muted); font-size: 13px; white-space: pre-wrap; max-height: 8em; overflow-y: auto; }
.flag { margin-top: 10px; padding: 9px 12px; border: 1px solid #f0d98a; border-radius: 8px; background: #fff9e6; font-size: 13px; }
.flag ul { margin: 4px 0 0; padding-left: 18px; }
.ask { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ask textarea { min-height: 42px; max-height: 150px; resize: none; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* kalender */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal div { min-height: 84px; padding: 4px 5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; overflow: hidden; }
.cal .dow { min-height: 0; color: var(--muted); font-weight: 600; text-align: center; }
.cal .off { background: var(--bg); color: #9aa7b8; }
.cal .today b { background: var(--gold); color: var(--navy); border-radius: 4px; padding: 0 4px; }
.cal p { margin: 2px 0 0; padding: 0 4px; border-radius: 4px; background: var(--tint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal p.nasional { background: #fff4d1; }

/* cetak QR */
.qrs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.qr { text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; break-inside: avoid; }
.qr img { width: 100%; max-width: 150px; }
.qr b { display: block; font-size: 13px; } .qr span { color: var(--muted); font-size: 12px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.stickers { display: flex; flex-wrap: wrap; gap: 3mm; }
.stickers.size-s { --sw: 50mm; } .stickers.size-m { --sw: 70mm; } .stickers.size-l { --sw: 100mm; }
.sticker { width: var(--sw); display: flex; flex-direction: column; align-items: center; gap: 1mm; padding: 0 3mm 3mm; border: 1px dashed #8a94a3; background: #fff; color: #000; text-align: center; break-inside: avoid; overflow-wrap: anywhere; }
.sticker-head { align-self: stretch; display: flex; align-items: center; justify-content: center; gap: 2mm; margin: 0 -3mm 1mm; padding: 1.5mm; background: var(--navy); color: #fff; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sticker-head img { width: 5mm; height: 5mm; } .sticker-head span { color: var(--gold); }
.sticker-code { width: 100%; }
.sticker b { font-size: 13px; line-height: 1.2; } .sticker-id { font-size: 12px; font-weight: 600; } .sticker small { font-size: 10px; line-height: 1.25; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs a { display: block; width: 104px; font-size: 12px; overflow-wrap: anywhere; text-decoration: none; }
.thumbs img { width: 104px; height: 78px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }

@media (max-width: 820px) {
  a.phone-only { display: inline-block !important; }
  .nav a.phone-only { display: block !important; }
  .shell { display: block; }
  .side { position: static; height: auto; padding: 10px 12px; gap: 8px; }
  .nav { flex-direction: row; overflow-x: auto; flex: none; }
  .navgroup { display: none; }
  .navsec, .navitems, .navsec.closed .navitems { display: contents; }
  .nav a { white-space: nowrap; }
  .account { margin-top: 0; padding-top: 6px; display: flex; flex-wrap: wrap; align-items: center; }
  .account small { display: none; } .account b { width: 100%; }
  .account button { width: auto; }
  .main { padding: 16px; }
  .chat { height: 72vh; }
  .cal { display: none; }
}
@media print {
  .side, .noprint { display: none !important; }
  .shell { display: block; } .main { padding: 0; } body { background: #fff; } .view { max-width: none; }
}

/* Graf Relasi */
.graf-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.graf-form .f { flex: 0 0 180px; margin: 0; }
.graf-form .graf-value { flex: 1 1 280px; }
.graf { position: relative; display: grid; gap: 56px; align-items: center; }
.graf.cols-1 { grid-template-columns: minmax(0, 320px); }
.graf.cols-2 { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }
.graf.cols-3 { grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 1fr); }
.graf-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.graf-lines path { fill: none; stroke: #c5cedb; stroke-width: 1.5; }
.graf-lines path.hot { stroke: var(--gold); stroke-width: 2.5; }
.gcol { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ggroup { display: flex; flex-direction: column; gap: 6px; }
.ggroup h3 { margin: 0 0 2px; font-size: 12px; font-weight: 600; color: #5b6b82; }
.ggroup h3 span { font-variant-numeric: tabular-nums; font-weight: 400; }
.gnode { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 7px 8px 7px 10px; background: #fff; border: 1px solid #dbe2ec; border-radius: 8px; }
.gnode::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #8391a6); }
.gnode:hover { border-color: #aab6c8; }
.gnode.t-regulation { --dot: var(--navy-2); }
.gnode.t-form { --dot: var(--gold); }
.gnode.t-sop { --dot: #2f8f83; }
.gnode.t-activity { --dot: #b4543a; }
.gnode.center { padding: 12px; background: var(--navy); border-color: var(--navy); --dot: var(--gold); }
.gnode.center b, .gnode.center small, .gnode.center a { color: #fff; }
.gmain { flex: 1 1 auto; min-width: 0; color: inherit; text-decoration: none; }
.gmain b, .gmain small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gnode.center .gmain b, .gnode.center .gmain small { white-space: normal; }
.gmain b { font-size: 13px; font-weight: 600; }
.gmain small { font-size: 11px; color: #5b6b82; }
a.gmain:hover b { text-decoration: underline; }
.gfocus { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: #5b6b82; }
.gfocus:hover { background: #eef2f7; color: var(--navy); }
@media (max-width: 760px) {
  .graf, .graf.cols-1, .graf.cols-2, .graf.cols-3 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
