/* RELAYZA theme: mirrors relayza.company (deep navy, teal-to-blue accent, Space Grotesk + DM Sans).
   Dark is the brand default; light is opt-in via the sidebar toggle (data-theme="light"). */
:root {
  --bg: #07111e;
  --surface: #0d1a2a;
  --surface-2: #12243a;
  --border: #223649;
  --text: #f4f7ff;
  --muted: #8fa4bb;
  --accent: #1fe5c9;
  --accent-strong: #3ff0d6;
  --accent-ink: #041928;
  --accent-soft: #0c363e;
  --accent-gradient: linear-gradient(120deg, #0df1c6, #39aefa);
  --text-gradient: linear-gradient(95deg, #20eed0, #24c0ef 58%, #5686ff);
  --warn: #fbbf24;
  --warn-soft: #3a2a0b;
  --danger: #ff7a85;
  --danger-soft: #3b1520;
  --info-soft: #14305a;
  --bubble-in: #12243a;
  --bubble-out: #0c3a40;
  --chart-a: #3d5a78;
  --chart-b: #1fe5c9;
  --glow-a: #1345b8;
  --glow-b: #085960;
  --shadow: none;
  --radius: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-2: #eaf1f7;
  --border: #d6e0ea;
  --text: #07111e;
  --muted: #5b6f84;
  --accent: #0bbfa6;
  --accent-strong: #067a6d;
  --accent-soft: #d6f7f1;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info-soft: #e1ecff;
  --bubble-in: #ffffff;
  --bubble-out: #d6f7f1;
  --chart-a: #9fb3c8;
  --chart-b: #0bbfa6;
  --glow-a: #9cc0ff;
  --glow-b: #8ef0e0;
  --shadow: 0 1px 2px rgb(7 17 30 / 6%), 0 1px 3px rgb(7 17 30 / 8%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Heebo", "Noto Sans Hebrew", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; font-family: "Space Grotesk", "DM Sans", system-ui, sans-serif; letter-spacing: -0.01em; }
h1 { letter-spacing: -0.03em; }
.gradient-text { background: var(--text-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; margin-top: 1rem; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 6px; font-size: 0.85em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.error-text { color: var(--danger); }

/* Shell */
/* --app-h is the window's measured height (main.js). Android's WebView can report 100vh as a
   fraction of the screen, which left the in-app menu drawer a sliver tall with its links clipped. */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: var(--app-h, 100vh); }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--border); padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; position: sticky; top: 0; height: var(--app-h, 100vh); overflow-y: auto; }
.brand { font-family: "Space Grotesk", "DM Sans", sans-serif; font-weight: 700; font-size: 1.3rem; letter-spacing: -0.05em; display: flex; align-items: center; gap: 0.5rem; color: var(--text); white-space: nowrap; }
.brand svg { width: 30px; height: 26px; flex-shrink: 0; }
.brand.big { font-size: 1.8rem; margin-bottom: 1.75rem; }
.brand.big svg { width: 42px; height: 36px; }
.brand-dot { color: var(--accent); }
.tenant-switch, .tenant-name { width: 100%; font-weight: 600; }
.tenant-name { padding: 0.4rem 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--text); padding: 0.5rem 0.65rem; border-radius: 8px; display: flex; gap: 0.6rem; align-items: center; }
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-badge { margin-inline-start: auto; background: var(--warn-soft); color: var(--warn); font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 0 0.45rem; min-width: 1.3rem; text-align: center; }
.nav-icon { width: 1.1rem; text-align: center; opacity: 0.8; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.sidebar-foot .foot-actions { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; }
.sidebar-foot .muted { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { min-width: 0; }
.topbar { display: none; }
.nav-scrim { display: none; }
.content { padding: 1.5rem 2rem; max-width: 1400px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-header p { margin: 0; }
.actions, .row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.row-actions { justify-content: flex-end; }

/* Controls */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.65rem; width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { width: auto; }
textarea { resize: vertical; }
.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 0.45rem 0.9rem; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
label.btn { display: inline-block; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent-gradient); border-color: transparent; color: var(--accent-ink); box-shadow: 0 4px 18px rgb(2 214 205 / 18%); }
.btn.primary:hover:not(:disabled) { background: var(--accent-gradient); filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.btn.full { width: 100%; }
.link { background: none; border: 0; color: var(--accent-strong); cursor: pointer; padding: 0; font: inherit; }
.icon-btn { background: none; border: 0; color: var(--text); font-size: 1.3rem; cursor: pointer; padding: 0.2rem 0.5rem; border-radius: 6px; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; flex: 1; min-width: 0; }
.label { font-weight: 600; font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.8rem; }
.row { display: flex; gap: 0.85rem; flex-wrap: wrap; }
.row > .field { min-width: 160px; }
.toggle { display: inline-flex; gap: 0.5rem; align-items: center; margin-bottom: 0.85rem; font-weight: 600; font-size: 0.9rem; }
.toggle.choice { display: flex; align-items: flex-start; font-weight: 400; }
.toggle.choice input { margin-top: 0.25rem; flex: none; }
.checks-inline { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.checks-inline label { display: flex; gap: 0.35rem; align-items: center; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.search { margin-bottom: 0.75rem; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.inner { box-shadow: none; margin: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.grid-2 > .card { margin: 0; }
.grid-agent { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 1rem; align-items: start; }
.callout { padding: 0.6rem 0.8rem; border-radius: 8px; margin: 0.5rem 0; background: var(--info-soft); }
.callout.error { background: var(--danger-soft); color: var(--danger); }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.ok { background: var(--accent-soft); }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--accent-soft); color: var(--accent-strong); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--info-soft); color: var(--text); }
.badge.muted { opacity: 0.7; }
.empty { text-align: center; padding: 2.5rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; align-items: center; }
.loading { padding: 2rem; text-align: center; color: var(--muted); }
.center-card { max-width: 420px; margin: 15vh auto; text-align: center; }
.code { background: var(--surface-2); padding: 0.75rem; border-radius: 8px; overflow-x: auto; font-size: 0.82rem; white-space: pre-wrap; word-break: break-all; }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Tables */
.table-wrap { overflow-x: auto; padding: 0.5rem; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); padding: 0.5rem; }
.table td { padding: 0.6rem 0.5rem; border-top: 1px solid var(--border); vertical-align: top; }
.table tr.dim td { opacity: 0.5; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }

/* Tabs & chips */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.5rem 0.75rem; font: inherit; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.count { background: var(--surface-2); border-radius: 999px; padding: 0 0.4rem; font-size: 0.75rem; }
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 0.25rem 0.75rem; font: inherit; font-size: 0.85rem; cursor: pointer; color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }

/* Overview */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.kpi { margin: 0; }
.kpi-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.kpi-value { font-family: "Space Grotesk", "DM Sans", sans-serif; font-size: 1.8rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.chart svg { width: 100%; height: 180px; display: block; }
.chart .bar.a { fill: var(--chart-a); }
.chart .bar.b { fill: var(--chart-b); }
.legend { font-size: 0.8rem; margin-top: 0.5rem; display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.a { background: var(--chart-a); }
.sw.b { background: var(--chart-b); }
.funnel { display: flex; flex-direction: column; gap: 0.35rem; }
.funnel-row { display: grid; grid-template-columns: 90px 1fr 40px; gap: 0.5rem; align-items: center; color: var(--text); font-size: 0.9rem; }
.funnel-bar { background: var(--surface-2); border-radius: 4px; height: 10px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--accent-gradient); }
.today-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; }
.today-item { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.today-item:hover { text-decoration: none; border-color: var(--accent); }
.today-item strong { font-family: "Space Grotesk", "DM Sans", sans-serif; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.today-item.warn strong { color: var(--warn); }
.brief-text { white-space: pre-wrap; font-family: inherit; margin: 0; }
.setup ol { margin: 0; padding-inline-start: 1.25rem; display: flex; flex-direction: column; gap: 0.3rem; }
.setup li.done a { color: var(--muted); text-decoration: line-through; }

/* Guided setup wizard */
.wizard { max-width: 920px; }
.wizard-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; padding: 0; margin: 0 0 1rem; font-size: 0.9rem; color: var(--muted); }
.wizard-steps li { display: flex; align-items: center; gap: 0.5rem; }
.wizard-steps .n { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 0.8rem; font-weight: 700; }
.wizard-steps li.active { color: var(--text); font-weight: 600; }
.wizard-steps li.active .n { background: var(--accent-gradient); color: var(--accent-ink); }
.wizard-steps li.done .n { background: var(--accent-soft); color: var(--accent-strong); }
.wizard-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.callout-card { background: var(--info-soft); }
.draft-entry { border-top: 1px solid var(--border); padding: 0.6rem 0; display: flex; flex-direction: column; gap: 0.35rem; }
.draft-entry .toggle { margin: 0; gap: 0.5rem; }
.draft-entry .toggle input[type="text"], .draft-entry .toggle input:not([type="checkbox"]) { flex: 1; }
.draft-entry.dim { opacity: 0.55; }
.setup-done { text-align: center; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.setup-done .plain { text-align: start; margin-top: 0.75rem; gap: 0.75rem; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; height: calc(var(--app-h, 100vh) - 3rem); }
.inbox-list { overflow-y: auto; min-width: 0; }
.conv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.conv { display: block; padding: 0.65rem 0.75rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.conv:hover { text-decoration: none; border-color: var(--accent); }
.conv.active { border-color: var(--accent); background: var(--accent-soft); }
.conv-top { display: flex; justify-content: space-between; gap: 0.5rem; }
.conv-snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.88rem; }
.conv-tags { margin-top: 0.25rem; }
.inbox-thread { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread-head { display: flex; gap: 0.75rem; justify-content: space-between; align-items: flex-start; padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.thread-head h2 { margin: 0; }
.thread-head .back { display: none; }
.thread-body { display: grid; grid-template-columns: 1fr 260px; flex: 1; min-height: 0; }
.messages { overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; background: var(--surface-2); }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 0.5rem 0.75rem; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; background: var(--bubble-in); border: 1px solid var(--border); }
.msg.out .bubble { background: var(--bubble-out); border-color: transparent; }
.msg.staff .bubble { background: var(--info-soft); }
.msg.system .bubble { background: var(--warn-soft); }
.meta { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
.contact-panel { border-inline-start: 1px solid var(--border); padding: 1rem; overflow-y: auto; }
.composer { display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--border); align-items: flex-end; background: var(--surface); }
.typing { display: inline-flex; gap: 4px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* Tasks */
.task-line { display: flex; flex-direction: column; gap: 0.1rem; }
.task-line label { display: flex; gap: 0.4rem; align-items: flex-start; }
.task-add { margin-top: 0.75rem; }
.task-add .chips { margin-bottom: 0.5rem; }
.task-add .chip { font-size: 0.75rem; padding: 0.15rem 0.55rem; }

/* Agent test chat */
.test-chat { position: sticky; top: 1rem; }
.phone { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; height: 520px; }
.phone .messages { flex: 1; }
.kb { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.kb li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--border); }

/* Services */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; }
.hours { list-style: none; padding: 0; margin: 0.5rem 0 0; font-size: 0.85rem; }
.hours li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.1rem 0; }
.hours-editor { display: flex; flex-direction: column; gap: 0.35rem; }
.hours-editor label { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 0.5rem; font-size: 0.9rem; }

/* Bookings */
.day h2 { margin-bottom: 0.25rem; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 0.35rem; max-height: 200px; overflow-y: auto; }
.slot { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 0.35rem; font: inherit; cursor: pointer; color: var(--text); }
.slot.active { background: var(--accent-gradient); color: var(--accent-ink); border-color: transparent; font-weight: 600; }

/* Modal & toast */
.modal-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / 45%); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 520px; box-shadow: 0 20px 50px rgb(0 0 0 / 25%); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem 0; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1rem 1.25rem 1.25rem; }
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 0.6rem 1rem; border-radius: 10px; z-index: 60; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); color: #fff; }
:root:not([data-theme="light"]) .toast.error { color: var(--accent-ink); }

/* Auth */
.auth-page { position: relative; min-height: 100vh; overflow: hidden; }
.auth-page .ambient { position: absolute; pointer-events: none; border-radius: 50%; filter: blur(90px); opacity: 0.3; }
.auth-page .a1 { width: 600px; height: 600px; background: var(--glow-a); top: -120px; right: -340px; }
.auth-page .a2 { width: 500px; height: 500px; background: var(--glow-b); bottom: -200px; left: -340px; }
.auth-page .grid-surface { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(#3c689b17 1px, transparent 1px), linear-gradient(90deg, #3c689b17 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(ellipse at 30% 40%, black, transparent 70%); }
.auth { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: center; padding: 2rem; max-width: 1100px; margin: 0 auto; }
.eyebrow { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--accent-strong); font-weight: 700; font-size: 0.68rem; letter-spacing: 0.15em; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 40px; padding: 0.5rem 0.9rem; margin-bottom: 1rem; }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.auth-pitch h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); line-height: 1.08; letter-spacing: -0.045em; }
.auth-pitch p { font-size: 1.05rem; color: var(--muted); }
.checks { padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.auth-pitch a:hover { text-decoration: none; }
.checks li::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.auth-card { max-width: 420px; width: 100%; justify-self: center; }
.auth-single { grid-template-columns: 1fr; }
.auth-card .forgot-row { margin: -0.25rem 0 0.75rem; text-align: end; }
.auth-card .brand { margin-bottom: 0.75rem; }

/* Responsive */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; height: auto; inset-inline-start: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform 0.2s; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / 30%); }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / 35%); }
  .topbar { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .content { padding: 1rem 16px; }
  .grid-agent, .auth { grid-template-columns: 1fr; }
  .test-chat { position: static; }
  .inbox { grid-template-columns: 1fr; height: calc(var(--app-h, 100vh) - 6rem); }
  .inbox.has-selection .inbox-list { display: none; }
  .inbox:not(.has-selection) .inbox-thread { display: none; }
  .thread-head .back { display: inline-block; }
  .thread-body { grid-template-columns: 1fr; }
  .contact-panel { display: none; }
  .msg { max-width: 90%; }
}

/* ── Billing ─────────────────────────────────────────────────────────────── */
.billing-banner { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 1rem; }
.billing-banner a { font-weight: 600; white-space: nowrap; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.segmented button { background: none; border: 0; border-radius: 999px; padding: 0.3rem 0.8rem; font: inherit; font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.segmented button.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 0.5rem 0 1rem; }
.plan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.plan-card.featured { border-color: var(--accent); }
.plan-card h3 { margin: 0; }
.plan-price { font-size: 1.6rem; font-weight: 700; }
.plan-features { flex: 1; }
.usage { margin: 0.75rem 0; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > div { height: 100%; background: var(--accent-gradient); }
.meter > div.near { background: var(--warn); }
.meter > div.over { background: var(--danger); }
.suggestion { border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: 0.75rem; display: grid; gap: 0.4rem; }

/* The dashboard assistant: a drawer on the inline-end side, open from every page. The transcript
   scrolls with the proposal cards under it, where the current value stands next to the one
   waiting to be applied; the composer stays pinned to the bottom. */
.assistant-open { font: inherit; color: var(--text); background: none; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.65rem; display: flex; gap: 0.6rem; align-items: center; cursor: pointer; text-align: start; }
.assistant-open:hover { background: var(--surface-2); }
.assistant-open.active { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; font-weight: 600; }
.assistant-top { margin-inline-start: auto; position: relative; font-weight: 700; }
/* Inside the Android app: the way back to its quick view, always on screen rather than in the drawer. */
.topbar .quick-view { margin-inline-start: auto; white-space: nowrap; }
.topbar .quick-view + .assistant-top { margin-inline-start: 0; }
.assistant-top .dot { position: absolute; top: 0.2rem; inset-inline-end: 0.2rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--warn); }
.assistant-drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(420px, 100vw); z-index: 45; background: var(--surface); border-inline-start: 1px solid var(--border); box-shadow: 0 0 40px rgb(0 0 0 / 18%); display: flex; flex-direction: column; }
.assistant-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; padding: 1rem 1rem 0.75rem; border-bottom: 1px solid var(--border); }
.assistant-head h2 { margin: 0; font-size: 1.1rem; }
.assistant-head p { margin: 0.25rem 0 0; }
.assistant-head .row-actions { flex-shrink: 0; align-items: center; }
.assistant-body { flex: 1; min-height: 0; overflow-y: auto; background: var(--surface-2); }
.assistant-drawer .chat-log { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.assistant-drawer .msg { max-width: 92%; }
.assistant-drawer .composer textarea { flex: 1; resize: vertical; min-height: 2.6rem; }
.assistant-changes { padding: 0 0.75rem 0.75rem; background: var(--surface); border-top: 1px solid var(--border); }
.assistant-drawer .change-diff { grid-template-columns: 1fr; }
.assistant-callout { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0 0 1rem; }
.assistant-callout p { margin: 0.2rem 0 0; }
@media (max-width: 560px) { .assistant-callout { flex-direction: column; align-items: flex-start; } }
.chat-examples { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chat-examples p { width: 100%; margin: 0; }
.chat-examples .chip { white-space: normal; text-align: start; max-width: 100%; line-height: 1.4; }
.section-head.tight { margin-top: 1.1rem; }
.section-head.tight h3 { margin: 0; }
.change-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.change-diff > div { min-width: 0; display: grid; gap: 0.2rem; }
.change-diff .was, .change-diff .will { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; padding: 0.4rem 0.6rem; border-radius: 8px; max-height: 10rem; overflow-y: auto; }
.change-diff .was { background: var(--surface-2); color: var(--muted); }
.change-diff .will { background: var(--accent-soft); color: var(--text); }
.suggestion.decided { opacity: 0.7; }
@media (max-width: 860px) { .change-diff { grid-template-columns: 1fr; } }

/* Right-to-left (Hebrew). Most layout uses flex/grid and logical properties; these cover the rest. */
[dir="rtl"] body { font-family: "Rubik", "DM Sans", system-ui, sans-serif; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { font-family: "Rubik", "Space Grotesk", system-ui, sans-serif; }
[dir="rtl"] .brand { direction: ltr; }
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="url"], [dir="rtl"] input[type="tel"], [dir="rtl"] .code, [dir="rtl"] code { direction: ltr; text-align: start; }
.manage-block { border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: 0.75rem; }
.row.align-end { align-items: flex-end; }
.row.align-end > .btn { margin-bottom: 0.85rem; }
.terms-check { align-items: flex-start; font-weight: 400; margin: 0.25rem 0 0.85rem; }
.terms-check input { margin-top: 0.2rem; }
.join .auth-pitch h1 { font-size: 2rem; margin: 1.25rem 0 1rem; }
.join-summary { display: grid; gap: 0.75rem; }
.join-summary .segmented { width: fit-content; }
.join-names { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }

/* Per-page user guide (<PageGuide />): a collapsible panel under the page header.
   Open state is remembered per page, so a reader who closes it keeps it closed. */
.guide { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; }
.guide > summary { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem; cursor: pointer; list-style: none; font-weight: 600; border-radius: var(--radius); }
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary:hover { background: var(--surface-2); }
.guide[open] > summary { border-bottom: 1px solid var(--border); border-end-start-radius: 0; border-end-end-radius: 0; }
.guide-mark { flex: none; width: 1.4rem; height: 1.4rem; border-radius: 999px; background: var(--accent-gradient); color: var(--accent-ink); font-size: 0.85rem; font-weight: 700; display: grid; place-items: center; }
.guide-title { min-width: 0; }
.guide-hint { margin-inline-start: auto; white-space: nowrap; }
.guide-body { padding: 0.1rem 0.9rem 0.9rem; font-size: 0.93rem; }
.guide-intro { margin: 0.6rem 0 0; color: var(--muted); }
.guide-section { margin-top: 0.9rem; }
.guide-section h3 { margin: 0 0 0.35rem; color: var(--accent-strong); }
.guide-section ol, .guide-section ul { margin: 0; padding-inline-start: 1.4rem; }
.guide-section li { line-height: 1.55; }
.guide-section li + li { margin-top: 0.3rem; }
.guide-section.install { background: var(--info-soft); border-radius: 10px; padding: 0.65rem 0.8rem; }
.guide-section.install h3 { color: var(--text); }
.guide-section.install ol, .guide-section.install ul { padding-inline-start: 1.2rem; }
.inbox-list .guide { font-size: 0.9rem; }
@media (max-width: 960px) { .guide-hint { display: none; } }

/* Email sorting (dashboard/src/pages/email.js) */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.email-body { background: var(--surface-2); padding: 0.75rem; border-radius: 8px; max-height: 40vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 0.88rem; }
.card details > summary { cursor: pointer; font-weight: 600; margin: 0.75rem 0 0.25rem; }
.email-rows > li.email-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.7rem 0; border-top: 1px solid var(--border); }
.email-main { flex: 1 1 18rem; min-width: 0; overflow-wrap: anywhere; }
.email-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
select.email-policy { width: auto; min-width: 11rem; }
.key-steps { margin: 0.25rem 0 0.75rem; }
.key-steps summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.key-steps ol { margin: 0.5rem 0 0; padding-inline-start: 1.25rem; line-height: 1.7; }
.link-list { display: grid; gap: 0.75rem; margin: 0.75rem 0; }
.link-item { display: flex; gap: 1rem; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; }
.link-item.archived { opacity: 0.6; }
.link-qr { width: 96px; height: 96px; flex: none; border-radius: 6px; background: #fff; }
.link-body { flex: 1; min-width: 0; display: grid; gap: 0.35rem; }
.link-url { word-break: break-all; }
.link-stats { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
@media (max-width: 560px) { .link-item { flex-direction: column; } }
.link-body .form-actions { flex-wrap: wrap; }
.link-item { min-width: 0; }
.segment-members { margin: 0.5rem 0 0; display: grid; gap: 0.2rem; }

/* Website page (dashboard/src/pages/website.js) */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; margin-bottom: 0.85rem; }
.template-card { display: flex; flex-direction: column; gap: 0.3rem; text-align: start; padding: 0.7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: inherit; cursor: pointer; font: inherit; }
.template-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.template-swatch { display: block; height: 36px; border-radius: 6px; }
.site-preview { position: sticky; top: 1rem; }
.site-preview iframe { width: 100%; height: min(78vh, 900px); border: 1px solid var(--border); border-radius: 10px; background: #fff; }

/* RELAYZA Academy (dashboard/src/pages/academy.js) */
.meter { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 0.4rem; }
.meter > span { display: block; height: 100%; background: color-mix(in srgb, var(--accent) 45%, transparent); border-radius: inherit; }
.meter > span.ok { background: var(--accent-gradient); }
.module-card { display: block; color: inherit; transition: border-color 0.15s; }
.module-card:hover:not(.locked) { border-color: var(--accent); }
.module-card h3 { margin: 0.5rem 0 0.25rem; }
.module-card.locked { opacity: 0.6; cursor: not-allowed; }
.lesson-body { line-height: 1.7; margin: 0.75rem 0; }
.lesson-body h3 { margin: 1rem 0 0.35rem; font-size: 1rem; }
.lesson-body ul { margin: 0.25rem 0 0.75rem; padding-inline-start: 1.25rem; }
.quiz-q { border: 0; padding: 0; margin: 0 0 1.1rem; }
.quiz-q legend { margin-bottom: 0.4rem; line-height: 1.5; }
.quiz-opt { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.4rem 0.6rem; border-radius: 8px; cursor: pointer; line-height: 1.5; }
.quiz-opt:hover { background: var(--surface-2); }
.quiz-opt.right { background: var(--accent-soft); }
.quiz-opt.wrong { background: var(--danger-soft); }
.sparring { height: min(68vh, 640px); margin: 0.5rem 0 1rem; }
.sparring .messages { flex: 1; }
.coach-transcript { max-height: 360px; border-radius: 8px; margin: 0.75rem 0; }
.grade .kpi-value.pass { color: var(--accent-strong); }
.grade .kpi-value.fail { color: var(--danger); }
.pre-wrap { white-space: pre-wrap; margin-top: 0.5rem; line-height: 1.6; }
details.card > summary { cursor: pointer; }

/* Draft mode: the held reply sits between the conversation and the composer. */
.draft-box { margin: 0 0.75rem 0.5rem; display: grid; gap: 0.5rem; max-height: 45vh; overflow-y: auto; }
.draft-box textarea { width: 100%; box-sizing: border-box; }
.draft-part .chips { margin-top: 0.25rem; }
.email-reply textarea { width: 100%; box-sizing: border-box; }
