/* Teyo Studio — shared design system for the owner dashboard and the client portal. */
:root {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f1f1ec; --line: #e4e4df; --line-2: #efefea;
  --ink: #17181c; --ink-2: #33363c; --muted: #5b5f66; --faint: #8b8f96;
  --accent: #0f766e; --accent-ink: #0b4a45; --accent-soft: #e6f2f0; --accent-hover: #0b5a54;
  --good: #166534; --good-bg: #e8f5ec; --good-dot: #16a34a;
  --warn: #8a4a0b; --warn-bg: #fdf1e4; --warn-dot: #d97706;
  --bad: #b42318; --bad-bg: #fdecea; --bad-dot: #dc2626;
  --info: #1e3a8a; --info-bg: #e8eefb;
  --note-bg: #fff7e0; --note-line: #d9a62b; --note-ink: #4a3608;
  --nav: #17181c; --nav-2: #22252c; --nav-active: #2b2e36; --nav-ink: #c9ccd3;
  --r: 16px; --r-sm: 10px; --shadow: 0 1px 2px rgba(23,24,28,.04), 0 8px 24px rgba(23,24,28,.05);
  --font: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[dir="rtl"], .ar { font-family: "IBM Plex Sans Arabic", var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(15,118,110,.35); outline-offset: 2px; border-radius: 8px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.nav { width: 248px; flex: 0 0 248px; background: var(--nav); color: #fff; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.nav.light { background: #fff; color: var(--ink); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 17px; }
.brand .logo.round { border-radius: 999px; background: #f1e7d8; color: #7a4b12; font-family: var(--font); font-size: 14px; }
.brand b { display: block; font-family: var(--display); font-size: 16px; }
.brand span { display: block; font-size: 12px; color: #a9adb6; }
.nav.light .brand span { color: var(--muted); }
.nav a.item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: var(--r-sm); color: var(--nav-ink); font-weight: 500; font-size: 14px; }
.nav a.item:hover { background: var(--nav-2); color: #fff; }
.nav a.item.on { background: var(--nav-active); color: #fff; font-weight: 600; }
.nav.light a.item { color: var(--ink-2); font-weight: 600; }
.nav.light a.item:hover { background: var(--surface-2); color: var(--ink); }
.nav.light a.item.on { background: var(--accent-soft); color: var(--accent-ink); }
svg[viewBox="0 0 24 24"] { width: 1.1em; height: 1.1em; vertical-align: -0.2em; flex: 0 0 auto; }
.nav svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 700; background: var(--bad); color: #fff; border-radius: 999px; padding: 1px 8px; }
.nav .foot { margin-top: auto; padding: 14px; border-radius: 12px; background: var(--nav-2); font-size: 12px; color: #a9adb6; display: grid; gap: 4px; }
.nav.light .foot { background: transparent; padding: 14px 10px 0; color: var(--muted); }
.nav .foot b { color: #fff; font-size: 13px; }
.nav button.link { background: none; border: 0; color: inherit; padding: 0; cursor: pointer; text-align: left; text-decoration: underline; font-size: 12px; }
main { flex: 1 1 auto; min-width: 0; padding: 34px 40px 64px; }
.wrap { max-width: 1140px; margin: 0 auto; display: grid; gap: 24px; }
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.top .titles { display: grid; gap: 6px; }
.top .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.grow { flex: 999 1 520px; min-width: 0; }
.side { flex: 1 1 320px; min-width: 0; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.mobilebar { display: none; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: grid; gap: 14px; align-content: start; }
.card.tight { padding: 8px; gap: 0; }
.card.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.card .head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 6px; }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .value { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1.1; }
.stat .note { font-size: 13px; color: var(--muted); }
.divider { border-top: 1px solid var(--line-2); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty svg { width: 36px; height: 36px; color: var(--faint); }
.banner { border-radius: 12px; padding: 14px 16px; font-size: 14px; line-height: 1.5; }
.banner.bad { background: var(--bad-bg); color: #8a1c12; }
.banner.warn { background: var(--warn-bg); color: #6b3a08; }
.banner.good { background: var(--good-bg); color: var(--good); }
.banner.info { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid #d9d9d3; background: #fff; color: var(--ink); white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #2b2e36; color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid #d9d9d3; background: #fff; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.textarea { padding: 11px 12px; min-height: 96px; line-height: 1.5; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
.input.ar, .textarea.ar { direction: rtl; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.switch { width: 52px; height: 30px; border-radius: 999px; border: 0; background: #c9cbc4; position: relative; cursor: pointer; flex: 0 0 auto; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 999px; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { left: 26px; }
.switch.danger-off[aria-checked="false"] { background: var(--bad); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.toggle-row:first-child { border-top: 0; }
.toggle-row b { display: block; font-size: 15px; }
.toggle-row span { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { color: var(--ink); text-decoration: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid #d9d9d3; background: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip[aria-selected="true"], .chip.on, .chip.on:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { margin-left: 6px; opacity: .7; font-weight: 500; }
.tabs { display: flex; gap: 4px; background: #ececE7; padding: 4px; border-radius: 12px; flex-wrap: wrap; width: fit-content; }
.tabs button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; cursor: pointer; color: #4a4d53; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* ---------- badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--accent-soft); color: var(--accent-ink); }
.pill.team { background: var(--info-bg); color: var(--info); }
.pill.plain { background: var(--surface-2); color: var(--ink-2); font-weight: 500; }
.dot { width: 12px; height: 12px; border-radius: 999px; flex: 0 0 auto; }
.dot.good { background: var(--good-dot); } .dot.warn { background: var(--warn-dot); } .dot.bad { background: var(--bad-dot); }

/* ---------- lists & tables ---------- */
.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line-2); }
.list-row:first-child { border-top: 0; }
.list-row .main { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.list-row .main b { font-size: 15px; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-box { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 680px; }
table.t th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 10px 8px; }
table.t td { padding: 13px 8px; border-top: 1px solid var(--line-2); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fafaf7; }
.conv-item { display: grid; gap: 6px; padding: 13px 14px; border-radius: 12px; border: 0; background: #fff; text-align: left; cursor: pointer; width: 100%; }
.conv-item:hover { background: #fafaf7; }
.conv-item[aria-current="true"] { background: var(--surface-2); }
.conv-item .l1 { display: flex; justify-content: space-between; gap: 10px; }
.conv-item .l1 b { font-size: 15px; }

/* ---------- conversation ---------- */
.thread { display: grid; gap: 12px; padding: 20px; background: #fafaf7; max-height: 560px; overflow-y: auto; }
.msg { display: flex; }
.msg.in { justify-content: flex-start; }
.msg.out { justify-content: flex-end; }
.msg.note { justify-content: stretch; }
.bubble { max-width: 76%; border-radius: 16px; padding: 10px 14px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.bubble .who { display: block; font-size: 12px; font-weight: 700; margin-bottom: 3px; opacity: .85; direction: ltr; text-align: left; }
.bubble .txt { display: block; unicode-bidi: plaintext; text-align: start; }
.bubble .when { display: block; font-size: 11px; opacity: .65; margin-top: 4px; direction: ltr; text-align: right; }
.msg.in .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.out.ai .bubble { background: var(--accent-soft); color: #0b2f2c; border-bottom-right-radius: 4px; }
.msg.out.staff .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.note .bubble { max-width: 100%; width: 100%; background: var(--note-bg); border: 1px dashed var(--note-line); color: var(--note-ink); font-size: 14px; }
.composer { display: grid; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line-2); }
.composer .line { display: flex; gap: 10px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.fact { background: var(--bg); border-radius: 12px; padding: 12px; display: grid; gap: 2px; }
.fact span { font-size: 12px; color: var(--muted); }
.fact b { font-size: 15px; }

/* ---------- business cards ---------- */
.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.biz { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 14px; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; color: inherit; }
.biz:hover { border-color: #cfcfc8; box-shadow: var(--shadow); color: inherit; }
.biz .name { font-family: var(--display); font-size: 18px; font-weight: 700; }
.biz .nums { display: flex; gap: 20px; font-size: 13px; color: var(--muted); }
.biz .nums b { color: var(--ink); font-size: 17px; }
.biz.add { border: 2px dashed #cfcfc8; place-items: center; align-content: center; color: var(--accent); font-weight: 600; min-height: 190px; }

/* ---------- editors ---------- */
.editor-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.editor-row.head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.icon-btn { width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--bad); }
.icon-btn svg { width: 18px; height: 18px; }
.faq-edit { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.hours-grid { display: grid; gap: 8px; }
.hours-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.step { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; text-align: left; }
.step .num { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-size: 13px; background: var(--surface-2); flex: 0 0 auto; }
.step[aria-current="step"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.step[aria-current="step"] .num { background: var(--accent); color: #fff; }
.step.done .num { background: var(--good-bg); color: var(--good); }
.type-card { display: grid; gap: 4px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: #fff; text-align: left; cursor: pointer; min-height: 88px; }
.type-card[aria-pressed="true"] { border: 2px solid var(--accent); padding: 15px; }
.type-card b { font-size: 16px; }
.type-card span { font-size: 13px; color: var(--muted); }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow); }

/* ---------- chat test ---------- */
.test-thread { min-height: 320px; max-height: 520px; }
.typing { display: inline-flex; gap: 4px; padding: 14px; }
.typing i { width: 7px; height: 7px; border-radius: 999px; background: #9a9da3; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.bar { flex: 1 1 auto; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 10px; background: var(--accent); border-radius: 999px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 50% -10%, #e6f2f0 0%, var(--bg) 60%); }
.login .box { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: grid; gap: 18px; box-shadow: var(--shadow); }

/* ---------- feedback ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; font-size: 14px; box-shadow: var(--shadow); animation: up .2s ease-out; max-width: 380px; }
.toast.bad { background: var(--bad); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.skeleton { background: linear-gradient(90deg, #efefea 0%, #f7f7f3 50%, #efefea 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; min-height: 96px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 999px; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- documents ---------- */
.drop { display: grid; justify-items: center; gap: 6px; padding: 26px 18px; border: 2px dashed #cfcfc8; border-radius: 14px; background: #fafaf7; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon svg { width: 28px; height: 28px; color: var(--accent); }
.doc-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: 0 0 auto; }
.doc-icon svg { width: 20px; height: 20px; }
.status-line { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); min-height: 20px; }
.suggest { display: grid; gap: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fff; }
.checks { display: grid; gap: 6px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--bg); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; }

/* ---------- Test Lab ---------- */
.lab-score { font-family: var(--display); font-size: 34px; font-weight: 700; }
.lab-score.good { color: var(--good); } .lab-score.warn { color: var(--warn); } .lab-score.bad { color: var(--bad); }
.lab-dot { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; flex: 0 0 auto; }
.lab-dot.pass { background: var(--good-bg); color: var(--good); } .lab-dot.fail { background: var(--bad-bg); color: var(--bad); } .lab-dot.skipped { background: var(--surface-2); color: var(--muted); }
.lab-thread { max-height: 420px; border-radius: 12px; margin: 0 0 12px 50px; }
@media (max-width: 640px) { .lab-thread { margin-left: 0; } }

/* ---------- Hearing test ---------- */
.prompt-row .main b { font-size: 16px; }
.clip-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--bg); border-radius: 999px; padding: 0 8px 0 2px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.hearing-t td.best { background: var(--good-bg); }
.hearing-t { min-width: 0; }
.hear-clip { display: grid; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line-2); }

/* ---------- AI keys ---------- */
.num-badge { width: 30px; height: 30px; border-radius: 999px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.addkey { display: grid; gap: 12px; }

/* ---------- campaigns ---------- */
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.camp-card { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.camp-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(15,118,110,.08); color: var(--ink); }
.camp-card .head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.camp-card b { font-size: 16px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.mini-stats span { display: grid; font-size: 12px; color: var(--muted); }
.mini-stats b { font-size: 18px; color: var(--ink); font-family: var(--display); }
.good-t { color: var(--good) !important; }
.dot.live { width: 8px; height: 8px; background: var(--good); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.card h2 .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; margin-right: 8px; vertical-align: 2px; }
.preview { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fafaf7; }
.preview-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.preview-head > div { flex: 1; display: grid; min-width: 180px; }
.big-n { font-family: var(--display); font-size: 40px; font-weight: 700; color: var(--accent); line-height: 1; }
.avatar { width: 38px; height: 38px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.list-row.tight { padding: 8px 0; }
.list-row.person { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; padding-left: 6px; padding-right: 6px; border-radius: 0; }
.list-row.person:hover { background: #fafaf7; }
.chips.end { justify-content: flex-end; align-items: center; flex-wrap: nowrap; }
.meter { width: 64px; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; display: inline-block; }
.meter span { display: block; height: 100%; background: var(--good); }
.grid-stats.four { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.quote { margin: 0; padding: 14px 16px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 10px 10px 0; line-height: 1.6; }
.range { width: 100%; accent-color: var(--accent); min-height: 32px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.steps li { counter-increment: s; display: grid; gap: 4px; padding: 16px; background: var(--bg); border-radius: 12px; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 999px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 4px; }
.steps span { font-size: 14px; color: var(--muted); }
.dlg { border: 0; border-radius: 18px; padding: 22px; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 40px); display: none; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg[open] { display: grid; }
.dlg::backdrop { background: rgba(20,22,26,.45); }
.dlg-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dlg-head h2 { margin: 0; }
.dlg .thread { max-height: 340px; border-radius: 12px; }

/* ---------- small screens ---------- */
@media (max-width: 640px) { .mini-stats b { font-size: 16px; } .list-row.person .meter { display: none; } .big-n { font-size: 32px; } }
.svc-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; align-items: start; }
.svc-row.head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.mobile-back { display: none; }
@media (max-width: 900px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 16px; }
  .stat .value { font-size: 28px; }
  .svc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
  .svc-row > :first-child { grid-column: 1 / -1; }
  .svc-row.head { display: none; }
  .has-sel .list-pane { display: none; }
  .has-sel .mobile-back { display: inline-flex; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
  .app { display: block; }
  .nav { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; z-index: 40; height: 100vh; }
  .nav.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  main { padding: 20px 16px 48px; }
  h1 { font-size: 24px; }
  .editor-row { grid-template-columns: 1fr 1fr; }
  .editor-row.head { display: none; }
  .hours-row { grid-template-columns: 76px minmax(0, 1fr) auto; gap: 8px; }
  .bubble { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Phone line / Leads ---------- */
.num-badge.done { background: var(--good-dot); }
.num-badge.done svg { width: 16px; height: 16px; }

/* ---------- test chat: voice notes and photos ---------- */
.btn.icon-only { padding: 0 12px; min-width: 44px; }
.btn.icon-only svg { margin: 0; }
.mic-btn.recording { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,.45); } 50% { box-shadow: 0 0 0 8px rgba(192,57,43,0); } }
.rec-time { flex: 1; display: flex; align-items: center; color: var(--bad); font-weight: 600; font-size: 15px; padding: 0 6px; }
.voice-note { display: flex; align-items: center; gap: 8px; direction: ltr; }
.voice-note svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--accent); }
.voice-note audio { height: 34px; max-width: 230px; }
.test-photo { display: block; max-width: 220px; border-radius: 10px; margin: 2px 0; }
.heard { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); font-style: italic; white-space: pre-wrap; }
.rec-time[hidden] { display: none; }
.bubble.media { white-space: normal; }

/* sign-in mode switch */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.add-form { display: grid; gap: 12px; border-top: 1px solid var(--line-2); padding-top: 16px; margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.banner.plain { background: var(--surface-2); color: var(--ink-2); }

/* Studio → Channels */
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; font-size: 14px; }
.kv > span:nth-child(3n+1) { color: var(--muted); font-weight: 600; font-size: 13px; }
.kv code, .snippet code { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; overflow-wrap: anywhere; display: block; }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.ch-card h3 { display: flex; align-items: center; gap: 8px; }
.ch-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.ch-row { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.ch-row .main { display: grid; gap: 2px; }
.snippet { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.ch-card details summary { cursor: pointer; padding: 4px 0; }
.wc-form input[type=color] { width: 54px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } }

/* in-page dialog */
.ask-back { position: fixed; inset: 0; z-index: 90; background: rgba(23,24,28,.42); display: grid; place-items: center; padding: 16px; animation: fadein .12s ease-out; }
.ask { background: #fff; border-radius: 18px; width: min(440px, 100%); padding: 22px; display: grid; gap: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.ask h2 { font-size: 18px; }
.ask-bar { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fadein { from { opacity: 0; } }
.auto { display: grid; gap: 14px; }
.auto-blk { display: grid; gap: 8px; border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; }
.auto-blk > b { font-size: 15px; }
.small-field { max-width: 220px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr minmax(110px, auto); gap: 12px; align-items: center; font-size: 14px; }
.bar-l { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-t { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-t i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-v { display: grid; text-align: right; }
.bar-v small { color: var(--muted); font-size: 11.5px; }
.stat.money .value { color: var(--accent); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.mini-stats > div { background: var(--surface-2); border-radius: 12px; padding: 10px 6px; display: grid; }
.mini-stats b { font-family: var(--display); font-size: 22px; }
.mini-stats span { font-size: 11.5px; color: var(--muted); }
.day-rep { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.day-rep summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
pre.rep { white-space: pre-wrap; font-family: var(--font); font-size: 14px; margin: 10px 0 0; background: #f6fbf9; border-radius: 10px; padding: 12px; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 1fr auto; } .bar-t { grid-column: 1 / -1; grid-row: 2; } }
/* ---------- CRM: pipeline board, customer record, CRM link, follow-ups ---------- */
.board-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 36px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(168px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--r); padding: 10px; display: grid; gap: 8px; align-content: start; min-height: 360px; border: 2px solid transparent; transition: border-color .12s, background .12s; }
.col.over { border-color: var(--accent); background: var(--accent-soft); }
.col header { display: flex; align-items: center; gap: 8px; }
.col header b { font-size: 14px; }
.col header .n { font-size: 12px; font-weight: 700; background: #fff; border-radius: 999px; padding: 1px 8px; color: var(--ink-2); }
.col header .v { margin-left: auto; }
.col .help { margin: -4px 0 2px; }
.col .cards { display: grid; gap: 8px; }
.col .drop-hint { text-align: center; padding: 18px 0; border: 1px dashed #d6d6cf; border-radius: 12px; }
.dot { width: 9px; height: 9px; border-radius: 999px; background: var(--faint); flex: 0 0 auto; }
.dot.contacted { background: #4f6bd8; } .dot.booked { background: var(--accent); } .dot.visited { background: var(--good-dot); } .dot.paid { background: #b7791f; } .dot.lost { background: #9a9ca3; }
.kcard { display: grid; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; color: var(--ink); cursor: grab; box-shadow: 0 1px 2px rgba(23,24,28,.04); }
.kcard:hover { border-color: #c9cbc4; color: var(--ink); }
.kcard.dragging { opacity: .45; }
.kcard .l1, .kcard .l3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kcard .l1 b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .pill { padding: 2px 8px; font-size: 11px; }
.kcard svg { width: 12px; height: 12px; }
.kcard .red { color: var(--bad); }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border-radius: 6px; padding: 1px 7px; }
.tag.test { background: var(--note-bg); color: var(--note-ink); }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-btn { min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid #d9d9d3; background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; }
.stage-btn:hover { background: var(--surface-2); }
.stage-btn[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.stage-btn.paid[aria-checked="true"] { background: #b7791f; border-color: #b7791f; }
.stage-btn.lost[aria-checked="true"] { background: #6b6e75; border-color: #6b6e75; }
.textarea { min-height: 90px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 12px; }
.timeline li { display: grid; gap: 1px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 999px; background: var(--accent); border: 2px solid #fff; }
.timeline li b { font-size: 14px; }
.works { display: flex; flex-wrap: wrap; gap: 6px; }
.works span { font-size: 12px; font-weight: 600; background: var(--surface-2); border-radius: 999px; padding: 3px 10px; color: var(--ink-2); }
details summary { cursor: pointer; padding: 6px 0; }
.howto { display: grid; gap: 10px; margin-top: 8px; font-size: 14px; }
pre.code, code.secret { display: block; background: #17181c; color: #e7e9ee; border-radius: 10px; padding: 12px 14px; font-size: 12px; overflow-x: auto; white-space: pre; user-select: all; }
code.secret { white-space: normal; word-break: break-all; margin-top: 6px; }
.fu-row { border-top: 1px solid var(--line-2); padding-top: 8px; display: grid; gap: 6px; }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.input.mini { width: 80px; min-height: 38px; }
.msg-edit summary { color: var(--accent); font-weight: 600; }
@media (max-width: 760px) { .board { grid-auto-columns: 82%; } }
.wrap:has(.board) { max-width: 1440px; }
.kcard .l3 b { white-space: nowrap; }
.board { gap: 10px; }
.col, .col .cards, .kcard, .kcard > * { min-width: 0; }
.col header .v { white-space: nowrap; }
.col .cards { grid-template-columns: minmax(0, 1fr); }
/* plan usage meter */
.meter-row { display: grid; gap: 6px; width: 100%; }
.meter-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.meter { display: block; width: 100%; min-width: 120px; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--good-dot); transition: width .3s; }
.meter > span.warn { background: var(--warn-dot); }
.meter > span.bad { background: var(--bad-dot); }
.pill svg { width: 13px; height: 13px; margin-right: 3px; vertical-align: -2px; }
.tag.need { background: var(--bad-bg, #fdecec); color: var(--bad); }
@media (max-width: 760px) { .board { scroll-snap-type: x mandatory; } .col { scroll-snap-align: start; } }

/* ---------- Calendar ---------- */
.cal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav .btn.small { min-height: 38px; }
.cal-nav .btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.cal-nav .flip svg { transform: rotate(180deg); }
.cal-title { font-size: 17px; margin-left: 6px; }
.mini-date { width: 150px; min-height: 38px; }
.cal-seg { width: 180px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cal-scroll { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: auto; max-height: calc(100vh - 290px); min-height: 420px; position: relative; }
.cal-grid { display: grid; grid-template-columns: 64px repeat(var(--cols), minmax(150px, 1fr)); position: relative; min-width: calc(64px + var(--cols) * 150px); }
.cal-gutter { position: sticky; left: 0; z-index: 3; background: #fff; border-right: 1px solid var(--line-2); }
.cal-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.cal-colhead { position: sticky; top: 0; z-index: 2; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.cal-colhead i { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.cal-colhead span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-gutter .cal-colhead { z-index: 4; }
.cal-col { border-right: 1px solid var(--line-2); min-width: 0; }
.cal-col.over .cal-body { background: var(--accent-soft); }
.cal-body { position: relative; cursor: copy; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-2); pointer-events: none; }
.cal-line.half { border-top-style: dashed; opacity: .6; }
.cal-closed { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #f3f3ef, #f3f3ef 6px, #ececE6 6px, #ececE6 12px); pointer-events: none; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad-dot); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad-dot); }
.cal-appt { position: absolute; left: 4px; right: 4px; z-index: 1; display: grid; align-content: start; gap: 1px; text-align: left; padding: 5px 8px; border-radius: 8px; border: 0; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 13%, #fff); color: var(--ink); font: inherit; cursor: grab; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.cal-appt:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); z-index: 2; }
.cal-appt:focus-visible { outline: 3px solid var(--accent); }
.cal-appt .t { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt .n { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt .s { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-appt.short { padding: 2px 8px; align-content: center; }
.cal-appt .mark { position: absolute; top: 4px; right: 6px; font-size: 12px; font-weight: 700; }
.cal-appt .mark svg { width: 14px; height: 14px; }
.cal-appt.b-came { background: color-mix(in srgb, var(--good-dot) 14%, #fff); border-left-color: var(--good-dot); }
.cal-appt.b-no { background: var(--bad-bg); border-left-color: var(--bad-dot); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.cal-appt.b-past { opacity: .75; }
.cal-appt.b-held { background: repeating-linear-gradient(135deg, #fff, #fff 6px, #f4f4f0 6px, #f4f4f0 12px); border: 1px dashed #c9c9c2; border-left: 4px dashed var(--c); cursor: default; }
.cal-appt.dragging { opacity: .85; box-shadow: 0 10px 24px rgba(0,0,0,.22); cursor: grabbing; z-index: 5; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 8px; overflow-x: auto; }
.cal-wday { background: #fff; border: 1px solid var(--line); border-radius: 14px; display: grid; align-content: start; min-height: 260px; overflow: hidden; }
.cal-wday.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-wday.closed { background: #f7f7f4; }
.cal-whead { display: grid; gap: 0; justify-items: start; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line-2); background: none; font: inherit; cursor: pointer; text-align: left; }
.cal-whead b { font-size: 22px; font-family: var(--display); }
.cal-whead:hover { background: var(--surface-2); }
.cal-wlist { display: grid; gap: 6px; padding: 8px; }
.cal-wappt { display: grid; gap: 1px; text-align: left; border: 0; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); border-radius: 8px; padding: 6px 8px; font: inherit; cursor: pointer; }
.cal-wappt b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-wappt.b-no { background: var(--bad-bg); border-left-color: var(--bad-dot); }
.cal-wappt.b-came { background: color-mix(in srgb, var(--good-dot) 14%, #fff); border-left-color: var(--good-dot); }
.cal-wappt.b-held { opacity: .7; border-left-style: dashed; }
.cal-wempty { border: 1px dashed var(--line); background: none; border-radius: 8px; padding: 10px; color: var(--muted); font: inherit; cursor: pointer; }
.cal-dialog { width: min(520px, 100%); max-height: 92vh; overflow: auto; }
.cal-dialog .fields { grid-template-columns: 1fr 1fr; }
.pill.b-up { background: #e7efff; color: #2547a8; } .pill.b-now { background: var(--accent-soft); color: var(--accent); } .pill.b-past { background: var(--surface-2); color: var(--ink-2); }
.pill.b-came { background: #e3f4ea; color: #1f6b43; } .pill.b-no { background: var(--bad-bg); color: var(--bad); } .pill.b-held { background: var(--surface-2); color: var(--muted); }
@media (max-width: 760px) {
  .cal-grid { grid-template-columns: 52px repeat(var(--cols), minmax(132px, 1fr)); min-width: calc(52px + var(--cols) * 132px); }
  .cal-scroll { max-height: calc(100vh - 230px); }
  .cal-title { width: 100%; margin: 4px 0 0; }
  .mini-date { width: 140px; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-wday { min-height: 0; }
  .cal-dialog .fields { grid-template-columns: 1fr; }
}
.cal-hour.first { transform: translateY(2px); }
