/* ============================================================
   CBA REQUIEM — "War Room" visual identity
   Iron & castle-gold, carved-stone display type, heraldic roles.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;800&family=Source+Sans+3:ital,wght@0,400;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;600&display=swap');

/* ---------- Tokens ---------- */
:root {
  --cba-gold:        #d4a017;
  --cba-gold-bright: #f0c040;
  --cba-iron:        #14151d;
  --cba-stone:       #1e2029;
  --cba-ally:        #4da3e0;
  --cba-enemy:       #e05252;
  --cba-siege:       #8f6fe0;
  --cba-support:     #52b788;
  --cba-raze:        #e0872e;
  --cba-tank:        #9aa0ad;
  --cba-wall:        #b08968;

  --md-primary-fg-color:        #1a1c26;
  --md-primary-fg-color--light: #2a2d3c;
  --md-primary-fg-color--dark:  #101117;
  --md-accent-fg-color:         var(--cba-gold);
  --md-accent-fg-color--transparent: rgba(212, 160, 23, 0.12);
}

/* Dark scheme = the canonical look */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: var(--cba-iron);
  --md-default-fg-color--light: #c9ccd6;
  --md-code-bg-color: #1b1d27;
  --md-typeset-a-color: var(--cba-gold-bright);
  --md-footer-bg-color: #101117;
}

/* Light scheme = daylight parchment */
[data-md-color-scheme="default"] {
  --md-default-bg-color: #faf7f0;
  --md-typeset-a-color: #a87c0a;
}
/* Light mode: darker gold for headline contrast on parchment */
[data-md-color-scheme="default"] .md-typeset h1 {
  color: #9a730a;
}

/* ---------- Typography ---------- */
body, .md-typeset {
  font-family: "Source Sans 3", system-ui, sans-serif;
}
.md-typeset code, .md-typeset pre {
  font-family: "JetBrains Mono", monospace;
}

/* Carved-stone display: H1 + site title only. Restraint. */
.md-typeset h1,
.md-header__topic .md-ellipsis {
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.md-typeset h1 {
  color: var(--cba-gold);
  font-size: 1.9rem;
  margin-bottom: 0.6em;
}
/* Gold chisel mark under every H1 */
.md-typeset h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 3px;
  margin-top: 0.35em;
  background: linear-gradient(90deg, var(--cba-gold), transparent);
  border-radius: 2px;
}

.md-typeset h2 {
  font-weight: 700;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(212, 160, 23, 0.25);
  padding-bottom: 0.25em;
}
.md-typeset h3 { font-weight: 700; }

/* ---------- Header & tabs ---------- */
.md-header {
  background: linear-gradient(180deg, #1d1f2b 0%, #16171f 100%);
  border-bottom: 1px solid rgba(212, 160, 23, 0.35);
}
.md-tabs {
  background: #16171f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.md-tabs__link--active,
.md-tabs__link:hover {
  color: var(--cba-gold-bright);
}
.md-search__form {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 0.6rem;
}

/* Spawn-pulse on the header logo — the CBA castle tick, as motion */
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  transition: transform 0.25s ease;
}
.md-header__button.md-logo:hover img,
.md-header__button.md-logo:hover svg {
  animation: spawn-pulse 1.1s ease-in-out infinite;
}
@keyframes spawn-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.14); }
}

/* ---------- Role badges (heraldic) ---------- */
.role {
  display: inline-block;
  padding: 0.12em 0.68em;
  border-radius: 0.25em;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  margin-right: 0.3em;
  vertical-align: middle;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}
.role-dive    { background: var(--cba-enemy); }
.role-kite    { background: var(--cba-ally); }
.role-tank    { background: var(--cba-tank); }
.role-raze    { background: var(--cba-raze); }
.role-siege   { background: var(--cba-siege); }
.role-support { background: var(--cba-support); }
.role-wall    { background: var(--cba-wall); }

/* ---------- Tier badges ---------- */
.tier {
  display: inline-block;
  min-width: 1.7em;
  text-align: center;
  padding: 0.06em 0.5em;
  border-radius: 0.3em;
  font-weight: 800;
  font-family: "Cinzel", serif;
  color: #14151d;
}
.tier-s { background: var(--cba-gold-bright); }
.tier-a { background: var(--cba-support); }
.tier-b { background: var(--cba-ally); }
.tier-c { background: var(--cba-tank); }
.tier-d { background: var(--cba-enemy); color: #fff; }

/* ---------- The signature: gold plaque stat cards ---------- */
/* Civ quick-stats table becomes a war-room plaque */
.md-typeset table:not([class]) {
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.md-typeset table:not([class]) th {
  background: #232532;
  color: var(--cba-gold-bright);
  font-weight: 700;
  letter-spacing: 0.02em;
}
[data-md-color-scheme="default"] .md-typeset table:not([class]) th {
  background: #efe7d2;
  color: #7c5e08;
}
.md-typeset table:not([class]) tr:hover td {
  background: rgba(212, 160, 23, 0.06);
}

/* ---------- Cards (landing + civ index grids) ---------- */
.cba-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.8rem;
  margin: 1.2em 0;
}
.cba-card {
  display: block;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(212, 160, 23, 0.28);
  border-radius: 0.6rem;
  background: linear-gradient(160deg, rgba(212,160,23,0.05), rgba(255,255,255,0.015));
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  color: inherit !important;
}
.cba-card:hover {
  transform: translateY(-3px);
  border-color: var(--cba-gold);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.cba-card .cba-card-title {
  display: block;
  font-weight: 700;
  color: var(--cba-gold-bright);
  margin-bottom: 0.2em;
}
.cba-card .cba-card-desc {
  display: block;
  font-size: 0.78rem;
  opacity: 0.8;
  line-height: 1.35;
}
[data-md-color-scheme="default"] .cba-card {
  background: #fffdf7;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* ---------- Admonitions in identity colors ---------- */
.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-color: var(--cba-gold);
}
.md-typeset .warning > .admonition-title,
.md-typeset .warning > summary {
  background-color: rgba(212, 160, 23, 0.12);
}
.md-typeset .warning > .admonition-title::before,
.md-typeset .warning > summary::before {
  background-color: var(--cba-gold);
}

/* Version-lock notice */
.version-lock {
  border-left: 4px solid var(--cba-gold);
  padding: 0.4em 0.8em;
  background: rgba(212, 160, 23, 0.08);
  font-size: 0.85rem;
  border-radius: 0 0.4rem 0.4rem 0;
}

/* ---------- Diagram figures ---------- */
.diagram {
  text-align: center;
  margin: 1.4em 0;
}
.diagram img {
  max-width: 760px;
  width: 100%;
  border-radius: 0.6rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.diagram figcaption {
  font-size: 0.78rem;
  opacity: 0.72;
  margin-top: 0.45em;
  font-style: italic;
}

/* Inline icon images (unit classes, shields) */
img.cba-icon {
  height: 1.25em;
  vertical-align: -0.25em;
  margin-right: 0.15em;
}

/* ---------- Hero on landing page ---------- */
.cba-hero {
  margin: 0 0 1.6em;
  text-align: center;
}
.cba-hero img {
  width: 100%;
  max-width: 900px;
  border-radius: 0.8rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- Quality floor ---------- */
:focus-visible {
  outline: 2px solid var(--cba-gold-bright);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .cba-card, .md-header__button.md-logo img { transition: none; }
  .md-header__button.md-logo:hover img,
  .md-header__button.md-logo:hover svg { animation: none; }
  .cba-card:hover { transform: none; }
}
@media screen and (max-width: 600px) {
  .md-typeset h1 { font-size: 1.5rem; }
  .cba-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- AI expert chat widget ---------- */
#cba-agent-fab {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 100;
  border: 1px solid var(--cba-gold);
  background: linear-gradient(160deg, #232532, #1a1c26);
  color: var(--cba-gold-bright);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.65em 1.1em;
  border-radius: 2em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#cba-agent-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
}
#cba-agent-panel {
  position: fixed;
  right: 1.2rem;
  bottom: 4.4rem;
  z-index: 100;
  width: min(420px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  background: #191b24;
  color: #e8e8f0;
  border: 1px solid rgba(212, 160, 23, 0.4);
  border-radius: 0.8rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  font-size: 0.72rem;
}
.cba-agent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  background: #22242f;
  border-bottom: 1px solid rgba(212, 160, 23, 0.35);
  font-weight: 700;
  color: var(--cba-gold-bright);
}
.cba-agent-headbtns button {
  background: none;
  border: none;
  color: #aab;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.15em 0.4em;
}
.cba-agent-headbtns button:hover { color: #fff; }
.cba-agent-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.cba-agent-msg {
  max-width: 88%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.6rem;
  line-height: 1.45;
}
.cba-agent-msg p { margin: 0 0 0.4em; }
.cba-agent-msg p:last-child { margin-bottom: 0; }
.cba-agent-msg ul { margin: 0.2em 0 0.4em 1.1em; padding: 0; }
.cba-agent-user {
  align-self: flex-end;
  background: rgba(77, 163, 224, 0.16);
  border: 1px solid rgba(77, 163, 224, 0.35);
}
.cba-agent-bot {
  align-self: flex-start;
  background: rgba(212, 160, 23, 0.09);
  border: 1px solid rgba(212, 160, 23, 0.25);
}
.cba-agent-thinking { opacity: 0.6; animation: cba-pulse 1.2s ease-in-out infinite; }
@keyframes cba-pulse { 50% { opacity: 0.25; } }
.cba-agent-meta {
  margin-top: 0.45em;
  font-size: 0.6rem;
  opacity: 0.55;
}
.cba-agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.cba-agent-chip {
  background: rgba(212, 160, 23, 0.1);
  border: 1px solid rgba(212, 160, 23, 0.4);
  color: var(--cba-gold-bright);
  border-radius: 1em;
  padding: 0.3em 0.75em;
  font-size: 0.62rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cba-agent-chip:hover { background: rgba(212, 160, 23, 0.22); }
.cba-agent-inputrow {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0;
}
.cba-agent-inputrow input {
  flex: 1;
  background: #12131a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8e8f0;
  border-radius: 0.5rem;
  padding: 0.5em 0.7em;
  font-size: 0.7rem;
}
.cba-agent-inputrow input:focus { outline: 2px solid var(--cba-gold); }
#cba-agent-send {
  background: var(--cba-gold);
  color: #14151d;
  border: none;
  border-radius: 0.5rem;
  padding: 0 0.9em;
  font-weight: 800;
  cursor: pointer;
}
#cba-agent-send:disabled { opacity: 0.4; cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .cba-agent-thinking { animation: none; }
  #cba-agent-fab, #cba-agent-fab:hover { transition: none; transform: none; }
}

/* ============================================================
   Full-window Expert Chat app (/chat/) — chat-app.js
   ============================================================ */

/* Page chrome: hide sidebars/footer/toc, full-width content.
   body:has() where supported; .cba-chat-body added by JS as fallback. */
body:has(#cba-chat-app) .md-sidebar,
body:has(#cba-chat-app) .md-footer,
body:has(#cba-chat-app) #cba-agent,
.cba-chat-body .md-sidebar,
.cba-chat-body .md-footer,
.cba-chat-body #cba-agent {
  display: none !important;
}
body:has(#cba-chat-app) .md-main__inner,
.cba-chat-body .md-main__inner {
  max-width: none;
  margin: 0;
}
body:has(#cba-chat-app) .md-content__inner,
.cba-chat-body .md-content__inner {
  margin: 0;
  padding: 0;
}
body:has(#cba-chat-app) .md-content__inner::before,
.cba-chat-body .md-content__inner::before {
  display: none;
}

#cba-chat-app { display: block; }

.cba-chat-shell {
  display: flex;
  height: calc(100vh - 5.4rem); /* header + sticky tabs */
  min-height: 420px;
  background: var(--cba-iron);
  color: #e8e8f0;
  font-size: 0.74rem;
  overflow: hidden;
}
[data-md-color-scheme="default"] .cba-chat-shell {
  background: #f4efe3;
  color: #2a2a33;
}

/* ---------- sessions sidebar ---------- */
.cba-cs {
  width: 260px;
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  background: #101117;
  border-right: 1px solid rgba(212, 160, 23, 0.25);
  padding: 0.7rem 0.55rem;
  gap: 0.55rem;
}
[data-md-color-scheme="default"] .cba-cs {
  background: #ebe4d2;
  border-right-color: rgba(150, 110, 10, 0.3);
}
.cba-cs-new {
  border: 1px solid var(--cba-gold);
  background: rgba(212, 160, 23, 0.1);
  color: var(--cba-gold-bright);
  font-weight: 700;
  border-radius: 0.5rem;
  padding: 0.55em 0.8em;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cba-cs-new:hover { background: rgba(212, 160, 23, 0.22); }
[data-md-color-scheme="default"] .cba-cs-new { color: #8a6708; }
.cba-cs-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.cba-cs-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45em 0.6em;
  border-radius: 0.45rem;
  cursor: pointer;
  border: 1px solid transparent;
  color: #c9ccd6;
}
[data-md-color-scheme="default"] .cba-cs-item { color: #4a4a52; }
.cba-cs-item:hover { background: rgba(255, 255, 255, 0.05); }
[data-md-color-scheme="default"] .cba-cs-item:hover { background: rgba(0, 0, 0, 0.05); }
.cba-cs-item.active {
  border-color: var(--cba-gold);
  background: rgba(212, 160, 23, 0.12);
  color: var(--cba-gold-bright);
}
[data-md-color-scheme="default"] .cba-cs-item.active { color: #8a6708; }
.cba-cs-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cba-cs-btns { display: none; gap: 0.1rem; }
.cba-cs-item:hover .cba-cs-btns,
.cba-cs-item.active .cba-cs-btns { display: inline-flex; }
.cba-cs-btns button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.68rem;
  color: inherit;
  opacity: 0.65;
  padding: 0 0.15em;
}
.cba-cs-btns button:hover { opacity: 1; }
.cba-cs-rename {
  flex: 1;
  min-width: 0;
  background: #12131a;
  border: 1px solid var(--cba-gold);
  color: #e8e8f0;
  border-radius: 0.35rem;
  font-size: 0.68rem;
  padding: 0.2em 0.4em;
}
.cba-cs-backdrop { display: none; }

/* ---------- main pane ---------- */
.cba-cm {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cba-cm-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  background: #191b24;
  border-bottom: 1px solid rgba(212, 160, 23, 0.3);
}
[data-md-color-scheme="default"] .cba-cm-head {
  background: #efe7d2;
  border-bottom-color: rgba(150, 110, 10, 0.3);
}
.cba-cm-burger {
  display: none;
  background: none;
  border: 1px solid rgba(212, 160, 23, 0.5);
  color: var(--cba-gold-bright);
  border-radius: 0.4rem;
  font-size: 0.8rem;
  padding: 0.1em 0.45em;
  cursor: pointer;
}
.cba-cm-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: var(--cba-gold-bright);
}
[data-md-color-scheme="default"] .cba-cm-title { color: #8a6708; }
.cba-cm-headright {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.62rem;
}
.cba-cm-model {
  opacity: 0.55;
  font-family: "JetBrains Mono", monospace;
}
.cba-cm-docs { color: var(--cba-ally) !important; }

/* ---------- thread ---------- */
.cba-cm-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.cba-msg {
  max-width: min(720px, 88%);
  padding: 0.65rem 0.9rem;
  border-radius: 0.7rem;
  line-height: 1.5;
}
.cba-msg p { margin: 0 0 0.5em; }
.cba-msg p:last-child { margin-bottom: 0; }
.cba-msg ul, .cba-msg ol { margin: 0.25em 0 0.5em 1.2em; padding: 0; }
.cba-msg h4 {
  margin: 0.6em 0 0.3em;
  font-size: 0.8rem;
  color: var(--cba-gold-bright);
}
.cba-msg code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.05em 0.3em;
  border-radius: 0.25em;
}
.cba-msg-user {
  align-self: flex-end;
  background: rgba(77, 163, 224, 0.16);
  border: 1px solid rgba(77, 163, 224, 0.35);
}
.cba-msg-bot {
  align-self: flex-start;
  background: rgba(212, 160, 23, 0.09);
  border: 1px solid rgba(212, 160, 23, 0.25);
}
[data-md-color-scheme="default"] .cba-msg-user { background: rgba(77, 163, 224, 0.12); }
[data-md-color-scheme="default"] .cba-msg-bot { background: rgba(212, 160, 23, 0.08); }
[data-md-color-scheme="default"] .cba-msg h4 { color: #8a6708; }
.cba-cursor {
  color: var(--cba-gold-bright);
  animation: cba-cursor-blink 0.9s steps(2, start) infinite;
}
@keyframes cba-cursor-blink { 50% { opacity: 0; } }

.cba-msg-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6em;
  padding-top: 0.45em;
  border-top: 1px dashed rgba(212, 160, 23, 0.25);
  font-size: 0.6rem;
}
.cba-msg-meta { opacity: 0.55; font-family: "JetBrains Mono", monospace; }
.cba-msg-sources { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.cba-src-chip {
  border: 1px solid rgba(212, 160, 23, 0.4);
  background: rgba(212, 160, 23, 0.08);
  color: var(--cba-gold-bright) !important;
  border-radius: 1em;
  padding: 0.1em 0.6em;
  text-decoration: none;
}
.cba-src-chip:hover { background: rgba(212, 160, 23, 0.2); }
[data-md-color-scheme="default"] .cba-src-chip { color: #8a6708 !important; }
.cba-msg-copy, .cba-msg-retry {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: inherit;
  opacity: 0.7;
  border-radius: 0.35rem;
  font-size: 0.6rem;
  padding: 0.15em 0.5em;
  cursor: pointer;
}
.cba-msg-copy:hover, .cba-msg-retry:hover { opacity: 1; }
.cba-msg-retry {
  margin: 0.5em 0 0;
  display: inline-block;
  border-color: var(--cba-enemy);
  color: var(--cba-enemy);
  opacity: 1;
}

/* ---------- welcome / quick start ---------- */
.cba-welcome {
  margin: auto;
  width: min(640px, 100%);
  text-align: center;
  padding: 1rem 0.5rem 2rem;
}
.cba-welcome-title {
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.5rem;
  color: var(--cba-gold);
  margin-bottom: 0.35em;
}
.cba-welcome-pitch {
  opacity: 0.8;
  max-width: 480px;
  margin: 0 auto 1.4em;
}
.cba-welcome-civrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.7rem;
  opacity: 0.9;
}
.cba-civ-select {
  background: #12131a;
  color: #e8e8f0;
  border: 1px solid rgba(212, 160, 23, 0.45);
  border-radius: 0.45rem;
  padding: 0.35em 0.6em;
  font-size: 0.68rem;
  cursor: pointer;
}
[data-md-color-scheme="default"] .cba-civ-select {
  background: #fffdf7;
  color: #2a2a33;
}
.cba-civ-select.cba-attn { outline: 2px solid var(--cba-enemy); }
.cba-qs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.cba-qs-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(212, 160, 23, 0.35);
  border-radius: 0.6rem;
  background: linear-gradient(160deg, rgba(212, 160, 23, 0.07), rgba(255, 255, 255, 0.015));
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.cba-qs-card:hover { transform: translateY(-2px); border-color: var(--cba-gold); }
.cba-qs-icon { font-size: 1.1rem; }
.cba-qs-name { font-weight: 700; color: var(--cba-gold-bright); }
[data-md-color-scheme="default"] .cba-qs-name { color: #8a6708; }
.cba-qs-desc { font-size: 0.62rem; opacity: 0.7; }
.cba-qs-draft {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.8rem;
}
.cba-qs-draft input {
  flex: 1;
  background: #12131a;
  border: 1px solid rgba(212, 160, 23, 0.45);
  color: #e8e8f0;
  border-radius: 0.45rem;
  padding: 0.45em 0.7em;
  font-size: 0.7rem;
}
[data-md-color-scheme="default"] .cba-qs-draft input { background: #fffdf7; color: #2a2a33; }
.cba-qs-draft button {
  background: var(--cba-gold);
  color: #14151d;
  border: none;
  border-radius: 0.45rem;
  font-weight: 800;
  padding: 0 1em;
  cursor: pointer;
}

/* ---------- composer ---------- */
.cba-cm-composer {
  border-top: 1px solid rgba(212, 160, 23, 0.3);
  background: #191b24;
  padding: 0.5rem 1rem 0.7rem;
}
[data-md-color-scheme="default"] .cba-cm-composer {
  background: #efe7d2;
  border-top-color: rgba(150, 110, 10, 0.3);
}
.cba-cm-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 0.45rem;
}
.cba-chip {
  background: rgba(212, 160, 23, 0.1);
  border: 1px solid rgba(212, 160, 23, 0.4);
  color: var(--cba-gold-bright);
  border-radius: 1em;
  padding: 0.28em 0.75em;
  font-size: 0.62rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.cba-chip:hover { background: rgba(212, 160, 23, 0.22); }
[data-md-color-scheme="default"] .cba-chip { color: #8a6708; }
.cba-cm-inputrow {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  margin: 0;
}
.cba-cm-inputrow textarea {
  flex: 1;
  resize: none;
  background: #12131a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e8e8f0;
  border-radius: 0.55rem;
  padding: 0.55em 0.75em;
  font-size: 0.72rem;
  font-family: inherit;
  line-height: 1.4;
  max-height: 140px;
}
[data-md-color-scheme="default"] .cba-cm-inputrow textarea {
  background: #fffdf7;
  color: #2a2a33;
  border-color: rgba(0, 0, 0, 0.18);
}
.cba-cm-inputrow textarea:focus { outline: 2px solid var(--cba-gold); }
#cba-cm-send {
  background: var(--cba-gold);
  color: #14151d;
  border: none;
  border-radius: 0.55rem;
  padding: 0.5em 1em;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
}
#cba-cm-send:disabled { opacity: 0.4; cursor: default; }

/* widget header expand link */
.cba-agent-headbtns a {
  color: #aab;
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.15em 0.4em;
}
.cba-agent-headbtns a:hover { color: #fff; }

/* ---------- responsive ---------- */
@media screen and (max-width: 900px) {
  .cba-chat-shell { height: calc(100vh - 3.2rem); }
  .cba-cs {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 110;
    width: min(280px, 84vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.5);
  }
  .cba-cs.open { transform: translateX(0); }
  .cba-cs-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 105;
    background: rgba(0, 0, 0, 0.5);
  }
  .cba-cm-burger { display: inline-block; }
  .cba-msg { max-width: 94%; }
  .cba-qs-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .cba-cursor { animation: none; }
  .cba-cs { transition: none; }
  .cba-qs-card, .cba-qs-card:hover { transition: none; transform: none; }
}
