/* =====================================================================
   RAF Gateway — Dashboard styles
   Tema: mission-control / operations console (dark, navy + electric blue + cyan)
   Warna brand di-override runtime oleh branding.js (CSS variables).
   ===================================================================== */

:root {
  /* Brand (default; di-overwrite dari GET /api/branding) */
  /* Aksen hijau emerald/teal (on-brand WhatsApp) — natural, modern, tidak "neon AI". */
  --brand-navy: #0c1c20;
  --brand-accent: #16a37b;
  --brand-cyan: #2bbfa6;

  /* Skala permukaan diturunkan dari base (teal-charcoal, netral-hijau) */
  --bg-0: #070f12;
  --bg-1: #0c1c20;
  --bg-2: #1a2c2f;
  --surface: #142528;
  --surface-2: #1d3033;
  --surface-3: #2c4044;
  --line: rgba(140, 180, 172, 0.14);
  --line-strong: rgba(140, 180, 172, 0.28);

  /* Teks */
  --text: #e9f1ef;
  --text-dim: #a4b8b4;
  --text-mute: #6f8783;

  /* Status */
  --ok: #2ecc71;
  --ok-bg: rgba(46, 204, 113, 0.14);
  --warn: #f5b13d;
  --warn-bg: rgba(245, 177, 61, 0.14);
  --danger: #ff5d6c;
  --danger-bg: rgba(255, 93, 108, 0.14);
  --info: var(--brand-cyan);
  --info-bg: rgba(0, 212, 255, 0.12);

  /* Aksen turunan (di-recompute oleh branding.js) */
  --accent-soft: rgba(22, 163, 123, 0.15);
  --accent-glow: rgba(22, 163, 123, 0.28);
  --cyan-soft: rgba(43, 191, 166, 0.12);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.75);
  --shadow-soft: 0 8px 28px -16px rgba(0, 0, 0, 0.6);

  --sidebar-w: 264px;
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ===== Tema Terang (Light) — override token via :root[data-theme="light"] ===== */
:root[data-theme="light"] {
  --brand-navy: #0b1f3a;
  --bg-0: #eef2f8;
  --bg-1: #ffffff;
  --bg-2: #e7eef7;
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --surface-3: #eaf0f8;
  --line: rgba(15, 42, 77, 0.12);
  --line-strong: rgba(15, 42, 77, 0.22);
  --text: #10233f;
  --text-dim: #41587b;
  --text-mute: #6b7f9b;
  --ok-bg: rgba(46, 204, 113, 0.16);
  --warn-bg: rgba(245, 177, 61, 0.18);
  --danger-bg: rgba(255, 93, 108, 0.14);
  --info-bg: rgba(0, 160, 200, 0.14);
  --accent-soft: rgba(22, 163, 123, 0.10);
  --accent-glow: rgba(22, 163, 123, 0.22);
  --cyan-soft: rgba(43, 191, 166, 0.08);
  --shadow: 0 18px 50px -22px rgba(15, 42, 77, 0.22);
  --shadow-soft: 0 8px 28px -16px rgba(15, 42, 77, 0.14);
}

/* Penyesuaian komponen tema terang (elemen yang semula hardcoded gelap/putih). */
:root[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.85); }
:root[data-theme="light"] .nav-link.active { background: var(--accent-soft); color: var(--brand-accent); }
:root[data-theme="light"] .modal-backdrop { background: rgba(15, 42, 77, 0.45); }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  /* Latar tenang & rata (tanpa grid sci-fi / gradient mesh) — kesan natural. */
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0.01em;
}

a { color: var(--brand-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 600; letter-spacing: -0.01em; }

::selection { background: var(--accent-glow); color: #fff; }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

/* =========================== LOGIN =========================== */
.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.auth-side {
  position: relative;
  overflow: hidden;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Kedalaman halus: dua glow hijau/teal lembut (atas-kiri + bawah-kanan) — bukan grid sci-fi. */
  background:
    radial-gradient(900px 600px at 18% 8%, var(--accent-soft), transparent 55%),
    radial-gradient(700px 520px at 92% 100%, var(--cyan-soft), transparent 60%),
    var(--bg-1);
  border-right: 1px solid var(--line);
}
/* Plexus/konstelasi latar — diadopsi dari desain gelap, dibuat lembut. */
.auth-plexus {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none;
}
.auth-plexus .plx-lines { opacity: 0.18; }
.auth-plexus .plx-dots { opacity: 0.45; }
.auth-plexus .plx-halo { opacity: 0.16; }
/* Tema terang: turunkan lagi agar elegan & tidak ramai (latar tetap "berisi"). */
:root[data-theme="light"] .auth-plexus .plx-lines { opacity: 0.12; }
:root[data-theme="light"] .auth-plexus .plx-dots { opacity: 0.28; }
:root[data-theme="light"] .auth-plexus .plx-halo { opacity: 0.10; }
.auth-side .brand-lockup { position: relative; z-index: 2; }
.auth-headline {
  position: relative; z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  max-width: 14ch;
  font-weight: 700;
}
.auth-headline .accent { color: var(--brand-accent); }
.auth-sub { position: relative; z-index: 2; color: var(--text-dim); max-width: 42ch; margin-top: 18px; line-height: 1.6; }
/* Kartu fitur (kiri) dengan ikon. */
.auth-features { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.auth-feat {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 16px 18px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.auth-feat-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--brand-accent); margin-bottom: 8px; }
.auth-feat-ic svg { width: 20px; height: 20px; }
.auth-feat b { font-family: var(--font-display); font-size: 15px; }
.auth-feat span { font-size: 12px; color: var(--text-mute); }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-soft);
}
.auth-card h1 { font-size: 25px; }
.auth-card .lead { color: var(--text-dim); margin: 8px 0 26px; }

/* Input dengan ikon di depan (+ tombol mata di belakang utk password). */
.input-icon { position: relative; }
.input-icon .ii-lead { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-mute); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.input-icon .ii-trail { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 6px; }
.input-icon:focus-within .ii-lead { color: var(--brand-accent); }

/* CTA daftar (pengganti akun demo). */
.auth-cta {
  margin-top: 20px; padding: 14px 16px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid var(--brand-accent);
  font-size: 13px; display: flex; flex-direction: column; gap: 2px;
}
.auth-cta span { color: var(--text-dim); }
.auth-cta a { font-weight: 600; color: var(--brand-accent); }

/* Brand lockup (logo + nama) */
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: var(--brand-accent);
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 19px;
  overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.1; }
.brand-tag { color: var(--text-mute); font-size: 11.5px; letter-spacing: 0.02em; }

/* =========================== SHELL =========================== */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 16px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar .brand-lockup { padding: 6px 8px 18px; }

.nav-group-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 14px 12px 6px;
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  position: relative;
}
.nav-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-link.active {
  background: linear-gradient(100deg, var(--accent-soft), transparent);
  color: #fff;
  border-color: var(--line-strong);
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--brand-accent), var(--brand-cyan));
}
/* Ukuran default ikon SVG — cegah ikon raksasa di konteks tanpa aturan khusus. */
.ico { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.nav-link .ico { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav-badge { margin-left: auto; background: var(--danger, #e5484d); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.nav-spacer { flex: 1; }

.sidebar-user {
  border-top: 1px solid var(--line);
  padding: 14px 8px 4px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: 14px;
  background: var(--surface-3); color: var(--brand-cyan);
  font-family: var(--font-display);
}
.sidebar-user .meta { min-width: 0; flex: 1; }
.sidebar-user .meta .name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .meta .role { font-size: 11px; color: var(--text-mute); text-transform: capitalize; }

/* Konten */
.content { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(6, 16, 31, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; }
.topbar .crumb { color: var(--text-mute); font-size: 12.5px; font-family: var(--font-mono); }
.topbar-spacer { flex: 1; }
.menu-toggle {
  display: none;
  background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--text); border-radius: 10px; width: 40px; height: 40px;
  cursor: pointer; align-items: center; justify-content: center;
}

.page { padding: 28px; display: flex; flex-direction: column; gap: 22px; animation: fadeUp 0.4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .titles h2 { font-size: 23px; }
.page-head .titles p { color: var(--text-dim); margin: 6px 0 0; font-size: 13.5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =========================== METRIC CARDS =========================== */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: linear-gradient(160deg, var(--surface), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}
.card.pad-0 { padding: 0; }
.card-title { font-family: var(--font-display); font-size: 15px; margin-bottom: 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15px; }

.metric {
  position: relative;
}
.metric::after {
  content: '';
  position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.metric .label { color: var(--text-mute); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.metric .value { font-family: var(--font-display); font-size: 32px; font-weight: 600; margin-top: 10px; line-height: 1; letter-spacing: -0.02em; }
.metric .value small { font-size: 15px; color: var(--text-mute); font-weight: 500; }
.metric .sub { color: var(--text-dim); font-size: 12.5px; margin-top: 8px; font-family: var(--font-mono); }
.metric .chip-ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--brand-cyan);
}

/* Mini progress (kuota) */
.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-accent), var(--brand-cyan)); transition: width 0.5s ease; }

/* =========================== AI INSIGHT (grafik bar ringan) =========================== */
.insight-bars { display: flex; flex-direction: column; gap: 7px; }
.ins-row { display: flex; align-items: center; gap: 10px; }
.ins-label { flex: 0 0 38px; font-family: var(--font-mono); font-size: 12px; color: var(--text-mute); text-align: right; }
.ins-track { flex: 1; height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.ins-fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-accent), var(--brand-cyan)); transition: width 0.5s ease; min-width: 2px; }
.ins-val { flex: 0 0 46px; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); text-align: right; }
.ins-row.is-best .ins-fill { background: linear-gradient(90deg, var(--ok), var(--brand-cyan)); }
.ins-row.is-best .ins-label { color: var(--ok); font-weight: 700; }
.ins-recs { margin: 0; padding-left: 18px; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.ins-recs li { line-height: 1.5; }

/* =========================== BUTTONS =========================== */
.btn {
  appearance: none;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
.btn-primary {
  border-color: transparent;
  background: var(--brand-accent);
  color: #fff;
}
.btn-primary:hover { background: #138a68; }
.btn-cyan { border-color: transparent; background: var(--brand-cyan); color: #04222b; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { border-color: rgba(255, 93, 108, 0.4); color: var(--danger); background: var(--danger-bg); }
.btn-danger:hover { background: rgba(255, 93, 108, 0.22); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================== FORMS =========================== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; letter-spacing: 0.01em; }
.field .hint { font-size: 11.5px; color: var(--text-mute); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { resize: vertical; min-height: 96px; font-family: var(--font-body); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-mute); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236c84a8' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input-wrap { position: relative; display: flex; }
.input-wrap .btn { border-radius: 0 10px 10px 0; border-left: none; }
.input-wrap .input { border-radius: 10px 0 0 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; gap: 10px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 42px; height: 24px; border-radius: 99px; background: var(--surface-3); transition: background 0.18s; position: relative; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-dim); transition: transform 0.18s, background 0.18s; }
.switch input:checked + .track { background: var(--brand-accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
/* Label teks di samping switch: cegah teks panjang menempel/menumpuk ke track. */
.switch > span { font-size: 13px; line-height: 1.4; color: var(--text); font-weight: 500; }
/* Penting: ".field label { display:block }" (label biasa) menimpa label.switch →
   track & teks jadi menumpuk. Paksa switch tetap inline-flex di dalam .field. */
.field .switch { display: inline-flex; align-items: flex-start; margin-bottom: 0; }
.field .switch .track { margin-top: 1px; }

/* =========================== PENGATURAN (Settings) =========================== */
.settings-section { margin-bottom: 26px; }
.settings-section:last-child { margin-bottom: 0; }
.settings-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.settings-section-head .ico-box {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: var(--accent-soft); color: var(--brand-accent);
  display: grid; place-items: center;
}
.settings-section-head .ico-box .ico { width: 18px; height: 18px; }
.settings-section-head h3 { font-size: 15px; margin: 0; }
.settings-section-head p { font-size: 12.5px; margin: 2px 0 0; }

/* Alasan putus terakhir di bawah badge status (halaman Perangkat). */
.device-disc-reason {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.35;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================== BADGES =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-transform: capitalize;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge-ok { color: var(--ok); background: var(--ok-bg); border-color: rgba(46, 204, 113, 0.3); }
.badge-ok .dot { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6); animation: pulse 1.8s infinite; }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(245, 177, 61, 0.3); }
.badge-danger { color: var(--danger); background: var(--danger-bg); border-color: rgba(255, 93, 108, 0.3); }
.badge-info { color: var(--brand-cyan); background: var(--info-bg); border-color: rgba(0, 212, 255, 0.3); }
.badge-mute { color: var(--text-mute); background: var(--surface-2); border-color: var(--line); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); } 70% { box-shadow: 0 0 0 6px rgba(46, 204, 113, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); } }

.tag-role { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

/* =========================== TABLE =========================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 600px; }
/* Alias: .table dipakai di beberapa halaman (dashboard, database pelanggan, dll) — samakan dgn .tbl. */
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th, .table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  white-space: nowrap;
}
.tbl thead th { position: sticky; top: 0; }
.tbl tbody td, .table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr, .table tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover, .table tbody tr:hover { background: var(--surface); }
.tbl tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: none; }
.tbl .mono, .table .mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }
.tbl .strong, .table .strong { font-weight: 600; color: var(--text); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.text-right { text-align: right; }
.text-dim { color: var(--text-dim); }
.text-mute { color: var(--text-mute); }
.nowrap { white-space: nowrap; }

/* =========================== PAGINATION =========================== */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager .info { color: var(--text-mute); font-size: 12.5px; font-family: var(--font-mono); }

/* =========================== EMPTY / LOADING =========================== */
.empty {
  text-align: center;
  padding: 54px 24px;
  color: var(--text-mute);
}
.empty .ico-lg { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--text-mute); opacity: 0.7; }
.empty h4 { font-size: 16px; color: var(--text-dim); margin-bottom: 6px; }
.empty p { font-size: 13px; max-width: 38ch; margin: 0 auto 16px; line-height: 1.6; }

.skeleton { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-3) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-row { height: 16px; margin: 10px 0; }

.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner.dark { border-color: rgba(0,0,0,0.2); border-top-color: var(--brand-accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: grid; place-items: center; padding: 60px; gap: 14px; color: var(--text-mute); }
.loading-center .spinner { width: 30px; height: 30px; }

/* =========================== MODAL =========================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3, 9, 18, 0.72);
  backdrop-filter: blur(5px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(165deg, var(--surface-2), var(--bg-1));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: pop 0.2s ease;
  max-height: 90dvh;
  display: flex; flex-direction: column;
}
.modal.wide { max-width: 820px; }
.modal.xwide { max-width: 1080px; }
/* Grid kartu add-on — kolom otomatis biar muat banyak tanpa scroll panjang. */
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr; } }
/* Indikator langkah wizard (1 Target · 2 Pesan · 3 Kirim). */
.wiz-steps { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; }
.wiz-step-ind { display: flex; align-items: center; gap: 8px; color: var(--text-mute); font-size: 13px; font-weight: 600; transition: color .15s; }
.wiz-step-ind .wiz-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text-mute); font-size: 12.5px; font-family: var(--font-mono); transition: background .15s, color .15s, border-color .15s; flex: none; }
.wiz-step-ind.active { color: var(--text); }
.wiz-step-ind.active .wiz-num { background: var(--brand-accent); border-color: var(--brand-accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.wiz-step-ind.done { color: var(--text-dim); }
.wiz-step-ind.done .wiz-num { background: var(--accent-soft); border-color: var(--brand-accent); color: var(--brand-accent); }
.wiz-sep { flex: 1; height: 1px; background: var(--line-strong); min-width: 12px; }
@media (max-width: 520px) {
  .wiz-step-ind .wiz-lbl { display: none; }
  .wiz-steps { gap: 6px; }
}
/* Chip variabel di composer (sisip {name}/spintax). */
.var-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.var-chips-label { font-size: 12px; color: var(--text-mute); margin-right: 2px; }
.chip-btn { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--accent-soft); color: var(--brand-accent); cursor: pointer; font-family: var(--font-mono); transition: background .12s, border-color .12s; }
.chip-btn:hover { background: var(--accent-glow); border-color: var(--brand-accent); }
/* Area unggah media (drag & drop) + file terpilih. */
.media-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 18px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.media-drop:hover, .media-drop:focus, .media-drop.drag { border-color: var(--brand-accent); background: var(--accent-soft); outline: none; }
.media-drop .ico { width: 26px; height: 26px; color: var(--text-mute); }
.media-drop-text { font-size: 13px; color: var(--text-dim); }
.media-drop-link { color: var(--brand-accent); text-decoration: underline; }
.media-pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.media-pick-icon { display: grid; place-items: center; color: var(--brand-accent); }
.media-pick-icon .ico { width: 18px; height: 18px; }
.media-pick-name { flex: 1; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-pick-clear { flex: none; }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-head p { color: var(--text-dim); font-size: 12.5px; margin: 4px 0 0; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); }
.modal-close { background: transparent; border: none; color: var(--text-mute); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.modal-close:hover { background: var(--surface); color: var(--text); }

/* Token reveal box */
.reveal {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-0);
  border: 1px solid var(--brand-accent);
  border-radius: 10px;
  padding: 14px;
  word-break: break-all;
  color: var(--brand-cyan);
  line-height: 1.5;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.alert {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert .ico { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.alert-warn { background: var(--warn-bg); color: #f7c878; border: 1px solid rgba(245, 177, 61, 0.3); }
.alert-info { background: var(--info-bg); color: #8fe6ff; border: 1px solid rgba(0, 212, 255, 0.3); }
.alert-danger { background: var(--danger-bg); color: #ff9aa4; border: 1px solid rgba(255, 93, 108, 0.3); }

/* =========================== TOAST =========================== */
.toast-stack { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: 11px;
  padding: 13px 15px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toastIn 0.25s ease;
}
.toast.out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.toast .ico { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast .msg { line-height: 1.45; }
.toast.ok { border-left-color: var(--ok); } .toast.ok .ico { color: var(--ok); }
.toast.err { border-left-color: var(--danger); } .toast.err .ico { color: var(--danger); }
.toast.info { border-left-color: var(--brand-cyan); } .toast.info .ico { color: var(--brand-cyan); }

/* =========================== QR / DEVICE PAIRING =========================== */
.qr-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.qr-frame {
  aspect-ratio: 1;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  background: var(--bg-0);
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 18px;
}
.qr-frame img { width: 100%; height: 100%; border-radius: 12px; background: #fff; padding: 8px; }
.qr-frame .corner { position: absolute; width: 26px; height: 26px; border: 2.5px solid var(--brand-cyan); }
.qr-frame .corner.tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.qr-frame .corner.tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.qr-frame .corner.bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.qr-frame .corner.br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
.qr-placeholder { text-align: center; color: var(--text-mute); padding: 30px; }
.qr-placeholder .spinner { margin: 0 auto 14px; width: 28px; height: 28px; }
/* Pemilih metode hubungkan (QR vs kode pairing). */
.seg-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-1); flex-wrap: wrap; }
.seg-tab {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; cursor: pointer;
  padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  color: var(--text-mute); transition: background .12s, color .12s;
}
.seg-tab .ico { width: 16px; height: 16px; }
.seg-tab:hover { color: var(--text); }
.seg-tab.active { background: var(--accent-soft); color: var(--brand-accent); }
.pair-phone-row { display: flex; gap: 12px; margin-bottom: 4px; max-width: 420px; }
.pair-phone-row[hidden] { display: none; }
/* Kartu kode pairing di dalam frame. */
.pair-code-card { text-align: center; padding: 20px; }
.pair-code-lbl { color: var(--text-mute); font-size: 13px; margin: 0 0 12px; }
.pair-code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: clamp(26px, 6vw, 40px); font-weight: 700; letter-spacing: 6px;
  color: var(--brand-accent); margin-bottom: 14px; word-break: break-all;
}
.scanline { position: absolute; left: 18px; right: 18px; height: 2px; background: linear-gradient(90deg, transparent, var(--brand-cyan), transparent); animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { 0%,100% { top: 24px; } 50% { top: calc(100% - 24px); } }

.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 13px; align-items: flex-start; }
.steps .n { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--brand-cyan); display: grid; place-items: center; font-family: var(--font-mono); font-size: 13px; font-weight: 600; flex: none; }
.steps .tx { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.steps .tx b { color: var(--text); display: block; font-weight: 600; }

.connected-card { text-align: center; padding: 30px; }
.connected-card .ring { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%; background: var(--ok-bg); display: grid; place-items: center; color: var(--ok); }

/* =========================== MISC / LAYOUT HELPERS =========================== */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.muted-line { height: 1px; background: var(--line); margin: 4px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--text-mute); }
.kv dd { margin: 0; color: var(--text); text-align: right; font-family: var(--font-mono); font-size: 12.5px; }

.swatch-row { display: flex; align-items: center; gap: 12px; }
.swatch { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); flex: none; }
.color-input { width: 52px; height: 40px; padding: 3px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg-0); cursor: pointer; }

.brand-preview {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 22px;
  background: linear-gradient(160deg, var(--surface), var(--bg-1));
}

.result-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.result-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; border-radius: 9px; background: var(--bg-0); border: 1px solid var(--line); font-size: 13px; }
.result-item .mono { font-family: var(--font-mono); font-size: 12.5px; }

.stat-line { display: flex; gap: 18px; flex-wrap: wrap; }
.stat-line .s { display: flex; flex-direction: column; gap: 3px; }
.stat-line .s .v { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.stat-line .s .l { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.06em; }

/* Strip ringkas info paket di dashboard (kompak, 1 baris). */
.plan-strip { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.plan-strip .ps-item { display: flex; flex-direction: column; gap: 1px; }
.plan-strip .ps-l { font-size: 10.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.06em; }
.plan-strip .ps-v { font-size: 14px; font-weight: 600; color: var(--text); }
.plan-strip .ps-sep { width: 1px; align-self: stretch; background: var(--line); }
@media (max-width: 560px) { .plan-strip .ps-sep { display: none; } }

/* Kartu rekomendasi AI Insight (bahasa awam, menonjol). */
.reco-card { border: 1px solid var(--brand-accent); background: var(--accent-soft); }
/* Bagian grafik teknis yang bisa dibuka (disembunyikan default agar tak membingungkan awam). */
.ins-details { margin-top: 4px; }
.ins-details > summary { cursor: pointer; font-size: 13px; color: var(--text-mute); padding: 8px 2px; list-style: revert; user-select: none; }
.ins-details > summary:hover { color: var(--text); }
.ins-details[open] > summary { margin-bottom: 8px; }

/* Sorot sementara saat deep-link #page?focus=elemId. */
.focus-flash { animation: focusFlash 1.7s ease-out; border-radius: 12px; }
@keyframes focusFlash {
  0% { box-shadow: 0 0 0 0 var(--brand-accent); }
  18% { box-shadow: 0 0 0 3px var(--brand-accent); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

.queue-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.queue-cell { background: var(--bg-0); border: 1px solid var(--line); border-radius: 11px; padding: 14px; text-align: center; }
.queue-cell .v { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.queue-cell .l { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }

.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.shortcut {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border-radius: var(--radius);
  background: var(--bg-0); border: 1px solid var(--line);
  cursor: pointer; transition: border-color 0.15s, transform 0.1s, background 0.15s;
}
.shortcut:hover { border-color: var(--line-strong); background: var(--surface); transform: translateY(-2px); }
.shortcut .ico-box { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--brand-cyan); display: grid; place-items: center; flex: none; }
.shortcut .tx b { display: block; font-size: 13.5px; }
.shortcut .tx span { font-size: 11.5px; color: var(--text-mute); }

/* =========================== RESPONSIVE =========================== */
@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .queue-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 920px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .qr-stage { grid-template-columns: 1fr; }
}
/* Mode inbox maksimal (DESKTOP): sidebar collapse agar inbox full-width.
   Klik hamburger -> sidebar tampil sebagai KOLOM yang mendorong konten (bukan
   menimpa). Klik lagi -> collapse. */
@media (min-width: 861px) {
  body.inbox-max .app { grid-template-columns: 1fr; }
  body.inbox-max .sidebar { display: none; }
  body.inbox-max .menu-toggle { display: flex; }
  body.inbox-max.nav-pushed .app { grid-template-columns: var(--sidebar-w) 1fr; }
  body.inbox-max.nav-pushed .sidebar { display: flex; }
  body.inbox-max .inbox-shell { height: calc(100vh - 116px); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .menu-toggle { display: flex; }
  .sidebar {
    position: fixed;
    z-index: 90;
    left: 0; top: 0;
    width: min(300px, 84vw);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 85; background: rgba(3,9,18,0.6); backdrop-filter: blur(2px); }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .cols-4 { grid-template-columns: 1fr; }
  .queue-grid { grid-template-columns: repeat(2, 1fr); }
  .page, .topbar { padding-left: 16px; padding-right: 16px; }
  .toast-stack { left: 14px; right: 14px; max-width: none; bottom: 14px; }
}

/* ===== Inbox (chat 2 panel) ===== */
/* Inbox maksimal: isi hampir seluruh tinggi layar (alat dipakai seharian). */
.inbox-page { display: flex; flex-direction: column; min-height: 0; }
.inbox-shell {
  --inbox-head-h: 58px; /* tinggi bar atas kedua kolom — disamakan agar presisi */
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 132px);
  min-height: 460px;
  overflow: hidden;
}
.inbox-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  min-height: 0;
  min-width: 0; /* cegah string panjang melebarkan track grid (snippet/URL) */
  background: var(--surface);
}
.inbox-list-head { display: flex; flex-direction: column; }
/* Bar atas kiri & kanan dibuat SAMA tinggi agar garis pemisah lurus (presisi). */
.inbox-list-topbar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--inbox-head-h); box-sizing: border-box;
  padding: 0 14px; border-bottom: 1px solid var(--line);
}
.inbox-list-tools {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.inbox-list-toolbar { display: flex; align-items: center; justify-content: space-between; }
.inbox-list-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; }
.inbox-list-title svg { width: 17px; height: 17px; color: var(--brand-accent); }
.inbox-filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.inbox-filters::-webkit-scrollbar { display: none; }
.inbox-chip {
  flex: 0 0 auto; padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 500;
  background: transparent; border: 1px solid var(--line); color: var(--text-dim);
  cursor: pointer; white-space: nowrap; transition: background .12s, color .12s, border-color .12s;
}
.inbox-chip:hover { border-color: var(--line-strong); color: var(--text); }
.inbox-chip.is-active { background: var(--accent-soft); border-color: var(--brand-accent); color: var(--brand-accent); font-weight: 600; }
.inbox-convos { flex: 1; overflow-y: auto; min-height: 0; }
.inbox-convo {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  color: var(--text);
  transition: background .12s ease;
}
.inbox-convo:hover { background: var(--surface-2); }
.inbox-convo.active { background: var(--accent-soft); }
.inbox-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--brand-accent);
  background: var(--accent-soft);
}
/* Foto profil WA (avatar) — isi penuh lingkaran bila ada. */
.inbox-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.inbox-avatar.has-img { background: transparent; }
/* Ikon perangkat lawan bicara (HP/laptop) di header. */
.inbox-peer-device .inbox-pd { display: inline-flex; align-items: center; margin-left: 7px; vertical-align: -2px; color: var(--brand-accent); }
.inbox-peer-device .inbox-pd svg { width: 14px; height: 14px; }
.inbox-convo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.inbox-convo-top, .inbox-convo-bottom { display: flex; align-items: center; gap: 8px; }
.inbox-convo-name {
  flex: 1; min-width: 0; font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inbox-convo-time { flex: 0 0 auto; font-size: 11px; color: var(--text-mute); }
.inbox-convo-snippet {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Penanda "sedang dilayani oleh CS X" (agen terakhir membalas). */
.inbox-convo-agent {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 3px;
  align-self: flex-start; max-width: 100%;
  padding: 1px 7px 1px 5px; border-radius: 99px;
  background: var(--accent-soft); color: var(--brand-accent);
  font-size: 10.5px; font-weight: 600;
}
.inbox-convo-agent svg { width: 11px; height: 11px; flex: 0 0 auto; }
.inbox-convo-agent span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-unread {
  flex: 0 0 auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--brand-accent); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}

.inbox-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-0); }
.inbox-empty { display: grid; place-items: center; height: 100%; }
.inbox-thread-head {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--inbox-head-h); box-sizing: border-box;
  padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.inbox-thread-peer { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.inbox-thread-peer strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-thread-peer span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-head-actions { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }
.inbox-back { display: none; }

/* Bar status/penugasan/label percakapan (Multi-CS helpdesk). */
.inbox-state-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.inbox-state-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
.inbox-state-field.inbox-state-labels { flex: 1; min-width: 140px; }
.inbox-state-lbl { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; }
.select-sm, .input-sm { font-size: 12.5px; padding: 4px 8px; height: auto; }
.inbox-state-labels .input-sm { width: 100%; }
/* Banner "sedang ditangani agen lain" (supervisor / ambil alih). */
.inbox-assign-note {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; font-size: 12.5px; color: var(--text);
  background: var(--warn-soft, rgba(234, 179, 8, 0.12));
  border-bottom: 1px solid var(--line);
}
.inbox-assign-note svg { flex: none; width: 16px; height: 16px; opacity: 0.8; }

/* Pilihan akses device per-agen (Tim CS). */
.radioline { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; cursor: pointer; }
.agdev-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.agdev-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* Area pesan dengan "wallpaper" halus ala WhatsApp (titik lembut di atas warna dasar). */
.inbox-bubbles {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 16px 7%; display: flex; flex-direction: column; gap: 4px;
  /* Dasar (tema gelap). */
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 24px 24px;
}
:root[data-theme="light"] .inbox-bubbles {
  background-color: #ece7df; /* warm neutral familiar ala WhatsApp */
  background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
}
.inbox-bubble-row { display: flex; margin: 1px 0; }
.inbox-bubble-row.in { justify-content: flex-start; }
.inbox-bubble-row.out { justify-content: flex-end; }
.inbox-bubble {
  position: relative;
  max-width: min(75%, 500px);
  padding: 6px 9px 7px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
}
/* Warna gelembung — ala WhatsApp (masuk = polos, keluar = hijau). */
.inbox-bubble-row.in .inbox-bubble { background: #1f2c33; color: #e9edef; border-top-left-radius: 0; }
.inbox-bubble-row.out .inbox-bubble { background: #005c4b; color: #e9edef; border-top-right-radius: 0; }
:root[data-theme="light"] .inbox-bubble-row.in .inbox-bubble { background: #ffffff; color: #111b21; border-top-left-radius: 0; }
:root[data-theme="light"] .inbox-bubble-row.out .inbox-bubble { background: #d9fdd3; color: #111b21; border-top-right-radius: 0; }
/* Ekor gelembung (tail) di pojok atas — seperti WhatsApp. */
.inbox-bubble-row.in .inbox-bubble::before {
  content: ''; position: absolute; top: 0; left: -8px;
  border-top: 8px solid #1f2c33; border-left: 8px solid transparent;
}
.inbox-bubble-row.out .inbox-bubble::before {
  content: ''; position: absolute; top: 0; right: -8px;
  border-top: 8px solid #005c4b; border-right: 8px solid transparent;
}
:root[data-theme="light"] .inbox-bubble-row.in .inbox-bubble::before { border-top-color: #ffffff; }
:root[data-theme="light"] .inbox-bubble-row.out .inbox-bubble::before { border-top-color: #d9fdd3; }
.inbox-bubble-text { white-space: pre-wrap; word-break: break-word; }
/* Pemisah tanggal (pill di tengah). */
.inbox-day { display: flex; justify-content: center; margin: 10px 0 8px; }
.inbox-day span {
  background: var(--surface); color: var(--text-dim);
  font-size: 11.5px; padding: 5px 13px; border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
/* Tombol "ke pesan terbaru" (scroll ke bawah). */
.inbox-bubbles-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.inbox-scroll-down {
  position: absolute; right: 18px; bottom: 16px; z-index: 5;
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--surface); color: var(--text-dim);
  box-shadow: 0 2px 10px rgba(0,0,0,0.22);
  display: inline-flex; align-items: center; justify-content: center;
}
.inbox-scroll-down[hidden] { display: none; }
.inbox-scroll-down .ico { width: 20px; height: 20px; }
.inbox-scroll-down:hover { color: var(--brand-accent); }
/* Bubble kutipan (native WA reply) di dalam pesan. */
.inbox-quote {
  display: flex; flex-direction: column; gap: 1px;
  border-left: 3px solid var(--brand-cyan);
  background: rgba(0,0,0,.20); border-radius: 6px;
  padding: 4px 8px; margin-bottom: 5px; max-width: 100%;
}
:root[data-theme="light"] .inbox-quote { background: rgba(0,0,0,.05); }
.inbox-quote-who { font-size: 11px; font-weight: 600; color: var(--brand-cyan); }
:root[data-theme="light"] .inbox-quote-who { color: var(--brand-accent); }
.inbox-quote-text {
  font-size: 12.5px; color: inherit; opacity: .75;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
/* Label "Diteruskan" (forward) di dalam bubble. */
.inbox-fwd-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-style: italic; color: inherit; opacity: .7;
  margin-bottom: 3px;
}
.inbox-fwd-tag .ico { width: 13px; height: 13px; }
/* Aksi per bubble (balas / teruskan) — tersembunyi sampai hover. */
.inbox-bubble-actions {
  position: absolute; top: 2px; display: flex; gap: 4px;
  opacity: 0; transition: opacity .12s;
}
.inbox-bubble-row.in .inbox-bubble-actions { right: -34px; flex-direction: column; }
.inbox-bubble-row.out .inbox-bubble-actions { left: -34px; flex-direction: column; }
.inbox-bubble-act {
  border: none; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); color: var(--text-mute);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .12s; padding: 0;
}
.inbox-bubble-act .ico { width: 14px; height: 14px; }
.inbox-bubble:hover .inbox-bubble-actions { opacity: 1; }
.inbox-bubble-act:hover { color: var(--brand-accent); }
/* Perangkat sentuh (tanpa hover): aksi selalu tampak agar bisa dipakai. */
@media (hover: none) { .inbox-bubble-actions { opacity: .65; } }
/* Chip reaksi emoji di tepi bawah bubble (ala WhatsApp). */
.inbox-bubble.has-reaction { margin-bottom: 12px; }
.inbox-reaction {
  position: absolute; bottom: -11px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 0 5px; font-size: 12.5px; line-height: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18); white-space: nowrap;
}
.inbox-bubble-row.in .inbox-reaction { left: 6px; }
.inbox-bubble-row.out .inbox-reaction { right: 6px; }
/* Popover pemilih emoji reaksi. */
.inbox-react-pop {
  position: absolute; z-index: 1000; display: flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 4px 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.28);
}
.inbox-react-emo {
  border: none; background: none; cursor: pointer; font-size: 20px; line-height: 1;
  padding: 4px; border-radius: 50%; transition: transform .1s ease, background .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.inbox-react-emo:hover { transform: scale(1.25); background: var(--accent-soft); }
.inbox-react-clear, .inbox-react-more { color: var(--text-mute); }
.inbox-react-clear .ico, .inbox-react-more .ico { width: 16px; height: 16px; }
/* Mode grid (emoji lengkap). */
.inbox-react-pop.is-grid { border-radius: 14px; padding: 8px; }
.inbox-react-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px;
  width: 268px; max-height: 200px; overflow-y: auto;
}
.inbox-react-grid .inbox-react-emo { font-size: 19px; padding: 5px; }
/* Modal Teruskan (forward). */
.fwd-search, .fwd-manual { margin-bottom: 10px; }
.fwd-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.fwd-item {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
}
.fwd-item:last-child { border-bottom: none; }
.fwd-item:hover { background: var(--accent-soft); }
.fwd-item .fwd-cb { width: 17px; height: 17px; accent-color: var(--brand-accent); flex-shrink: 0; }
.fwd-ava {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--brand-accent); font-weight: 700; font-size: 14px;
}
.fwd-meta { display: flex; flex-direction: column; min-width: 0; }
.fwd-name { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fwd-peer { font-size: 11.5px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Bar "membalas" di atas composer. */
.inbox-reply-preview {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-bottom: 8px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-left: 3px solid var(--brand-accent); border-radius: 10px;
}
.inbox-reply-preview[hidden] { display: none; }
.inbox-reply-preview-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.inbox-reply-preview .inbox-quote-who { font-size: 11.5px; }
/* Nama pengirim per bubble pada thread grup (siapa yang bicara). */
.inbox-bubble-sender {
  font-size: 11.5px; font-weight: 600; color: var(--brand-accent);
  margin-bottom: 2px; word-break: break-word;
}
/* Meta di dalam gelembung: jam + centang (ala WhatsApp), rapat di kanan-bawah. */
.inbox-bubble-meta {
  margin-top: 1px; font-size: 11px; line-height: 1;
  display: flex; align-items: center; gap: 4px; justify-content: flex-end;
  float: right; margin-left: 10px; position: relative; top: 4px;
  color: rgba(233,237,239,0.6);
}
:root[data-theme="light"] .inbox-bubble-meta { color: rgba(17,27,33,0.45); }
/* Bila ada teks, sisakan ruang agar jam tak menabrak kalimat terakhir. */
.inbox-bubble.has-text .inbox-bubble-text { display: inline; }
.inbox-bubble-meta .ibm-extra { font-style: italic; opacity: 0.9; white-space: nowrap; }
.inbox-bubble-meta .ibm-time { white-space: nowrap; }
.wa-tk { display: inline-flex; align-items: center; }
.wa-tk svg { width: 16px; height: 11px; }
.wa-tk-read { color: #53bdeb; } /* centang biru = dibaca */
.wa-tk-fail { color: var(--danger); font-weight: 700; font-style: normal; }
.inbox-media-img img, .inbox-media-vid {
  max-width: 260px; max-height: 280px; border-radius: 10px; display: block;
}
.inbox-media-aud { max-width: 240px; }
.inbox-media-img { display: block; margin-bottom: 4px; }
.inbox-media-vid { margin-bottom: 4px; }
.inbox-media-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  background: var(--surface-3); color: var(--text-dim);
  font-size: 13px; margin-bottom: 4px;
}
.inbox-media-card .inbox-media-ic { color: var(--brand-accent); display: inline-flex; }
.inbox-media-fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.inbox-reply { border-top: 1px solid var(--line); padding: 10px 12px; background: var(--surface); }
.inbox-reply-controls { display: flex; align-items: flex-end; gap: 8px; }
.inbox-emoji-panel { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-1); max-height: 140px; overflow-y: auto; }
.inbox-emoji-panel[hidden] { display: none; }
.inbox-emoji-panel .emoji-pick { border: none; background: none; cursor: pointer; font-size: 20px; line-height: 1; padding: 5px; border-radius: 8px; transition: background .12s; }
.inbox-emoji-panel .emoji-pick:hover { background: var(--accent-soft); }
.inbox-tpl-panel { padding: 6px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-1); max-height: 200px; overflow-y: auto; }
.inbox-tpl-panel[hidden] { display: none; }
.inbox-tpl-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 7px 10px; border: none; background: none; border-radius: 8px; cursor: pointer; transition: background .12s; }
.inbox-tpl-item:hover { background: var(--accent-soft); }
.inbox-tpl-name { font-size: 13px; font-weight: 600; color: var(--text); }
.inbox-tpl-body { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.inbox-gif-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-dim); cursor: pointer; }
/* Umpan balik voucher di modal langganan. */
.voucher-ok { margin-top: 6px; padding: 9px 12px; border-radius: 9px; font-size: 12.5px; line-height: 1.6; background: var(--ok-bg); border: 1px solid var(--ok); color: var(--text); }
.voucher-ok .vo-old { text-decoration: line-through; color: var(--text-mute); }
.voucher-ok .vo-new { color: var(--ok); font-size: 14px; }
.voucher-bad { margin-top: 6px; padding: 9px 12px; border-radius: 9px; font-size: 12.5px; background: var(--danger-bg); border: 1px solid var(--danger); color: var(--text); }
/* Kartu kontak "Butuh Bantuan" di FAQ. */
.help-contact { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; border-left: 3px solid var(--brand-accent); }
.help-contact-txt { display: flex; flex-direction: column; gap: 2px; }
.help-contact-txt b { display: inline-flex; align-items: center; gap: 6px; }
.help-contact-txt span { font-size: 12.5px; color: var(--text-mute); }
.help-contact-btns { display: flex; gap: 8px; }
.inbox-reply-input { flex: 1; resize: none; max-height: 120px; min-height: 40px; margin: 0; }
.inbox-attach-row { margin-bottom: 8px; }
.inbox-attach-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 9px; border-radius: 8px; background: var(--surface-3);
  font-size: 12.5px; color: var(--text);
}
.inbox-attach-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Pratinjau media (gambar/video) ala WhatsApp Web */
.inbox-attach-preview {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  max-width: 100%;
}
.inbox-attach-thumb {
  width: 96px; height: 96px; border-radius: 9px; object-fit: cover; flex: none;
  background: var(--surface-3); border: 1px solid var(--line);
}
.inbox-attach-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 22px; }
.inbox-attach-x {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
  border: none; cursor: pointer; display: grid; place-items: center;
  background: var(--danger); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.inbox-attach-x svg { width: 13px; height: 13px; }
.inbox-attach-chip .inbox-attach-x { position: static; width: 22px; height: 22px; }
.inbox-reply label.btn-icon { cursor: pointer; flex: 0 0 auto; }
.inbox-reply label.btn-icon input { display: none; }

@media (max-width: 760px) {
  .inbox-shell { grid-template-columns: 1fr; height: calc(100vh - 120px); }
  .inbox-thread { display: none; }
  .inbox-shell.show-thread .inbox-list { display: none; }
  .inbox-shell.show-thread .inbox-thread { display: flex; }
  .inbox-back { display: inline-flex; }
  /* Hemat ruang header thread di HP: tombol aksi jadi ikon saja. */
  .inbox-head-actions .btn-text { display: none; }
  .inbox-head-actions .btn { padding: 7px; }
  .inbox-thread-head { padding: 10px 12px; gap: 8px; }
  /* Saat thread terbuka di HP, sembunyikan judul app & sidebar agar fokus chat. */
  body.inbox-thread-open .topbar,
  body.inbox-thread-open .sidebar { display: none; }
  body.inbox-thread-open .inbox-shell { height: calc(100vh - 24px); }
}

/* ===================== Batch AI ===================== */
/* Tombol "Buat dengan AI" di composer (var-chips). */
.chip-btn.chip-ai { border-color: var(--brand-accent); color: var(--brand-accent); font-weight: 600; }
.chip-btn.chip-ai:hover { background: var(--brand-accent); color: #fff; }

/* Panel generator AI di dalam composer. */
.ai-gen-panel { margin: 0 0 10px; }
.ai-gen-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.ai-draft-text { white-space: pre-wrap; line-height: 1.5; font-size: 13.5px; }
.ai-metrics { margin-top: 10px; display: grid; gap: 6px; }
.ai-metric { display: grid; grid-template-columns: 140px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.ai-metric .ai-bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.ai-metric .ai-bar i { display: block; height: 100%; background: var(--brand-accent); border-radius: 99px; }
.ai-metric b { text-align: right; color: var(--text); }
.ai-suggest { margin-top: 10px; font-size: 12.5px; color: var(--text-dim); }
.ai-suggest ul { margin: 4px 0 0; padding-left: 18px; }
.ai-suggest li { margin: 2px 0; }

/* Halaman AI: opsi koneksi managed/BYOK. */
.ai-conn-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.ai-opt:hover { border-color: var(--line-strong); }
.ai-opt input { margin-top: 3px; accent-color: var(--brand-accent); }
.ai-opt:has(input:checked) { border-color: var(--brand-accent); background: color-mix(in srgb, var(--brand-accent) 8%, transparent); }
@media (max-width: 640px) { .ai-conn-opts { grid-template-columns: 1fr; } }
.ai-managed-note { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px; background: var(--accent-soft); }
.ai-managed-note .ico-box { width: 36px; height: 36px; border-radius: 10px; background: var(--bg-1);
  color: var(--brand-cyan); display: grid; place-items: center; flex: none; }
/* Kartu paket (Langganan): hover terasa "hidup". */
.pick-card { transition: border-color .15s, box-shadow .15s, transform .12s; cursor: pointer; }
.pick-card:hover { border-color: var(--brand-accent); box-shadow: 0 8px 24px rgba(31,111,235,0.16); transform: translateY(-3px); }

.addon-card { position: relative; transition: border-color .15s, box-shadow .15s, transform .12s; }
.addon-card:hover { border-color: var(--brand-accent); box-shadow: 0 6px 20px rgba(31,111,235,0.18); transform: translateY(-2px); }
.addon-card.is-featured { border-color: var(--brand-accent); box-shadow: 0 0 0 1px var(--brand-accent) inset; }
.addon-card.is-featured:hover { box-shadow: 0 0 0 1px var(--brand-accent) inset, 0 6px 20px rgba(31,111,235,0.22); }
.addon-badge { position: absolute; top: -10px; right: 12px; font-size: 11px; font-weight: 600;
  background: var(--brand-accent); color: #fff; padding: 2px 8px; border-radius: 999px; }
/* Tag tipe add-on — pill kecil, kalem (tidak menyolok). */
.addon-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-mute); }
.addon-tag-ai  { color: var(--brand-accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--brand-accent) 22%, transparent); }
.addon-tag-cap { color: var(--text-mute); background: var(--surface-2); border-color: var(--line); }
/* Ikon emoji per paket add-on */
.addon-ico { flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  font-size: 23px; line-height: 1; background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--brand-accent) 16%, transparent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- Onboarding "Mulai Cepat" (Item 2) ---------- */
.onb-card { border: 1px solid var(--line-strong); background: linear-gradient(160deg, color-mix(in srgb, var(--brand-accent) 6%, var(--surface)), var(--surface)); }
.onb-card .card-title { display: inline-flex; align-items: center; gap: 8px; }
.onb-card .card-title svg { width: 18px; height: 18px; color: var(--brand-accent); }
.onb-steps { display: flex; flex-direction: column; gap: 10px; }
.onb-step { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); transition: border-color .15s, background .15s; }
.onb-step.is-done { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-bg); }
.onb-check { flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-dim); border: 1px solid var(--line); }
.onb-step.is-done .onb-check { background: var(--ok); color: #fff; border-color: var(--ok); }
.onb-check svg { width: 16px; height: 16px; }
.onb-check .onb-num { font-size: 13px; font-weight: 700; }
.onb-tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.onb-tx b { font-size: 14px; color: var(--text); }
.onb-tx span { font-size: 12.5px; color: var(--text-dim); }
.onb-act { flex: none; }
@media (max-width: 560px) { .onb-step { flex-wrap: wrap; } .onb-act { width: 100%; } .onb-act .btn { width: 100%; justify-content: center; } }

/* Tombol bantuan "?" kecil di page-head tiap halaman. */
.page-help { flex: none; width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-dim); transition: border-color .15s, color .15s, background .15s; }
.page-help:hover { border-color: var(--brand-accent); color: var(--brand-accent); background: var(--accent-soft); }
.page-help svg { width: 16px; height: 16px; }
/* Sisipkan tombol "?" di samping judul tanpa mengganggu layout existing. */
.page-head .titles h2 { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===== Bantuan / Tiket Support ===== */
.ticket-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 13px 16px; background: transparent; border: none;
  border-bottom: 1px solid var(--line); cursor: pointer; color: var(--text);
  transition: background .12s;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row:hover { background: var(--surface-2); }
.ticket-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ticket-top { display: flex; align-items: center; gap: 8px; }
.ticket-subj { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-sub { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-time { flex: 0 0 auto; font-size: 11.5px; color: var(--text-mute); }
/* Detail tiket (modal). */
.tk-head { font-size: 15px; margin-bottom: 10px; }
.tk-status-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tk-thread { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px; }
.tk-msg { display: flex; }
.tk-msg.mine { justify-content: flex-end; }
.tk-bubble { max-width: 80%; padding: 8px 11px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.tk-msg.mine .tk-bubble { background: var(--accent-soft); }
.tk-who { font-size: 11px; font-weight: 700; color: var(--brand-accent); margin-bottom: 2px; }
.tk-body { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.tk-time { font-size: 10.5px; color: var(--text-mute); margin-top: 3px; text-align: right; }
.tk-reply { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.tk-reply textarea { flex: 1; }

/* Lampiran pada pesan tiket. */
.tk-att-img { display: inline-block; margin-top: 6px; }
.tk-att-img img { max-width: 200px; max-height: 200px; border-radius: 8px; display: block; }
.tk-att-file { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--brand-accent); }
.tk-att-file svg { width: 14px; height: 14px; }

/* ===== Leads (CRM) — ringkasan pipeline ===== */
.lead-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 700px) { .lead-summary { grid-template-columns: repeat(2, 1fr); } }
.lead-stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.lead-stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lead-stat-top b { font-size: 20px; }
.lead-stat-val { margin-top: 6px; font-size: 12.5px; color: var(--text-mute); }

/* ===== Analitik — mini charts ===== */
.an-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.an-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.an-bar > span { width: 100%; min-height: 2px; background: var(--brand-accent); border-radius: 3px 3px 0 0; transition: height .2s; }
.an-bar > em { font-size: 9px; color: var(--text-mute); height: 12px; font-style: normal; }
.an-week { display: flex; align-items: flex-end; gap: 10px; justify-content: space-around; }
.an-wcell { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.an-wcell > span { width: 26px; background: var(--brand-cyan); border-radius: 4px 4px 0 0; }
.an-wcell > em { font-size: 11px; color: var(--text-mute); font-style: normal; }
.an-wcell > b { font-size: 11px; }

/* ===== Kapasitas Server (admin) ===== */
.cap-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.cap-row-top { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; margin-bottom: 7px; }
.cap-row-top b { font-size: 16px; }
.cap-track { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.cap-track > span { display: block; height: 100%; border-radius: 6px; }
.cap-track .cap-ok { background: var(--brand-accent); }
.cap-track .cap-warn { background: #e0a93b; }
.cap-track .cap-bad { background: var(--danger); }
.cap-cur td { background: var(--accent-soft); }

/* ---------- Dashboard Bisnis (admin/owner) ---------- */
/* Distribusi/paket favorit — bar tipis */
.dist-row { margin-bottom: 12px; }
.dist-row:last-child { margin-bottom: 0; }
.dist-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 5px; }
.dist-track { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.dist-track > span { display: block; height: 100%; border-radius: 6px; background: var(--brand-accent); }
/* Status layanan — pill dengan titik lampu */
.svc-pill { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.svc-pill:last-child { border-bottom: 0; }
.svc-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.svc-dot.on  { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.svc-dot.off { background: var(--text-mute); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-mute) 18%, transparent); }
.metric.metric-alert { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
/* Segmented toggle (sort) */
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-1); }
.seg button { border: 0; background: transparent; color: var(--text-mute); font-size: 12.5px; font-weight: 500;
  padding: 5px 11px; border-radius: 7px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.is-active { background: var(--accent-soft); color: var(--brand-accent); font-weight: 600; }
/* Mini bar chart tren 6 bulan */
.trend-chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 16px; }
.tb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.tb-val { font-size: 10.5px; color: var(--text-mute); font-weight: 600; height: 13px; line-height: 13px; }
.tb-bar { width: 100%; max-width: 34px; min-height: 2px; border-radius: 6px 6px 0 0;
  background: var(--brand-accent); transition: opacity .15s; }
.tb-bar-rev { background: var(--ok); }
.tb:hover .tb-bar { opacity: .8; }
.tb-lbl { font-size: 11px; color: var(--text-mute); }
