/* Bizuki dashboard. Same palette and font as bizuki.com. */
:root {
  --bg: #faf9fc;
  --card: #ffffff;
  --ink: #1e1b2e;
  --navy: #0f172a;
  --muted: #5b6070;
  --faint: #8a8fa0;
  --border: #e5e7eb;
  --border-strong: #d4d7de;
  --indigo: #4f46e5;
  --indigo-ink: #4338ca;
  --indigo-tint: #eef0ff;
  --violet: #7c3aed;
  --lavender: #ede9fe;
  --grad: linear-gradient(135deg, var(--indigo), var(--violet));
  --green: #047857;
  --green-tint: #e7f8f1;
  --amber: #b45309;
  --amber-tint: #fef3e2;
  --red: #b91c1c;
  --red-tint: #fdecec;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(79, 70, 229, 0.06);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.18);
  --sidebar-w: 248px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--indigo-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--navy); }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 13px; }
:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.45); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; color: var(--navy); letter-spacing: -0.03em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 16px; }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar .brand { padding: 4px 10px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 14.5px;
}
.nav a:hover { background: #f3f2f8; color: var(--navy); text-decoration: none; }
.nav a.active { background: var(--indigo-tint); color: var(--indigo-ink); }
.nav a svg { flex: none; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.mini-meter { padding: 10px 12px; border-radius: 10px; background: #f7f6fb; }
.mini-meter .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.mini-meter .row strong { color: var(--navy); }
.mini-meter .bar { margin-top: 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.user-chip .who .name { font-weight: 700; color: var(--navy); }

.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 32px 36px 64px; max-width: 1180px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin-top: 6px; color: var(--muted); }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px;
  background: var(--amber-tint); color: #7c3a06; border: 1px solid #f6d9ae;
}
.banner.info { background: var(--indigo-tint); color: var(--indigo-ink); border-color: #d7dafe; }
.banner.success { background: var(--green-tint); color: var(--green); border-color: #bfe8d7; }
.banner.error { background: var(--red-tint); color: var(--red); border-color: #f5c6c6; }
.banner .grow { flex: 1; min-width: 200px; }

/* ---------- Cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-body { padding: 22px; }
.stack { display: grid; gap: 20px; }
.stack-sm { display: grid; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-editor { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; margin-top: 4px; }
.stat .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.bar { height: 8px; border-radius: 99px; background: #eceaf4; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width 0.6s var(--ease); }
.bar.low > span { background: linear-gradient(135deg, #f59e0b, #dc2626); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25); }
.btn-primary:hover { background: var(--indigo-ink); }
.btn-grad { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--indigo); color: var(--indigo-ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f0f7; color: var(--navy); }
.btn-danger { background: #fff; color: var(--red); border-color: #f1c4c4; }
.btn-danger:hover { background: var(--red-tint); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border-width: 2px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-size: 13.5px; font-weight: 700; color: var(--navy); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .error { font-size: 12.5px; color: var(--red); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ink);
  background: #fff; border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12); }
.field.has-error .input, .field.has-error .textarea, .field.has-error .select { border-color: #e48b8b; }
.input-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 44px; height: 40px; border: 1px solid var(--border-strong); border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--indigo); }
.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--indigo-ink); cursor: pointer; padding: 6px 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

.segmented { display: inline-flex; padding: 4px; background: #efedf6; border-radius: 12px; gap: 2px; }
.segmented button { border: 0; background: transparent; font: inherit; font-weight: 700; font-size: 13.5px; color: var(--muted); padding: 7px 14px; border-radius: 9px; cursor: pointer; }
.segmented button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }

.faq-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fcfcfe; }
.faq-item .stack-sm { gap: 8px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #f1f0f6; color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-tint); color: var(--green); }
.badge.amber { background: var(--amber-tint); color: var(--amber); }
.badge.red { background: var(--red-tint); color: var(--red); }
.badge.indigo { background: var(--indigo-tint); color: var(--indigo-ink); }

/* ---------- Tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); padding: 12px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #faf9ff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 700; color: var(--navy); }
.cell-sub { font-size: 13px; color: var(--muted); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; }

.agent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.agent-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; color: inherit; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.agent-card:hover { text-decoration: none; border-color: #c9ccfb; transform: translateY(-2px); box-shadow: 0 12px 30px rgba(79, 70, 229, 0.12); }
.agent-card .top { display: flex; gap: 12px; align-items: center; }
.agent-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.agent-card .meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; }

.empty { text-align: center; padding: 48px 24px; display: grid; justify-items: center; gap: 10px; }
.empty .empty-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--indigo-tint); color: var(--indigo); display: grid; place-items: center; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 420px; }
.empty .btn { margin-top: 8px; }

/* ---------- Plans ---------- */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.plan { position: relative; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.plan.current { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12), var(--shadow); background: linear-gradient(180deg, #f7f6ff 0%, #fff 60%); }
.plan.current::before { content: "Your plan"; position: absolute; top: -11px; left: 22px; background: var(--navy); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.plan.current .btn[disabled] { opacity: 1; background: #eceaf4; border-color: transparent; color: var(--muted); box-shadow: none; }
.plan.popular::before { content: "Most popular"; position: absolute; top: -11px; left: 22px; background: var(--grad); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.plan .price { font-size: 34px; font-weight: 800; color: var(--navy); letter-spacing: -0.03em; }
.plan .price small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.plan li { display: flex; gap: 8px; align-items: flex-start; }
.plan li svg { color: var(--green); flex: none; margin-top: 2px; }
.plan .btn { margin-top: auto; }
.topups { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

/* ---------- Code / copy ---------- */
.code-box { position: relative; background: var(--navy); color: #e2e8f0; border-radius: 12px; padding: 16px 16px 16px 16px; font-family: var(--mono); font-size: 13px; line-height: 1.6; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.code-box + .row { margin-top: 10px; }
.key-reveal { background: var(--green-tint); border: 1px solid #bfe8d7; border-radius: 12px; padding: 14px; display: grid; gap: 8px; }

/* ---------- Chat preview & transcripts ---------- */
.chat-test { display: flex; flex-direction: column; height: 460px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; }
.chat-test .chat-head { padding: 12px 16px; color: #fff; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; background: #f8fafc; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 85%; padding: 9px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.bot { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble.me { color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; background: var(--indigo); }
.chat-test form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.transcript { display: flex; flex-direction: column; gap: 10px; }
.transcript-raw { white-space: pre-wrap; font-size: 14px; line-height: 1.7; background: #fafafe; border: 1px solid var(--border); border-radius: 12px; padding: 16px; max-height: 520px; overflow-y: auto; }

/* ---------- Detail lists ---------- */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; color: var(--navy); word-break: break-word; }

/* ---------- Phone number display ---------- */
.phone-big { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; color: var(--navy); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: radial-gradient(1200px 600px at -10% -20%, rgba(129, 140, 248, 0.35), transparent 60%), var(--navy);
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side .brand { color: #fff; }
.auth-side h2 { color: #fff; font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; max-width: 460px; }
.auth-side .points { display: grid; gap: 14px; margin-top: 28px; color: #cbd5e1; max-width: 440px; }
.auth-side .points div { display: flex; gap: 12px; align-items: flex-start; }
.auth-side .points svg { color: #a5b4fc; flex: none; margin-top: 3px; }
.auth-side .foot { color: #94a3b8; font-size: 13px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; display: grid; gap: 22px; }
.auth-card .head p { color: var(--muted); margin-top: 8px; }
.auth-card .alt { text-align: center; font-size: 14px; color: var(--muted); }
.auth-mobile-brand { display: none; }

/* ---------- Dialog, toast, spinner, skeleton ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 16px; box-shadow: var(--shadow-lg); width: min(520px, calc(100vw - 32px)); color: var(--ink); }
dialog.modal::backdrop { background: rgba(15, 23, 42, 0.45); }
.modal-body { padding: 24px; display: grid; gap: 14px; }
.modal-body p { color: var(--muted); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 0 24px 22px; }

.toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 10px; z-index: 1000; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600; max-width: 360px; animation: toast-in 0.25s var(--ease); display: flex; gap: 10px; align-items: center; }
.toast.error { background: #7f1d1d; }
.toast.success::before { content: "✓"; color: #6ee7b7; font-weight: 800; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.spin { width: 22px; height: 22px; border: 3px solid rgba(79, 70, 229, 0.18); border-top-color: var(--indigo); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
.btn-primary .spin, .btn-grad .spin { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 80px 0; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.skeleton { background: linear-gradient(90deg, #efeef5 0%, #f7f6fb 50%, #efeef5 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 700; font-size: 14px; color: var(--muted); padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--indigo-ink); border-bottom-color: var(--indigo); }

.pager { display: flex; justify-content: center; padding: 16px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .select { width: auto; min-width: 150px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plans { grid-template-columns: 1fr; max-width: 520px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform 0.25s var(--ease); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 40; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .content { padding: 22px 16px 56px; }
  .grid-2, .grid-3, .grid-editor { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-mobile-brand { display: block; }
  .input-row { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
  h1 { font-size: 22px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .toasts { left: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
