/* Sales Guide — Caparol Georgia
   Brand identity: white chrome + real brand logos; accent follows the brand
   (Caparol red / Alpina blue); the Caparol elephant stripe is the signature
   motif (login card, header rule). All selectors used by app.js preserved.
   2026-07-19 design pass: FiraGO type, token scale, welcome cards, guided
   panel, product/margin cards — critic-panel corrections applied. */

@font-face { font-family: "FiraGO"; font-weight: 400; font-style: normal;
  src: url("/static/fonts/FiraGO-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "FiraGO"; font-weight: 600; font-style: normal;
  src: url("/static/fonts/FiraGO-SemiBold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "FiraGO"; font-weight: 700; font-style: normal;
  src: url("/static/fonts/FiraGO-Bold.woff2") format("woff2"); font-display: swap; }

:root {
  --caparol: #C8102E;
  --alpina: #005CA9;
  --accent: var(--caparol);          /* switched per brand from JS via body classes */
  --accent-dark: #9C0C24;
  --ink: #20242A;
  --ink-2: #4A5058;                  /* secondary ink (positioning lines) */
  --bg: #F4F3F0;
  --card: #FFFFFF;
  --line: #E4E1DB;
  --line-2: #C9C4BB;                 /* stronger line: dashed borders, empty ticks */
  --muted: #6E7680;
  --muted-strong: #565D66;           /* muted that passes contrast at small sizes */
  --field: #F1EFEA;
  --good: #1E6B41;                   /* dealer-margin green ONLY */
  --good-bg: #E1F0E6;
  --radius: 14px;                    /* bubbles, chips, buttons */
  --r-card: 16px;                    /* cards */
  --r-tile: 10px;                    /* icon tiles, badges */
  /* type scale — 12px hard floor for Georgian */
  --fs-caption: .75rem;
  --fs-small: .8125rem;
  --fs-body: .9rem;
  --fs-emph: 1rem;
  --fs-title: 1.0625rem;
  --fs-hero: 1.25rem;
  --stripe: linear-gradient(90deg,
      #FFD400 0 17%, #F59B00 17% 34%, #E63312 34% 50%,
      #C4007A 50% 67%, #0082CA 67% 84%, #3AA935 84% 100%);
  --content-w: 820px;
}
body.brand-alpina { --accent: var(--alpina); --accent-dark: #004A87; }
body.brand-both   { --accent: #383B40; --accent-dark: #202226; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "FiraGO", "Noto Sans Georgian", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: #B00020; font-size: .9rem; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- login ---------- */
.view { min-height: 100%; }
#view-login {
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(200,16,46,.05), transparent 60%),
    radial-gradient(55% 45% at 95% 100%, rgba(0,92,169,.06), transparent 60%),
    var(--bg);
}
#view-login.hidden { display: none; }
.login-card {
  background: var(--card); border-radius: 18px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(32,36,42,.10), 0 2px 8px rgba(32,36,42,.06);
  padding: 0; width: 100%; max-width: 400px; text-align: center;
}
.login-card::before { content: ""; display: block; height: 6px; background: var(--stripe); }
.login-inner { padding: 34px 32px 30px; }
.login-logos {
  display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 20px;
}
.login-logos img { height: 44px; width: auto; }
.login-logos .logo-sep { width: 1px; height: 34px; background: var(--line); }
.login-card h1 {
  margin: 0 0 4px; font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em;
}
.login-card .muted { font-size: .92rem; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.login-card input {
  padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 1rem; font-family: inherit; background: var(--field);
  transition: border-color .15s, background .15s;
}
.login-card input:focus { border-color: var(--caparol); background: #fff; outline: none; }
.login-card button {
  margin-top: 4px; padding: 13px; border: 0; border-radius: 12px;
  background: var(--caparol); color: #fff; font-size: 1.02rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.login-card button:hover { background: var(--accent-dark); }
.login-card button:active { background: var(--accent-dark); }
.login-foot { margin-top: 18px; font-size: .78rem; color: var(--muted); }

/* ---------- chat ---------- */
#view-chat { display: flex; flex-direction: row; height: 100dvh; }
#chat-column { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; height: 100dvh; }
#view-chat.hidden { display: none; }
#chat-header {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); color: var(--ink); padding: 10px 16px;
  flex: 0 0 auto; position: relative;
  border-bottom: 1px solid var(--line);
}
#chat-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px;
  background: var(--stripe); opacity: .9;
}
#chat-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-title {
  font-weight: 700; font-size: .98rem; letter-spacing: -.01em; white-space: nowrap;
  color: var(--ink);
}
.header-spacer { flex: 1; }
.header-btn {
  background: transparent; color: var(--ink); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 6px 13px; font-size: .84rem; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.header-btn:hover { border-color: var(--accent); color: var(--accent); }
.header-btn:active { background: var(--field); }
@media (max-width: 520px) {
  #chat-header { padding: 9px 10px; gap: 6px; }
  .brand-logo { height: 22px; }
  .brand-title { font-size: .9rem; }
  .header-btn { padding: 5px 9px; font-size: .78rem; }
}
body { overflow-x: clip; }

#messages { flex: 1 1 auto; overflow-y: auto; padding: 18px 14px 6px; }
#messages > * { max-width: var(--content-w); margin-left: auto; margin-right: auto; }

.msg {
  padding: 12px 16px; border-radius: var(--radius); line-height: 1.5;
  word-wrap: break-word; white-space: normal; margin-bottom: 12px;
}
.msg.user {
  background: #EDE9E3;
  background: color-mix(in srgb, var(--accent) 8%, #fff);
  border: 1px solid transparent;
  border-color: color-mix(in srgb, var(--accent) 16%, transparent);
  max-width: min(88%, 640px); margin-right: 0; margin-left: auto;
  border-bottom-right-radius: 5px;
}
.msg.bot {
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(32,36,42,.05);
  border-bottom-left-radius: 5px;
  max-width: min(94%, var(--content-w)); margin-left: 0;
}
.msg.bot.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg.bot.waiting::after { content: none; }  /* no cursor while the loader shows */

/* Perceived latency: thinking happens before the first token arrives. Instead
   of an empty bubble, the Caparol elephant paints a wall (pilot feedback
   2026-07-18). Pure CSS; the whole loader is replaced by real text on the
   first token or on any error (finishBubble). */
.paint-loader { display: flex; align-items: center; gap: 11px; padding: 1px 0; }
.paint-ele { height: 34px; width: auto; transform-origin: 60% 100%;
  animation: ele-bob 1.15s ease-in-out infinite; }
.paint-scene {
  position: relative; width: 30px; height: 34px; flex: 0 0 auto;
  border-radius: 4px; overflow: hidden;
  background: var(--field); border: 1px solid var(--line);
}
.paint-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #5AA53C;
  animation: paint-rise 2.4s ease-in-out infinite, paint-hue 7.2s linear infinite;
}
.paint-roller {
  position: absolute; left: 2px; right: 2px; top: 27px; height: 5px;
  border-radius: 2px; background: var(--ink); opacity: .7;
  animation: paint-roll 2.4s ease-in-out infinite;
}
.paint-text { color: var(--muted); font-size: .9em; animation: blink 1.4s infinite; }
@keyframes ele-bob { 0%,100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes paint-rise { 0% { height: 0; } 55% { height: 100%; } 92% { height: 100%; } 100% { height: 0; } }
@keyframes paint-roll { 0% { top: 27px; } 55% { top: 2px; } 92% { top: 2px; } 100% { top: 27px; } }
@keyframes paint-hue { 0% { background: #5AA53C; } 33% { background: #C8102E; }
  66% { background: #005CA9; } 100% { background: #5AA53C; } }
@media (prefers-reduced-motion: reduce) {
  .msg.bot.streaming::after { animation: none; }
  .paint-ele, .paint-fill, .paint-roller, .paint-text { animation: none; }
  .paint-fill { height: 60%; }
}
.msg p { margin: 0 0 9px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 6px 0 10px; padding-left: 22px; }
.msg li { margin-bottom: 3px; }
.msg h4 {
  margin: 14px 0 6px; font-size: .98rem; font-weight: 700; letter-spacing: .01em;
}
.msg h4:first-child { margin-top: 2px; }
.msg b { font-weight: 700; }
.msg code {
  background: var(--field); padding: 1px 6px; border-radius: 6px; font-size: .9em;
  font-family: ui-monospace, Consolas, monospace;
}
.msg .cite {
  display: inline-block; color: var(--muted); font-size: .78em;
  background: var(--field); border-radius: 999px; padding: 1px 8px; vertical-align: middle;
}
.flag-btn {
  display: inline-block; margin-top: 8px; border: 0; background: none;
  color: var(--muted); font-size: .78rem; cursor: pointer; padding: 0;
  opacity: .8;
}
.flag-btn:hover { opacity: 1; color: var(--accent-dark); }
.flag-btn.flagged { color: #B00020; opacity: 1; }
.sys-note {
  text-align: center; color: var(--muted); font-size: .84rem; margin: 12px auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 16px; width: fit-content; max-width: 92%;
}

#options-bar {
  flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 14px; width: 100%; max-width: calc(var(--content-w) + 28px);
  margin: 0 auto; justify-content: flex-start;
}
#options-bar button {
  border: 1.5px solid var(--accent); color: var(--accent); background: var(--card);
  border-radius: 999px; padding: 9px 16px; font-size: .93rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 3px rgba(32,36,42,.06);
  transition: background .15s, color .15s;
}
#options-bar button:hover {
  background: #FBF4F4;
  background: color-mix(in srgb, var(--accent) 7%, #fff);
}
#options-bar button:active { background: var(--accent); color: #fff; }
#options-bar button.selected { background: var(--accent); color: #fff; }
#options-bar button.confirm {
  background: var(--accent); color: #fff; font-weight: 700;
}
#options-bar button.confirm:disabled { opacity: .4; cursor: default; }

#composer {
  flex: 0 0 auto; display: flex; gap: 10px; align-items: flex-end;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
#composer::before { content: ""; }  /* keeps flex intact if empty */
#input {
  flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 11px 14px; font-size: 1rem; font-family: inherit; max-height: 120px;
  background: var(--field); transition: border-color .15s, background .15s;
  max-width: calc(var(--content-w) - 56px); margin-left: auto;
}
#input:focus { border-color: var(--accent); background: #fff; outline: none; }
#btn-send {
  border: 0; background: var(--accent); color: #fff; border-radius: 50%;
  width: 46px; height: 46px; font-size: 1.05rem; cursor: pointer; flex: 0 0 auto;
  box-shadow: 0 2px 6px rgba(32,36,42,.15);
  transition: background .15s; margin-right: auto;
}
#btn-send:hover { background: var(--accent-dark); }
#btn-send:disabled { opacity: .45; cursor: default; }
@media (min-width: 900px) {
  #composer { justify-content: center; }
  #input { margin-left: 0; }
  #btn-send { margin-right: 0; }
}

/* ---------- history rows (admin transcript reuse) ---------- */
.hist-row .hist-title {
  font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-row { margin-bottom: 10px; }
.badge {
  display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 999px;
  padding: 1px 9px; vertical-align: middle;
}
.badge.active { color: #1E6B41; background: #E1F0E6; }
.badge.closed { color: var(--muted); background: var(--field); }
.hist-row .admin-transcript .msg { max-width: 100%; margin-bottom: 8px; font-size: .9rem; }
.hist-row .admin-transcript .msg.user { max-width: 85%; }

/* ---------- admin ---------- */
#view-admin { display: flex; flex-direction: column; height: 100dvh; }
#view-admin.hidden { display: none; }
#admin-header {
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; padding: 11px 16px;
  font-weight: 600; font-size: .95rem; flex: 0 0 auto;
}
#admin-header .header-btn { color: #fff; border-color: rgba(255,255,255,.3); }
#admin-header .header-btn:hover { border-color: #fff; color: #fff; }
#admin-tabs {
  display: flex; gap: 2px; padding: 0 12px; background: var(--card);
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
#admin-tabs button {
  border: 0; background: none; border-bottom: 3px solid transparent;
  padding: 12px 14px 9px; font-size: .92rem; font-weight: 600; color: var(--muted);
  cursor: pointer;
}
#admin-tabs button.active { color: var(--ink); border-bottom-color: var(--caparol); }
#admin-content { flex: 1 1 auto; overflow-y: auto; padding: 14px; }
#admin-content > * { max-width: 900px; margin-left: auto; margin-right: auto; }
.admin-row {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 3px rgba(32,36,42,.04);
  padding: 12px 16px; margin-bottom: 10px; cursor: pointer; font-size: .95rem;
}
.admin-row .meta { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.admin-transcript {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin-top: 10px;
}
.admin-transcript .t-msg { margin-bottom: 10px; white-space: pre-wrap; font-size: .88rem; }
.admin-transcript .t-msg b { color: var(--accent-dark); }
.admin-empty { color: var(--muted); text-align: center; margin-top: 30px; }

/* ================= 2026-07-19 design pass components ================= */

/* ---------- header: user chip + menu ---------- */
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer;
  font-size: var(--fs-caption); font-weight: 600; min-height: 32px;
  transition: border-color .15s, background .12s;
}
.user-chip:hover { border-color: var(--accent); }
.user-chip:active { background: var(--field); }
.user-chip .ava {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; flex: 0 0 auto;
}
.user-chip .role { color: var(--muted-strong); font-weight: 600; }
#user-menu {
  position: absolute; top: calc(100% + 8px); right: 10px; z-index: 30;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(32,36,42,.14), 0 2px 8px rgba(32,36,42,.08);
  display: flex; flex-direction: column; min-width: 190px; overflow: hidden; padding: 6px;
}
#user-menu button {
  border: 0; background: none; text-align: left; cursor: pointer;
  padding: 11px 12px; font-size: var(--fs-body); font-weight: 600; color: var(--ink);
  border-radius: var(--r-tile); min-height: 42px;
}
#user-menu button:hover { background: var(--field); }
#user-menu button:active { background: var(--line); }
#user-menu .menu-danger { color: #B00020; }

/* ---------- guided panel (welcome + tree steps, lives in #messages) ---------- */
#guided-panel { margin-bottom: 12px; }
.hello { margin: 4px 2px 12px; }
.hello .hi { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -.01em; }
.hello .q { color: var(--muted-strong); font-size: var(--fs-body); margin-top: 3px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.crumb {
  border: 1px solid var(--line); background: var(--card); color: var(--muted-strong);
  border-radius: 999px; padding: 4px 11px; font-size: var(--fs-caption); font-weight: 600;
  cursor: pointer; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb:hover { border-color: var(--accent); color: var(--accent); }
.crumb:active { background: var(--field); }

.g-question { font-weight: 700; font-size: var(--fs-title); margin: 0 2px 10px; }
.g-question small { color: var(--muted-strong); font-weight: 400; font-size: var(--fs-small); }

.g-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
.g-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  cursor: pointer; text-align: left; box-shadow: 0 1px 4px rgba(32,36,42,.05);
  font-size: var(--fs-body); font-weight: 600; color: var(--ink); line-height: 1.3;
  transition: transform .12s, border-color .15s; min-height: 44px;
  min-width: 0; overflow-wrap: anywhere;
}
.g-card:hover { border-color: var(--accent); }
.g-card:active { transform: scale(.98); background: var(--field); }
.g-card .ic {
  width: 32px; height: 32px; border-radius: var(--r-tile); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: #F7EDEF;
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  color: var(--accent);
}
.g-card .ic svg { width: 18px; height: 18px; }
.g-card.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.g-card.wide small { display: block; color: var(--muted-strong); font-weight: 400; font-size: var(--fs-caption); margin-top: 2px; }

.g-list { display: flex; flex-direction: column; gap: 8px; }
.g-chip {
  display: flex; align-items: center; gap: 11px; text-align: left;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 11px 12px; font-weight: 600; font-size: var(--fs-body); color: var(--ink);
  cursor: pointer; box-shadow: 0 1px 3px rgba(32,36,42,.04); min-height: 46px;
  transition: border-color .15s, background .12s;
}
.g-chip:hover { border-color: var(--accent); }
.g-chip:active { transform: scale(.99); background: var(--field); }
.g-chip .tick {
  margin-left: auto; width: 21px; height: 21px; border-radius: 7px;
  border: 2px solid #9AA0A8; flex: 0 0 auto; position: relative;
}
.g-chip.on { border-color: var(--accent);
  background: #FBF4F5; background: color-mix(in srgb, var(--accent) 5%, #fff); }
.g-chip.on .tick { border: 0; background: var(--accent); }
.g-chip.on .tick::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(42deg);
}
.g-confirm {
  margin-top: 10px; width: 100%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; border-radius: var(--radius);
  padding: 13px; font-weight: 700; font-size: var(--fs-emph); min-height: 48px;
}
.g-confirm:disabled { opacity: .45; cursor: default; }
.g-confirm:active:not(:disabled) { background: var(--accent-dark); }

/* ---------- options bar: safety net + close pill ---------- */
#options-bar { max-height: 40dvh; overflow-y: auto; }
#options-bar button.close-pill {
  border-color: var(--good); color: var(--good); font-weight: 700;
}
#options-bar button.close-pill:hover { background: #EFF7F1; }
#options-bar button.close-pill:active { background: var(--good); color: #fff; }

/* ---------- rich answer blocks (final render only) ---------- */
.md-table-wrap { overflow-x: auto; margin: 8px 0 10px; }
.md-table { border-collapse: collapse; font-size: var(--fs-small); min-width: 100%; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.md-table th { background: var(--field); font-weight: 700; }

.pcards { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.pcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 10px 12px; box-shadow: 0 1px 4px rgba(32,36,42,.05);
  display: flex; align-items: center; gap: 10px;
}
.pcard .p-main { min-width: 0; flex: 1; }
.pcard .p-name { font-weight: 700; font-size: var(--fs-body); }
.pcard .p-pos { color: var(--ink-2); font-size: var(--fs-caption); margin-top: 2px; line-height: 1.4; }
.pcard .p-price {
  font-weight: 700; font-size: var(--fs-body); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pcard.star { border: 1.5px solid var(--accent); flex-direction: column; align-items: stretch;
  gap: 6px; padding: 12px 13px; position: relative; margin-top: 12px;
  box-shadow: 0 4px 14px rgba(32,36,42,.10); }
.pcard.star .p-head { display: flex; align-items: center; gap: 10px; }
.pcard.star .p-price { font-size: var(--fs-emph); margin-left: auto; }
.pcard .ribbon {
  position: absolute; top: -9px; left: 12px; background: var(--accent); color: #fff;
  font-size: var(--fs-caption); font-weight: 700; border-radius: 999px; padding: 2px 11px;
}

/* dealer margin block — the ONLY green surface */
.money {
  background: #FBFDFB; border: 1px solid var(--line); border-left: 4px solid var(--good);
  border-radius: var(--r-card); padding: 12px 14px; margin: 10px 0;
}
.money .m-title {
  display: flex; align-items: center; gap: 8px; font-weight: 700;
  font-size: var(--fs-body); color: var(--good); margin-bottom: 6px;
}
.money p, .money li { font-variant-numeric: tabular-nums; }
.money .m-hl {
  background: var(--good-bg); border-radius: var(--r-tile); padding: 7px 11px;
  font-weight: 700; color: var(--good);
}

@media (max-width: 380px) { .g-grid { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 520px) { .user-chip .role { display: none; } }

/* ================= 2026-10-21: left panel + arguments drop-down ================= */

/* ---------- left panel: own conversations + functions ---------- */
#side-panel {
  width: 276px; flex: 0 0 276px; height: 100dvh;
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.sp-top { padding: 14px 12px 10px; border-bottom: 1px solid var(--line); }
.sp-new {
  width: 100%; border: 0; cursor: pointer; min-height: 44px;
  background: var(--accent); color: #fff; border-radius: var(--radius);
  padding: 11px; font-weight: 700; font-size: var(--fs-body);
  transition: background .15s;
}
.sp-new:hover { background: var(--accent-dark); }
.sp-section-title {
  padding: 12px 14px 6px; font-size: var(--fs-caption); font-weight: 700;
  color: var(--muted-strong); letter-spacing: .04em; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px;
}
.sp-count {
  font-weight: 600; color: var(--muted); background: var(--field);
  border-radius: 999px; padding: 0 7px; font-size: .7rem; text-transform: none;
}
.sp-list { flex: 1 1 auto; overflow-y: auto; padding: 0 8px 8px; }
.sp-empty { color: var(--muted); font-size: var(--fs-small); padding: 8px 10px; margin: 0; }
.sp-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid transparent; background: none; border-radius: var(--r-tile);
  padding: 8px 10px; margin-bottom: 2px; font-family: inherit; color: var(--ink);
  transition: background .12s, border-color .12s;
}
.sp-item:hover { background: var(--field); }
.sp-item.current {
  background: color-mix(in srgb, var(--accent) 8%, #fff);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}
.sp-item .t {
  font-size: var(--fs-small); font-weight: 600; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-item .m {
  font-size: var(--fs-caption); color: var(--muted); margin-top: 3px;
  display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden;
}
.sp-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); flex: 0 0 auto; }
.sp-item.active .dot { background: #1E6B41; }
.sp-bottom { border-top: 1px solid var(--line); padding: 4px 8px 10px; }
.sp-fn {
  display: block; width: 100%; text-align: left; cursor: pointer; min-height: 42px;
  border: 0; background: none; padding: 10px; border-radius: var(--r-tile);
  font-size: var(--fs-body); font-weight: 600; color: var(--ink); font-family: inherit;
}
.sp-fn:hover { background: var(--field); }
.sp-fn.danger { color: #B00020; }
.sp-user {
  padding: 8px 10px 0; font-size: var(--fs-caption); color: var(--muted-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#btn-panel { display: none; padding: 5px 10px; font-size: 1.05rem; line-height: 1; }
@media (max-width: 899px) {
  #side-panel {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 0 10px 30px rgba(32,36,42,.22);
  }
  body.panel-open #side-panel { transform: none; }
  #sp-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(32,36,42,.35); }
  #btn-panel { display: inline-flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) { #side-panel { transition: none; } }

/* ---------- arguments drop-down inside a bot bubble ---------- */
.msg details.args { margin-top: 10px; border-top: 1px dashed var(--line-2); padding-top: 4px; }
.msg details.args summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 7px;
  padding: 7px 0; font-weight: 700; font-size: var(--fs-small); color: var(--accent);
  min-height: 36px;
}
.msg details.args summary::-webkit-details-marker { display: none; }
.msg details.args summary::before { content: "▸"; font-size: .95em; transition: transform .15s; }
.msg details.args[open] summary::before { transform: rotate(90deg); }
.msg details.args summary:hover { color: var(--accent-dark); }
.msg .args-body { padding: 2px 0 2px; }
