/* ═══════════════════════════════════════════════════════════════════
   SMS Pro — Design System v2 "Ambient Glass"
   Alexandria (display) + Vazirmatn (UI) · indigo brand · glass surfaces
   Light/Dark via semantic tokens · RTL-first via logical properties
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-soft: #EEF0FE;
  --on-primary: #FFFFFF;
  --brand-grad: linear-gradient(135deg, #4F46E5 0%, #7C3AED 60%, #9333EA 100%);
  --accent: #059669;
  --accent-soft: #EAFBF3;
  --danger: #DC2626;
  --danger-soft: #FDEFEF;
  --warning: #D97706;
  --warning-soft: #FEF7E8;

  --bg: #F6F7FB;
  --bg-glow-1: rgba(79, 70, 229, .07);
  --bg-glow-2: rgba(147, 51, 234, .05);
  --surface: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, .78);
  --surface-2: #F3F5FA;
  --border: #E7EAF3;
  --border-strong: #CDD4E4;

  --text: #101323;
  --text-2: #4B5268;
  --text-3: #9AA1B5;

  --sidebar-bg: linear-gradient(180deg, #0D1022 0%, #12152B 55%, #171233 100%);
  --sidebar-text: #8B92AD;
  --sidebar-active: #FFFFFF;
  --sidebar-active-bg: linear-gradient(135deg, rgba(99, 102, 241, .28), rgba(147, 51, 234, .18));

  --chart-sent: #4F46E5;
  --chart-failed: #DC2626;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(16, 19, 35, .04), 0 6px 24px rgba(16, 19, 35, .06);
  --shadow-lg: 0 12px 40px rgba(16, 19, 35, .14);
  --glow: 0 4px 20px rgba(79, 70, 229, .35);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Alexandria", "Vazirmatn", system-ui, sans-serif;
}

html.dark {
  --primary: #6366F1;
  --primary-hover: #818CF8;
  --primary-soft: rgba(99, 102, 241, .16);
  --brand-grad: linear-gradient(135deg, #6366F1 0%, #8B5CF6 60%, #A855F7 100%);
  --accent: #34D399;
  --accent-soft: rgba(52, 211, 153, .13);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, .13);
  --warning: #FBBF24;
  --warning-soft: rgba(251, 191, 36, .13);

  --bg: #0B0D16;
  --bg-glow-1: rgba(99, 102, 241, .13);
  --bg-glow-2: rgba(168, 85, 247, .09);
  --surface: #12152290;
  --surface-glass: rgba(18, 21, 34, .72);
  --surface-2: rgba(255, 255, 255, .045);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);

  --text: #E8EAF2;
  --text-2: #9CA3BA;
  --text-3: #5D6478;

  --sidebar-bg: linear-gradient(180deg, #090B14 0%, #0D0F1E 55%, #120D26 100%);
  --sidebar-text: #7C83A0;

  --chart-sent: #6366F1;
  --chart-failed: #EF4444;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  --glow: 0 4px 24px rgba(99, 102, 241, .45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100dvh;
  position: relative;
}
/* ambient glow field */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -8%, var(--bg-glow-1), transparent 62%),
    radial-gradient(800px 520px at 95% 100%, var(--bg-glow-2), transparent 60%);
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.35; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }

/* ── Layout ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: 250px; flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
  padding: 22px 14px 18px;
  overflow: hidden;
}
.sidebar::before {
  content: ""; position: absolute; inset-inline-start: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, .22), transparent 70%);
  pointer-events: none;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 26px 30px 90px; max-width: 1200px; width: 100%; margin: 0 auto; animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.brand {
  display: flex; align-items: center; gap: 11px;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.14rem;
  padding: 2px 10px 20px; letter-spacing: .2px; position: relative;
}
/* The mark now carries its own gradient badge (partials/logo.html), so the
   container only positions it and keeps the glow. A background here would
   stack a second badge behind the first. */
.brand .logo {
  width: 37px; height: 37px; border-radius: 12px;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(99, 102, 241, .5);
}
.brand .logo .brand-mark { width: 37px; height: 37px; display: block; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; position: relative; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border-radius: 12px;
  color: var(--sidebar-text); font-weight: 500; font-size: .94rem;
  transition: background .22s var(--ease), color .22s var(--ease), transform .22s var(--ease);
}
.nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav a:hover { color: #E4E7F5; background: rgba(148, 163, 184, .09); transform: translateX(2px); }
[dir="rtl"] .nav a:hover { transform: translateX(-2px); }
.nav a.active {
  color: var(--sidebar-active);
  background: var(--sidebar-active-bg);
  box-shadow: inset 0 0 0 1px rgba(139, 122, 246, .28), 0 4px 16px rgba(80, 60, 220, .25);
}
.nav a.active svg { color: #A5B4FC; }
.nav .sep { margin: 14px 13px 8px; font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: #4A5170; font-weight: 600; }

.sidebar-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid rgba(148, 163, 184, .12); position: relative; }
.sidebar-foot a { display: flex; align-items: center; gap: 12px; padding: 9px 13px; border-radius: 11px; color: var(--sidebar-text); font-size: .9rem; transition: background .2s, color .2s; }
.sidebar-foot a:hover { color: #E4E7F5; background: rgba(148, 163, 184, .09); }
.sidebar-foot svg { width: 18px; height: 18px; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 30px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar .page-title { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600;
  color: var(--text-2); cursor: pointer;
  transition: border-color .2s, color .2s, transform .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip:active { transform: scale(.97); }
.chip svg { width: 15px; height: 15px; }
.chip.balance { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 32%, transparent); background: var(--accent-soft); }
.avatar {
  width: 35px; height: 35px; border-radius: 999px;
  background: var(--brand-grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .88rem;
  box-shadow: 0 3px 10px rgba(99, 102, 241, .35);
}

/* ── Cards & grids ──────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; margin-bottom: 20px; }
.grid-stats .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.stat { display: flex; flex-direction: column; gap: 7px; position: relative; overflow: hidden; }
.stat .label { font-size: .8rem; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 9px; }
.stat .label svg {
  width: 31px; height: 31px; padding: 7px; border-radius: 10px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary);
}
.stat .value { font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.15; }
.stat .sub { font-size: .77rem; color: var(--text-3); }
.stat.tone-primary .label svg { background: var(--primary-soft); color: var(--primary); }
.stat.tone-green .label svg { background: var(--accent-soft); color: var(--accent); }
.stat.tone-red .label svg { background: var(--danger-soft); color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .92rem;
  padding: 10px 19px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; min-height: 44px;
  transition: background .2s, border-color .2s, transform .16s var(--ease), box-shadow .2s;
}
.btn:active { transform: scale(.965); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand-grad); color: var(--on-primary); box-shadow: var(--glow); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 26px rgba(99, 102, 241, .5); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--text-3); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.btn-sm { padding: 6px 13px; min-height: 34px; font-size: .84rem; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: none; }
.btn.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ──────────────────────────────────────────────── */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1.5px solid transparent;
  border-radius: 12px; padding: 10px 15px; min-height: 44px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:hover { border-color: var(--border-strong); }
.input:focus {
  outline: none; background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}
textarea.input { resize: vertical; line-height: 1.65; }
.hint { font-size: .78rem; color: var(--text-3); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th {
  text-align: start; font-size: .72rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-3); font-weight: 700; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap;
}
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .16s; }
.tbl tbody tr:hover { background: var(--surface-2); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .75rem; font-weight: 700; padding: 3px 11px; border-radius: 999px;
}
.badge svg { width: 12px; height: 12px; }
.badge-green { background: var(--accent-soft); color: var(--accent); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.badge-gray { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-blue { background: var(--primary-soft); color: var(--primary); }

/* ── Compose page ───────────────────────────────────────── */
.compose-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.sms-meter { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sms-meter .m {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px;
  transition: border-color .2s;
}
.sms-meter .m:hover { border-color: var(--border-strong); }
.sms-meter .m b { display: block; font-family: var(--font-display); font-size: 1.18rem; font-variant-numeric: tabular-nums; }
.sms-meter .m span { font-size: .73rem; color: var(--text-3); font-weight: 600; }
.cost-line {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary) 6%, transparent));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: var(--radius-sm);
  padding: 13px 15px; margin-top: 12px; font-weight: 700;
}
.cost-line .amount { font-family: var(--font-display); font-size: 1.3rem; color: var(--primary); font-variant-numeric: tabular-nums; }
.phone-preview {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 22px;
  padding: 16px; max-width: 300px; margin-inline: auto;
}
.phone-preview .bubble {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; border-start-start-radius: 5px;
  padding: 10px 14px; font-size: .9rem; white-space: pre-wrap; word-break: break-word;
  box-shadow: var(--shadow); min-height: 40px;
}
.phone-preview .meta { font-size: .72rem; color: var(--text-3); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }

/* ── Chart ──────────────────────────────────────────────── */
.chart-box { position: relative; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 30;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); border-radius: 10px; padding: 8px 13px;
  font-size: .8rem; display: none; white-space: nowrap;
}
.legend { display: flex; gap: 18px; font-size: .8rem; color: var(--text-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; }

/* ── Misc ───────────────────────────────────────────────── */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toast-stack { position: fixed; inset-block-start: 18px; inset-inline-end: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  border-inline-start: 4px solid var(--accent);
  box-shadow: var(--shadow-lg); border-radius: 12px; padding: 12px 18px;
  font-size: .9rem; font-weight: 500; animation: slidein .35s var(--ease);
}
.toast.err { border-inline-start-color: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty svg { width: 44px; height: 44px; margin-bottom: 10px; color: var(--border-strong); }
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: center; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-size: .85rem; font-weight: 600; color: var(--text-2); padding-inline: 8px;
}
.pagination .cur { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: var(--glow); }
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; width: fit-content; margin-bottom: 16px; }
.tabs button {
  font: inherit; font-weight: 600; font-size: .87rem; border: 0; background: none;
  padding: 8px 16px; border-radius: 9px; cursor: pointer; color: var(--text-2);
  transition: background .2s, color .2s;
}
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
html.dark .tabs button.on { background: rgba(255, 255, 255, .1); }
.tab-pane { display: none; }
.tab-pane.on { display: block; animation: rise .3s var(--ease); }
code.k {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 7px; font-size: .84rem; direction: ltr; display: inline-block;
}
pre.code {
  background: #0D1022; color: #A5B4FC; direction: ltr; text-align: left;
  border: 1px solid rgba(165, 180, 252, .15);
  border-radius: 12px; padding: 14px 18px; overflow-x: auto; font-size: .82rem; line-height: 1.7;
}
.mobile-nav { display: none; }

/* ── Login ──────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 20px;
  position: relative; overflow: hidden;
  background: var(--bg);
}
.auth-wrap::before, .auth-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px);
  animation: drift 14s ease-in-out infinite alternate;
}
.auth-wrap::before {
  width: 480px; height: 480px; inset-inline-start: -120px; top: -120px;
  background: radial-gradient(circle, rgba(99, 102, 241, .35), transparent 65%);
}
.auth-wrap::after {
  width: 520px; height: 520px; inset-inline-end: -140px; bottom: -160px;
  background: radial-gradient(circle, rgba(168, 85, 247, .28), transparent 65%);
  animation-delay: -7s;
}
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(40px, 30px) scale(1.12); } }
.auth-card { width: 100%; max-width: 402px; padding: 36px 32px; position: relative; z-index: 1; background: var(--surface-glass); }
.auth-card .brand { color: var(--text); padding: 0 0 8px; justify-content: center; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { padding: 16px 14px 110px; }
  .topbar { padding: 12px 14px; }
  .grid-2, .compose-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 10px; inset-inline: 10px; z-index: 50;
    background: var(--surface-glass);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom) / 2);
    justify-content: space-around;
    box-shadow: var(--shadow-lg);
  }
  .mobile-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: .65rem; font-weight: 600; color: var(--text-3);
    padding: 6px 10px; border-radius: 13px; min-width: 54px;
    transition: color .2s, background .2s;
  }
  .mobile-nav a svg { width: 21px; height: 21px; }
  .mobile-nav a.active { color: var(--primary); background: var(--primary-soft); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Bot menu map ──────────────────────────────────────────────────── */
/* A tree of menu options. Indentation uses logical padding so the map
   mirrors correctly in RTL, and the connector rail is drawn with a border
   rather than glyphs so it lines up at every level. */
.menu-map { margin-bottom: 4px; }

.menu-node { padding-inline-start: calc(var(--lvl, 0) * 22px); }

.menu-node.is-child > .menu-node-line {
  border-inline-start: 2px solid var(--border-strong);
  padding-inline-start: 12px;
}

.menu-node-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.menu-node-main { flex: 1; min-width: 0; }

.menu-node-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.menu-node-head strong { font-size: .93rem; }

/* The number the customer can type instead of tapping. */
.menu-num {
  flex: 0 0 auto;
  min-width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

/* Quoted body / reply text, kept LTR-neutral and wrapping on long answers. */
.menu-quote {
  font-size: .84rem;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: 3px;
  padding-inline-start: 8px;
  border-inline-start: 2px solid var(--border);
}

.menu-actions { flex: 0 0 auto; }
.menu-actions summary { list-style: none; cursor: pointer; }
.menu-actions summary::-webkit-details-marker { display: none; }

.menu-edit {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.menu-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 14px;
  font-size: .88rem;
}

/* An open editor needs the full row width, not the narrow action column. */
.menu-node-line:has(.menu-actions[open]) { flex-wrap: wrap; }
.menu-actions[open] { flex: 1 1 100%; }

/* ── Menu row actions ──────────────────────────────────────────────── */
/* Three equal icon buttons rather than mismatched text buttons, so the
   right-hand column stays a fixed width at every nesting level. */
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.menu-node-line:has(.menu-actions[open]) .row-actions { flex-wrap: wrap; }

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon-btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}
/* An open panel marks its trigger so it is obvious which row is being edited. */
details[open] > .icon-btn {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* ── JSON bulk editor ──────────────────────────────────────────────── */
.json-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}
.json-errors, .json-warnings {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: .85rem;
}
.json-errors { background: var(--danger-soft); color: var(--danger); }
.json-warnings { background: var(--warning-soft); color: var(--warning); }
.json-errors ul, .json-warnings ul { margin: 6px 0 0; padding-inline-start: 18px; }
.json-errors li, .json-warnings li { margin-bottom: 3px; overflow-wrap: anywhere; }

/* ── Working hours ─────────────────────────────────────────────────── */
.hours-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--surface-2);
}

.day-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* Checkbox styled as a chip: the native input stays focusable for keyboard
   and screen-reader users, it is just visually replaced by its label. */
.day-chip { cursor: pointer; }
.day-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.day-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  font-size: .84rem;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.day-chip input:checked + span {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}
.day-chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Public legal pages ────────────────────────────────────────────── */
.legal-wrap { max-width: 780px; margin: 0 auto; padding: 28px 18px 60px; }
.legal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.legal-head .brand { text-decoration: none; color: inherit; }
.legal-card { padding: 28px; }
.legal-card h1 { font-size: 1.5rem; margin: 0 0 4px; }
.legal-card h2 { font-size: 1.02rem; margin: 26px 0 8px; }
.legal-card p, .legal-card li { color: var(--text-2); line-height: 1.75; font-size: .92rem; }
.legal-card ul, .legal-card ol { padding-inline-start: 20px; margin: 8px 0; }
.legal-card li { margin-bottom: 6px; }
.legal-updated { font-size: .8rem; color: var(--text-3); margin: 0 0 18px; }
.legal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 22px;
  font-size: .84rem;
}
.legal-foot a { color: var(--text-3); text-decoration: none; }
.legal-foot a:hover { color: var(--primary); }

/* ── Public marketing site ─────────────────────────────────────────── */
body.site { background: var(--bg); }

.site-head {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  max-width: 1080px; margin: 0 auto; padding: 18px 20px;
}
.site-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  color: var(--text); text-decoration: none;
}
.site-nav { display: flex; align-items: center; gap: 16px; margin-inline-start: auto; flex-wrap: wrap; }
.site-nav a { color: var(--text-2); text-decoration: none; font-size: .9rem; }
.site-nav a:hover { color: var(--text); }
.site-nav .btn { text-decoration: none; }

/* Hero ------------------------------------------------------------- */
.hero { position: relative; max-width: 760px; margin: 0 auto; padding: 48px 20px 10px; text-align: center; }
.hero-glow {
  position: absolute; inset-inline: 0; top: -40px; height: 380px; z-index: -1;
  background: radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, .22), transparent 68%);
  pointer-events: none;
}
.hero h1 {
  font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 2.9rem);
  line-height: 1.25; margin: 0 0 14px; letter-spacing: -.3px;
}
.hero-sub { color: var(--text-2); font-size: 1.04rem; line-height: 1.7; margin: 0 auto 26px; max-width: 580px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 44px; }

/* A WhatsApp thread rendered in CSS — no screenshot to keep in sync. */
.phone {
  max-width: 340px; margin: 0 auto; text-align: start;
  border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
  background: var(--surface); box-shadow: 0 24px 60px rgba(17, 20, 45, .16);
}
.phone-bar {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 16px; font-size: .88rem; font-weight: 600;
  color: #fff; background: var(--brand-grad);
}
.phone-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; }
.phone-body { padding: 14px; display: flex; flex-direction: column; gap: 9px; background: var(--surface-2); }
.bubble {
  max-width: 85%; padding: 9px 13px; border-radius: 14px;
  font-size: .86rem; line-height: 1.5;
}
.bubble.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-start-start-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--primary-soft); color: var(--text); border-start-end-radius: 4px; }
.bubble.short { max-width: 60%; }
.bubble-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.bubble-btns span {
  padding: 5px 11px; border-radius: 9px; font-size: .78rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--primary);
}

/* Sections --------------------------------------------------------- */
.site-section { max-width: 1080px; margin: 0 auto; padding: 56px 20px; }
.site-section h2 {
  font-family: var(--font-display); font-size: clamp(1.3rem, 3.4vw, 1.75rem);
  text-align: center; margin: 0 0 32px;
}

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feature {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px;
  transition: transform .18s ease, border-color .18s ease;
}
.feature:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.feature-icon { font-size: 1.5rem; line-height: 1; }
.feature h3 { font-size: 1rem; margin: 12px 0 7px; }
.feature p { color: var(--text-2); font-size: .89rem; line-height: 1.65; margin: 0; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step { padding: 22px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.step-n {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: 10px; background: var(--brand-grad); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
}
.step h3 { font-size: 1rem; margin: 12px 0 7px; }
.step p { color: var(--text-2); font-size: .89rem; line-height: 1.65; margin: 0; }

.demo-card { max-width: 620px; margin: 0 auto; padding: 28px; }
.demo-card h2 { text-align: start; margin-bottom: 4px; }

/* Footer ----------------------------------------------------------- */
.site-foot {
  max-width: 1080px; margin: 0 auto; padding: 28px 20px 48px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.site-foot-brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: .92rem; }
.site-foot nav { display: flex; gap: 16px; flex-wrap: wrap; margin-inline-start: auto; }
.site-foot a { color: var(--text-3); text-decoration: none; font-size: .85rem; }
.site-foot a:hover { color: var(--primary); }
.site-foot-mail { flex-basis: 100%; }

@media (max-width: 640px) {
  .site-nav { gap: 12px; width: 100%; }
  .site-section { padding: 40px 18px; }
  .site-foot nav { margin-inline-start: 0; }
}
