/* SMR AI Brain. Tokens follow brand.config.json: Darwaza ivory surfaces, Neel accent, Manch night + gold for the hero only. */
@font-face { font-family: 'Martel'; src: url('/assets/fonts/Martel-ExtraBold.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Mukta'; src: url('/assets/fonts/Mukta-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Mukta'; src: url('/assets/fonts/Mukta-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --paper: #FBF7F0;
  --raised: #FFFDF9;
  --ink: #16182B;
  --muted: #5F574B;
  --line: #E7DFD1;
  --neel: #2B3990;
  --neel-dark: #1F2A6E;
  --neel-soft: #E9ECF8;
  --night: #0E0D12;
  --gold: #E9B949;
  --stage-ivory: #F5EFE3;
  --ok: #1E7A46;
  --warn: #9A5B00;
  --bad: #A4262C;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 24, 43, .06), 0 6px 18px rgba(22, 24, 43, .06);
  --font-head: 'Martel', Georgia, serif;
  --font-body: 'Mukta', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.55 var(--font-body); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 800; line-height: 1.2; margin: 0 0 .5em; }
a { color: var(--neel); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 48px; padding: 0 22px; border-radius: 999px;
  border: 0; background: var(--neel); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, transform .05s; }
.btn:hover { background: var(--neel-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.gold { background: var(--gold); color: var(--night); }
.btn.gold:hover { background: #F2C863; }
.btn.ghost { background: transparent; color: var(--neel); border: 1.5px solid var(--neel); }
.btn.ghost:hover { background: var(--neel-soft); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 15px; }
.btn.block { width: 100%; }

/* ---------- Landing ---------- */
.stage { background: var(--night); color: var(--stage-ivory); overflow: hidden; }
.stage-inner { max-width: 1080px; margin: 0 auto; padding: 18px 16px 0; display: grid; gap: 8px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar img { height: 30px; width: auto; }
.topbar a.link { color: var(--stage-ivory); text-decoration: none; font-weight: 600; padding: 10px 4px; }
.hero { display: grid; gap: 8px; align-items: end; padding-top: 18px; }
.hero h1 { font-size: clamp(30px, 7.4vw, 52px); color: #fff; }
.hero h1 .gold { color: var(--gold); }
.hero p.lead { font-size: 19px; color: var(--stage-ivory); max-width: 34ch; margin: 0 0 18px; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.hero .note { font-size: 15px; color: #CFC6B5; margin: 0 0 22px; }
.hero-photo { position: relative; justify-self: center; width: min(78vw, 360px); }
.hero-photo::before { content: ''; position: absolute; inset: 14% 4% 0; border-radius: 180px 180px 0 0; border: 2px solid var(--gold); opacity: .8; }
.hero-photo img { position: relative; width: 100%; height: auto; border-radius: 160px 160px 0 0; aspect-ratio: 560 / 600; object-fit: cover; }
@media (min-width: 860px) {
  .hero { grid-template-columns: 1.15fr .85fr; padding-top: 40px; }
  .hero-copy { padding-bottom: 64px; }
}

.section { max-width: 1080px; margin: 0 auto; padding: 44px 16px; }
.section h2 { font-size: clamp(24px, 5vw, 34px); }
.grid3 { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { font-size: 19px; }
.card .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--neel-soft); color: var(--neel); display: grid; place-items: center; margin-bottom: 10px; }
.card .ico svg { width: 24px; height: 24px; }
.card p { margin: 0; color: var(--muted); }
.ask-sample { display: grid; gap: 10px; }
.bubble { padding: 12px 14px; border-radius: 16px; max-width: 46ch; }
.bubble.q { background: var(--neel); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.bubble.a { background: var(--raised); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.steps li::before { content: counter(s); width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: var(--night); font-weight: 800; display: grid; place-items: center; font-family: var(--font-head); }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.foot .section { padding: 22px 16px 32px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }

/* ---------- Forms ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.auth-top { background: var(--night); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.auth-top img.logo { height: 26px; width: auto; }
.auth-main { width: 100%; max-width: 460px; margin: 0 auto; padding: 22px 16px 40px; }
.auth-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.auth-head img { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--gold); }
.auth-head h1 { font-size: 24px; margin: 0; }
.auth-head p { margin: 0; color: var(--muted); font-size: 15px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--raised); font-size: 17px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--neel); outline: none; box-shadow: 0 0 0 3px var(--neel-soft); }
.field .err { color: var(--bad); font-size: 14px; min-height: 0; }
.field.bad input { border-color: var(--bad); }
.phone-wrap { display: flex; }
.phone-wrap span { display: grid; place-items: center; padding: 0 12px; border: 1.5px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px; background: var(--paper); color: var(--muted); font-weight: 600; }
.phone-wrap input { border-radius: 0 12px 12px 0; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: 15px; margin: 4px 0 16px; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--neel); }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 15px; }
.alert.bad { background: #FBE9EA; color: var(--bad); }
.alert.ok { background: #E6F4EC; color: var(--ok); }
.alert.info { background: var(--neel-soft); color: var(--neel-dark); }
.muted { color: var(--muted); }
.center { text-align: center; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 6px; top: 6px; height: 36px; padding: 0 10px; border: 0; background: transparent; color: var(--neel); font-weight: 600; cursor: pointer; }

/* ---------- Chat app ---------- */
.chat { height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
@media (min-width: 900px) { .shell { display: grid; grid-template-columns: 290px 1fr; height: 100dvh; } }
.side { display: none; background: var(--raised); border-right: 1px solid var(--line); flex-direction: column; min-height: 0; }
.side.open { display: flex; position: fixed; inset: 0 22% 0 0; z-index: 30; box-shadow: 0 0 0 100vmax rgba(14, 13, 18, .45); }
@media (min-width: 900px) { .side { display: flex; } .side.open { position: static; box-shadow: none; } }
.side-head { padding: 14px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.side-list { overflow-y: auto; padding: 8px; flex: 1; }
.side-list button { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; cursor: pointer; display: block; font-size: 15px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-list button:hover, .side-list button.on { background: var(--neel-soft); }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 14px; display: grid; gap: 6px; }
.side-foot button { border: 0; background: none; color: var(--neel); padding: 6px 0; text-align: left; cursor: pointer; font-weight: 600; }

.bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--night); color: var(--stage-ivory); }
.bar .menu { border: 0; background: transparent; color: var(--stage-ivory); width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; border-radius: 10px; }
@media (min-width: 900px) { .bar .menu { display: none; } }
.bar img.av { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--gold); }
.bar .who { line-height: 1.15; flex: 1; min-width: 0; }
.bar .who b { display: block; font-family: var(--font-head); font-size: 16px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .bar .who b { font-size: 15px; } .bar .who span { font-size: 12px; } .bar img.av { width: 34px; height: 34px; } }
.bar .who span { font-size: 13px; color: #CFC6B5; }
.quota { font-size: 13px; font-weight: 600; background: rgba(233, 185, 73, .14); color: var(--gold); border: 1px solid rgba(233, 185, 73, .45); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }

.thread { overflow-y: auto; padding: 16px 12px 8px; scroll-behavior: smooth; }
.thread-inner { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
.msg { display: grid; gap: 6px; }
.msg.user { justify-items: end; }
.msg.user .text { background: var(--neel); color: #fff; padding: 10px 14px; border-radius: 18px 18px 4px 18px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { grid-template-columns: 34px 1fr; gap: 8px; align-items: start; }
.msg.bot img.av { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--gold); }
.msg.bot .body { background: var(--raised); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.msg.bot .text { overflow-wrap: anywhere; }
.msg.bot .text p { margin: 0 0 .6em; }
.msg.bot .text p:last-child { margin-bottom: 0; }
.msg.bot .text ul, .msg.bot .text ol { margin: .2em 0 .6em; padding-left: 1.2em; }
.msg.bot .text li { margin-bottom: .25em; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .8; } .thread { scroll-behavior: auto; } }
.sources { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); display: grid; gap: 6px; }
.sources .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.chip { display: flex; gap: 8px; align-items: center; font-size: 14px; background: var(--paper); border: 1px solid var(--line); padding: 6px 10px; border-radius: 10px; }
.chip svg { width: 16px; height: 16px; flex: none; color: var(--neel); }
.chip span.t { color: var(--muted); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 4px; margin-top: 8px; }
.tools button { border: 0; background: transparent; color: var(--muted); height: 34px; min-width: 34px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; padding: 0 8px; font-size: 13px; }
.tools button:hover { background: var(--paper); color: var(--ink); }
.tools button.on { color: var(--neel); background: var(--neel-soft); }
.tools svg { width: 18px; height: 18px; }

.welcome { text-align: center; padding: 18px 6px 4px; display: grid; justify-items: center; gap: 10px; }
.welcome img { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--gold); }
.welcome h1 { font-size: 24px; margin: 0; }
.welcome p { margin: 0; color: var(--muted); max-width: 40ch; }
.starters { display: grid; gap: 8px; width: 100%; max-width: 560px; margin-top: 8px; }
@media (min-width: 640px) { .starters { grid-template-columns: 1fr 1fr; } }
.starters button { text-align: left; border: 1px solid var(--line); background: var(--raised); padding: 12px 14px; border-radius: 12px; cursor: pointer; font-size: 15px; box-shadow: var(--shadow); }
.starters button:hover { border-color: var(--neel); }
.starters button b { display: block; font-size: 12px; color: var(--neel); text-transform: none; letter-spacing: .02em; }

.composer { border-top: 1px solid var(--line); background: var(--raised); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.composer form { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 48px; max-height: 160px; padding: 12px 14px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--paper); font-size: 17px; line-height: 1.4; }
.composer textarea:focus { outline: none; border-color: var(--neel); }
.composer .send { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--neel); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.composer .send[disabled] { opacity: .45; cursor: not-allowed; }
.composer .send svg { width: 22px; height: 22px; }
.composer .small-print { max-width: 760px; margin: 6px auto 0; font-size: 12px; color: var(--muted); text-align: center; }

.limit-box { background: var(--night); color: var(--stage-ivory); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; }
.limit-box h3 { color: #fff; font-size: 20px; margin: 0; }
.limit-box p { margin: 0; color: #CFC6B5; }
.test-ribbon { background: var(--warn); color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: 4px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 15px; z-index: 50; box-shadow: var(--shadow); }

/* ---------- Admin ---------- */
.admin { max-width: 1200px; margin: 0 auto; padding: 16px; }
.admin header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: var(--raised); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 15px; }
.tabs button.on { background: var(--neel); color: #fff; border-color: var(--neel); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--raised); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi b { display: block; font-size: 26px; font-family: var(--font-head); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--paper); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--neel-soft); color: var(--neel-dark); }
.pill.bad { background: #FBE9EA; color: var(--bad); } .pill.ok { background: #E6F4EC; color: var(--ok); } .pill.warn { background: #FFF1DC; color: var(--warn); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.row .field { margin: 0; }
.qa-answer { white-space: pre-wrap; max-width: 60ch; font-size: 13px; color: var(--muted); max-height: 7.5em; overflow: hidden; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 80px; padding: 8px 0; }
.bars div { flex: 1; background: var(--neel); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
dialog { border: 0; border-radius: var(--radius); padding: 18px; max-width: 520px; width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(14, 13, 18, .5); }

.prose { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
.prose h1 { font-size: 28px; } .prose h2 { font-size: 20px; margin-top: 1.4em; }

/* ---------- Premium plans ---------- */
dialog.plans { max-width: 460px; padding: 22px 18px 16px; }
.plans h2 { font-size: 24px; margin: 0 0 4px; }
.plans-sub { margin: 0 0 14px; font-size: 15px; }
.plans-x { position: absolute; right: 8px; top: 6px; width: 44px; height: 44px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; }
.plans-list { display: grid; gap: 10px; }
.plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 6px; background: var(--raised); }
.plan .row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.plan b.name { font-size: 17px; }
.plan .price { font-family: var(--font-head); font-size: 22px; white-space: nowrap; }
.plan .price small { font-family: var(--font-body); font-size: 13px; color: var(--muted); font-weight: 400; }
.plan .meta { font-size: 14px; color: var(--muted); }
.plan.founding { background: var(--night); color: var(--stage-ivory); border: 1.5px solid var(--gold); box-shadow: 0 8px 24px rgba(14, 13, 18, .25); padding: 16px; }
.plan.founding .kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.plan.founding b.name { color: #fff; font-family: var(--font-head); font-size: 22px; }
.plan.founding .price { color: var(--gold); font-size: 28px; }
.plan.founding .price small, .plan.founding .meta { color: #CFC6B5; }
.plan .was { text-decoration: line-through; color: #A79E8E; font-size: 15px; margin-right: 6px; font-family: var(--font-body); }
.plan ul { margin: 4px 0 6px; padding-left: 1.1em; font-size: 14px; }
.plan ul li { margin-bottom: 3px; }
.seats { display: grid; gap: 4px; font-size: 13px; color: #CFC6B5; }
.seats .bar { height: 6px; border-radius: 99px; background: rgba(245, 239, 227, .15); overflow: hidden; }
.seats .bar i { display: block; height: 100%; background: var(--gold); }
.plans-fine { font-size: 12px; color: var(--muted); margin: 12px 0 0; text-align: center; }
.founder-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--night); background: var(--gold); border-radius: 999px; padding: 3px 10px; width: fit-content; }
.welcome .founder-badge { margin-top: -2px; }
