/* =========================================================
   FormGuard — Design System
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- tokens ---------- */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-hover: #f4f5f7;

  --line: #e8eaee;
  --line-strong: #d8dce3;

  --text: #0d1117;
  --text-2: #5b6472;
  --text-3: #8b95a5;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-line: #c7d2fe;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;

  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-line: #fde68a;

  --ok: #059669;
  --ok-soft: #ecfdf5;
  --ok-line: #a7f3d0;

  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --sh-xs: 0 1px 2px rgba(13,17,23,.05);
  --sh-sm: 0 1px 3px rgba(13,17,23,.06), 0 1px 2px rgba(13,17,23,.04);
  --sh-md: 0 4px 12px rgba(13,17,23,.07), 0 1px 3px rgba(13,17,23,.05);
  --sh-lg: 0 12px 32px rgba(13,17,23,.10), 0 2px 8px rgba(13,17,23,.05);
  --sh-xl: 0 24px 64px rgba(13,17,23,.16);

  --sidebar-w: 244px;
  --ease: cubic-bezier(.32,.72,0,1);
}

[data-theme="dark"] {
  --bg: #0b0d11;
  --bg-elev: #14171d;
  --bg-subtle: #191d24;
  --bg-hover: #1e232b;

  --line: #252a33;
  --line-strong: #333a45;

  --text: #e9edf3;
  --text-2: #9aa4b2;
  --text-3: #6b7684;

  --accent: #7b74f0;
  --accent-hover: #8e88f4;
  --accent-soft: #1d1b3a;
  --accent-line: #37326b;

  --danger: #f87171;
  --danger-soft: #2a1517;
  --danger-line: #4c2225;

  --warn: #fbbf24;
  --warn-soft: #2a2110;
  --warn-line: #4a3a14;

  --ok: #34d399;
  --ok-soft: #10241d;
  --ok-line: #1f4d3d;

  --sh-xs: 0 1px 2px rgba(0,0,0,.4);
  --sh-sm: 0 2px 6px rgba(0,0,0,.35);
  --sh-md: 0 6px 18px rgba(0,0,0,.45);
  --sh-lg: 0 16px 40px rgba(0,0,0,.55);
  --sh-xl: 0 28px 70px rgba(0,0,0,.7);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','ss01';
}
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -0.014em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { width: 1em; height: 1em; fill: currentColor; flex: 0 0 auto; }
::selection { background: var(--accent-soft); color: var(--accent); }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  z-index: 60;
  transition: transform .32s var(--ease);
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 18px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(145deg, #6366f1, #4f46e5);
  display: grid; place-items: center;
  color: #fff; font-size: 18px;
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 14.5px; font-weight: 650; letter-spacing: -0.02em; }
.brand-text small { font-size: 11px; color: var(--text-3); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 10px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8.5px 11px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  transition: background .13s, color .13s;
  position: relative;
}
.nav a svg { font-size: 16px; opacity: .75; }
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active svg { opacity: 1; }
.nav a.active::before {
  content: ''; position: absolute; left: -10px; top: 50%;
  width: 3px; height: 18px; margin-top: -9px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}

.sidebar-foot { padding: 10px; display: flex; flex-direction: column; gap: 10px; }

.hint-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  border-radius: var(--r-md);
  font-size: 12px;
}
.hint-card svg { color: var(--ok); font-size: 15px; margin-top: 1px; }
.hint-card b { display: block; font-size: 12px; font-weight: 600; color: var(--ok); }
.hint-card span { color: var(--text-2); font-size: 11.5px; }
.hint-card em { font-style: normal; font-weight: 700; color: var(--ok); }

/* ---------- main ---------- */
.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-titles { flex: 1; min-width: 0; }
.topbar-titles h1 { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.topbar-titles p { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 31px; height: 31px; border-radius: 50%;
  background: linear-gradient(145deg, #6366f1, #a855f7);
  color: #fff; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 650;
  box-shadow: var(--sh-sm);
  user-select: none;
}

.content {
  flex: 1;
  padding: 22px 28px 64px;
  max-width: 1320px;
  width: 100%;
}

.view { animation: viewIn .32s var(--ease); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px;
  font-size: 13.5px; font-weight: 550; font-family: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background .13s, border-color .13s, box-shadow .13s, transform .08s;
  box-shadow: var(--sh-xs);
}
.btn svg { font-size: 15px; }
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,.2), 0 4px 12px rgba(79,70,229,.22);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { color: var(--danger); border-color: var(--danger-line); background: var(--bg-elev); }
.btn-danger:hover { background: var(--danger-soft); }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: 5.5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-sm svg { font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--text-2);
  cursor: pointer; font-size: 15px;
  transition: background .13s, color .13s;
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 13.5px; }

#themeBtn .icon-moon { display: none; }
[data-theme="dark"] #themeBtn .icon-sun { display: none; }
[data-theme="dark"] #themeBtn .icon-moon { display: block; }

/* ---------- cards ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--sh-xs);
}
.card-flush { padding: 0; overflow: hidden; }

.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card-head h2 { font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 16px;
  box-shadow: var(--sh-xs);
  position: relative;
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s;
}
.stat:hover { box-shadow: var(--sh-sm); border-color: var(--line-strong); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-ico {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; font-size: 13px;
  background: var(--bg-hover); color: var(--text-3);
}
.stat-ico.danger { background: var(--danger-soft); color: var(--danger); }
.stat-ico.ok { background: var(--ok-soft); color: var(--ok); }
.stat-ico.accent { background: var(--accent-soft); color: var(--accent); }
.stat-value {
  font-size: 25px; font-weight: 650; letter-spacing: -0.03em;
  margin-top: 8px; font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-value.danger { color: var(--danger); }
.stat-foot { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/* ---------- layout helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- forms ---------- */
label {
  display: block; font-size: 12.5px; font-weight: 550;
  color: var(--text-2); margin-bottom: 6px;
}
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 13.5px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 8.5px 11px;
  outline: none;
  transition: border-color .13s, box-shadow .13s;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238b95a5'%3E%3Cpath d='M12 15.5 5.5 9l1.4-1.4L12 12.7l5.1-5.1L18.5 9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 16px;
  padding-right: 32px;
}
textarea { resize: vertical; line-height: 1.55; }

.field { margin-bottom: 13px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.code-area {
  min-height: 190px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}
.code-area.sm { min-height: 120px; }

.hint-line { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.hint-line.hint-warn { color: var(--warn, #b45309); font-weight: 600; }

.select-inline { width: auto; min-width: 150px; }

.search {
  position: relative; display: flex; align-items: center;
  width: 260px;
}
.search svg {
  position: absolute; left: 10px; font-size: 14px;
  color: var(--text-3); pointer-events: none;
}
.search input { padding-left: 32px; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar-info { font-size: 12.5px; color: var(--text-3); font-weight: 500; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: left;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .035em;
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky; top: 0;
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--bg-subtle); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 5px; }

.cell-phone {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.cell-mono {
  font-family: var(--mono); font-size: 12px; color: var(--text-2);
}
.cell-muted { font-size: 12.5px; color: var(--text-3); }
.cell-truncate {
  max-width: 260px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; color: var(--text-3);
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge svg { font-size: 11px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.badge-off { background: var(--bg-hover); color: var(--text-3); border-color: var(--line); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

.badge-retur { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge-fake_order { background: var(--warn-soft); color: var(--warn); border-color: #fde68a; }
.badge-cod_gagal { background: #fdf4ff; color: #a21caf; border-color: #f5d0fe; }
.badge-tidak_respon { background: #eff8ff; color: #0b6bcb; border-color: #cce3fd; }
.badge-lainnya { background: var(--bg-hover); color: var(--text-2); border-color: var(--line); }

[data-theme="dark"] .badge-cod_gagal { background: #2a1030; color: #e879f9; border-color: #4a1d54; }
[data-theme="dark"] .badge-tidak_respon { background: #0c2236; color: #60a5fa; border-color: #164a70; }
[data-theme="dark"] .badge-fake_order { background: var(--warn-soft); border-color: #4a3a10; }

/* ---------- empty ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 46px 24px; gap: 4px;
}
.empty-ico {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--bg-hover); color: var(--text-3);
  font-size: 20px; margin-bottom: 10px;
}
.empty b { font-size: 13.5px; font-weight: 600; }
.empty p { font-size: 12.5px; color: var(--text-3); max-width: 320px; }

/* ---------- code block ---------- */
.code-block {
  margin: 0;
  background: #0d1117;
  color: #c9d1d9;
  border-radius: var(--r-md);
  padding: 14px 15px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  overflow: auto;
  max-height: 300px;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #21262d;
}
[data-theme="dark"] .code-block { border-color: #30363d; }

/* ---------- note ---------- */
.note-box {
  display: flex; gap: 11px;
  padding: 12px 13px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  margin-top: 14px;
}
.note-box > svg { color: var(--accent); font-size: 16px; margin-top: 1px; }
.note-box b { font-size: 12.5px; font-weight: 600; color: var(--accent); display: block; }
.note-box p { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }

/* ---------- telegram ---------- */
.status-banner {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  margin-bottom: 16px;
  font-size: 13px;
}
.status-banner .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3); flex: 0 0 auto;
}
.status-banner.on { border-color: var(--ok-line); background: var(--ok-soft); }
.status-banner.on .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.status-banner.off .dot { background: var(--text-3); }
.status-banner.warn { border-color: var(--warn-line, var(--line)); background: var(--warn-soft, var(--bg-subtle)); }
.status-banner.warn .dot { background: var(--warn, #d97706); }
.status-banner b { font-weight: 600; }
.status-banner span { color: var(--text-2); }
.status-banner .spacer { flex: 1; }
.status-banner .meta {
  font-size: 11.5px; color: var(--text-3);
  font-family: var(--mono);
}

.check-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  margin-bottom: 0;
}
.check-row input[type="checkbox"] {
  width: 16px; height: 16px; margin: 2px 0 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
  cursor: pointer;
}
.check-row span { display: block; }
.check-row b { display: block; font-size: 12.8px; font-weight: 600; color: var(--text); }
.check-row em { display: block; font-style: normal; font-size: 11.8px; color: var(--text-3); margin-top: 1px; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li {
  position: relative;
  padding: 0 0 16px 34px;
  counter-increment: s;
}
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: -1px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.steps li:not(:last-child)::after {
  content: '';
  position: absolute; left: 10.5px; top: 25px; bottom: 3px;
  width: 1px; background: var(--line);
}
.steps li > b { font-size: 12.8px; font-weight: 600; display: block; }
.steps p { font-size: 12.2px; color: var(--text-2); line-height: 1.55; margin-top: 2px; }
.steps p b,
.steps p strong { display: inline; font-weight: 600; color: var(--text); }
.steps code {
  font-family: var(--mono); font-size: 11.5px;
  background: var(--bg-subtle); border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px;
}
.link-btn {
  background: none; border: 0; padding: 0;
  font: inherit; font-size: 12.2px; font-weight: 600;
  color: var(--accent); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-hover, var(--accent)); }

.chat-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.chat-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .13s, background .13s;
  text-align: left; width: 100%; font: inherit; color: inherit;
  background: var(--bg-elev);
}
.chat-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.chat-item .ci-main { flex: 1; min-width: 0; }
.chat-item b { display: block; font-size: 12.8px; font-weight: 600; }
.chat-item small {
  display: block; font-size: 11.5px; color: var(--text-3);
  font-family: var(--mono); margin-top: 1px;
}

.sample-result {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  overflow: hidden;
}
.sample-result .sr-head {
  padding: 9px 13px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: .03em;
}
.sample-result .sr-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 13px;
  border-bottom: 1px solid var(--line);
}
.sample-result .sr-row:last-child { border-bottom: 0; }
.sample-result .sr-phone {
  font-family: var(--mono); font-size: 12.8px; font-weight: 500;
}
.sample-result .sr-item { border-bottom: 1px solid var(--line); }
.sample-result .sr-item:last-child { border-bottom: 0; }
.sample-result .sr-item .sr-row { border-bottom: 0; }
/* Rincian tiap nomor: nomor order + catatan hasil ekstraksi. */
.sample-result .sr-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  padding: 0 13px 10px;
  font-size: 11.8px; line-height: 1.5; color: var(--text-3);
}
.sample-result .sr-meta .sr-order {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  padding: 1px 6px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent);
  flex: 0 0 auto;
}
.sample-result .sr-meta .sr-note-text { flex: 1 1 180px; min-width: 0; }

/* ---------- kv list ---------- */
.kv { margin: 0; display: flex; flex-direction: column; gap: 0; }
.kv > div {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line);
}
.kv > div:last-child { border-bottom: 0; }
.kv dt { font-size: 12.5px; color: var(--text-3); margin: 0; }
.kv dd {
  margin: 0; font-size: 12.5px; font-weight: 550;
  color: var(--text); text-align: right;
}

/* ---------- forms grid ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.form-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-xs);
  transition: box-shadow .18s, border-color .18s, transform .18s var(--ease);
  display: flex; flex-direction: column; gap: 12px;
}
.form-card:hover { box-shadow: var(--sh-md); border-color: var(--line-strong); transform: translateY(-1px); }
.form-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.form-card-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.form-card-slug {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.form-card-stats {
  display: flex; gap: 14px; padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.form-card-stats div { display: flex; flex-direction: column; gap: 1px; }
.form-card-stats span { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.form-card-stats b { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.form-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* 4 tombol (Script, Uji, Matikan, Hapus) — di layar sempit mereka turun baris
   daripada teksnya terpotong. */
.form-card-actions .btn { flex: 1 1 auto; min-width: 84px; justify-content: center; }
.form-card-actions .btn svg { flex: 0 0 auto; }

/* ---------- pager ---------- */
.pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.pager-info { margin-right: auto; font-size: 12px; color: var(--text-3); }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease);
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(9,11,15,.5);
  backdrop-filter: blur(3px);
}
.modal-panel {
  position: relative;
  width: min(500px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 20px;
  box-shadow: var(--sh-xl);
  transform: translateY(10px) scale(.98);
  transition: transform .24s var(--ease);
}
.modal.open .modal-panel { transform: none; }
.modal-panel.modal-sm { width: min(420px, 100%); }

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.modal-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.modal-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ---------- segmented control ---------- */
.seg {
  display: inline-flex; gap: 2px;
  padding: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.seg button {
  border: 0; background: transparent;
  padding: 6px 13px;
  font-size: 12.5px; font-weight: 550;
  color: var(--text-2);
  border-radius: 6px;
  cursor: pointer;
  transition: background .13s, color .13s;
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--bg-elev); color: var(--text);
  box-shadow: var(--sh-xs);
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 15px;
  background: var(--text);
  color: var(--bg-elev);
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 550;
  box-shadow: var(--sh-lg);
  animation: toastIn .3s var(--ease);
  max-width: 90vw;
}
.toast svg { font-size: 15px; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- messages ---------- */
.err { font-size: 12.5px; color: var(--danger); min-height: 0; }
.err:not(:empty) { margin-top: 10px; }
.ok { font-size: 12.5px; color: var(--ok); }
.ok:not(:empty) { margin-top: 10px; }

/* ---------- skeleton ---------- */
.sk {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-subtle) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: sk 1.3s ease-in-out infinite;
  border-radius: 5px;
  height: 13px;
}
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-row { display: flex; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sk-row .sk:nth-child(1) { width: 90px; }
.sk-row .sk:nth-child(2) { width: 120px; }
.sk-row .sk:nth-child(3) { flex: 1; }
.sk-row .sk:nth-child(4) { width: 60px; }

/* ---------- login ---------- */
.login-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background: var(--bg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-body::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(700px 400px at 50% -10%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%);
  pointer-events: none;
}
.login-card {
  position: relative;
  width: min(376px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 30px 28px 26px;
  box-shadow: var(--sh-lg);
  animation: loginIn .45s var(--ease);
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 22px;
}
.login-brand .brand-mark { width: 36px; height: 36px; font-size: 19px; }
.login-brand b { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.login-card h2 { font-size: 19px; font-weight: 650; letter-spacing: -0.025em; }
.login-card > p { font-size: 13px; color: var(--text-3); margin: 5px 0 22px; }
.login-card .btn { margin-top: 6px; padding: 10px 14px; }

/* ---------- mobile ---------- */
.mobile-only { display: none; }
.scrim {
  display: none; position: fixed; inset: 0;
  background: rgba(9,11,15,.5); z-index: 55;
  backdrop-filter: blur(2px);
}

@media (max-width: 1080px) {
  .grid-2, .split { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .mobile-only { display: grid; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--sh-xl); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; }
  .main { margin-left: 0; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 56px; }
  .field-row { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .toolbar .select-inline { flex: 1; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .stat-value { font-size: 22px; }
}

@media (max-width: 720px) {
  .table-wrap { overflow-x: visible; }
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr {
    position: relative;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  tbody tr:hover { background: transparent; }
  tbody td {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    border: 0;
    font-size: 13px;
    text-align: right;
  }
  tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--text-3);
    text-transform: uppercase;
    text-align: left;
    padding-top: 2px;
  }
  tbody td:first-child {
    padding-bottom: 9px;
    margin-bottom: 7px;
    border-bottom: 1px dashed var(--line);
  }
  tbody td:first-child::before { display: none; }
  tbody td:first-child .cell-phone { font-size: 15px; }
  td.actions {
    justify-content: flex-end; gap: 6px;
    padding-top: 11px; margin-top: 4px;
    border-top: 1px dashed var(--line);
  }
  td.actions::before { display: none; }
  td.actions .btn { flex: 1; justify-content: center; }
  .cell-truncate { max-width: 62%; }

  .status-banner { flex-wrap: wrap; align-items: flex-start; }
  .status-banner .spacer { display: none; }
  .status-banner .meta {
    flex: 1 0 100%;
    padding-left: 19px;
    margin-top: 5px;
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
  .toolbar .btn { flex: 1; }
  thead th { padding: 10px 12px; }
}

/* ---------- a11y / motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
