/* ── Sales AI ChatBot Assistant · Superdoll brand framework (yellow × charcoal) ───────── */
:root {
  --yellow: #FDC90C;
  --yellow-ink: #1E1F24;
  --charcoal: #343641;
  --charcoal-2: #2B2D36;
  --charcoal-3: #4A4B56;

  --bg: #F3F3F0;
  --surface: #FFFFFF;
  --surface-2: #F7F7F4;
  --line: #E4E4DF;
  --text: #1E1F24;
  --text-2: #4E505A;
  --muted: #7A7C86;
  --bot-bubble: #FFFFFF;
  --user-bubble: var(--yellow);
  --user-ink: #1E1F24;
  --chip: #FFFFFF;
  --chip-line: #DADAD4;
  --shadow: 0 1px 2px rgba(20,20,30,.06), 0 4px 14px rgba(20,20,30,.06);
  --good: #0E8A3A;
  --warn: #B26B00;
  --bad: #C2312E;

  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161B; --surface: #202128; --surface-2: #26272F; --line: #33343D;
    --text: #EEEEEA; --text-2: #C4C5CC; --muted: #9496A0;
    --bot-bubble: #22232B; --chip: #22232B; --chip-line: #3A3B45;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    --good: #3DBE6B; --warn: #E5A33A; --bad: #EF6B68;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15161B; --surface: #202128; --surface-2: #26272F; --line: #33343D;
  --text: #EEEEEA; --text-2: #C4C5CC; --muted: #9496A0;
  --bot-bubble: #22232B; --chip: #22232B; --chip-line: #3A3B45;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  --good: #3DBE6B; --warn: #E5A33A; --bad: #EF6B68;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15.5px; line-height: 1.5;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app { height: 100dvh; display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; position: relative; background: var(--bg); }

/* ── Header ─────────────────────────────────────────────── */
.topbar {
  position: relative; overflow: hidden; flex: none;
  padding: calc(10px + var(--safe-t)) 12px 10px 14px;
  background: linear-gradient(90deg, #4A4A55 0%, var(--charcoal) 45%, var(--charcoal-2) 100%);
  color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 3px solid var(--yellow);
}
.topbar-stripes { position: absolute; right: 92px; top: 0; bottom: 0; display: flex; gap: 7px; pointer-events: none; opacity: .95; }
.topbar-stripes i { width: 14px; height: 140%; margin-top: -10%; background: var(--yellow); transform: skewX(-28deg); }
.topbar-stripes i:nth-child(n+3) { opacity: .55; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; position: relative; z-index: 1; }
.brand-logo { height: 26px; width: auto; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.brand-title { font-weight: 900; font-size: 16px; letter-spacing: .2px; line-height: 1.1; }
.brand-sub { font-size: 12px; color: #D6D6DC; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3DBE6B; box-shadow: 0 0 0 3px rgba(61,190,107,.2); flex: none; }
.dot.busy { background: var(--yellow); box-shadow: 0 0 0 3px rgba(253,201,12,.25); animation: pulse 1.2s infinite; }
.dot.off { background: #EF6B68; box-shadow: 0 0 0 3px rgba(239,107,104,.2); }
.top-actions { display: flex; gap: 4px; position: relative; z-index: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; }
.topbar .icon-btn { background: rgba(255,255,255,.08); }
.topbar .icon-btn:active { background: rgba(255,255,255,.2); }
.topbar .icon-btn circle { fill: currentColor; stroke: none; }

/* ── Chat area ─────────────────────────────────────────── */
.chat { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 14px 6px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.spacer { height: 8px; }

.welcome { padding: 18px 4px 6px; animation: rise .35s ease-out; }
.welcome[hidden] { display: none; }
.welcome-badge { width: 52px; height: 52px; border-radius: 16px; background: var(--yellow); color: var(--charcoal); display: grid; place-items: center; box-shadow: var(--shadow); }
.welcome-badge svg { width: 28px; height: 28px; fill: var(--charcoal); stroke: none; }
.welcome h1 { font-size: 26px; font-weight: 900; margin: 16px 0 4px; letter-spacing: -.2px; }
.welcome p { color: var(--text-2); margin: 0 0 16px; }
.welcome .hint { color: var(--muted); font-size: 13px; margin-top: 14px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 12px 13px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; min-height: 104px;
  position: relative; overflow: hidden; transition: transform .12s;
}
.quick:active { transform: scale(.97); }
.quick::after { content: ""; position: absolute; right: -14px; top: -10px; width: 34px; height: 60px; background: var(--yellow); transform: skewX(-28deg); opacity: .9; }
.quick .q-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--charcoal); color: var(--yellow); display: grid; place-items: center; }
.quick .q-ico svg { width: 18px; height: 18px; }
.quick b { font-size: 14px; font-weight: 700; line-height: 1.25; }
.quick span { font-size: 12px; color: var(--muted); line-height: 1.3; }

/* ── Messages ──────────────────────────────────────────── */
.msg { display: flex; gap: 8px; margin: 10px 0 14px; animation: rise .22s ease-out; }
.msg.user { justify-content: flex-end; }
.msg .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--yellow); color: var(--charcoal); font-weight: 900; font-size: 11.5px; display: grid; place-items: center; flex: none; margin-top: 2px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--charcoal); }
.msg .body { min-width: 0; max-width: calc(100% - 38px); display: flex; flex-direction: column; gap: 8px; }
.msg.user .body { max-width: 84%; align-items: flex-end; }
.bubble { padding: 10px 14px; border-radius: var(--radius); word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--user-bubble); color: var(--user-ink); border-bottom-right-radius: 6px; font-weight: 500; white-space: pre-wrap; }
.msg.bot .bubble { background: var(--bot-bubble); border: 1px solid var(--line); border-top-left-radius: 6px; box-shadow: var(--shadow); }
.msg .time { font-size: 11px; color: var(--muted); padding: 0 4px; }

.md p { margin: 0 0 8px; } .md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 4px 0 8px; padding-left: 20px; } .md li { margin: 2px 0; }
.md strong { font-weight: 700; }
.md code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.md pre { background: var(--surface-2); padding: 10px; border-radius: 10px; overflow-x: auto; font-size: 12px; }
.md table { border-collapse: collapse; font-size: 13px; margin: 6px 0; display: block; overflow-x: auto; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.caret::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px; background: var(--yellow); animation: blink .9s steps(1) infinite; border-radius: 1px; }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px dashed var(--chip-line); padding: 6px 12px; border-radius: 999px; align-self: flex-start; }
.status.done { opacity: .6; border-style: solid; }
.status .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--yellow); animation: spin .8s linear infinite; }
.status.done .spin { animation: none; border-color: var(--good); }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

.err { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); padding: 9px 12px; border-radius: 12px; font-size: 14px; }
.divider { text-align: center; font-size: 12px; color: var(--muted); margin: 14px 0; }

/* ── Cards (table / chart / report / kpis) ─────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.card-title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.card-sub { font-size: 12px; color: var(--muted); }
.card-actions { display: flex; gap: 6px; flex: none; }
.pill { border: 1px solid var(--chip-line); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.pill:active { transform: scale(.96); }
.pill svg { width: 14px; height: 14px; }

.tbl-wrap { overflow: auto; max-height: 360px; }
.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--yellow); color: var(--yellow-ink); text-align: left; font-weight: 700; padding: 7px 10px; white-space: nowrap; cursor: pointer; user-select: none; font-size: 12px; }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th .arrow { opacity: .6; margin-left: 3px; font-size: 10px; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.tbl tbody tr:nth-child(even) td { background: var(--surface-2); }
.tbl td.neg { color: var(--bad); }
.tbl-more { width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--surface); padding: 9px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.bad  { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

.chart-box { padding: 10px 12px 12px; position: relative; height: 260px; }
.chart-box.tall { height: 340px; }
.chart-data { display: none; } .chart-data.on { display: block; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--yellow); }
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .k-value { font-size: 20px; font-weight: 900; letter-spacing: -.3px; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .k-note { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

.report { display: flex; align-items: center; gap: 12px; padding: 12px; }
.report .r-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--charcoal); color: var(--yellow); display: grid; place-items: center; flex: none; position: relative; overflow: hidden; }
.report .r-ico::after { content: ""; position: absolute; right: -6px; bottom: -8px; width: 12px; height: 30px; background: var(--yellow); transform: skewX(-28deg); }
.report .r-main { flex: 1; min-width: 0; }
.report .r-title { font-weight: 700; font-size: 14px; }
.report .r-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 700; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--yellow); color: var(--yellow-ink); }
.btn.dark { background: var(--charcoal); color: #fff; }

.suggest { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; margin-left: 38px; }
.suggest::-webkit-scrollbar { display: none; }
.chip { flex: none; max-width: 260px; text-align: left; background: var(--chip); border: 1px solid var(--chip-line); border-radius: 999px; padding: 7px 13px; font-size: 13px; line-height: 1.3; box-shadow: var(--shadow); }
.chip:active { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); }
.msg-tools { display: flex; gap: 2px; margin-left: -6px; }
.msg-tools button { border: 0; background: transparent; color: var(--muted); padding: 4px 6px; border-radius: 8px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.msg-tools button svg { width: 15px; height: 15px; }
.msg-tools button:active { background: var(--surface-2); }

/* ── Composer ──────────────────────────────────────────── */
.composer-wrap { flex: none; padding: 8px 10px calc(10px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); position: relative; }
.composer { display: flex; align-items: flex-end; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 5px 5px 5px 4px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 30%, transparent), var(--shadow); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 16px; line-height: 1.4; padding: 9px 4px; max-height: 140px; }
.composer textarea::placeholder { color: var(--muted); }
.mic { color: var(--text-2); }
.mic.on { background: var(--bad); color: #fff; animation: pulse 1.2s infinite; }
.send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--yellow); color: var(--charcoal); display: grid; place-items: center; flex: none; transition: transform .12s, opacity .2s; }
.send svg { fill: var(--charcoal); stroke: var(--charcoal); stroke-width: 1.5; width: 20px; height: 20px; }
.send:disabled { opacity: .45; }
.send:not(:disabled):active { transform: scale(.92); }
.send.stop svg { fill: var(--charcoal); }

.mention { position: absolute; left: 10px; right: 10px; bottom: calc(100% - 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; animation: rise .15s ease-out; }
.mention-tabs { display: flex; gap: 4px; padding: 8px 8px 6px; border-bottom: 1px solid var(--line); }
.mention-tabs button { border: 0; background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 500; }
.mention-tabs button.on { background: var(--charcoal); color: #fff; }
.mention-list { max-height: 230px; overflow-y: auto; }
.mention-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 0; background: transparent; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.mention-item:active, .mention-item.sel { background: color-mix(in srgb, var(--yellow) 22%, transparent); }
.mention-item small { color: var(--muted); white-space: nowrap; }
.mention-empty { padding: 12px; color: var(--muted); font-size: 13px; }

.to-bottom { position: absolute; right: 16px; bottom: calc(86px + var(--safe-b)); width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 5; }
.to-bottom.on { opacity: 1; pointer-events: auto; }

/* ── Sheet / toast ─────────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10,10,15,.45); z-index: 20; animation: fade .2s; }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(100%, 560px); background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px 16px calc(18px + var(--safe-b)); z-index: 21; animation: up .22s ease-out; max-height: 85dvh; overflow-y: auto; }
.sheet[hidden], .sheet-backdrop[hidden] { display: none; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 12px; }
.sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 500; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.seg button.on { background: var(--charcoal); color: #fff; }
.sheet-section { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 14px 0 6px; font-weight: 700; }
.pinned { display: flex; flex-direction: column; gap: 6px; }
.pinned .p-item { display: flex; align-items: center; gap: 6px; }
.pinned .p-item button:first-child { flex: 1; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 8px 10px; font-size: 14px; }
.pinned .p-item .x { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; }
.pinned .p-empty { color: var(--muted); font-size: 13px; }
.sheet-btn { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 13px 0; border-bottom: 1px solid var(--line); font-weight: 500; text-decoration: none; color: var(--text); }
.sheet-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--charcoal); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 30; max-width: 90%; text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Login ─────────────────────────────────────────────── */
.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #4A4A55, var(--charcoal-2)); position: relative; overflow: hidden; }
.login-hero { position: absolute; left: -40px; top: 0; bottom: 0; display: flex; gap: 14px; }
.login-hero i { width: 46px; height: 120%; margin-top: -10%; background: var(--yellow); transform: skewX(-24deg); opacity: .9; }
.login-hero i:nth-child(n+4) { opacity: .35; }
.login-card { position: relative; width: min(100%, 360px); background: var(--surface); color: var(--text); border-radius: 22px; padding: 26px 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 10px; text-align: center; }
.login-logo { height: 36px; margin: 0 auto 6px; }
.login-card h1 { margin: 0; font-weight: 900; font-size: 24px; }
.login-card p { margin: 0 0 8px; color: var(--muted); }
.login-card input { font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); outline: 0; }
.login-card input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 30%, transparent); }
.login-card button { font-weight: 900; font-size: 16px; padding: 12px; border: 0; border-radius: 12px; background: var(--yellow); color: var(--yellow-ink); }
.login-err { color: var(--bad); font-size: 13.5px; }
.login-foot { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes fade { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes pulse { 50% { opacity: .55; } }

@media (min-width: 700px) {
  .chat { padding: 18px 22px 6px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .composer-wrap { padding-left: 18px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .chat { scroll-behavior: auto; } }

/* ── Chats drawer ──────────────────────────────────────── */
.brand .icon-btn { margin-left: -6px; flex: none; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10,10,15,.45); z-index: 24; animation: fade .2s; }
.drawer-backdrop[hidden], .drawer[hidden] { display: none; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(86vw, 340px); z-index: 25;
  background: var(--surface); display: flex; flex-direction: column;
  padding: calc(10px + var(--safe-t)) 12px calc(12px + var(--safe-b));
  box-shadow: 8px 0 30px rgba(0,0,0,.25); animation: slideIn .22s ease-out;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 10px; }
.drawer-title { font-weight: 900; font-size: 20px; position: relative; padding-left: 12px; }
.drawer-title::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 2px; background: var(--yellow); }
.drawer-new { display: flex; align-items: center; gap: 8px; border: 0; border-radius: 14px; padding: 11px 14px; background: var(--yellow); color: var(--yellow-ink); font-weight: 700; font-size: 15px; }
.drawer-new svg { width: 18px; height: 18px; }
.drawer-new:active { transform: scale(.98); }
.drawer-search { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.drawer-search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.drawer-search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; padding: 9px 0; min-width: 0; }
.chat-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.chat-group { font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 14px 6px 6px; }
.chat-item { display: flex; align-items: center; gap: 4px; border-radius: 12px; }
.chat-item.active { background: color-mix(in srgb, var(--yellow) 22%, transparent); }
.chat-item .open { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 9px 8px; border-radius: 12px; }
.chat-item .open:active { background: var(--surface-2); }
.chat-item .c-title { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .c-meta { font-size: 12px; color: var(--muted); }
.chat-item .more { width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); border-radius: 50%; flex: none; display: grid; place-items: center; }
.chat-item .more svg { width: 18px; height: 18px; }
.chat-item .more circle { fill: currentColor; stroke: none; }
.chat-item .more:active { background: var(--surface-2); }
.chat-actions { display: flex; gap: 6px; padding: 0 8px 8px; }
.chat-actions button { flex: 1; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 7px; font-size: 13px; font-weight: 500; }
.chat-actions button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.chat-empty { color: var(--muted); font-size: 13.5px; padding: 18px 8px; text-align: center; }
.chat-skel { height: 44px; border-radius: 12px; background: var(--surface-2); margin: 8px 4px; animation: pulse 1.2s infinite; }
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: none; } }

/* ── Data freshness (menu) ─────────────────────────────── */
.fresh { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; }
.fresh::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.fresh.ok::before { background: var(--good); }
.fresh.old::before { background: var(--warn); }
.fresh.busy::before { background: var(--yellow); animation: pulse 1.2s infinite; }

/* ── Header v2: logo on top, title under it; + and ⋮ stacked on the right ── */
.topbar { padding: calc(6px + var(--safe-t)) 10px 8px 10px; align-items: center; }
.brand {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto;
  column-gap: 8px; row-gap: 4px; align-items: center;
}
.brand #chatsBtn { grid-column: 1; grid-row: 1 / span 2; margin-left: 0; }
.brand-logo { grid-column: 2; grid-row: 1; justify-self: start; align-self: start; height: 24px; margin-top: -2px; }
.brand-text { grid-column: 2; grid-row: 2; min-width: 0; }
.brand-title { font-size: 14.5px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { flex-direction: column; gap: 4px; align-self: center; }
.topbar .top-actions .icon-btn { width: 30px; height: 30px; }
.topbar .top-actions .icon-btn svg { width: 17px; height: 17px; }
.topbar-stripes { right: 52px; }
/* header right buttons: compact */
.top-actions { gap: 2px; }
.topbar .top-actions .icon-btn { width: 24px; height: 24px; }
.topbar .top-actions .icon-btn svg { width: 13px; height: 13px; }
.topbar-stripes { right: 44px; }

/* header: keep + / ⋮ clear of the stripes */
.top-actions { align-self: flex-end; margin-top: 12px; }
.topbar-stripes { right: 64px; }

/* ── Login v2: card dead-centre, stripes running through the middle ── */
.login-body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; box-sizing: border-box; position: relative; overflow: hidden;
}
.login-hero {
  position: absolute; top: 0; bottom: 0; left: 50%; right: auto;
  transform: translateX(-50%); display: flex; gap: 18px; pointer-events: none;
}
.login-hero i { width: 54px; height: 130%; margin-top: -15%; transform: skewX(-24deg); }
.login-hero i:nth-child(1), .login-hero i:nth-child(5) { opacity: .35; }
.login-hero i:nth-child(2), .login-hero i:nth-child(4) { opacity: .7; }
.login-hero i:nth-child(3) { opacity: .95; }
.login-card { margin: auto; z-index: 1; }

/* header stripes: nudge right */
.topbar-stripes { right: 54px; }
.fresh.off { color: var(--bad); }
.fresh.off::before { background: var(--bad); }

/* ── Account / user-management pages ───────────────────────────────────────── */
.page-body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: Roboto, system-ui, sans-serif; }
.page-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(12px + var(--safe-t)) 16px 12px; background: var(--charcoal); color: #fff; overflow: hidden; }
.page-bar h1 { margin: 0; font-size: 18px; font-weight: 900; }
.page-back { color: var(--yellow); text-decoration: none; font-size: 30px; line-height: 1; padding: 0 6px 4px 0; }
.page-stripes { position: absolute; right: 54px; top: 0; bottom: 0; display: flex; gap: 8px; }
.page-stripes i { width: 14px; height: 140%; margin-top: -20%; background: var(--yellow); transform: skewX(-24deg); }
.page-stripes i:nth-child(2) { opacity: .6; } .page-stripes i:nth-child(3) { opacity: .3; }
.page-main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(32px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; }
.page-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.page-card h2 { margin: 0; font-size: 16px; font-weight: 900; display: inline; }
.page-card summary { cursor: pointer; list-style: none; }
.page-card summary::-webkit-details-marker { display: none; }
.page-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 4px 0; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; } .kv span { color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.form.inline { flex-direction: row; flex-wrap: wrap; }
.form.inline input { flex: 1 1 160px; }
.form input[type=text], .form input[type=password], .form input:not([type]) { font: inherit; font-size: 16px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2, var(--surface)); color: var(--text); outline: 0; min-width: 0; }
.form input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 30%, transparent); }
.role-seg { display: flex; gap: 16px; padding: 4px 2px; }
.role-seg label { display: flex; align-items: center; gap: 6px; }
.btn-yellow { font: inherit; font-weight: 900; font-size: 15px; padding: 12px; border: 0; border-radius: 12px; background: var(--yellow); color: var(--yellow-ink); cursor: pointer; }
.btn-line { font: inherit; font-weight: 700; font-size: 13.5px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--chip-line); background: var(--chip); color: var(--text); cursor: pointer; }
.btn-line.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hint, .muted { color: var(--muted); font-size: 12.5px; margin: 0; }
.page-msg { padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 500; }
.page-msg.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.page-msg.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.user-head { display: flex; gap: 12px; align-items: center; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--yellow); color: var(--yellow-ink); }
.user-card.off .avatar { background: var(--line); color: var(--muted); }
.who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.who span { font-size: 13px; color: var(--text-2, var(--muted)); }
.who em { font-style: normal; color: var(--muted); font-weight: 500; }
.user-actions { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.user-actions > summary { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.me-row b { font-weight: 700; }

/* ══ Clean & light v3 — same colours, header, drawer and menu; calmer type and surfaces ══ */
:root {
  --bg: #FAFAF8; --surface-2: #F5F5F2; --line: #ECECE7; --chip-line: #E2E2DC;
  --text: #23242B; --text-2: #5A5C66; --muted: #8A8C95;
  --shadow: 0 1px 2px rgba(20,20,30,.04);
  --radius: 16px;
  --ease: cubic-bezier(.2,.7,.2,1);
}
:root[data-theme="dark"] { --bg: #16171C; --line: #2C2D35; --shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #16171C; --line: #2C2D35; --shadow: none; } }

body, .page-body {
  font-family: Inter, -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.6; letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
.brand-title { font-weight: 600; letter-spacing: 0; }

/* welcome */
.welcome { padding: 28px 4px 8px; }
.welcome-badge { display: none; }
.welcome h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
.welcome p { color: var(--muted); font-size: 15px; margin-bottom: 20px; }
.quick { box-shadow: none; border-color: var(--line); border-radius: 14px; min-height: 96px; gap: 10px;
         transition: transform .18s var(--ease), border-color .18s, background .18s; }
.quick:hover { border-color: var(--chip-line); background: var(--surface-2); }
.quick::after { width: 26px; height: 48px; right: -12px; top: -12px; opacity: .75; }
.quick .q-ico { width: 30px; height: 30px; border-radius: 9px; }
.quick b { font-weight: 600; font-size: 14px; }
.quick span { font-size: 12.5px; }

/* messages: bot answers are plain text on the page, user keeps the yellow bubble */
.msg { margin: 6px 0 22px; animation: rise .3s var(--ease); }
.msg.bot .avatar { display: none; }
.msg .body { max-width: 100%; gap: 12px; }
.msg.bot .bubble { background: transparent; border: 0; box-shadow: none; padding: 0 2px; border-radius: 0; }
.msg.user .bubble { font-weight: 400; padding: 9px 15px; border-radius: 20px 20px 6px 20px; }
.msg .time { font-size: 11px; }
.md p { margin: 0 0 10px; }
.md strong { font-weight: 600; }
.md ul, .md ol { padding-left: 22px; } .md li { margin: 4px 0; }
.md h1, .md h2, .md h3 { font-size: 15.5px; font-weight: 600; margin: 14px 0 6px; }
.caret::after { display: none; }
.typing { padding: 6px 2px; } .typing i { width: 6px; height: 6px; }
.status { border: 0; background: transparent; padding: 2px 2px; font-size: 13px; color: var(--muted); }
.status .spin { width: 12px; height: 12px; border-width: 1.5px; }
.status.done { display: none; }

/* cards, tables, KPIs */
.card { box-shadow: none; border-radius: 14px; }
.card-head { padding: 12px 14px 10px; }
.card-title { font-weight: 600; }
.pill { background: transparent; font-weight: 500; }
.tbl { font-size: 13px; }
.tbl th { font-weight: 600; padding: 8px 12px; }
.tbl td { padding: 8px 12px; }
.tbl tbody tr:nth-child(even) td { background: transparent; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl-more { font-weight: 500; }
.kpi { box-shadow: none; border-radius: 12px; padding: 12px 14px; }
.kpi::before { width: 3px; }
.kpi .k-value { font-weight: 600; letter-spacing: -.02em; }
.report .r-title, .btn { font-weight: 600; }

/* follow-up chips and message tools */
.suggest { margin-left: 0; }
.chip { box-shadow: none; background: transparent; font-size: 13px; padding: 7px 14px; transition: background .15s, border-color .15s; }
.chip:hover { background: var(--surface-2); }
.msg-tools { margin-left: -4px; opacity: .75; }

/* composer */
.composer { box-shadow: 0 2px 10px rgba(20,20,30,.05); border-color: var(--line); border-radius: 24px; }
.composer:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 22%, transparent); }
.composer textarea { font-size: 16px; }
.send { transition: transform .15s var(--ease), opacity .2s; }

/* sheet, drawer, toast, login, pages: lighter weights only */
.sheet-row, .sheet-btn { font-weight: 400; }
.sheet-section, .chat-group, .page-section { font-weight: 600; letter-spacing: .04em; }
.fresh { font-weight: 500; }
.drawer-title { font-weight: 600; }
.drawer-new { font-weight: 600; border-radius: 12px; }
.chat-item .c-title { font-weight: 400; }
.mention, .to-bottom { box-shadow: 0 4px 16px rgba(20,20,30,.08); }
.login-card h1 { font-weight: 600; font-size: 21px; letter-spacing: -.01em; }
.login-card button, .btn-yellow { font-weight: 600; }
.login-foot { font-weight: 500; }
.page-bar h1, .page-card h2 { font-weight: 600; }
.btn-line { font-weight: 500; }
.avatar { font-weight: 600; }
.page-card { box-shadow: none; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Notifications (menu) ─────────────────────────────────────────────────── */
.notif { display: flex; flex-direction: column; gap: 2px; }
.notif-on { border: 0; border-radius: 12px; padding: 11px 14px; background: var(--yellow); color: var(--yellow-ink); font-weight: 600; text-align: left; }
.notif-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; cursor: pointer; }
.notif-row input { width: 40px; height: 22px; appearance: none; -webkit-appearance: none; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .2s; cursor: pointer; }
.notif-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.notif-row input:checked { background: var(--charcoal); }
.notif-row input:checked::after { transform: translateX(18px); background: var(--yellow); }
.notif-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.notif-note { font-size: 13.5px; color: var(--text-2); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }

/* ── Web sources under an answer ───────────────────────────────────────────── */
.sources { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 13px; background: var(--surface); }
.sources summary { cursor: pointer; color: var(--text-2); font-weight: 500; list-style: none; }
.sources summary::before { content: "🔗 "; }
.sources summary::-webkit-details-marker { display: none; }
.sources ol { margin: 8px 0 2px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.sources a { color: var(--text); text-decoration: underline; text-decoration-color: var(--yellow); text-underline-offset: 3px; overflow-wrap: anywhere; }
.src-host { display: block; color: var(--muted); font-size: 11.5px; }

/* ── AI usage page ─────────────────────────────────────────────────────────── */
.u-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.u-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.u-tile span { font-size: 12.5px; color: var(--muted); }
.u-tile b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.u-tile em { font-style: normal; font-size: 12px; color: var(--text-2); }
.u-tile.hi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--yellow); }
.u-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin-top: 12px; }
.u-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.u-bar i { width: 100%; max-width: 22px; background: var(--charcoal); border-radius: 4px 4px 0 0; min-height: 2px; }
.u-bar span { font-size: 10.5px; color: var(--muted); }
:root[data-theme="dark"] .u-bar i { background: var(--yellow); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .u-bar i { background: var(--yellow); } }
.u-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
.u-tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.u-tbl td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.u-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.u-q { color: var(--text-2); } .u-q em { color: var(--muted); font-style: normal; }
@media (min-width: 700px) { .u-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── Latest-alert banner (under the header) ────────────────────────────────── */
.alert-bar { display: flex; align-items: center; gap: 8px; margin: 8px 10px 0; padding: 9px 10px 9px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--yellow) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--yellow) 60%, transparent);
  animation: rise .25s var(--ease, ease-out); }
.ab-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.35; }
.ab-text b { font-weight: 600; } .ab-text span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ab-open { flex: none; border: 0; border-radius: 10px; padding: 7px 14px; background: var(--charcoal); color: var(--yellow); font-weight: 600; font-size: 13px; }
.ab-x { flex: none; border: 0; background: transparent; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; }

/* business-line picker (Manage users) */
.lines-pick { border: 1px solid rgba(52,54,65,.15); border-radius: 10px; padding: 10px 12px; margin: 4px 0; }
.lines-pick legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.lines-group { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 0; border-bottom: 1px dashed rgba(52,54,65,.12); }
.lines-group:last-child { border-bottom: 0; }
.lines-group label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
.lines-group .lines-all { flex-basis: 100%; }
