/* =========================================================
   SAKTI — Solusi Sehat GKJ Bekti
   Design system mengikuti mockup: gradasi plum → navy,
   aksen lime, panel abu membulat, motif kawung pada kartu.
   ========================================================= */
:root {
  --plum: #3b0b3f;
  --navy: #0e1650;
  --grad: linear-gradient(100deg, #3b0b3f 0%, #1d1049 55%, #0e1650 100%);
  --lime: #dde31e;
  --lime-press: #c9cf12;
  --lime-ink: #1a1b00;
  --blue: #3b53c4;
  --ink: #16161f;
  --ink-2: #474757;
  --ink-3: #74748a;
  --paper: #ffffff;
  --mist: #ececf1;
  --mist-2: #e1e1e8;
  --line: #d4d4de;
  --ok: #17784a;   --ok-bg: #dff3e7;
  --warn: #8f5500; --warn-bg: #fdefd2;
  --bad: #b3261e;  --bad-bg: #fce4e1;
  --low: #1f5aa6;  --low-bg: #e1ecfb;
  --radius-panel: 22px;
  --radius-ctl: 12px;
  --radius-btn: 14px;
  --shadow-pop: 0 18px 50px -12px rgba(14, 22, 80, .35);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --header-h: 64px;
  --bnav-h: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--paper); -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lucide { width: 1.25em; height: 1.25em; stroke-width: 2; flex-shrink: 0; vertical-align: -0.2em; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--grad); color: #fff;
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in {
  max-width: 1160px; margin: 0 auto; height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 20px;
}
.brand { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; color: #fff; text-decoration: none; line-height: 1; }
.brand small { display: none; }
.topnav { display: none; margin-left: auto; gap: 4px; }
.topnav a {
  color: rgba(255,255,255,.78); text-decoration: none; font-size: 17px; font-weight: 500; padding: 8px 14px; border-radius: 10px;
}
.topnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.topnav a.active { color: #fff; font-weight: 700; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; display: inline-grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.1); color: #fff;
}
.icon-btn:hover { background: rgba(255,255,255,.18); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: 15px;
  background: rgba(255,255,255,.14); color: #fff; border: 0; cursor: pointer;
}
.topbar .btn-tambah { display: none; }

main#view { max-width: 1160px; margin: 0 auto; padding: 20px 16px calc(var(--bnav-h) + 28px + env(safe-area-inset-bottom, 0px)); }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none;
  color: var(--ink-3); font-size: 12px; font-weight: 600; background: none; border: 0; cursor: pointer;
}
.bottomnav .lucide { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--navy); }
.bottomnav a.active .lucide { stroke-width: 2.4; }
.bottomnav .fab {
  width: 58px; height: 58px; border-radius: 18px; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center;
  margin-top: -22px; box-shadow: 0 8px 20px -6px rgba(59, 11, 63, .45);
}
.bottomnav .fab .lucide { width: 28px; height: 28px; stroke-width: 2.6; }

.site-footer { background: var(--grad); color: #fff; text-align: center; padding: 34px 16px 40px; display: none; }
.site-footer .brand { font-size: 52px; display: block; }
.site-footer p { font-size: 14px; opacity: .9; margin-top: 6px; }

@media (min-width: 900px) {
  :root { --header-h: 96px; }
  .topbar-in { padding: 0 40px; }
  .brand { font-size: 34px; }
  .topnav { display: flex; }
  .top-actions { margin-left: 12px; }
  .topbar .btn-tambah { display: inline-flex; }
  .top-scan { display: none; }
  .bottomnav { display: none; }
  main#view { padding: 40px 40px 64px; }
  .site-footer { display: block; }
  h1 { font-size: 32px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: var(--radius-btn); border: 1.5px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer;
  text-decoration: none; background: var(--mist); color: var(--ink); transition: background .12s, transform .06s;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:hover { background: var(--mist-2); }
.btn-primary { background: var(--lime); color: var(--lime-ink); }
.btn-primary:hover { background: var(--lime-press); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-dark:hover { background: #1a2470; }
.btn-outline { background: #fff; border-color: var(--line); }
.btn-outline:hover { background: var(--mist); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-danger:hover { background: #f8d2cd; }
.btn-wa { background: #1faa55; color: #fff; }
.btn-wa:hover { background: #178f47; }
.btn-lg { min-height: 58px; font-size: 18px; padding: 14px 22px; border-radius: 16px; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-tambah { background: var(--lime); color: var(--lime-ink); border-radius: 12px; min-height: 52px; padding: 0 20px; font-size: 16px; }
.btn-tambah:hover { background: var(--lime-press); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin-right: auto; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 600; margin-bottom: 10px; min-height: 40px; }

/* Search bar mengikuti mockup (blok ikon abu gelap + field abu) */
.search {
  display: flex; align-items: stretch; background: var(--mist); border: 1.5px solid var(--line); border-radius: var(--radius-ctl);
  overflow: hidden; min-height: 52px; flex: 1 1 280px;
}
.search .s-ico { background: #a3a3ad; color: #fff; display: grid; place-items: center; width: 52px; }
.search input { flex: 1; border: 0; background: transparent; padding: 0 14px; font-size: 17px; min-width: 0; }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--blue); }
.search .s-btn { border: 0; background: transparent; padding: 0 14px; cursor: pointer; color: var(--ink-2); }

/* ---------- Panels ---------- */
.panel { background: var(--mist); border-radius: var(--radius-panel); padding: 20px; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.panel-white { background: #fff; border: 1.5px solid var(--mist-2); border-radius: var(--radius-panel); padding: 20px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h2, .panel-head h3 { margin-right: auto; }
@media (min-width: 900px) { .panel, .panel-white { padding: 28px 36px; } }

.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > * + * { margin-top: 0 !important; } }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span, .label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--ink); }
.field .hint { display: block; font-weight: 500; font-size: 13.5px; color: var(--ink-3); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; min-height: 52px; border: 1.5px solid var(--line); border-radius: var(--radius-ctl); background: #fff;
  padding: 12px 14px; font-size: 17px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 83, 196, .15); }
.affix { position: relative; display: flex; align-items: center; }
.affix .input { padding-right: 70px; }
.affix .pre + .input { padding-left: 46px; padding-right: 14px; }
.affix .pre { position: absolute; left: 14px; color: var(--ink-3); font-weight: 700; pointer-events: none; }
.affix .suf { position: absolute; right: 14px; color: var(--ink-3); font-size: 14px; pointer-events: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.form-actions {
  position: sticky; bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, #fff 30%);
  padding: 18px 0 8px; margin-top: 8px; z-index: 5;
}
@media (min-width: 900px) { .form-actions { bottom: 0; } }

/* Segmented control */
.seg { display: inline-flex; background: var(--mist); border-radius: 14px; padding: 4px; gap: 4px; width: 100%; }
.seg button {
  flex: 1; min-height: 46px; border: 0; background: transparent; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Toggle chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tchip {
  min-height: 42px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; cursor: pointer;
  font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 6px;
}
.tchip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.scroll-x { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .chips { flex-wrap: nowrap; }

/* Kelompok chip (biru mockup) */
.chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 3px 12px; border-radius: 8px; color: #fff;
  background: var(--blue); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.chip-lg { font-size: 18px; min-height: 36px; padding: 4px 14px; }
.chip-ghost { background: var(--mist-2); color: var(--ink-2); }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  white-space: nowrap; line-height: 1.6;
}
.lv-normal { background: var(--ok-bg); color: var(--ok); }
.lv-waspada { background: var(--warn-bg); color: var(--warn); }
.lv-tinggi { background: var(--bad-bg); color: var(--bad); }
.lv-rendah { background: var(--low-bg); color: var(--low); }
.lv-none { background: var(--mist); color: var(--ink-3); }

/* ---------- Lists ---------- */
.list { background: #fff; border: 1.5px solid var(--mist-2); border-radius: 18px; overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; color: inherit; border-top: 1px solid var(--mist-2);
  min-height: 72px; background: #fff; cursor: pointer; width: 100%; border-left: 0; border-right: 0; border-bottom: 0; text-align: left;
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: #f7f7fa; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .meta { font-size: 14px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 2px; }
.list-row .side { text-align: right; flex-shrink: 0; }
.list-row > .lucide:last-child { color: var(--ink-3); }
.initial {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; flex-shrink: 0;
}

/* ---------- Kartu pasien (mockup) ---------- */
.idcard {
  position: relative; overflow: hidden; background: var(--mist); border-radius: var(--radius-panel); padding: 22px 20px 24px;
}
.idcard .kawung { position: absolute; right: 0; top: 0; bottom: 0; width: 42%; max-width: 360px; color: #bdbdc6; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%); mask-image: linear-gradient(90deg, transparent, #000 30%); }
.idcard .kawung svg { width: 100%; height: 100%; }
.idcard > *:not(.kawung) { position: relative; }
.idcard .card-tools { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; z-index: 2; }
.idcard .card-tools .btn { background: rgba(255,255,255,.92); min-height: 44px; width: 44px; padding: 0; }
.idcard .card-tools .btn:hover { background: #fff; }
.idcard .pid { font-weight: 700; font-size: 16px; color: var(--ink-2); }
.idcard .pname { font-size: clamp(32px, 7vw, 58px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; margin: 6px 0 14px; max-width: 85%; overflow-wrap: anywhere; }
.idcard .pmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; font-size: 18px; }
.idcard .pmeta a { color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .idcard { padding: 36px 36px 40px; } .idcard .pmeta { font-size: 22px; } }

/* ---------- Kartu digital (virtual card) ---------- */
.vcard {
  position: relative; overflow: hidden; background: var(--grad); color: #fff; border-radius: 24px; padding: 22px;
  aspect-ratio: 1.586; max-width: 440px; width: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-pop);
}
.vcard .kawung { position: absolute; inset: 0 -30% 0 45%; color: rgba(255,255,255,.09); pointer-events: none; }
.vcard .kawung svg { width: 100%; height: 100%; }
.vcard > *:not(.kawung) { position: relative; }
.vcard .v-top { display: flex; align-items: flex-start; justify-content: space-between; }
.vcard .v-brand { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.vcard .v-org { font-size: 11.5px; opacity: .8; margin-top: 4px; }
.vcard .v-qr { background: #fff; border-radius: 10px; padding: 5px; width: 30%; max-width: 110px; }
.vcard .v-qr svg { display: block; width: 100%; height: auto; }
.vcard .v-bottom { margin-top: auto; }
.vcard .v-id { font-size: 13px; opacity: .85; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.vcard .v-name { font-size: clamp(20px, 6vw, 28px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin: 2px 0 8px; }
.vcard .chip { background: rgba(255,255,255,.18); }

/* ---------- Hasil cek tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(5, 1fr); } }
.tile { background: #fff; border-radius: 16px; padding: 14px; border: 1.5px solid var(--mist-2); }
.tile .t-lbl { font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.tile .t-val { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.tile .t-val small { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.tile.is-empty .t-val { color: var(--ink-3); }

/* ---------- Tabel riwayat (desktop, mengikuti mockup) ---------- */
.table-wrap { overflow-x: auto; }
table.riwayat { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 900px; }
table.riwayat th {
  text-align: left; font-size: 17px; font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap;
}
table.riwayat th + th { border-left: 2px solid var(--ink); }
table.riwayat td { padding: 14px 10px; vertical-align: top; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.riwayat td.c, table.riwayat th.c { text-align: center; }
table.riwayat td.r, table.riwayat th.r { text-align: right; }
table.riwayat tr:last-child td { border-bottom: 0; }
table.riwayat .stack-lines div + div { margin-top: 2px; }
table.riwayat .row-act { opacity: .6; }
table.riwayat tr:hover .row-act { opacity: 1; }

/* Timeline riwayat (mobile) */
.visit-card { background: #fff; border-radius: 18px; padding: 16px; border: 1.5px solid var(--mist-2); }
.visit-card + .visit-card { margin-top: 10px; }
.visit-card .vc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.visit-card .vc-head strong { margin-right: auto; font-size: 16px; }
.vc-vitals { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 15px; }
.vc-vitals span b { font-variant-numeric: tabular-nums; }
.vc-block { margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.vc-block .lbl { font-weight: 700; color: var(--ink); font-size: 13.5px; display: block; }
.show-desktop { display: none; }
@media (min-width: 900px) { .show-desktop { display: block; } .hide-desktop { display: none !important; } }

/* ---------- Dashboard ---------- */
.hello { margin-bottom: 18px; }
.hello h1 { font-size: 28px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.kpi { background: var(--mist); border-radius: 18px; padding: 16px; text-decoration: none; color: inherit; display: block; }
.kpi .k-lbl { font-size: 14px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .k-val { font-size: clamp(22px, 5.5vw, 30px); font-weight: 800; letter-spacing: -0.025em; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .k-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.kpi.hero { background: var(--grad); color: #fff; position: relative; overflow: hidden; }
.kpi.hero .k-lbl, .kpi.hero .k-sub { color: rgba(255,255,255,.8); }
.kpi.hero .kawung { position: absolute; right: -60px; top: -30px; width: 260px; height: 200px; color: rgba(255,255,255,.08); }
.up { color: var(--ok); } .down { color: var(--bad); }
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }
.hbar { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; align-items: center; font-size: 14px; }
.hbar .bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--mist-2); }
.hbar .bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- Quick actions ---------- */
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0 22px; }
@media (min-width: 900px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick a, .quick button {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; border-radius: 16px; background: #fff;
  border: 1.5px solid var(--mist-2); text-decoration: none; color: var(--ink); font-weight: 700; cursor: pointer; text-align: left; font-size: 15.5px;
}
.quick a:hover, .quick button:hover { border-color: var(--line); background: #fafafc; }
.quick .q-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--mist); flex-shrink: 0; }
.quick .primary { background: var(--lime); border-color: var(--lime); }
.quick .primary .q-ico { background: rgba(0,0,0,.08); }

/* ---------- Medicine ---------- */
.stock { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.stock small { font-weight: 600; font-size: 13px; color: var(--ink-3); }
.stock.low { color: var(--bad); }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.stepper button { width: 44px; height: 44px; border: 0; background: var(--mist); cursor: pointer; display: grid; place-items: center; }
.stepper input { width: 56px; height: 44px; border: 0; text-align: center; font-weight: 800; font-size: 18px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.med-line { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.med-line:first-child { border-top: 0; }
.med-line .main { flex: 1; min-width: 0; }
.pay-line { display: grid; grid-template-columns: 1fr 44px; grid-template-areas: "cat del" "amt amt"; gap: 6px 8px; align-items: center;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--mist-2); }
.pay-line [data-pcat] { grid-area: cat; }
.pay-line .affix { grid-area: amt; }
.pay-line [data-delpay] { grid-area: del; }
@media (min-width: 600px) {
  .pay-line { grid-template-columns: 1fr 180px 44px; grid-template-areas: "cat amt del"; padding-bottom: 0; border-bottom: 0; margin-bottom: 8px; }
}
.pay-line .input { min-height: 48px; font-size: 16px; }

/* Label QR cetak */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.label-card { border: 1px dashed #999; border-radius: 8px; padding: 10px; text-align: center; break-inside: avoid; background: #fff; }
.label-card svg { width: 120px; height: 120px; }
.label-card b { display: block; font-size: 13px; margin-top: 4px; }
.label-card span { font-size: 11px; color: #555; }

/* ---------- Sheets / modal ---------- */
.backdrop {
  position: fixed; inset: 0; background: rgba(14, 12, 40, .5); z-index: 80; display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease;
}
.sheet {
  background: #fff; width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  animation: rise .2s cubic-bezier(.2,.8,.2,1);
}
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { margin-right: auto; font-size: 20px; }
.sheet-close { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--mist); cursor: pointer; display: grid; place-items: center; }
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { max-width: 560px; border-radius: 24px; padding: 18px 26px 26px; }
  .sheet .grab { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }

.action-list { display: grid; gap: 10px; }
.action-list button, .action-list a {
  display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 12px 16px; border-radius: 16px; border: 1.5px solid var(--mist-2);
  background: #fff; cursor: pointer; text-align: left; text-decoration: none; color: var(--ink);
}
.action-list .a-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--mist); flex-shrink: 0; }
.action-list .a-t { font-weight: 700; font-size: 17px; display: block; }
.action-list .a-s { font-size: 14px; color: var(--ink-3); display: block; }
.action-list .primary { background: var(--lime); border-color: var(--lime); }
.action-list .primary .a-ico { background: rgba(0,0,0,.08); }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--bnav-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 120; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 900px) { .toasts { bottom: 28px; } }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-pop);
  display: flex; align-items: center; gap: 10px; max-width: 520px; animation: rise .2s ease; pointer-events: auto;
}
.toast.err { background: var(--bad); }
.toast.ok .lucide { color: var(--lime); }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty .e-ico { width: 64px; height: 64px; border-radius: 20px; background: var(--mist); display: grid; place-items: center; margin: 0 auto 14px; color: var(--ink-3); }
.empty .e-ico .lucide { width: 30px; height: 30px; }
.empty h3 { margin-bottom: 6px; }
.empty p { max-width: 380px; margin: 0 auto 16px; }
.loading { display: grid; place-items: center; padding: 60px 0; color: var(--ink-3); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--mist-2); border-top-color: var(--navy); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 15px; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--low-bg); color: var(--low); }

/* ---------- Scanner ---------- */
.scanner { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; display: flex; flex-direction: column; }
.scanner-top { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px; background: var(--grad); }
.scanner-top h2 { font-size: 18px; margin-right: auto; }
.scanner-view { flex: 1; position: relative; overflow: hidden; display: grid; place-items: center; }
.scanner-view #qr-reader { width: 100%; height: 100%; }
.scanner-view video { object-fit: cover; width: 100% !important; height: 100% !important; }
.scan-frame { position: absolute; width: min(78vw, 360px); aspect-ratio: 1.6; border: 3px solid var(--lime); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); pointer-events: none; }
.scan-hint { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-weight: 600; text-shadow: 0 1px 4px #000; padding: 0 16px; }
.scanner-bottom { background: #fff; color: var(--ink); padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
.scanner-bottom form { display: flex; gap: 8px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--grad); padding: 24px 16px; position: relative; overflow: hidden; }
.login-wrap > .kawung { position: absolute; inset: -10%; color: rgba(255,255,255,.05); }
.login-wrap > .kawung svg { width: 100%; height: 100%; }
.login-card { position: relative; background: #fff; border-radius: 26px; padding: 30px 24px; width: 100%; max-width: 420px; box-shadow: var(--shadow-pop); }
.login-card .brand { color: var(--ink); font-size: 44px; }
.login-card .tagline { color: var(--ink-3); margin: 6px 0 24px; }

/* ---------- Print ---------- */
@media print {
  .topbar, .bottomnav, .site-footer, .no-print, .toasts { display: none !important; }
  main#view { padding: 0; max-width: none; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ikon status di dalam lingkaran */
.initial.lv-normal { color: var(--ok); }
.initial.lv-waspada { color: var(--warn); }
.initial.lv-tinggi { color: var(--bad); }
.initial.lv-rendah { color: var(--low); }
.vcard .v-qr:empty { display: none; }
.grid-2 > * { min-width: 0; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.scroll-x .chips > * { flex-shrink: 0; white-space: nowrap; }
.list-row .side { max-width: 45%; }
