/* LAPSA — gaya tampilan. Mobile-first; satu keluarga huruf (Plus Jakarta Sans).
   Unsur khas: "kapsul" — progres target & tombol tambah berbentuk kapsul obat dua warna. */
:root {
  --ink: #0E3B43;        /* teal tua: identitas, header, tombol utama */
  --ink-2: #1D5A63;
  --paper: #F3F6F5;      /* latar */
  --surface: #FFFFFF;
  --capsule: #F2B630;    /* kuning kapsul: aksen tunggal */
  --capsule-ink: #3A2A00;
  --mint: #2F8F6B;       /* tercapai / diperiksa */
  --rose: #C8463D;       /* kurang / galat */
  --text: #13232A;
  --muted: #5B6B70;
  --line: #D9E3E1;
  --soft: #E7EFED;
  --shadow: 0 1px 0 rgba(14, 59, 67, .06), 0 6px 18px -12px rgba(14, 59, 67, .35);
  --r-lg: 22px; --r-md: 14px; --r-sm: 10px;
  --fill: #0E3B43; --fill-2: #1D5A63;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #7FC9C2; --ink-2: #5FB0A8; --paper: #0B1C20; --surface: #12292E; --capsule: #F2B630; --capsule-ink: #2A1E00;
    --mint: #57C496; --rose: #F07D72; --text: #E4EEEC; --muted: #93A7AA; --line: #22403F; --soft: #173439; --fill: #236B66; --fill-2: #2C8780;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -14px rgba(0,0,0,.8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #7FC9C2; --ink-2: #5FB0A8; --paper: #0B1C20; --surface: #12292E; --capsule: #F2B630; --capsule-ink: #2A1E00;
  --mint: #57C496; --rose: #F07D72; --text: #E4EEEC; --muted: #93A7AA; --line: #22403F; --soft: #173439; --fill: #236B66; --fill-2: #2C8780;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -14px rgba(0,0,0,.8); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--paper); color: var(--text); font-size: 15px; line-height: 1.5;
  font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased; overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--capsule); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- kerangka ---------- */
#app { max-width: 720px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--paper);
  display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 10px;
}
.topbar h1 { font-size: 20px; line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -.01em; flex: 1; min-width: 0; }
.topbar .sub { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn svg { width: 20px; height: 20px; }
.view { padding: 4px 16px 24px; }

.net { margin: 0 16px 10px; padding: 9px 12px; border-radius: var(--r-sm); font-size: 13px; display: flex; gap: 8px; align-items: center; background: var(--soft); }
.net.warn { background: color-mix(in srgb, var(--capsule) 25%, var(--surface)); }
.net button { margin-left: auto; }

/* ---------- navigasi bawah ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.nav-in { max-width: 720px; margin: 0 auto; height: var(--nav-h); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 6px 0; position: relative; }
.nav a svg { width: 23px; height: 23px; }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ''; position: absolute; top: -1px; width: 26px; height: 3px; border-radius: 3px; background: var(--capsule); }
.nav .plus { justify-self: center; width: 64px; height: 40px; border-radius: 999px; border: 0; cursor: pointer; position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--ink) 0 50%, var(--capsule) 50% 100%); box-shadow: var(--shadow); margin-top: -18px; }
.nav .plus svg { width: 22px; height: 22px; color: #fff; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); filter: drop-shadow(0 0 1px rgba(0,0,0,.4)); }
.nav .badge { position: absolute; top: 2px; right: calc(50% - 22px); }

/* ---------- komponen ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2 { font-size: 16px; margin: 0 0 10px; font-weight: 700; }
.card .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card .head h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; background: var(--ink); color: var(--surface); font-weight: 700; cursor: pointer; text-decoration: none; }
:root[data-theme="dark"] .btn, :root:not([data-theme="light"]) .btn { }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.cap { background: var(--capsule); color: var(--capsule-ink); }
.btn.danger { background: transparent; color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, transparent); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--ink-2); font-weight: 700; cursor: pointer; font-size: 14px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip.ok { background: color-mix(in srgb, var(--mint) 16%, var(--surface)); color: var(--mint); }
.chip.new { background: color-mix(in srgb, var(--capsule) 26%, var(--surface)); color: var(--capsule-ink); }
:root[data-theme="dark"] .chip.new { color: var(--capsule); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.new { color: var(--capsule); } }
.chip.bad { background: color-mix(in srgb, var(--rose) 14%, var(--surface)); color: var(--rose); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rose); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }

/* ---------- kapsul progres (unsur khas) ---------- */
.capsule { position: relative; height: 34px; border-radius: 999px; background: var(--soft); overflow: hidden; border: 1px solid var(--line); }
.capsule .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, var(--fill) 0, var(--fill-2) 100%); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.capsule .fill.over { background: linear-gradient(90deg, var(--fill) 0 70%, var(--capsule) 100%); }
.capsule .pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--capsule); }
.capsule .lbl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; font-size: 13px; font-weight: 800; color: var(--text); mix-blend-mode: normal; }
.capsule .lbl .on { color: #fff; }
.capsule.slim { height: 12px; }
@media (prefers-reduced-motion: reduce) { .capsule .fill { transition: none; } }

.hero-total { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.kpi { background: var(--paper); border-radius: var(--r-md); padding: 10px 12px; }
.kpi b { display: block; font-size: 18px; font-weight: 800; }
.kpi span { font-size: 12px; color: var(--muted); }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: 12px; }
.bars i { flex: 1; background: var(--line); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars i.on { background: var(--ink-2); }
.bars i.today { background: var(--capsule); }

/* ---------- daftar ---------- */
.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.item:last-child { border-bottom: 0; }
.item .t { font-weight: 700; }
.item .s { font-size: 13px; color: var(--muted); }
.item .v { margin-left: auto; text-align: right; flex: none; }
.item input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.daysep { padding: 8px 16px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--paper); position: sticky; top: 0; }
.empty { text-align: center; padding: 28px 18px; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }

.berrow { padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.berrow:last-child { border-bottom: 0; }
.berrow .top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.berrow .nm { font-weight: 800; }
.berrow .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--line); }
.dot.live { background: var(--mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 25%, transparent); }

/* ---------- form ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field > span em { font-style: normal; color: var(--rose); }
.field small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.in, select.in, textarea.in { width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); font-size: 16px; }
textarea.in { min-height: 84px; resize: vertical; }
.in:focus { border-color: var(--ink-2); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink-2) 18%, transparent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: var(--soft); border-radius: 999px; padding: 4px; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.line { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; padding: 12px; border: 1.5px solid var(--line); border-radius: var(--r-md); margin-bottom: 10px; }
.line .x { grid-column: 2; grid-row: 1; }
.line .meta { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: var(--soft); font-size: 22px; font-weight: 700; cursor: pointer; color: var(--ink); }
.stepper input { width: 56px; height: 44px; border: 0; text-align: center; font-weight: 800; font-size: 17px; background: var(--surface); }
.sticky-save { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 -2px 0 var(--line), var(--shadow); padding: 12px 14px; display: flex; gap: 12px; align-items: center; z-index: 5; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { border: 1.5px solid var(--line); background: var(--surface); padding: 8px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.pick[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- lembar bawah (bottom sheet) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(5, 20, 24, .45); z-index: 50; animation: fade .18s ease; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92dvh; overflow-y: auto; background: var(--paper);
  border-radius: 24px 24px 0 0; padding: 8px 16px calc(var(--safe-b) + 20px); max-width: 720px; margin: 0 auto; animation: up .24s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 12px; }
.sheet h3 { margin: 0 0 14px; font-size: 18px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.act { border: 0; background: var(--surface); border-radius: var(--r-md); padding: 14px; text-align: left; cursor: pointer; box-shadow: var(--shadow); min-height: 84px; }
.act b { display: block; font-size: 15px; }
.act span { font-size: 12.5px; color: var(--muted); }
.act .ic { width: 34px; height: 20px; border-radius: 999px; margin-bottom: 8px; background: linear-gradient(90deg, var(--ink) 0 50%, var(--capsule) 50%); }
.act.main { grid-column: span 1; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes down { from { transform: translateY(-20px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-bg, .toast { animation: none; } }

.toast { position: fixed; left: 16px; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 12px); z-index: 60; max-width: 520px; margin: 0 auto;
  background: var(--text); color: var(--paper); padding: 12px 16px; border-radius: var(--r-md); font-weight: 600; box-shadow: var(--shadow); animation: down .2s ease; }
.toast.err { background: var(--rose); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px; max-width: 420px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand .pill { width: 56px; height: 30px; border-radius: 999px; background: linear-gradient(90deg, var(--ink) 0 50%, var(--capsule) 50%); transform: rotate(-24deg); box-shadow: var(--shadow); }
.brand b { font-size: 30px; font-weight: 800; letter-spacing: .02em; }
.brand span { display: block; color: var(--muted); font-size: 14px; }
.demo-note { font-size: 13px; background: var(--soft); border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 16px; }

/* ---------- laporan ---------- */
.rep { display: flex; gap: 14px; align-items: flex-start; }
.rep .tag { flex: none; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: var(--soft); color: var(--ink); }
.files { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.file { border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 12px; display: flex; gap: 10px; align-items: center; background: var(--surface); cursor: pointer; text-align: left; }
.file .ext { font-weight: 800; font-size: 12px; padding: 6px 7px; border-radius: 8px; color: #fff; }
.file .ext.x { background: #1F7A4D; } .file .ext.p { background: #B3362D; }
.preview { overflow: auto; max-height: 60dvh; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; color: #13232A; }
.preview table { border-collapse: collapse; font-size: 11px; }
.preview td, .preview th { border: 1px solid #c9d6d3; padding: 3px 6px; white-space: nowrap; }
.preview th { background: #0E3B43; color: #fff; }
.preview .t { font-weight: 800; font-size: 13px; padding: 10px 6px 4px; }
.progress-line { height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; margin-top: 12px; }
.progress-line i { display: block; height: 100%; width: 40%; background: var(--capsule); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---------- panduan ---------- */
.guide-hero { background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 20px 18px; margin-bottom: 16px; position: relative; overflow: hidden; }
:root[data-theme="dark"] .guide-hero { background: #12403F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .guide-hero { background: #12403F; } }
.guide-hero h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.25; max-width: 16ch; }
.guide-hero p { margin: 0; opacity: .85; max-width: 30ch; position: relative; }
.guide-hero .pill { position: absolute; right: -22px; bottom: -12px; width: 110px; height: 52px; border-radius: 999px; background: linear-gradient(90deg, #fff 0 50%, var(--capsule) 50%); transform: rotate(-28deg); opacity: .95; }
.toc { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.toc button { flex: none; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; margin-bottom: 18px; }
.step .no { width: 34px; height: 34px; border-radius: 50%; background: var(--capsule); color: var(--capsule-ink); font-weight: 800; display: grid; place-items: center; }
.step h3 { margin: 4px 0 4px; font-size: 16px; }
.step p { margin: 0 0 8px; color: var(--muted); }
.step ul { margin: 0 0 8px; padding-left: 18px; color: var(--muted); }
.mock { border: 2px solid var(--line); border-radius: 22px; padding: 12px; background: var(--paper); max-width: 300px; font-size: 12.5px; }
.mock .bar { height: 8px; width: 50%; background: var(--line); border-radius: 4px; margin-bottom: 10px; }
.mock .f { border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 10px; margin-bottom: 6px; }
.mock .b { border-radius: 999px; background: var(--ink); color: var(--surface); text-align: center; padding: 7px; font-weight: 700; }
.mock .hl { outline: 3px solid var(--capsule); outline-offset: 2px; }
.faq details { background: var(--surface); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { color: var(--muted); margin: 8px 0 0; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 48px 0; }
.skel { height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--soft), var(--surface), var(--soft)); background-size: 200% 100%; animation: sk 1.2s linear infinite; margin-bottom: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (min-width: 560px) {
  .actions { grid-template-columns: repeat(3, 1fr); }
  .view { padding: 4px 20px 24px; }
}
