/* ============================================================
   PUI CAINT — Design System (vanilla CSS, pengganti Tailwind)
   Token warna: variabel --c-* (RGB triplet) dari base.html.
   Font: Inter (body), Space Grotesk (display), JetBrains Mono (data).
   ============================================================ */

/* ---------- 1. Dasar & reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* Atribut hidden selalu menang atas display komponen (mis. .chart-status display:flex). */
[hidden] { display: none !important; }

/* pengganti ringan Tailwind preflight */
h1, h2, h3, h4, p, ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; padding: 0; }

body {
  font-family: "Inter", system-ui, sans-serif;
  min-height: 100vh;
  background: rgb(var(--c-canvas));
  color: rgb(var(--c-ink));
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display-font {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-weight: 600;
}

a { color: rgb(var(--c-accent)); text-decoration: none; }
a:hover { text-decoration: underline; }
.btn, .nav-link, .tab, .icon-btn, .logout-link { text-decoration: none; }
.btn:hover, .tab:hover, .icon-btn:hover, .logout-link:hover { text-decoration: none; }

img, svg { display: inline-block; vertical-align: middle; }

/* Scrollbar halus */
* { scrollbar-width: thin; scrollbar-color: rgb(var(--c-line) / .25) transparent; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
.nav-link:focus-visible, .logout-link:focus-visible, .icon-btn:focus-visible,
.tab:focus-visible, .btn:focus-visible {
  outline: 2px solid rgb(var(--c-accent)); outline-offset: 2px;
}

/* ---------- 2. Shell aplikasi ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.content { flex: 1 1 auto; padding: 1.5rem; max-width: 90rem; width: 100%; margin: 0 auto; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 240px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgb(var(--c-surface));
  transition: width .25s cubic-bezier(.4,0,.2,1);
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1rem 1rem; overflow: hidden; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 10px; background: rgb(var(--c-primary) / .12); color: rgb(var(--c-primary)); }
.brand-text { min-width: 0; transition: opacity .2s ease; white-space: nowrap; }
.brand-name { font-family: "Space Grotesk", Inter, sans-serif; font-weight: 700; font-size: .875rem; letter-spacing: .02em; color: rgb(var(--c-ink)); }
.brand-sub { font-size: .6875rem; color: rgb(var(--c-muted)); white-space: nowrap; }
.nav-list { list-style: none; margin: .5rem 0; padding: 0 .75rem; display: grid; gap: .25rem; }
.nav-group {
  margin: .875rem .5rem .375rem;
  font-size: .625rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgb(var(--c-muted) / .8); white-space: nowrap;
}
.nav-group:first-child { margin-top: .125rem; }
.nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .5625rem .75rem; border-radius: 10px;
  font-size: .875rem; font-weight: 500; color: rgb(var(--c-muted));
  white-space: nowrap; overflow: hidden;
  transition: background-color .15s ease, color .15s ease;
}
.nav-link:hover { background: rgb(var(--c-surface-2)); color: rgb(var(--c-ink)); text-decoration: none; }
.nav-link.active { background: rgb(var(--c-primary) / .10); color: rgb(var(--c-primary)); }
.nav-text { transition: opacity .2s ease; }
.nav-count { margin-left: auto; font-size: .6875rem; font-weight: 600; padding: .125rem .5rem; border-radius: 999px;
  background: rgb(var(--c-danger) / .12); color: rgb(var(--c-danger)); transition: opacity .2s ease; }
.nav-count--live { background: rgb(var(--c-success) / .12); color: rgb(var(--c-success)); }
.sidebar-footer { margin-top: auto; position: relative; padding: .75rem; }
.sidebar-user {
  display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: 8px;
  cursor: pointer; transition: background .12s ease;
}
.sidebar-user:hover { background: rgb(var(--c-surface-2)); }
.sidebar-user:focus-visible { outline: 2px solid rgb(var(--c-accent)); outline-offset: 2px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 8px; background: rgb(var(--c-primary) / .12); color: rgb(var(--c-primary));
  font-size: .6875rem; font-weight: 700; letter-spacing: .02em; }
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: .8125rem; font-weight: 600; color: rgb(var(--c-ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .6875rem; color: rgb(var(--c-muted)); }
.user-menu {
  position: absolute; bottom: 100%; left: .75rem; right: .75rem; margin-bottom: .25rem;
  background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line) / .10);
  border-radius: 8px; box-shadow: 0 4px 12px rgb(0 0 0 / .08);
  overflow: hidden; z-index: 30;
}
.user-menu[hidden] { display: none; }
.user-menu-item {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem;
  font-size: .8125rem; font-weight: 500; color: rgb(var(--c-ink));
  text-decoration: none; transition: background .1s ease;
}
.user-menu-item:hover { background: rgb(var(--c-danger) / .06); color: rgb(var(--c-danger)); text-decoration: none; }
html.rail .sidebar-footer { padding: .5rem; display: flex; justify-content: center; }
html.rail .user-meta { opacity: 0; pointer-events: none; }
html.rail .sidebar-user { justify-content: center; padding: .5rem; }
html.rail .user-menu { left: .5rem; right: auto; min-width: 8rem; }

/* Rail (tablet default & desktop collapsed) */
html.rail .sidebar { width: 64px; }
html.rail .brand-text, html.rail .nav-text, html.rail .user-meta,
html.rail .nav-count, html.rail .nav-group { display: none; }
html.rail .sidebar-brand, html.rail .sidebar-footer { justify-content: center; padding-left: .5rem; padding-right: .5rem; }
  html.rail .nav-link { justify-content: center; padding: .625rem; }
  /* Dua tombol sidebar. Selektor ganda (.icon-btn.…) supaya menang atas .icon-btn
     (didefinisikan lebih bawah), dan aturan dasar (hidden) ditaruh SEBELUM media query —
     sebelumnya urutannya terbalik sehingga hamburger tidak pernah tampil di HP. */
  .icon-btn.icon-btn--desktop { display: none; }
  .icon-btn.icon-btn--mobile { display: none; }
  /* Ciutkan/lebarkan rail: tablet & desktop (≥769px) */
  @media (min-width: 769px) { .icon-btn.icon-btn--desktop { display: inline-flex; } }
  /* Hamburger buka drawer: hanya HP/tablet kecil (≤768px) */
  @media (max-width: 768px) { .icon-btn.icon-btn--mobile { display: inline-flex; } }

  /* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; padding: 0 1.25rem;
  background: rgb(var(--c-surface) / .85); backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: .375rem; justify-content: flex-end; }
.page-title { font-family: "Space Grotesk", Inter, sans-serif; font-size: 1rem; font-weight: 600; color: rgb(var(--c-ink));
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Tanpa kotak cari (< 768px) grid 3 kolom membuat aksi pindah ke kolom tengah
   dan judul terhimpit menimpa ikon lonceng — pakai 2 kolom saja. */
@media (max-width: 767.98px) { .topbar { grid-template-columns: minmax(0, 1fr) auto; } }
.topbar-search { position: relative; display: none; align-items: center; width: 16rem; justify-self: center; }
@media (min-width: 768px) { .topbar-search { display: flex; } }
/* Cari langsung: isi sedikit memudar selama hasil diambil (tanpa muat ulang halaman). */
.content { transition: opacity .12s ease; }
.content.is-loading { opacity: .55; }
/* Pengganti kotak cari di halaman tanpa pencarian: menjaga grid 3 kolom topbar. */
.topbar-search-spacer { display: none; }
@media (min-width: 768px) { .topbar-search-spacer { display: block; width: 16rem; } }
.topbar-search > svg { position: absolute; left: .75rem; pointer-events: none; color: rgb(var(--c-muted)); }
.topbar-search > input { padding-left: 2.25rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  color: rgb(var(--c-muted));
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background-color: rgb(var(--c-surface-2)); color: rgb(var(--c-ink)); }
.topbar-bell { position: relative; }
.bell-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 999px;
  background: rgb(var(--c-danger)); border: 2px solid rgb(var(--c-surface)); }
.topbar-avatar { width: 32px; height: 32px; }

/* Overlay mobile */
.sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 30; background: rgb(2 6 23 / .5); }
.sidebar-overlay.visible { display: block; }

/* Drawer mobile */
@media (max-width: 768px) {
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; width: 240px !important; }
  .sidebar.open { transform: translateX(0); }
html.rail .sidebar { width: 240px !important; }
html.rail .brand-text, html.rail .nav-text, html.rail .user-meta, html.rail .nav-group { display: block; }
html.rail .nav-link { justify-content: flex-start; }
}

/* ---------- 3. Kerangka halaman ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header__title { font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.25rem; font-weight: 600; color: rgb(var(--c-ink)); }
.page-header__subtitle { margin-top: .25rem; font-size: .875rem; color: rgb(var(--c-muted)); }
.page-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }

.empty-state { padding: 3rem 0; text-align: center; font-size: .875rem; color: rgb(var(--c-muted)); }

.card {
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .10);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .04), 0 4px 12px rgb(15 23 42 / .05);
}
.card--pad { padding: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid rgb(var(--c-line) / .10); }

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.text-muted { color: rgb(var(--c-muted)); }

/* ---------- 4. Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: 10px; padding: .5rem 1rem;
  font-size: .875rem; font-weight: 600;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  cursor: pointer; border: none;
}
.btn--primary { background: rgb(var(--c-primary)); color: rgb(var(--c-on-primary)); }
.btn--primary:hover { background: rgb(var(--c-primary-hover)); }
.btn--secondary { background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line) / .15); color: rgb(var(--c-ink)); }
.btn--secondary:hover { background: rgb(var(--c-surface-2)); }
.btn--ghost { background: transparent; color: rgb(var(--c-muted)); font-weight: 500; padding: .5rem .75rem; }
.btn--ghost:hover { background: rgb(var(--c-surface-2)); color: rgb(var(--c-ink)); }
.btn--ghost-danger { background: transparent; color: rgb(var(--c-danger)); font-weight: 500; }
.btn--ghost-danger:hover { background: rgb(var(--c-danger) / .10); }
.btn--danger { background: rgb(var(--c-danger) / .10); color: rgb(var(--c-danger)); }
.btn--danger:hover { background: rgb(var(--c-danger) / .20); }
.btn--sm { padding: .375rem .75rem; font-size: .75rem; }
.btn--block { width: 100%; }
.btn--inline { display: inline-flex; }

/* ---------- 5. Badge & dot ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .375rem;
  border-radius: 999px; padding: .25rem .625rem;
  font-size: .75rem; font-weight: 500;
}
.badge--success { background: rgb(var(--c-success) / .10); color: rgb(var(--c-success)); }
.badge--warning { background: rgb(var(--c-warning) / .10); color: rgb(var(--c-warning)); }
.badge--danger  { background: rgb(var(--c-danger) / .10);  color: rgb(var(--c-danger)); }
.badge--info    { background: rgb(var(--c-info) / .10);    color: rgb(var(--c-info)); }
.badge--primary { background: rgb(var(--c-primary) / .10); color: rgb(var(--c-primary)); }
.badge--muted   { background: rgb(var(--c-line) / .10);    color: rgb(var(--c-muted)); }

.dot { display: inline-block; width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.dot--pulse { animation: pulse-ring 2s ease-out infinite; }

/* ---------- 6. Tabel ---------- */
.table-wrap {
  /* Petunjuk "bisa digeser": bayangan tipis di tepi kiri/kanan muncul HANYA saat ada isi
     yang tersembunyi di sisi itu (teknik background-attachment: local). */
  background-image:
    linear-gradient(to right, rgb(var(--c-surface)) 30%, rgb(var(--c-surface) / 0)),
    linear-gradient(to left, rgb(var(--c-surface)) 30%, rgb(var(--c-surface) / 0)),
    radial-gradient(farthest-side at 0 50%, rgb(15 23 42 / .22), rgb(15 23 42 / 0)),
    radial-gradient(farthest-side at 100% 50%, rgb(15 23 42 / .22), rgb(15 23 42 / 0));
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-repeat: no-repeat;
  background-size: 2.5rem 100%, 2.5rem 100%, .9rem 100%, .9rem 100%;
  background-attachment: local, local, scroll, scroll;
  /* position: relative -> elemen position:absolute di dalam tabel (mis. .sr-only pada kolom
     "Aksi") terkurung di wadah ini. Tanpa ini ia terletak di luar layar HP dan membuat
     SELURUH halaman bisa digeser ke samping. */
  position: relative;
  /* Tabel lebar bisa digeser ke samping (keluhan pembimbing L1519); sudut tetap membulat. */
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background-color: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .10);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .04), 0 4px 12px rgb(15 23 42 / .05);
}
table.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table thead th {
  background: rgb(var(--c-surface-2)); text-align: left;
  font-size: .75rem; text-transform: uppercase; letter-spacing: .03em;
  color: rgb(var(--c-muted)); padding: .75rem 1rem; font-weight: 600;
}
.table tbody td { border-top: 1px solid rgb(var(--c-line) / .10); padding: .75rem 1rem; vertical-align: middle; }
.table tbody tr:hover { background: rgb(var(--c-surface-2) / .6); }
/* Avatar/ikon + nama di dalam sel tabel: tetap berdampingan (tidak turun ke bawah di layar
   sempit); hanya teks nama yang boleh membungkus. */
.table td .page-header__actions { flex-wrap: nowrap; }
.table td .page-header__actions > div { min-width: 0; }
/* Judul kolom satu baris; sel yang memuat avatar/ikon + nama cukup lebar agar nama tidak
   pecah per kata; sel teks tidak terlalu sempit. Tabel tetap bisa digeser bila lebih lebar. */
.table thead th { white-space: nowrap; }
.table td:has(> .page-header__actions) { min-width: 12rem; }
@media (max-width: 768px) {
  .table tbody td { min-width: 6.5rem; }
  .table td.empty-state { text-align: left; }
}
td.nowrap { white-space: nowrap; }
td.cell-muted { color: rgb(var(--c-muted)); white-space: nowrap; }

/* ---------- 7. Form ---------- */
.form-input {
  width: 100%; border-radius: 10px;
  border: 1px solid rgb(var(--c-line) / .15);
  background: rgb(var(--c-surface));
  padding: .5rem .75rem; font-size: .875rem; color: rgb(var(--c-ink));
}
.form-input::placeholder { color: rgb(var(--c-muted) / .70); }
.form-input:focus {
  border-color: rgb(var(--c-accent));
  box-shadow: 0 0 0 3px rgb(var(--c-accent) / .30);
  outline: none;
}
select.form-input { width: 100%; }
input[type="search"].form-input { width: 100%; }

.form-label { display: block; margin-bottom: .375rem; font-size: .8125rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: rgb(var(--c-muted)); }
.form-grid { display: grid; gap: 1.125rem 1rem; }
@media (min-width: 768px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-field--full { grid-column: 1 / -1; }
.form-section {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: .625rem;
  margin: .25rem 0 -.25rem;
  font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: rgb(var(--c-primary));
}
.form-section::after { content: ""; flex: 1; height: 1px; background: rgb(var(--c-line) / .12); }
.form-section:not(:first-child) { margin-top: .75rem; }
input[type="checkbox"].pill-check { accent-color: rgb(var(--c-primary)); width: 1rem; height: 1rem; }

/* Bar filter halaman data: kartu berisi field label-di-atas-input.
   Pengganti form.chip-row yang membuat input melebar & tombol tidak sejajar. */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .10);
  border-radius: 12px;
  padding: .875rem 1rem;
  margin-bottom: 1rem;
}
.filter-field { display: flex; flex-direction: column; gap: .25rem; }
.filter-field--grow { flex: 1 1 15rem; min-width: 12rem; }
.filter-field .form-label { margin-bottom: 0; }
.filter-field .form-input { width: auto; }
.filter-field--grow .form-input { width: 100%; }
.filter-field input[type="date"].form-input { width: 9.75rem; }
@media (max-width: 640px) {
  /* Grid 2 kolom: Perangkat selebar kartu, Dari/Sampai dan Jam dari/Jam sampai
     berpasangan, Terapkan/Reset berdampingan. Jarak antar-field lebih lega dan
     tinggi sentuh >= 44 px supaya tidak dempet / sulit dipencet. */
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 1.125rem .75rem; padding: 1rem; }
  .filter-field { min-width: 0; }
  .filter-field--grow { grid-column: 1 / -1; min-width: 0; }
  .filter-field .form-input, .filter-field--grow .form-input,
  .filter-field input[type="date"].form-input { width: 100%; min-width: 0; }
  .filter-bar .form-input, .filter-bar .btn { min-height: 2.75rem; }
  .filter-bar .form-label { margin-bottom: .125rem; }
}
/* Layar sangat sempit: kolom tunggal agar input tanggal/jam tidak terpotong. */
@media (max-width: 359px) {
  .filter-bar { grid-template-columns: 1fr; }
}

/* Baris aksi form (Simpan/Batal) setelah kartu/tabel — napas dari elemen di atasnya. */
.form-actions { display: flex; align-items: center; gap: .625rem; margin-top: 1rem; }
label.pill {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid rgb(var(--c-line) / .15); border-radius: 999px;
  padding: .4375rem .875rem; font-size: .8125rem; font-weight: 600;
  color: rgb(var(--c-muted)); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
label.pill:hover { border-color: rgb(var(--c-primary) / .5); color: rgb(var(--c-ink)); }
label.pill:has(input:checked) {
  border-color: rgb(var(--c-primary));
  background: rgb(var(--c-primary) / .10);
  color: rgb(var(--c-primary));
}

.flash { border-radius: 10px; padding: .75rem 1rem; font-size: .875rem; margin-bottom: 1rem; }
.flash:last-child { margin-bottom: 0; }
.flash--danger  { background: rgb(var(--c-danger) / .10);  color: rgb(var(--c-danger)); }
.flash--success { background: rgb(var(--c-success) / .10); color: rgb(var(--c-success)); }
.flash--warning { background: rgb(var(--c-warning) / .12); color: rgb(var(--c-warning)); }

/* ---------- 8. Tab / chip filter ---------- */
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.tab {
  border-radius: 10px; padding: .375rem .75rem;
  font-size: .875rem; font-weight: 500; color: rgb(var(--c-muted));
  transition: background-color .15s ease, color .15s ease;
}
.tab:hover { background: rgb(var(--c-surface-2)); color: rgb(var(--c-ink)); }
.tab--active { background: rgb(var(--c-primary) / .10); color: rgb(var(--c-primary)); }

/* Paging bernomor: footer daftar dengan napas dari tabel, bukan nempel.
   Dipakai partial pagination.html di semua halaman daftar. */
.paging {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .625rem 1rem;
  margin-top: 1rem; margin-bottom: .25rem;
}
.paging__pages { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.paging__ellipsis { color: rgb(var(--c-muted)); padding: 0 .25rem; }
.paging__info {
  font-size: .8125rem; color: rgb(var(--c-muted));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .paging { flex-direction: column; align-items: flex-start; }
}

/* ---------- 9. Stat card (dashboard) ---------- */
.stat-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Grafik dashboard: tren 7 hari + donat status perangkat. */
.dash-charts { display: grid; gap: 1rem; }
@media (min-width: 1024px) { .dash-charts { grid-template-columns: 2fr 1fr; } }
.chart-box { position: relative; height: 260px; }
.chart-box--square { height: 220px; }
.chart-box canvas { display: block; max-width: 100%; }
/* Jarak antara teks hint dan area grafik di dalam kartu. */
.hint + .chart-box { margin-top: .75rem; }
@media (max-width: 640px) { .chart-box { height: 220px; } }

.stat-card {
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .10);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .04), 0 4px 12px rgb(15 23 42 / .05);
  padding: 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon--primary { background: rgb(var(--c-primary) / .10); color: rgb(var(--c-primary)); }
.stat-icon--success { background: rgb(var(--c-success) / .10); color: rgb(var(--c-success)); }
.stat-icon--warning { background: rgb(var(--c-warning) / .10); color: rgb(var(--c-warning)); }
.stat-icon--danger  { background: rgb(var(--c-danger) / .10);  color: rgb(var(--c-danger)); }
.stat-icon--info    { background: rgb(var(--c-info) / .10);    color: rgb(var(--c-info)); }
.stat-icon--muted   { background: rgb(var(--c-line) / .10);    color: rgb(var(--c-muted)); }
.stat-label { font-size: .6875rem; text-transform: uppercase; letter-spacing: .025em; color: rgb(var(--c-muted)); }
.stat-value { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 1.5rem; font-weight: 600; color: rgb(var(--c-ink)); font-variant-numeric: tabular-nums; }

/* ---------- 10. Daftar baris dalam kartu ---------- */
.rows-card {
  overflow: hidden;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .10);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .04), 0 4px 12px rgb(15 23 42 / .05);
}
.row-item { border-top: 1px solid rgb(var(--c-line) / .10); padding: .75rem 1rem; transition: background-color .15s ease; }
.row-item:first-child { border-top: none; }
.row-item:hover { background: rgb(var(--c-surface-2) / .60); }
.row-item--unread { background: rgb(var(--c-warning) / .05); }

.inline-form { display: inline; }

/* ---------- 11. Konsol monitoring ---------- */
.monitor-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); }

.monitor-card {
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .10);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .04), 0 4px 12px rgb(15 23 42 / .05);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.monitor-card--online { border-color: rgb(var(--c-success) / .30); }
.monitor-card--offline { border-color: rgb(var(--c-line) / .10); opacity: .9; }

.monitor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.monitor-name { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .875rem; font-weight: 600; color: rgb(var(--c-ink)); }
.monitor-sub { font-size: .75rem; color: rgb(var(--c-muted)); }

.vital-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
@media (min-width: 640px) { .vital-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.vital-label { font-size: .6875rem; text-transform: uppercase; letter-spacing: .1em; color: rgb(var(--c-muted)); white-space: nowrap; }
.vital-value, .monitor-vital__value {
  display: flex; align-items: baseline; gap: .3rem; flex-wrap: wrap;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.5rem; font-weight: 600; color: rgb(var(--c-ink));
  font-variant-numeric: tabular-nums;
}
.vital-unit, .monitor-vital__unit { font-size: .8125rem; font-weight: 400; color: rgb(var(--c-muted)); }

/* Hook untuk JS polling (pengganti kelas utility yang ditulis script) */
.monitor-card__status {
  display: inline-flex; align-items: center; gap: .375rem;
  border-radius: 999px; padding: .25rem .625rem;
  font-size: .75rem; font-weight: 500;
}
.monitor-card__status--online { background: rgb(var(--c-success) / .10); color: rgb(var(--c-success)); }
.monitor-card__status--offline { background: rgb(var(--c-line) / .10); color: rgb(var(--c-muted)); }
.monitor-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.monitor-actions form { margin: 0; }
.monitor-updated { margin-top: auto; padding-top: .5rem; font-size: .75rem; color: rgb(var(--c-muted)); }

.monitor-ecg { height: 56px; width: 100%; }
.monitor-ecg-holder { height: 56px; width: 100%; display: flex; align-items: center; }
/* Kanvas EKG besar di halaman detail Monitoring. */
.monitor-ecg-holder--lg, .monitor-ecg-holder--lg .monitor-ecg { height: 160px; }
/* Detail Monitoring: vital + EKG di kiri, tensi/notifikasi/info di kanan (layar lebar). */
.monitor-layout { display: grid; gap: 1.5rem; }
.monitor-layout__main, .monitor-layout__side { display: grid; gap: 1.5rem; align-content: start; min-width: 0; }
@media (min-width: 1024px) { .monitor-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.vital-grid--detail { grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); }
.vital-time { margin-top: .25rem; font-size: .75rem; color: rgb(var(--c-muted)); min-height: 1rem; }
.monitor-alerts { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .75rem; }
.monitor-alerts li { display: grid; gap: .25rem; justify-items: start; padding-top: .75rem; border-top: 1px solid rgb(var(--c-line) / .10); }
.monitor-alerts li:first-child { padding-top: 0; border-top: 0; }
.monitor-alerts .alert-msg { font-size: .8125rem; color: rgb(var(--c-ink)); }
.monitor-alerts .hint { margin-top: 0; }
.monitor-info { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; margin: .75rem 0 0; font-size: .875rem; }
.monitor-info dt { color: rgb(var(--c-muted)); }
.monitor-info dd { margin: 0; color: rgb(var(--c-ink)); text-align: right; overflow-wrap: anywhere; }
.table tr[data-href] { cursor: pointer; }
.ecg-line {
  fill: none; stroke: rgb(var(--c-accent)); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 700; stroke-dashoffset: 700;
  animation: ecg-draw 2.6s linear infinite;
}

/* ---------- 12. Info grid (detail perangkat) ---------- */
.info-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.info-cell {
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .10);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .04), 0 4px 12px rgb(15 23 42 / .05);
  padding: 1rem;
}
.info-label { font-size: .6875rem; text-transform: uppercase; letter-spacing: .025em; color: rgb(var(--c-muted)); }
.info-value { font-size: .875rem; font-weight: 500; color: rgb(var(--c-ink)); }

/* ---------- 13. Halaman auth — split view ---------- */
.auth-split {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}
html body > main { overflow: hidden; margin: 0; }
@media (max-width: 1023px) {
  .auth-split {
    flex-direction: column;
    overflow-y: auto;
  }
}

/* ── Kiri: brand side ── */
.auth-side {
  display: none;
  width: 50%;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 2.25rem;
  background: rgb(var(--c-primary));
  color: #fff;
  position: relative;
  overflow: hidden;
}
@media (min-width: 1024px) {
  .auth-side { display: flex; }
}

/* subtle noise texture */
.auth-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-conic-gradient(rgb(255 255 255 / .025) 0% 25%, transparent 0% 50%)
    0 0 / 4px 4px;
  pointer-events: none;
}

.auth-side-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: .625rem;
}
.auth-side-logo { color: #fff; }
.auth-side-brand {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: .04em;
}

.auth-side-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}
.auth-side-title {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.03em;
}
.auth-side-desc {
  font-size: .9375rem;
  color: rgb(255 255 255 / .6);
  letter-spacing: .02em;
}
.auth-side-body--logo { align-items: center; }
.auth-logo {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 2px 8px rgb(2 6 23 / .25));
}
.auth-theme {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .15);
}

.auth-side-foot { position: relative; }
.auth-ecg {
  display: block;
  width: 100%;
  height: 48px;
  color: rgb(255 255 255 / .32);
}
.auth-ecg-line {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: ecg-draw 5s linear infinite;
}

/* ── Kanan: form side ── */
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: rgb(var(--c-surface));
}
@media (min-width: 640px) {
  .auth-main { padding: 2rem 3rem; }
}
.auth-main-inner {
  width: 100%;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.auth-heading {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: rgb(var(--c-ink));
  letter-spacing: -.01em;
}
.auth-sub {
  font-size: .8125rem;
  color: rgb(var(--c-muted));
  margin-top: .25rem;
}

/* ── Form ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.field { display: flex; flex-direction: column; gap: .3rem; }
.field-label {
  font-size: .75rem;
  font-weight: 600;
  color: rgb(var(--c-ink));
  letter-spacing: .01em;
}
.field-input {
  height: 2.5rem;
  padding: 0 .75rem;
  border: 1px solid rgb(var(--c-line) / .15);
  border-radius: 6px;
  background: rgb(var(--c-surface));
  color: rgb(var(--c-ink));
  font-size: .8125rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field-input::placeholder { color: rgb(var(--c-muted) / .5); }
.field-input:focus {
  outline: none;
  border-color: rgb(var(--c-primary));
  box-shadow: 0 0 0 3px rgb(var(--c-primary) / .10);
}

.auth-submit {
  margin-top: .5rem;
  height: 2.5rem;
  border: none;
  border-radius: 6px;
  background: rgb(var(--c-primary));
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, transform .08s ease;
}
.auth-submit:hover { background: rgb(var(--c-primary-hover)); }
.auth-submit:active { transform: scale(.985); }

.auth-bottom {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .75rem;
}
.auth-bottom a {
  color: rgb(var(--c-primary));
  text-decoration: none;
}
.auth-bottom a:hover { text-decoration: underline; }
.auth-bottom-sep { color: rgb(var(--c-muted) / .4); }

.auth-footnote {
  font-size: .6875rem;
  color: rgb(var(--c-muted) / .55);
}

/* ---------- 14. Motion ---------- */
@keyframes ecg-draw { to { stroke-dashoffset: -700; } }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgb(var(--c-success) / .45); }
  70%, 100% { box-shadow: 0 0 0 6px rgb(var(--c-success) / 0); }
}

@media (prefers-reduced-motion: reduce) {
  .ecg-line, .auth-ecg-line, .dot--pulse { animation: none; }
  .ecg-line, .auth-ecg-line { stroke-dashoffset: 0; }
  .sidebar { transition: none; }
}

/* ---------- 15. Extensions ---------- */
.form-card { max-width: 42rem; margin-inline: auto; }
.section-gap { margin-top: 1.5rem; }
/* Ritme vertikal antar-blok konten: kartu/tabel/grid yang bersebelahan langsung
   tidak pernah menempel atau tampak bertumpuk (mis. kartu "Grafik Riwayat" lalu
   tabel "WAKTU" di Pengukuran), walau template lupa memberi .section-gap.
   Murni layout flow (tanpa position absolute); margin vertikal di block flow
   saling collapse, jadi tidak menggandakan jarak yang sudah ada. */
.content > :is(.card, .table-wrap, .rows-card, .info-grid, .stat-grid, .dash-charts, .monitor-grid)
  + :is(.card, .table-wrap, .rows-card, .info-grid, .stat-grid, .dash-charts, .monitor-grid, .bulk-bar) {
  margin-top: 1.5rem;
}
/* Tinggi kartu selalu mengikuti konten. */
.content .card, .content .table-wrap, .content .rows-card { height: auto; }
.card-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.card-title { font-family: "Space Grotesk", Inter, sans-serif; font-size: .875rem; font-weight: 600; color: rgb(var(--c-ink)); }
.rows-card .row-item { display: flex; align-items: flex-start; gap: .75rem; }
.row-item--dim { background: rgb(var(--c-surface-2) / .40); }
.hint { margin-top: .25rem; font-size: .75rem; color: rgb(var(--c-muted)); }
.text-danger { color: rgb(var(--c-danger)); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }
.row-item__body { flex: 1 1 auto; min-width: 0; }
.row-inline { display: flex; align-items: center; gap: .5rem; }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Teks status di atas grafik (memuat / kosong / gagal) */
.chart-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 1rem; text-align: center; font-size: .875rem; color: rgb(var(--c-muted)); background: rgb(var(--c-surface) / .85); pointer-events: none; }

/* Aksesibilitas: tautan lewati ke konten, tampil saat difokus keyboard */
.skip-link { position: absolute; left: .75rem; top: -3rem; z-index: 100; padding: .5rem .9rem; border-radius: .5rem; background: rgb(var(--c-primary)); color: rgb(var(--c-on-primary)); font-weight: 600; text-decoration: none; transition: top .15s ease; }
.skip-link:focus { top: .75rem; }

/* Konfigurasi per kelompok + satuan */
.cfg-group { margin-bottom: 1.5rem; }
.cfg-group__title { font-family: "Space Grotesk", Inter, sans-serif; font-size: 1rem; font-weight: 600; margin: 0 0 .5rem; color: rgb(var(--c-ink)); }
.cfg-input { display: flex; align-items: center; gap: .5rem; }
.cfg-input .form-input { max-width: 10rem; min-width: 5.5rem; flex: 0 1 8rem; }
.cfg-unit { font-size: .8rem; color: rgb(var(--c-muted)); white-space: nowrap; }

/* Paging: pilih jumlah baris */
.paging__size { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: rgb(var(--c-muted)); }
.form-input--sm { padding: .2rem .4rem; width: auto; min-height: 0; font-size: .8rem; }

/* ID ringkas + tombol salin */
.id-short { display: inline-flex; align-items: center; gap: .25rem; }
.copy-btn { display: inline-flex; align-items: center; justify-content: center; padding: .15rem; border: 0; border-radius: .25rem; background: transparent; color: rgb(var(--c-muted)); cursor: pointer; }
.copy-btn:hover, .copy-btn:focus-visible { color: rgb(var(--c-primary)); background: rgb(var(--c-primary) / .10); }
.copy-btn--done { color: rgb(var(--c-success)); }

/* Notifikasi: pilih banyak + selesaikan sekaligus */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; font-size: .875rem; color: rgb(var(--c-muted)); }
.bulk-bar input, .row-check { width: 1rem; height: 1rem; accent-color: rgb(var(--c-primary)); }
.row-check { margin-top: .2rem; flex: 0 0 auto; }

/* ── Kiosk (komponen & tema project, tanpa sidebar admin) ── */
.kiosk-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.25rem; border-bottom: 1px solid rgb(var(--c-line) / .12); background: rgb(var(--c-surface)); position: sticky; top: 0; z-index: 10; }
.kiosk-brand { display: flex; align-items: center; gap: .6rem; }
.kiosk-brand .brand-name { font-weight: 700; letter-spacing: .02em; color: rgb(var(--c-ink)); }
.content--kiosk { padding: 0; }
.kiosk-wrap { max-width: 760px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.kiosk-hero { text-align: center; margin-bottom: 1.75rem; }
.kiosk-hero__logo { height: 56px; margin-bottom: .5rem; }
.kiosk-hero__title { font-size: 1.7rem; margin: .25rem 0; color: rgb(var(--c-ink)); }
.kiosk-hero__sub { color: rgb(var(--c-muted)); margin: 0; }
.kiosk-form { display: flex; flex-direction: column; gap: 1.25rem; }
.kiosk-card { background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line) / .12); border-radius: 16px; padding: 1.25rem 1.35rem; box-shadow: 0 1px 3px rgb(0 0 0 / .05); }
.kiosk-card__head { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.kiosk-card__head h2 { font-size: 1.05rem; margin: 0; color: rgb(var(--c-ink)); }
.kiosk-step { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: rgb(var(--c-primary)); color: rgb(var(--c-on-primary)); font-size: .85rem; font-weight: 700; }
.kiosk-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.kiosk-field { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; color: rgb(var(--c-ink)); }
.kiosk-field .form-input { font-size: 1.05rem; padding: .8rem .9rem; }
.kiosk-services { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.kiosk-service { position: relative; display: flex; flex-direction: column; gap: .2rem; border: 2px solid rgb(var(--c-line) / .18); border-radius: 14px; padding: 1.1rem 1.2rem; cursor: pointer; background: rgb(var(--c-surface-2)); transition: border-color .12s, background .12s, transform .12s; }
.kiosk-service:hover { transform: translateY(-1px); }
.kiosk-service__radio { position: absolute; opacity: 0; pointer-events: none; }
.kiosk-service__check { position: absolute; top: 1rem; right: 1rem; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgb(var(--c-line) / .35); }
.kiosk-service__check::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: rgb(var(--c-primary)); transform: scale(0); transition: transform .12s; }
.kiosk-service:has(.kiosk-service__radio:checked) { border-color: rgb(var(--c-primary)); background: rgb(var(--c-primary) / .08); }
.kiosk-service:has(.kiosk-service__radio:checked) .kiosk-service__check { border-color: rgb(var(--c-primary)); }
.kiosk-service:has(.kiosk-service__radio:checked) .kiosk-service__check::after { transform: scale(1); }
.kiosk-service:focus-within { outline: 2px solid rgb(var(--c-primary) / .5); outline-offset: 2px; }
.kiosk-service__name { font-weight: 700; color: rgb(var(--c-ink)); padding-right: 1.8rem; }
.kiosk-service__desc { color: rgb(var(--c-muted)); font-size: .82rem; }
.kiosk-service__price { margin-top: .4rem; color: rgb(var(--c-primary)); font-weight: 700; font-size: 1.05rem; }
.kiosk-cta { align-self: stretch; padding: 1rem; font-size: 1.15rem; font-weight: 700; border: none; border-radius: 14px; background: rgb(var(--c-primary)); color: rgb(var(--c-on-primary)); cursor: pointer; transition: background .12s; }
.kiosk-cta:hover { background: rgb(var(--c-primary-hover)); }
.kiosk-paycard { max-width: 460px; margin: 0 auto; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line) / .12); border-radius: 18px; padding: 1.75rem; text-align: center; box-shadow: 0 1px 3px rgb(0 0 0 / .05); }
.kiosk-paycard__label { color: rgb(var(--c-muted)); font-size: .85rem; }
.kiosk-paycard__value { font-size: 1.9rem; font-weight: 700; color: rgb(var(--c-ink)); }
.kiosk-paycard__svc { color: rgb(var(--c-muted)); margin-top: .15rem; }
.kiosk-qr { display: block; width: 260px; height: 260px; margin: 1.25rem auto; background: #fff; border: 1px solid rgb(var(--c-line) / .15); border-radius: 12px; padding: .5rem; }
.kiosk-hint { color: rgb(var(--c-muted)); margin: .5rem 0; }
.kiosk-status { font-weight: 700; margin: 1rem 0 .5rem; }
.kiosk-status--ok { color: rgb(var(--c-success)); }
.kiosk-status--err { color: rgb(var(--c-danger)); }
.kiosk-back { display: inline-block; margin-top: .5rem; color: rgb(var(--c-muted)); }
.cell-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.cell-actions form { margin: 0; }
.kiosk-steps { text-align: left; margin: .75rem auto 1.25rem; padding-left: 1.4rem; line-height: 1.6; color: rgb(var(--c-ink)); }
@media (max-width: 640px) { .kiosk-fields, .kiosk-services { grid-template-columns: 1fr; } }

/* Auth: tombol kirim ulang kode */.auth-resend-form { text-align: center; margin-top: .6rem; }.auth-resend { background: none; border: none; color: rgb(var(--c-primary)); font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }

/* ===== Portal pasien (role PASIEN): header + tab, tanpa sidebar admin ===== */
.portal-topbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .75rem 1.25rem; border-bottom: 1px solid rgb(var(--c-line) / .12); background: rgb(var(--c-surface)); position: sticky; top: 0; z-index: 10; }
.portal-topbar .kiosk-brand { text-decoration: none; }
.portal-topbar .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.portal-tabs { display: flex; gap: .25rem; }
.portal-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .9rem; border-radius: 999px; color: rgb(var(--c-muted)); font-weight: 600; text-decoration: none; transition: background .15s, color .15s; }
.portal-tab:hover { background: rgb(var(--c-surface-2)); color: rgb(var(--c-ink)); }
.portal-tab--active { background: rgb(var(--c-primary) / .12); color: rgb(var(--c-primary)); }
.portal-user { font-size: .85rem; color: rgb(var(--c-muted)); max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content--portal { padding: 0; }
.portal-wrap { max-width: 880px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.portal-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.portal-hero__greet { margin: 0 0 .25rem; color: rgb(var(--c-muted)); font-weight: 600; }
.portal-hero__title { margin: 0; font-size: 1.6rem; color: rgb(var(--c-ink)); }
.portal-hero__sub { margin: .35rem 0 0; color: rgb(var(--c-muted)); }
.portal-hero__actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.portal-count { margin: 0 0 1rem; color: rgb(var(--c-muted)); font-size: .9rem; }
.portal-back { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: 1rem; color: rgb(var(--c-primary)); font-weight: 600; text-decoration: none; }
.portal-back:hover { text-decoration: underline; }
.portal-section { font-size: 1.1rem; margin: 1.75rem 0 .75rem; color: rgb(var(--c-ink)); }
.portal-disclaimer { margin-top: 1.75rem; padding: .9rem 1rem; border-radius: 12px; background: rgb(var(--c-surface-2)); color: rgb(var(--c-muted)); font-size: .88rem; }
.exam-cards { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-direction: column; gap: .85rem; }
.exam-card { display: flex; align-items: center; gap: 1.1rem; padding: 1rem 1.15rem; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line) / .12); border-radius: 16px; box-shadow: 0 1px 3px rgb(0 0 0 / .05); }
.exam-card__date { flex: none; width: 4.25rem; padding: .5rem 0; text-align: center; border-radius: 12px; background: rgb(var(--c-primary) / .1); color: rgb(var(--c-primary)); }
.exam-card__day { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.exam-card__month { display: block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.exam-card__body { flex: 1; min-width: 0; }
.exam-card__badges { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .35rem; }
.exam-card__name { margin: 0; font-weight: 700; color: rgb(var(--c-ink)); }
.exam-card__meta { margin: .15rem 0 0; color: rgb(var(--c-muted)); font-size: .88rem; }
.exam-card__ts { margin: .3rem 0 0; color: rgb(var(--c-muted)); font-size: .75rem; overflow-wrap: anywhere; }
.exam-card__actions { flex: none; display: flex; flex-direction: column; gap: .4rem; }
.exam-empty { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; padding: 2.5rem 1rem; text-align: center; color: rgb(var(--c-muted)); background: rgb(var(--c-surface)); border: 1px dashed rgb(var(--c-line) / .25); border-radius: 16px; }
.exam-empty p { margin: 0; }
.result-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .85rem; }
.result-card { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.1rem; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line) / .12); border-radius: 16px; }
.result-card__label { color: rgb(var(--c-muted)); font-size: .85rem; font-weight: 600; }
.result-card__value { font-size: 1.6rem; font-weight: 700; color: rgb(var(--c-ink)); }
.result-card__value small { font-size: .85rem; font-weight: 600; color: rgb(var(--c-muted)); }
.result-card__time { font-size: .75rem; color: rgb(var(--c-muted)); }
.periksa-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; counter-reset: langkah; }
.periksa-step { position: relative; display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem 1rem 3.4rem; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line) / .12); border-radius: 16px; counter-increment: langkah; }
.periksa-step::before { content: counter(langkah); position: absolute; left: 1rem; top: 1rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: rgb(var(--c-line) / .12); color: rgb(var(--c-ink)); }
.periksa-step.is-done { border-color: rgb(var(--c-success) / .45); }
.periksa-step.is-done::before { content: "\2713"; background: rgb(var(--c-success)); color: #fff; }
.periksa-step__title { font-weight: 700; color: rgb(var(--c-ink)); }
.periksa-step__hint { color: rgb(var(--c-muted)); font-size: .9rem; }
.periksa-step__value { font-size: 1.25rem; font-weight: 700; color: rgb(var(--c-muted)); }
.periksa-step.is-done .periksa-step__value { color: rgb(var(--c-ink)); }
.periksa-finish { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.btn--lg { padding: .8rem 1.5rem; font-size: 1.05rem; }
@media (max-width: 640px) {
  .portal-topbar { padding: .6rem .9rem; }
  .portal-tabs { order: 3; width: 100%; }
  .portal-tab { flex: 1; justify-content: center; }
  .portal-user span { display: none; }
  .exam-card { flex-wrap: wrap; }
  .exam-card__actions { flex-direction: row; width: 100%; }
  .exam-card__actions .btn { flex: 1; justify-content: center; }
}

/* Status alat per layanan kiosk */
.kiosk-service__state { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; margin-top: .3rem; }
.kiosk-service__state .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.kiosk-service__state--on { color: rgb(var(--c-success)); }
.kiosk-service__state--off { color: rgb(var(--c-muted)); }
.kiosk-service--off { opacity: .6; cursor: not-allowed; }
.kiosk-service--off:hover { transform: none; }
.kiosk-cta:disabled { opacity: .5; cursor: not-allowed; }

/* Halaman profil (semua role) */
.profile-wrap { max-width: 44rem; margin: 0 auto; }
.portal-wrap .profile-wrap, .content--portal > .profile-wrap { padding: 2rem 1.25rem 4rem; }
.profile-card { margin-bottom: 1rem; }
.profile-card .card-title { margin: 0 0 .9rem; font-size: 1rem; }
.profile-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .75rem 1.25rem; margin: 0 0 .75rem; }
.profile-info dt { font-size: .78rem; color: rgb(var(--c-muted)); font-weight: 600; }
.profile-info dd { margin: .15rem 0 0; color: rgb(var(--c-ink)); overflow-wrap: anywhere; }
.profile-form { display: flex; flex-direction: column; gap: .45rem; }
.profile-form .form-label { margin-top: .35rem; }
.profile-sep { border: 0; border-top: 1px solid rgb(var(--c-line) / .12); margin: 1.25rem 0; }
.user-menu-item--neutral:hover { background: rgb(var(--c-surface-2)); color: rgb(var(--c-ink)); }
a.portal-user { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; padding: .35rem .6rem; border-radius: 999px; }
a.portal-user:hover, .portal-user--active { background: rgb(var(--c-surface-2)); color: rgb(var(--c-ink)); }

/* ===== Halaman blokir ponsel (aplikasi mobile segera hadir) ===== */
.mb-body { margin: 0; min-height: 100vh; background:
  radial-gradient(120% 60% at 50% -10%, rgb(var(--c-primary) / .22), transparent 60%),
  rgb(var(--c-canvas)); color: rgb(var(--c-ink)); font-family: Inter, system-ui, sans-serif; }
.mb-wrap { max-width: 28rem; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 1rem) 1.25rem calc(env(safe-area-inset-bottom, 0px) + 2rem); display: flex; flex-direction: column; gap: 1.5rem; }
.mb-top { display: flex; align-items: center; justify-content: space-between; }
.mb-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; letter-spacing: .02em; }
.mb-actions { display: inline-flex; gap: .4rem; }
.mb-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .75rem; padding-top: .5rem; }
.mb-phone { width: 7.5rem; height: 13.5rem; border-radius: 1.6rem; padding: .45rem; background: rgb(var(--c-ink) / .9); box-shadow: 0 18px 40px rgb(var(--c-primary) / .28); animation: mb-float 4s ease-in-out infinite; }
.mb-phone__screen { height: 100%; border-radius: 1.2rem; background: linear-gradient(160deg, rgb(var(--c-primary)), rgb(var(--c-accent))); display: flex; flex-direction: column; justify-content: center; gap: .55rem; padding: 0 .8rem; color: rgb(var(--c-on-primary)); }
.mb-phone__ecg { width: 100%; height: 2.4rem; }
.mb-phone__ecg polyline { stroke-dasharray: 260; stroke-dashoffset: 260; animation: mb-draw 2.4s ease-in-out infinite; }
.mb-phone__bar { height: .45rem; border-radius: 999px; background: rgb(255 255 255 / .55); }
.mb-phone__bar--short { width: 60%; background: rgb(255 255 255 / .35); }
.mb-phone__pill { margin-top: .4rem; height: 1.4rem; border-radius: .6rem; background: rgb(255 255 255 / .9); }
.mb-badge { display: inline-block; padding: .3rem .8rem; border-radius: 999px; background: rgb(var(--c-primary) / .14); color: rgb(var(--c-primary)); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.mb-title { margin: 0; font-family: "Space Grotesk", Inter, sans-serif; font-size: 1.65rem; line-height: 1.2; }
.mb-sub { margin: 0; color: rgb(var(--c-muted)); line-height: 1.55; }
.mb-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .65rem; }
.mb-features li, .mb-desk { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border-radius: 14px; background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line) / .1); font-weight: 500; }
.mb-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: 10px; background: rgb(var(--c-primary) / .12); color: rgb(var(--c-primary)); }
.mb-stores { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.mb-store { display: flex; align-items: center; gap: .6rem; padding: .7rem .85rem; border-radius: 12px; background: rgb(var(--c-ink)); color: rgb(var(--c-canvas)); opacity: .9; }
.mb-store span { display: flex; flex-direction: column; line-height: 1.15; }
.mb-store small { font-size: .65rem; opacity: .8; }
.mb-store strong { font-size: .92rem; }
.mb-desk p { margin: 0; font-size: .9rem; color: rgb(var(--c-muted)); }
.mb-desk strong { color: rgb(var(--c-ink)); }
.mb-foot { margin: 0; text-align: center; font-size: .75rem; color: rgb(var(--c-muted)); }
@keyframes mb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes mb-draw { 0% { stroke-dashoffset: 260; } 60%, 100% { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .mb-phone, .mb-phone__ecg polyline { animation: none; stroke-dashoffset: 0; } }
/* Pesan notifikasi: token panjang (mis. ID) tidak melebarkan tabel. */
.alert-msg { overflow-wrap: anywhere; }
.cell-nowrap { white-space: nowrap; }
