/* =========================================================================
   Kahwin · Sistem reka bentuk
   Token & komponen dikongsi oleh landing page, halaman log masuk dan dashboard.
   Kad tetamu (public/card) ada tema warna sendiri tetapi ikut bentuk & saiz yang sama.

   Saiz kawalan:   sm 32px · md 40px · lg 48px
   Sudut:          sm 8px · md 10px (butang & input) · lg 14px (kad, jadual, dialog) · xl 20px
   Ikon:           .ic 16px (18px dalam .lg), sentiasa di tengah kerana .ic ialah kotak flex tetap
   Saiz skrin:     telefon ≤ 767px · tablet 768–1099px · desktop ≥ 1100px
   Skrin sentuh:   kawalan dibesarkan (sm 36 · md 44) dan teks input 16px supaya iOS tidak zoom
   ========================================================================= */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-script: 'Great Vibes', cursive;
  --r-sm: 8px; --r: 10px; --r-lg: 14px; --r-xl: 20px;
  --h-sm: 32px; --h-md: 40px; --h-lg: 48px;

  --bg: #f7f3ef; --bg-2: #f1e9e2; --panel: #ffffff; --panel-2: #faf6f2;
  --ink: #2a2421; --ink-2: #4a403b; --muted: #786c66; --line: #e7dfd7; --line-2: #d8cdc3;
  --accent: #7a2d3b; --accent-hover: #8f3a4a; --accent-ink: #ffffff; --accent-soft: #f5e6e9;
  --ok: #2f7d4f; --ok-soft: #e4f2e9; --warn: #946012; --warn-soft: #fbf0db;
  --danger: #b3261e; --danger-hover: #9c2019; --danger-ink: #ffffff; --danger-soft: #fce8e6;
  --info: #2c5d8a; --info-soft: #e5eef8;
  --gold: #b08a45; --gold-ink: #2a1d10; --velvet: #5e0f19; --velvet-ink: #f1d9a0;
  --blush: #f1d3d8; --blush-2: #ecd2b8;
  --chart: #a8475a; --grid: #ece5de;
  --shadow-sm: 0 1px 2px rgb(40 20 20 / .06);
  --shadow: 0 1px 2px rgb(40 20 20 / .05), 0 6px 24px rgb(40 20 20 / .06);
  --shadow-lg: 0 4px 12px rgb(40 20 20 / .08), 0 24px 60px rgb(40 20 20 / .16);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23786c66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --show-sun: none; --show-moon: inline-flex;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15110f; --bg-2: #1a1513; --panel: #201a17; --panel-2: #1a1512;
    --ink: #f2eae4; --ink-2: #d9cec6; --muted: #a99c93; --line: #352c27; --line-2: #4a3e37;
    --accent: #e2a1ad; --accent-hover: #ecb6c0; --accent-ink: #22100f; --accent-soft: #3a2328;
    --ok: #7fd09c; --ok-soft: #1b3125; --warn: #e8b45f; --warn-soft: #382a13;
    --danger: #ff8a80; --danger-hover: #ffa49c; --danger-ink: #2a0f0d; --danger-soft: #3d1c1a;
    --info: #8fbbe6; --info-soft: #1a2a3a;
    --gold: #d8b46a; --gold-ink: #1d140a; --velvet: #3d0a12; --velvet-ink: #f1d9a0;
    --blush: #3a2027; --blush-2: #33261a;
    --chart: #d9677e; --grid: #2e2622;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .3);
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 24px rgb(0 0 0 / .25);
    --shadow-lg: 0 4px 12px rgb(0 0 0 / .35), 0 24px 60px rgb(0 0 0 / .5);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a99c93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --show-sun: inline-flex; --show-moon: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15110f; --bg-2: #1a1513; --panel: #201a17; --panel-2: #1a1512;
  --ink: #f2eae4; --ink-2: #d9cec6; --muted: #a99c93; --line: #352c27; --line-2: #4a3e37;
  --accent: #e2a1ad; --accent-hover: #ecb6c0; --accent-ink: #22100f; --accent-soft: #3a2328;
  --ok: #7fd09c; --ok-soft: #1b3125; --warn: #e8b45f; --warn-soft: #382a13;
  --danger: #ff8a80; --danger-hover: #ffa49c; --danger-ink: #2a0f0d; --danger-soft: #3d1c1a;
  --info: #8fbbe6; --info-soft: #1a2a3a;
  --gold: #d8b46a; --gold-ink: #1d140a; --velvet: #3d0a12; --velvet-ink: #f1d9a0;
  --blush: #3a2027; --blush-2: #33261a;
  --chart: #d9677e; --grid: #2e2622;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 24px rgb(0 0 0 / .25);
  --shadow-lg: 0 4px 12px rgb(0 0 0 / .35), 0 24px 60px rgb(0 0 0 / .5);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a99c93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --show-sun: inline-flex; --show-moon: none;
  color-scheme: dark;
}

@media (pointer: coarse) {
  :root { --h-sm: 36px; --h-md: 44px; --h-lg: 50px; }
}

/* ---------- Asas ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; }
a { color: var(--accent); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
@media (max-width: 560px) { .hide-sm { display: none !important; } }
@media (max-width: 767px) { .no-mobile { display: none !important; } }
@media (min-width: 768px) { .mobile-only { display: none !important; } }
@media (max-width: 1099px) { .desktop-only { display: none !important; } }
.page-title { font: 600 34px/1.15 var(--font-serif); letter-spacing: -.01em; }
.section-title { font: 700 16px/1.3 var(--font-sans); }

/* ---------- Ikon ---------- */
/* Kotak flex bersaiz tetap: ikon sentiasa tepat di tengah, tidak terkesan garis dasar teks. */
.ic { display: inline-flex; flex: none; width: 16px; height: 16px; align-items: center; justify-content: center; }
.ic svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.lg { width: 20px; height: 20px; }

/* ---------- Butang ---------- */
.btn {
  --bh: var(--h-md);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; vertical-align: middle;
  height: var(--bh); min-width: var(--bh); padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  font: 600 14px/1 var(--font-sans); letter-spacing: .005em; white-space: nowrap; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; flex-shrink: 0;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--panel-2); border-color: color-mix(in srgb, var(--ink) 22%, var(--line-2)); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); border-color: var(--line); color: var(--ink); }
.btn.ghost.danger { color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.sm { --bh: var(--h-sm); padding: 0 12px; gap: 6px; font-size: 13px; border-radius: var(--r-sm); }
.btn.lg { --bh: var(--h-lg); padding: 0 22px; gap: 10px; font-size: 15.5px; }
.btn.lg .ic { width: 18px; height: 18px; }
.btn.square { width: var(--bh); padding: 0; }
.btn.block { width: 100%; }
.btn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn .spinner { width: 14px; height: 14px; }

/* Butang tema: ikon bulan (mod terang) / matahari (mod gelap) */
.theme-btn .moon { display: var(--show-moon); }
.theme-btn .sun { display: var(--show-sun); }

/* ---------- Input ---------- */
.input, .select, .textarea,
/* :where() = specificity rendah, supaya .input-icon, .sm dan sebagainya sentiasa boleh override. */
.field :where(input:not([type=checkbox], [type=radio], [type=color], [type=file], [type=range]), select, textarea) {
  width: 100%; height: var(--h-md); padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  font: 400 14.5px/1.4 var(--font-sans); transition: border-color .15s, box-shadow .15s;
}
.textarea, .field :where(textarea) { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.select, .field :where(select) {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background: var(--panel) var(--chevron) no-repeat right 10px center / 16px;
}
:is(.input, .select, .textarea, .field input, .field select, .field textarea)::placeholder { color: var(--muted); opacity: .85; }
:is(.input, .select, .textarea, .field input, .field select, .field textarea):hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--line-2)); }
:is(.input, .select, .textarea, .field input, .field select, .field textarea):focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
:is(.input, .select, .textarea, .field input, .field select, .field textarea)[aria-invalid="true"] { border-color: var(--danger); }
:is(.input, .select, .textarea, .field input, .field select, .field textarea):is(:disabled, [readonly]) { background-color: var(--panel-2); color: var(--muted); }
.input.sm, .select.sm { height: var(--h-sm); font-size: 13.5px; border-radius: var(--r-sm); }
@media (pointer: coarse) {
  .input, .select, .textarea, .field :where(input:not([type=checkbox], [type=radio], [type=color], [type=file], [type=range]), select, textarea) { font-size: 16px; }
}
.select.sm { padding-right: 30px; background-position: right 8px center; background-size: 14px; }

.field { display: grid; gap: 6px; align-content: start; }
.field > span:first-child, .field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small, .field-hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.field .field-error { font-size: 12.5px; color: var(--danger); }

.input-icon { position: relative; display: block; }
.input-icon > .ic { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 36px; }
.input-action { position: relative; }
.input-action > input { padding-right: 84px !important; }
.input-action > .btn { position: absolute; right: 4px; top: 50%; translate: 0 -50%; }

.check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--h-md); cursor: pointer; font-size: 14.5px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
/* Suis hidup/mati: <input type="checkbox" class="switch" role="switch">. Untuk tetapan yang
   berkuat kuasa serta-merta; .check kekal untuk pilihan dalam borang. */
.switch {
  appearance: none; flex: none; position: relative; width: 40px; height: 24px; margin: 0; border-radius: 999px; cursor: pointer;
  background: var(--line-2); transition: background-color .18s ease;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: translate .18s ease;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { translate: 16px 0; background: var(--accent-ink); }
.switch:focus-visible { outline: none; box-shadow: var(--focus); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
/* Baris tetapan: teks di kiri, suis di kanan; seluruh baris boleh diklik. */
.opt-list { display: grid; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.opt-list > .opt-row:first-child { border-top: 0; padding-top: 4px; }
.opt-row .txt { display: grid; gap: 2px; min-width: 0; }
.opt-row .txt b { font-size: 14.5px; font-weight: 600; }
.opt-row .txt small { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.opt-row.is-off { cursor: default; }
.opt-row.is-off .txt { opacity: .55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
/* Bekas borang: grid medan ikut lebar bekas (cth. lajur borang editor di tablet), bukan lebar skrin. */
.sect, .dlg-body { container-type: inline-size; }
@container (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .grid3 { grid-template-columns: 1fr 1fr; } .grid3 > :first-child { grid-column: 1 / -1; } }
@container (max-width: 340px) { .grid3 { grid-template-columns: 1fr; } }

/* ---------- Lencana & amaran ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font: 600 12px/1 var(--font-sans); white-space: nowrap; vertical-align: middle;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.badge:is(.ok, .aktif) { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge:is(.warn, .draf) { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge:is(.mute, .arkib) { background: var(--panel-2); color: var(--muted); }

.alert { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 12px 14px; border-radius: var(--r); border: 1px solid; font-size: 14px; line-height: 1.5; }
.alert > .ic { margin-top: 2px; }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 28%, transparent); }
.alert.info > .ic { color: var(--info); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.alert.warn > .ic { color: var(--warn); }
.alert.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.alert.bad > .ic { color: var(--danger); }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.alert.ok > .ic { color: var(--ok); }
.form-error { display: flex; gap: 8px; align-items: center; color: var(--danger); font-size: 13.5px; }

/* ---------- Menu tindakan (⋯) ---------- */
.menu { position: relative; display: inline-flex; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 190px; padding: 4px;
  display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  animation: dlg-in .12s ease-out;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--ink); font: 500 14px/1 var(--font-sans); text-align: left; white-space: nowrap; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--danger-soft); }
.menu-sep { height: 1px; margin: 3px 4px; background: var(--line); }

/* ---------- Kad / panel ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }

/* ---------- Segmen & tab ---------- */
/* min-width: 0 membolehkan segmen mengecut dalam baris flex dan skrol di dalam dirinya (tidak menolak halaman jadi lebar). */
.seg { position: relative; display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line); min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; vertical-align: middle; }
.seg::-webkit-scrollbar { display: none; }
.seg > :is(button, a) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font: 600 13px/1 var(--font-sans);
  white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s;
}
.seg > :is(button, a):hover { color: var(--ink); }
.seg > :is(.on, [aria-selected="true"], [aria-current="page"]) { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg .count { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Jadual ---------- */
.table-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
/* position: relative supaya elemen absolute di dalam jadual turut dipotong, tidak melebarkan halaman. */
.table-scroll { position: relative; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  height: 40px; padding: 0 14px; text-align: left; vertical-align: middle; white-space: nowrap;
  font: 600 12px/1 var(--font-sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table .actions { width: 1%; text-align: right; white-space: nowrap; }
.table .actions .btn + .btn { margin-left: 2px; }
.table .sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.table .wrap-text { max-width: 380px; white-space: pre-line; overflow-wrap: anywhere; }
.table .is-dim td { opacity: .55; }
.table .empty-row td { padding: 44px 16px; text-align: center; color: var(--muted); }
.table .empty-row:hover td { background: none; }
.skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2), var(--line), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

/* Jadual "stack": di telefon setiap baris jadi kad. Sel diberi data-label;
   .cell-main = tajuk baris, .actions = penjuru kanan atas, .cell-wide = penuh lebar. */
@media (max-width: 767px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody { display: block; }
  .table.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table.stack tbody tr:last-child { border-bottom: 0; }
  .table.stack td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  .table.stack tbody tr:hover td { background: none; }
  .table.stack td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font: 600 11px/1.2 var(--font-sans); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  .table.stack .cell-main { grid-column: 1; grid-row: 1; align-self: center; }
  .table.stack .actions { grid-column: 2; grid-row: 1; width: auto; justify-self: end; align-self: start; margin: -4px -6px 0 0; }
  .table.stack .cell-main:last-child, .table.stack .cell-wide { grid-column: 1 / -1; }
  .table.stack .num { text-align: left; }
  .table.stack .nowrap { white-space: normal; }
  .table.stack td .badge { margin: 0 4px 4px 0; }
  .table.stack .empty-row, .table.stack .skel-row { display: block; }
  .table.stack .empty-row td { padding: 32px 8px; }
  .table.stack .skel-row td { padding: 4px 0; }
  .table-scroll:has(.table.stack) { overflow-x: visible; }
}

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.pager .range { font-variant-numeric: tabular-nums; }
.pager .range b { color: var(--ink); font-weight: 600; }
.pager .per { display: inline-flex; align-items: center; gap: 8px; }
.pager .per .select { width: auto; }
.pager .pages { display: inline-flex; align-items: center; gap: 4px; }
.pager .pages .btn { font-variant-numeric: tabular-nums; }
.pager .num-page { min-width: var(--bh); padding: 0 8px; }
.pager .page-of { display: none; min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pager .gap { width: 24px; text-align: center; }
@media (max-width: 767px) {
  .pager .num-page, .pager .gap, .pager .per { display: none; }
  .pager .page-of { display: inline-block; }
  .pager .range { font-size: 13px; }
}

/* ---------- Muat / kosong ---------- */
.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 16px; color: var(--muted); font-size: 14px; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .empty-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .empty-ic .ic { width: 22px; height: 22px; }
.empty h3 { font: 600 17px/1.3 var(--font-sans); color: var(--ink); }
.empty p { max-width: 420px; font-size: 14px; }

/* ---------- Dialog ---------- */
dialog.dlg {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; margin: auto;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); color: var(--ink);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.dlg[open] { display: flex; flex-direction: column; animation: dlg-in .18s cubic-bezier(.2,.8,.2,1); }
dialog.dlg::backdrop { background: rgb(20 10 10 / .5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
dialog.dlg.sm { width: min(420px, calc(100vw - 32px)); }
dialog.dlg.lg { width: min(680px, calc(100vw - 32px)); }
.dlg-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 4px; }
.dlg-head .dlg-titles { flex: 1; min-width: 0; }
.dlg-head h2 { font: 600 24px/1.2 var(--font-serif); }
.dlg-head p { margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.dlg-head .btn { margin: -4px -6px 0 0; }
.dlg-tone { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.dlg-tone.danger { background: var(--danger-soft); color: var(--danger); }
.dlg-tone .ic { width: 20px; height: 20px; }
.dlg-body { padding: 14px 20px; overflow: auto; display: grid; gap: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 20px; flex-wrap: wrap; }
@media (max-width: 560px) {
  dialog.dlg { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: 0; }
  dialog.dlg[open] { animation-name: sheet-in; }
  .dlg-foot { flex-direction: column-reverse; }
  .dlg-foot .btn { width: 100%; }
}

/* ---------- Toast (gaya Sonner) ---------- */
.toaster { position: fixed; right: 20px; bottom: 20px; width: 360px; z-index: 1000; pointer-events: none; }
.toast {
  position: absolute; right: 0; bottom: 0; width: 100%; pointer-events: auto;
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start;
  padding: 13px 12px 13px 14px; border-radius: var(--r-lg);
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transition: transform .4s cubic-bezier(.21,1.02,.73,1), opacity .4s; will-change: transform;
}
.toast::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 14px; }
.toast .t-ic { margin-top: 1px; width: 18px; height: 18px; }
.toast.success .t-ic { color: var(--ok); }
.toast.error .t-ic { color: var(--danger); }
.toast.info .t-ic { color: var(--info); }
.toast.warning .t-ic { color: var(--warn); }
.toast .t-title { font-weight: 600; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.toast .t-desc { margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.toast .t-body { min-width: 0; transition: opacity .2s; }
.toast.behind .t-body, .toast.behind .t-ic, .toast.behind .btn { opacity: 0; }
.toast .btn { --bh: 24px; margin: -2px -4px 0 0; border-radius: 6px; color: var(--muted); }
.toast .btn .ic { width: 14px; height: 14px; }
@media (max-width: 560px) { .toaster { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; } }
@media (max-width: 767px) { .has-tabbar .toaster, .has-dock .toaster { bottom: calc(84px + env(safe-area-inset-bottom)); } }

@keyframes spin { to { rotate: 360deg; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  .btn, .toast, .seg > * { transition: none; }
  dialog.dlg[open] { animation: none; }
  .skel, .spinner { animation-duration: 2s; }
}

/* ---------- Pemilih lokasi (dialog peta; editor & landing) ---------- */
.hint-line { display: flex; align-items: flex-start; gap: 6px; margin: -4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.hint-line > .ic { flex: none; margin-top: 1px; }
dialog.dlg.map-dlg { width: min(760px, calc(100vw - 32px)); --map-h: min(48vh, 380px); }
@media (max-width: 767px) { dialog.dlg.map-dlg { --map-h: min(42vh, 320px); } }
.map-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.map-results { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: var(--r); max-height: 220px; min-height: 112px; overflow-y: auto; background: var(--panel); }
.map-results button {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; width: 100%; padding: 8px 10px; text-align: left;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: inherit; cursor: pointer;
}
.map-results button:hover, .map-results button:focus-visible { background: var(--panel-2); outline: none; }
.map-results button > .ic { color: var(--accent); margin-top: 2px; }
.map-results span { display: grid; gap: 1px; min-width: 0; }
.map-results b { font-size: 14px; font-weight: 600; }
.map-results small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-box { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); min-height: var(--map-h); }
.map-box .map { height: var(--map-h); min-height: 220px; background: var(--panel-2); z-index: 0; }
/* Kiri atas: kawalan zum (kanan bawah) & jenis peta (kanan atas) milik enjin peta tidak dihalang. */
.map-locate { position: absolute; left: 10px; top: 10px; z-index: 500; box-shadow: var(--shadow); }
.map-pin { color: var(--accent); filter: drop-shadow(0 2px 3px rgb(0 0 0 / .3)); }
.map-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; font-size: 13.5px; }
.map-coords { display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.map-coords .ic { color: var(--accent); align-self: center; }
.map-coords b { font-variant-numeric: tabular-nums; }
.map-coords small { color: var(--muted); font-size: 12.5px; }
/* Leaflet ikut tema dashboard */
.map-box .leaflet-bar a { background: var(--panel); color: var(--ink); border-color: var(--line); }
.map-box .leaflet-bar a:hover { background: var(--panel-2); }
.map-box .leaflet-control-attribution { font-size: 10.5px; }
:root[data-theme="dark"] .map-box .leaflet-tile-pane { filter: brightness(.8) contrast(1.1) saturate(.85); }
.hint-line > span { min-width: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map-box .leaflet-tile-pane { filter: brightness(.8) contrast(1.1) saturate(.85); } }

/* Perangkap bot (honeypot): di luar skrin, bukan display:none (sesetengah bot langkau medan tersembunyi). */
.hp { position: absolute !important; left: -10000px !important; top: auto; width: 1px; height: 1px; overflow: hidden; }
