/* =========================================================
   Jaya Mandiri Jasaa — mobile-first PWA styles
   ========================================================= */
:root {
  --brand: #0f766e;
  --brand-ink: #fff;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e4e8ee;
  --line-strong: #cfd6df;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #15803d;
  --success-bg: #ecfdf3;
  --wa: #1fa855;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --appbar-h: 56px;
  --nav-h: 62px;
  --side-w: 232px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --st0-bg: #e0ecff; --st0-fg: #1d4ed8;
  --st1-bg: #fff4d6; --st1-fg: #a15c00;
  --st2-bg: #dcfce7; --st2-fg: #15803d;
  --st3-bg: #ede9fe; --st3-fg: #6d28d9;
  --st4-bg: #fee2e2; --st4-fg: #b91c1c;
  --st5-bg: #e2e8f0; --st5-fg: #334155;
  color-scheme: light;
}
/* Mode gelap: diaktifkan lewat atribut data-theme="dark" pada <html>
   (diatur static/js/theme.js sesuai pilihan Terang / Gelap / Ikuti perangkat). */
:root[data-theme="dark"] {
  --bg: #0b1016;
  --surface: #131a22;
  --surface-2: #18212b;
  --text: #e6edf3;
  --muted: #8b98a8;
  --line: #232e3a;
  --line-strong: #2f3d4c;
  --danger: #f87171;
  --danger-bg: #2a1517;
  --success: #4ade80;
  --success-bg: #11261a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --st0-bg: #172b4d; --st0-fg: #93c5fd;
  --st1-bg: #3a2a0b; --st1-fg: #fcd34d;
  --st2-bg: #0f2e1c; --st2-fg: #86efac;
  --st3-bg: #2a1f4a; --st3-fg: #c4b5fd;
  --st4-bg: #3b1515; --st4-fg: #fca5a5;
  --st5-bg: #253141; --st5-fg: #cbd5e1;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45;
  background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.upper { text-transform: uppercase; }
.upper::placeholder { text-transform: none; }

/* ---------- Layout shell ---------- */
.main { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); }
body:not(.has-nav) .main { padding-bottom: 0; }
.stack { display: grid; gap: 12px; padding: 12px; max-width: 760px; margin: 0 auto; }

/* Halaman daftar: layar penuh, hanya tabel yang scroll */
body.page-list { overflow: hidden; }
body.page-list .main {
  position: fixed; inset: 0 0 calc(var(--nav-h) + var(--safe-b)) 0;
  display: flex; flex-direction: column; min-height: 0; padding: 0;
}

/* ---------- Appbar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--appbar-h) + var(--safe-t)); padding: var(--safe-t) 8px 0;
  background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.appbar__title { flex: 1; margin: 0 4px; font-size: 18px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__actions { display: flex; gap: 4px; }
.appbar__logo { flex: none; display: grid; place-items: center; width: 40px; height: 40px; }
.appbar__logo img { width: 32px; height: 32px; border-radius: 9px; background: #fff; object-fit: contain; }
.appbar--search { gap: 6px; padding-right: 8px; }

.icon-btn {
  position: relative; flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,.18); }
.icon-btn--filled { background: rgba(255,255,255,.16); }
.badge-dot {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: #fbbf24; color: #1f2937; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
}

.search { position: relative; flex: 1; min-width: 0; }
.search input {
  width: 100%; height: 40px; padding: 0 36px 0 38px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.95); color: #0f172a; font-size: 15px; outline: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.search__icon { position: absolute; left: 11px; top: 10px; color: #64748b; pointer-events: none; }
.search__clear { position: absolute; right: 4px; top: 4px; display: grid; place-items: center; width: 32px; height: 32px; color: #64748b; }

/* ---------- Chips (filter status cepat) ---------- */
.chips {
  flex: none; display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; font-weight: 550; white-space: nowrap; color: var(--muted);
}
.chip .i { width: 14px; height: 14px; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip--removable { background: var(--surface-2); color: var(--text); }

/* ---------- Tabel data ---------- */
.table-area { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.table-wrap { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.dt { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dt th, .dt td { padding: 9px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.dt thead th {
  position: sticky; top: 0; z-index: 3; padding: 0;
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .02em;
  border-bottom: 1px solid var(--line-strong);
}
.dt thead th a { display: flex; align-items: center; gap: 2px; padding: 10px; }
.dt thead th.num a { justify-content: flex-end; }
.dt thead th.is-sorted { color: var(--brand); }
.dt thead th .i { width: 14px; height: 14px; }
.dt .num { text-align: right; font-variant-numeric: tabular-nums; }
.dt tbody tr { cursor: pointer; }
.dt tbody tr:nth-child(even) td { background: var(--surface-2); }
.dt tbody tr:hover td, .dt tbody tr:active td { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.dt td.clip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.dt td { background: var(--surface); }

/* Kolom Nama menempel di kiri saat tabel digeser */
.dt [data-col="nama"] {
  position: sticky; left: 0; z-index: 2; max-width: 46vw; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 1px 0 0 var(--line-strong), 4px 0 8px -6px rgba(0,0,0,.25);
}
.dt thead [data-col="nama"] { z-index: 4; }
.dt td[data-col="nama"] a { font-weight: 650; color: var(--text); }

.dt tfoot td {
  position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); font-weight: 700;
  border-top: 1px solid var(--line-strong); border-bottom: 0;
}
.dt tfoot td[data-col="nama"] { z-index: 4; }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap;
  background: var(--pill-bg); color: var(--pill-fg);
}
.st-0 { --pill-bg: var(--st0-bg); --pill-fg: var(--st0-fg); }
.st-1 { --pill-bg: var(--st1-bg); --pill-fg: var(--st1-fg); }
.st-2 { --pill-bg: var(--st2-bg); --pill-fg: var(--st2-fg); }
.st-3 { --pill-bg: var(--st3-bg); --pill-fg: var(--st3-fg); }
.st-4 { --pill-bg: var(--st4-bg); --pill-fg: var(--st4-fg); }
.st-5 { --pill-bg: var(--st5-bg); --pill-fg: var(--st5-fg); }
.chip--st.is-active { background: var(--pill-fg); border-color: var(--pill-fg); color: #fff; }

.plate {
  display: inline-block; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 700; letter-spacing: .03em;
}
.plate--lg { font-size: 15px; padding: 4px 10px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.tag--ok { background: var(--success-bg); color: var(--success); border-color: transparent; }
.tag--danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.wa-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px 4px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--wa) 12%, transparent); color: var(--wa); font-weight: 650;
}
.wa-btn .i { width: 16px; height: 16px; }

/* ---------- Pager ---------- */
.pager {
  flex: none; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 8px 0 12px;
  background: var(--surface); border-top: 1px solid var(--line); font-size: 13px;
}
.pager__info { color: var(--muted); white-space: nowrap; }
.pager__pages { flex: 1; display: flex; justify-content: center; gap: 2px; overflow: hidden; }
.pg { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 9px; font-weight: 600; }
.pg .i { width: 18px; height: 18px; }
.pg.is-current { background: var(--brand); color: #fff; }
.pg.is-disabled { opacity: .35; }
.pg--gap { min-width: 16px; color: var(--muted); }
.pager__per select { height: 32px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); font-size: 13px; }
@media (max-width: 420px) { .pager__pages a.pg:not([aria-label]), .pager__pages .pg--gap { display: none; } }

/* ---------- Empty state ---------- */
.empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 40px 24px; text-align: center; color: var(--muted); }
.empty > .i { width: 48px; height: 48px; stroke-width: 1.5; opacity: .6; }
.empty h2 { margin: 6px 0 0; font-size: 18px; color: var(--text); }
.empty p { margin: 0 0 10px; }
.err-code { font-size: 54px; font-weight: 800; color: var(--brand); line-height: 1; }

/* ---------- Bottom nav / sidebar ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: stretch; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav__brand { display: none; }
.nav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.nav__item .i { width: 23px; height: 23px; }
.nav__item.is-active { color: var(--brand); }
.nav__item--fab .fab {
  display: grid; place-items: center; width: 46px; height: 46px; margin-top: -18px; border-radius: 16px;
  background: var(--brand); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 45%, transparent);
}
.nav__item--fab .fab .i { width: 26px; height: 26px; stroke-width: 2.4; }

/* ---------- Cards & forms ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card__title { margin: 0 0 12px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.form { display: grid; gap: 12px; padding: 12px 12px 90px; max-width: 760px; margin: 0 auto; }
.field { display: grid; gap: 5px; margin: 0 0 12px; border: 0; padding: 0; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field__label { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; }
.field__label i { color: var(--danger); font-style: normal; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 12px; }
input[type=text], input[type=tel], input[type=password], input[type=date], input[type=search]:not(.search input), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input[type=date] { min-width: 0; max-width: 100%; display: block; -webkit-appearance: none; appearance: none; }
textarea { resize: vertical; line-height: 1.5; }
textarea.mono { font-size: 13px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type=color] { width: 100%; height: 46px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.field__error { margin: 0; color: var(--danger); font-size: 12.5px; font-weight: 600; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.money { position: relative; }
.money > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; font-weight: 600; }
.money input { padding-left: 38px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.calc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 8px; }
.calc > div { padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.calc span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.calc b { font-size: 14px; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 8px 4px; border-radius: 9px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }
.segmented--icons span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; }

/* Tombol ganti tema cepat (sidebar desktop) */
.theme-toggle { display: none; }
:root[data-theme="dark"] .theme-toggle .when-light, :root:not([data-theme="dark"]) .theme-toggle .when-dark { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px;
  font-weight: 650; font-size: 15px; cursor: pointer; white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-soft { background: var(--danger-bg); color: var(--danger); }
.btn--wa { background: var(--wa); color: #fff; }
.btn--wa.is-disabled { background: var(--surface-2); color: var(--muted); border-color: var(--line-strong); }
.btn--link { min-height: 34px; padding: 0; background: none; color: var(--brand); font-size: 14px; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn--block { width: 100%; }
.btn--icon { width: 46px; padding: 0; }

.action-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 35;
  display: flex; gap: 8px; padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.action-bar > .btn, .action-bar > form { flex: 1; }
.action-bar > form:has(.btn--icon) { flex: none; }
.action-bar > form .btn { width: 100%; }
body:not(.has-nav) .action-bar { bottom: 0; }
.stack > form.stack { padding: 0; }
.stack:has(.action-bar) { padding-bottom: 80px; }

/* ---------- Detail ---------- */
.detail { display: grid; gap: 12px; padding: 12px 12px 90px; max-width: 760px; margin: 0 auto; }
.hero__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.hero__name { margin: 10px 0 8px; font-size: 21px; line-height: 1.25; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hero__sisa { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.hero__sisa span { font-size: 13px; color: var(--muted); font-weight: 600; }
.hero__sisa b { font-size: 20px; font-variant-numeric: tabular-nums; }
.hero__sisa.is-ok { background: var(--success-bg); } .hero__sisa.is-ok b { color: var(--success); }
.hero__sisa.is-due { background: var(--danger-bg); } .hero__sisa.is-due b { color: var(--danger); }
.kv { display: grid; grid-template-columns: auto 1fr; margin: 0; }
.kv dt, .kv dd { padding: 9px 0; border-bottom: 1px dashed var(--line); margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; padding-right: 12px; }
.kv dd { text-align: right; font-weight: 600; word-break: break-word; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.kv--money dd { font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: 8px; }
.inline-form select { flex: 1; }
.wa-preview summary, .placeholders summary, .col-toggle summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 650; list-style: none; }
.wa-preview summary .i { color: var(--wa); }
.wa-preview pre {
  margin: 12px 0 10px; padding: 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word;
  background: color-mix(in srgb, var(--wa) 9%, var(--surface)); font: 13.5px/1.5 var(--font);
}
.placeholders { margin: 10px 0; }
.placeholders ul { margin: 8px 0; padding-left: 18px; font-size: 13px; }
.placeholders li { margin: 3px 0; }
code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }
.audit { font-size: 12px; text-align: center; margin: 0; }
.danger-zone { max-width: 760px; margin: -70px auto 90px; padding: 0 12px; }

/* ---------- Akun / menu ---------- */
.profile { display: flex; gap: 12px; align-items: center; }
.profile p { margin: 2px 0 0; font-size: 13px; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--brand); color: #fff; font-size: 20px; font-weight: 700; }
.menu-list { padding: 4px 14px; }
.link-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0; border: 0; background: none;
  text-align: left; font-weight: 600; cursor: pointer; border-bottom: 1px solid var(--line);
}
.menu-list > :last-child, .menu-list > :last-child .link-row { border-bottom: 0; }
.link-row__end { margin-left: auto; color: var(--muted); }
.menu-details { border-bottom: 1px solid var(--line); }
.menu-details > summary { list-style: none; border-bottom: 0; }
.menu-details > summary::-webkit-details-marker { display: none; }
.menu-details[open] .chev { transform: rotate(180deg); }
.menu-details__body { padding: 4px 0 16px; }
.section-title { margin: 10px 4px 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hint--spaced { margin-top: 8px; }
.stack--no-bar { padding-bottom: 12px; }
.logo-edit { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.logo-edit img { width: 72px; height: 72px; border-radius: 16px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.logo-edit__form { display: flex; flex-wrap: wrap; gap: 8px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Auth (Desain PT. Jayaa Mandiri Jasa & Setup) ---------- */
body.page-auth {
  min-height: 100dvh;
  background: #0c4399;
  overflow-x: hidden;
}
.page-auth .main {
  min-height: 100dvh;
  width: 100%;
  padding: 0 !important;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  background: linear-gradient(180deg, #dceafe 0%, #ebf3ff 52%, #d8e8ff 100%);
}

/* Fallback untuk halaman setup awal (setup.html) */
.auth { width: 100%; max-width: 420px; padding: 20px 16px; margin: auto; }
.auth__brand { text-align: center; margin-bottom: 14px; }
.auth__brand img { width: 76px; height: 76px; border-radius: 20px; object-fit: contain; background: #fff; box-shadow: var(--shadow); }
.auth__brand h1 { margin: 10px 0 4px; font-size: 22px; }
.auth__brand p { margin: 0; color: var(--muted); }
.auth__card { padding: 18px; }

/* Kontainer Utama Login PT. Jayaa Mandiri Jasa — FULL SCREEN di Mobile */
.jmj-auth-page {
  width: 100%;
  min-height: 100dvh;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 0;
  margin: 0;
}
.jmj-auth-container {
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, #dceafe 0%, #ebf3ff 52%, #d8e8ff 100%);
  color: #0b1f44;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

/* Hanya pada layar tablet/desktop lebar (> 768px) tampil sebagai kartu tengah */
@media (min-width: 769px) {
  .page-auth .main {
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #cfe2ff 0%, #e8f1ff 50%, #d5e6ff 100%);
  }
  .jmj-auth-page {
    padding: 20px 12px;
    align-items: center;
    flex: none;
  }
  .jmj-auth-container {
    max-width: 430px;
    height: auto;
    min-height: min(840px, 94dvh);
    border-radius: 30px;
    box-shadow: 0 22px 55px rgba(6, 33, 89, .26);
    border: 1px solid rgba(255, 255, 255, .65);
    overflow: hidden;
  }
}

/* 1. Header Gelombang Biru & Emas */
.jmj-header {
  position: relative;
  flex: none;
  padding: calc(var(--safe-t) + clamp(12px, 2.2dvh, 20px)) 16px clamp(20px, 3.6dvh, 32px);
}
.jmj-header__wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.jmj-header__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.jmj-header__logo-wrap {
  flex: none;
  width: clamp(82px, 13dvh, 104px);
  height: clamp(82px, 13dvh, 104px);
  border-radius: 50%;
  background: #062157;
  padding: 2px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .34);
  display: grid;
  place-items: center;
}
.jmj-header__logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.jmj-header__divider {
  flex: none;
  width: 2px;
  height: clamp(62px, 10dvh, 78px);
  background: rgba(255, 255, 255, .85);
  border-radius: 2px;
}
.jmj-header__info {
  flex: 1;
  min-width: 0;
  color: #ffffff;
}
.jmj-header__title {
  margin: 0;
  font-size: clamp(19px, 2.8dvh, 22px);
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .24);
}
.jmj-header__subtitle {
  margin: 4px 0 2px;
  font-size: clamp(11px, 1.65dvh, 12.5px);
  font-style: italic;
  font-weight: 500;
  line-height: 1.32;
  color: rgba(255, 255, 255, .95);
}
.jmj-header__swoosh {
  width: 120px;
  height: 9px;
  display: block;
  margin-left: 10px;
}

/* 2. Ilustrasi Vektor Petugas & Dokumen (Fleksibel mengikuti tinggi layar mobile) */
.jmj-scene {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 130px;
  margin-top: -20px;
  padding: 0 2px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.jmj-scene__svg {
  width: 100%;
  max-height: clamp(150px, 27dvh, 235px);
  height: auto;
  display: block;
}
.jmj-float-doc {
  animation: jmj-float 4.2s ease-in-out infinite;
}
.jmj-doc-hands {
  animation: jmj-read 3.4s ease-in-out infinite;
}
@keyframes jmj-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes jmj-read {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .jmj-float-doc, .jmj-doc-hands { animation: none !important; }
}

/* 3. Kartu Putih Form Login */
.jmj-card {
  position: relative;
  z-index: 2;
  flex: none;
  margin: -16px 14px 0;
  padding: clamp(16px, 2.6dvh, 24px) 18px clamp(16px, 2.4dvh, 22px);
  background: #ffffff;
  color: #0b1f44;
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(10, 42, 102, .14);
}
.jmj-card__title {
  margin: 0 0 4px;
  font-size: clamp(20px, 3dvh, 24px);
  font-weight: 800;
  color: #091d42;
  letter-spacing: -.01em;
}
.jmj-card__subtitle {
  margin: 0 0 clamp(12px, 2dvh, 18px);
  font-size: clamp(12.5px, 1.8dvh, 13.8px);
  color: #53647d;
  line-height: 1.38;
}

.jmj-field {
  margin-bottom: clamp(9px, 1.5dvh, 12px);
}
.jmj-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.jmj-input-wrap input[type=text],
.jmj-input-wrap input[type=password] {
  width: 100%;
  min-height: clamp(44px, 6.2dvh, 50px);
  height: clamp(44px, 6.2dvh, 50px);
  padding: 0 16px 0 44px;
  border: 1.5px solid #cfd9e8;
  border-radius: 13px;
  background: #f8fafd;
  color: #0f172a;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.jmj-input-wrap--pw input[type=text],
.jmj-input-wrap--pw input[type=password] {
  padding-right: 44px;
}
.jmj-input-wrap input::placeholder {
  color: #6b7c96;
}
.jmj-input-wrap input:focus {
  background: #ffffff;
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .16);
}
.jmj-input__icon {
  position: absolute;
  left: 14px;
  width: 19px;
  height: 19px;
  color: #5a6b85;
  pointer-events: none;
}
.jmj-pw-toggle {
  position: absolute;
  right: 6px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #64748b;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.jmj-pw-toggle:hover {
  background: #eff4fb;
  color: #0f172a;
}

.jmj-row-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: clamp(10px, 1.8dvh, 14px) 0 clamp(12px, 2.2dvh, 18px);
  font-size: 13.5px;
}
.jmj-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1e293b;
  font-weight: 500;
  cursor: pointer;
}
.jmj-remember input[type=checkbox] {
  width: 19px;
  height: 19px;
  accent-color: #0d6efd;
  border-radius: 6px;
  cursor: pointer;
}
.jmj-forgot-link {
  border: 0;
  background: none;
  padding: 0;
  color: #0d5bd9;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.jmj-forgot-link:hover {
  text-decoration: underline;
}

.jmj-login-btn {
  width: 100%;
  min-height: clamp(46px, 6.5dvh, 52px);
  height: clamp(46px, 6.5dvh, 52px);
  border: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, #094799 0%, #1360c4 50%, #1973df 100%);
  color: #ffffff;
  font-size: 16.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(19, 96, 196, .35);
  cursor: pointer;
  transition: transform .12s, filter .15s;
}
.jmj-login-btn:hover { filter: brightness(1.05); }
.jmj-login-btn:active { transform: scale(.985); }
.jmj-login-btn__icon {
  width: 21px;
  height: 21px;
}

/* 4. Footer Motto & Gelombang Bawah */
.jmj-footer {
  position: relative;
  flex: none;
  margin-top: auto;
  padding-top: clamp(8px, 1.5dvh, 16px);
}
.jmj-motto {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 20px 4px;
}
.jmj-motto__line {
  width: 34px;
  height: 1.5px;
  background: #1e3a8a;
  opacity: .75;
}
.jmj-motto__text {
  font-size: clamp(12.5px, 1.8dvh, 13.5px);
  font-weight: 700;
  font-style: italic;
  color: #0a214a;
}
.jmj-footer__wave {
  width: 100%;
  height: clamp(48px, 7.5dvh, 68px);
  display: block;
  margin-top: -14px;
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; left: 12px; right: 12px; top: calc(var(--safe-t) + 64px); z-index: 100;
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 480px;
  padding: 12px 8px 12px 14px; border-radius: 14px; background: #111827; color: #fff; font-size: 14px; font-weight: 550;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: toast-in .25s ease-out;
}
.toast span { flex: 1; }
.toast--success > .i { color: #4ade80; }
.toast--error { background: #7f1d1d; }
.toast--error > .i { color: #fecaca; }
.toast__close { display: grid; place-items: center; width: 30px; height: 30px; border: 0; background: none; color: #fff; opacity: .7; cursor: pointer; }
.toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- Dialog & bottom sheet ---------- */
dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); }
dialog::backdrop { background: rgba(15, 23, 42, .5); }
.dialog { width: min(92vw, 380px); border-radius: 20px; padding: 22px 18px 16px; text-align: center; }
.dialog__icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 16px; background: var(--danger-bg); color: var(--danger); }
.dialog__title { margin: 4px 0; font-size: 18px; }
.dialog__msg { margin: 0 0 18px; color: var(--muted); }
.dialog__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh; margin: auto auto 0; border-radius: 22px 22px 0 0;
  overflow: auto; animation: sheet-up .22s ease-out;
}
.sheet__body { padding: 6px 16px calc(16px + var(--safe-b)); }
.sheet__handle { width: 40px; height: 5px; margin: 4px auto 6px; border-radius: 3px; background: var(--line-strong); }
.sheet__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet__head h2 { margin: 0; font-size: 18px; }
.sheet__head .icon-btn:active { background: var(--surface-2); }
.sheet__actions { position: sticky; bottom: calc(-16px - var(--safe-b)); display: grid; grid-template-columns: 1fr 2fr; gap: 8px; padding: 12px 0 0; background: var(--surface); }
.col-toggle { padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.col-toggle__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 8px; margin-top: 10px; }
.col-toggle .check { margin: 6px 0; font-size: 13px; }
.sheet .link-row { border-bottom: 0; color: var(--brand); }
@keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } }

/* ---------- Tablet & desktop ---------- */
@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  body { font-size: 15px; }
  .nav {
    top: 0; bottom: 0; right: auto; width: var(--side-w); height: auto; flex-direction: column; gap: 2px;
    padding: 14px 12px; border-top: 0; border-right: 1px solid var(--line);
  }
  .nav__brand { order: -2; display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; font-weight: 750; font-size: 16px; }
  .nav__brand img { width: 34px; height: 34px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
  .nav__item { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 12px; border-radius: 12px; font-size: 14.5px; }
  .nav__item .i { width: 21px; height: 21px; }
  .nav__item.is-active { background: color-mix(in srgb, var(--brand) 10%, transparent); }
  .nav__item--fab { order: -1; margin-bottom: 8px; background: var(--brand); color: #fff !important; }
  .nav__item--fab .fab { width: auto; height: auto; margin: 0; background: none; box-shadow: none; border-radius: 0; }
  .nav__item--fab .fab .i { width: 21px; height: 21px; }
  .nav .theme-toggle {
    display: flex; margin-top: auto; border: 0; background: none; cursor: pointer; font: inherit; color: var(--muted);
  }
  .has-nav .main { margin-left: var(--side-w); }
  body.page-list.has-nav .main { inset: 0 0 0 var(--side-w); margin-left: 0; }
  .appbar__logo { display: none; }
  .appbar--search { padding-left: 16px; }
  .search { max-width: 560px; }
  .dt { font-size: 13.5px; }
  .dt [data-col="nama"] { max-width: 280px; }
  .action-bar { left: var(--side-w); justify-content: flex-end; }
  .action-bar > .btn, .action-bar > form { flex: none; min-width: 140px; }
  body:not(.has-nav) .action-bar { left: 0; }
  .toasts { top: 72px; left: auto; right: 20px; width: 420px; }
  .sheet { margin: auto; border-radius: 22px; }
  .stack, .form, .detail { padding-top: 20px; }
}
