/* styles.css — Torus RAG Appliance · premium redesign ("premium archive")
   Ink vault sidebar, warm paper content, editorial serif display, slate accent.
   Token system from design_reference/torus.css with the locked slate accent.
   Class vocabulary keeps every hook main.js toggles or generates — see
   /tmp/design_handoff_premium_redesign/dom-contract.md. */

/* ============================================================
   SELF-HOSTED FONTS — nothing leaves the instance
   woff2 files in src/fonts/ (served by the existing nginx COPY of src/);
   @font-face blocks replicate the css2 declarations Google served for
   the previous <link> (same weights, unicode-ranges, font-display) so
   rendering is unchanged. Hanken Grotesk is a variable font: one file
   per subset, declared once per used weight. Latin subset covers the
   FR accents (U+0000-00FF) and Œ/œ (U+0152-0153); latin-ext the rest. */
/* Hanken Grotesk 400 latin-ext */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Hanken Grotesk 400 latin */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Hanken Grotesk 500 latin-ext */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Hanken Grotesk 500 latin */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Hanken Grotesk 600 latin-ext */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Hanken Grotesk 600 latin */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Hanken Grotesk 700 latin-ext */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Hanken Grotesk 700 latin */
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/hanken-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* IBM Plex Mono 400 latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-ext-400.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* IBM Plex Mono 400 latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* IBM Plex Mono 600 latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-ext-600.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* IBM Plex Mono 600 latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Source Serif 4 600 latin-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/source-serif-4-latin-ext-600.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Source Serif 4 600 latin */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/source-serif-4-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  /* palette */
  --ink-900: #10141c;
  --ink-800: #161c27;
  --ink-700: #1f2735;
  --paper: #f5f5f2;
  --card: #ffffff;
  --tx: #1b212c;
  --tx-2: #5a6271;
  --tx-3: #8d94a3;
  --line: #e7e6e1;
  --line-2: #d9d8d2;
  --line-card: #e9e8e3;
  --accent: #3b5d7c;
  --accent-d: #2f4c66;
  --accent-soft: #edf3f8;
  --accent-line: #d2e0eb;
  --on-ink: #eef0f4;
  --on-ink-2: #9aa3b5;
  --on-ink-3: #646e82;
  --ok: #2e7d57;       --ok-bg: #e9f3ee;   --ok-line: #cde5d8;
  --warn: #9a6a14;     --warn-bg: #f7f0de; --warn-line: #ecdcb4;
  --err: #a3382f;      --err-bg: #f9ebe9;  --err-line: #efd2ce;
  --idle: #6b7480;     --idle-bg: #eef0f3; --idle-line: #dde1e7;
  --brand-gradient: linear-gradient(160deg, #48749b, #2f4c66);
  --nav-bar: #6f95b8;
  /* type */
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Hanken Grotesk', -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  /* misc */
  --r: 12px;
  --r-sm: 8px;
  --r-xs: 6px;
  --sh: 0 1px 2px rgba(20, 24, 33, .04), 0 1px 3px rgba(20, 24, 33, .05);
  --sh-lg: 0 8px 28px rgba(20, 24, 33, .12);
  --sh-modal: 0 24px 80px rgba(16, 20, 28, .3);
  --topbar-h: 59px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--tx);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; }
p, dl, dd, dt, ul, ol, figure { margin: 0; }
button { font-family: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); }

::selection { background: var(--accent-soft); }

:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}

/* ---------- utilities ---------- */
.is-hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.empty-state {
  padding: 26px 20px;
  text-align: center;
  color: var(--tx-3);
  font-size: 13px;
}

/* ============================================================
   APP FRAME
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

/* ---- sidebar (ink vault) ---- */
.sidebar {
  width: 252px;
  flex: 0 0 252px;
  background: var(--ink-900);
  color: var(--on-ink);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 10px 22px; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: transparent;
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: "";
  width: 15px;
  height: 15px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  display: block;
  position: absolute;
}
.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  color: #fff;
  line-height: 1.2;
}
.brand-subtitle { font-size: 11px; color: var(--on-ink-2); letter-spacing: .04em; line-height: 1.3; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--on-ink-3);
  text-transform: uppercase;
  letter-spacing: .14em;
  padding: 10px 12px 6px;
}
/* hide a group label when every nav item after it is hidden (non-admins) */
.sidebar-nav .nav-label:not(:has(~ .nav-item:not(.is-hidden))) { display: none; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: none;
  border: none;
  color: var(--on-ink-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  position: relative;
  transition: background .12s, color .12s;
  width: 100%;
  white-space: nowrap;
}
.nav-item svg { flex: 0 0 auto; opacity: .75; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: var(--on-ink); }
.nav-item.is-active { background: rgba(255, 255, 255, .08); color: #fff; font-weight: 600; }
.nav-item.is-active svg { opacity: 1; }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--nav-bar);
}

.instance-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--r-sm);
  padding: 12px;
  background: rgba(255, 255, 255, .03);
}
.instance-host { font-family: var(--mono); font-size: 11px; color: var(--on-ink-2); }
.status-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: #7fc7a5;
  margin-top: 7px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4caf82;
  box-shadow: 0 0 0 3px rgba(76, 175, 130, .18);
  flex: 0 0 auto;
}
.instance-note { font-size: 10.5px; color: var(--on-ink-3); margin-top: 6px; line-height: 1.45; }

/* ---- main column ---- */
.workspace { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-h);
}
.topbar-title { display: flex; align-items: center; gap: 14px; min-width: 0; flex-wrap: wrap; }
.topbar-title > strong { font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.topbar-divider { width: 1px; height: 20px; background: var(--line-2); flex: 0 0 auto; }
.client-label, .instance-label {
  font-size: 12.5px;
  color: var(--tx-2);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.client-label strong { color: var(--tx); font-weight: 600; }
.livedot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-bg);
  flex: 0 0 auto;
  display: inline-block;
}

.auth-menu { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar-sign-in {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--sh);
  transition: background .12s, border-color .12s;
}
.topbar-sign-in:hover { background: var(--accent-d); border-color: var(--accent-d); }

.user-session { position: relative; }
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  transition: border-color .12s;
}
.user-menu-trigger:hover,
.user-menu-trigger[aria-expanded="true"] { border-color: var(--line-2, var(--line)); }
.user-menu-chevron { color: var(--tx-3); flex: 0 0 auto; }
.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  max-width: 280px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(16, 20, 28, .08);
  padding: 6px;
  display: flex;
  flex-direction: column;
  z-index: 60;
}
.user-menu-identity {
  padding: 8px 10px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
  cursor: default;
}
.user-menu-identity strong { font-size: 12.5px; font-weight: 600; }
.user-menu-identity small { font-size: 11px; color: var(--tx-3); }
.user-menu-separator { height: 1px; background: var(--line); margin: 2px 4px 4px; }
.user-menu-panel .user-account-action,
.user-menu-panel .sign-out-button {
  border-left: none;
  margin-left: 0;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.user-menu-panel .user-account-action:hover { background: rgba(16, 20, 28, .04); color: var(--tx-1); }
.user-menu-panel .sign-out-button:hover { background: rgba(16, 20, 28, .04); }
.avatar {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--ink-700);
  color: #cfd6e2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  flex: 0 0 auto;
}
.user-session-copy { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-session-copy strong { font-size: 12px; font-weight: 600; }
.user-session-copy small { font-size: 10.5px; color: var(--tx-3); }
.sign-out-button {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
  background: none;
  border: none;
  border-left: 1px solid var(--line);
  padding: 4px 6px 4px 10px;
  margin-left: 2px;
  border-radius: 0;
  transition: color .12s;
  white-space: nowrap;
}
.sign-out-button:hover { color: var(--err); }
.user-account-action {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
  background: none;
  border: none;
  border-left: 1px solid var(--line);
  padding: 4px 6px 4px 10px;
  margin-left: 2px;
  border-radius: 0;
  transition: color .12s;
  white-space: nowrap;
  text-decoration: none;
}
.user-account-action:hover { color: var(--tx-1); }

.language-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  background: #fff;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
}
.language-select svg { color: var(--tx-3); }
.language-select select {
  border: none;
  outline: none;
  background: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx);
  cursor: pointer;
  padding: 0;
  box-shadow: none;
}

/* ---- content ---- */
.workspace-main {
  flex: 1 1 auto;
  padding: 30px 36px 48px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}
.view { display: flex; flex-direction: column; gap: 22px; }

/* chat view fills the viewport; the thread scrolls internally */
.app-shell.chat-view-active .workspace-main {
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  padding-bottom: 26px;
  display: flex;
  flex-direction: column;
}
.app-shell.chat-view-active #chat-view { flex: 1 1 auto; min-height: 0; }

/* ---- page header ---- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.page-header h1 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -.01em;
  /* tight heading leading: the inherited body line-height (1.5 → ~40px box)
     left ~13px of dead space above the title once the eyebrow was removed.
     margin-top:0 lifts the title to the top of the header. */
  line-height: 1.15;
  margin-top: 0;
}
.page-header > div > p:last-child:not(.eyebrow) {
  color: var(--tx-2);
  font-size: 13.5px;
  margin-top: 6px;
  max-width: 62ch;
}
.header-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--tx-2);
  white-space: nowrap;
}
.pill-blue { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.pill-success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.pill-success::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex: 0 0 auto;
}
.pill-dark { background: var(--ink-800); border-color: var(--ink-800); color: #dfe4ec; }

/* buttons */
.secondary-action,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--tx);
  transition: background .12s, border-color .12s, box-shadow .12s;
  white-space: nowrap;
}
.secondary-action:hover:not(:disabled),
.secondary-button:hover:not(:disabled) { background: #f4f5f3; }
.secondary-action svg, .btn-primary svg { flex: 0 0 auto; }

.compact-action { padding: 6.5px 12px; font-size: 12.5px; font-weight: 500; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--sh);
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-d); border-color: var(--accent-d); }

.btn-danger {
  border-color: var(--err-line);
  color: var(--err);
  background: #fff;
}
.btn-danger:hover:not(:disabled) { background: var(--err-bg); }

.text-action {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.text-action:hover { text-decoration: underline; }
.text-action::after { content: "→"; font-size: 12px; }

/* cards */
.section-card {
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r);
  box-shadow: var(--sh);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.section-header h2 { font-size: 14px; font-weight: 650; }
.section-header h3 { font-size: 13.5px; font-weight: 650; }
.section-header > div > p { font-size: 12px; color: var(--tx-3); font-weight: 400; margin-top: 2px; }
.section-header > div > p.section-kicker { margin-top: 0; margin-bottom: 3px; }
.section-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.section-kicker {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--tx-3);
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* tables */
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table-wrap td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr { transition: background .1s; }
.table-wrap tbody tr:hover { background: #fafaf8; }
.table-wrap td:first-child { color: var(--tx-2); }
.table-wrap td .empty-state { padding: 18px 4px; text-align: left; }

/* status badges generated by main.js (single source of truth):
   success/indexed → ok · partial/processing/pending/accepted → warn ·
   failed/failure → err · idle/archived/neutral/unknown → idle */
.table-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3.5px 10px 3.5px 8px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}
.table-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: currentColor;
}
.table-status.success { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.table-status.processing,
.table-status.accepted { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.table-status.failed { color: var(--err); background: var(--err-bg); border-color: var(--err-line); }
.table-status.neutral,
.table-status.unknown { color: var(--idle); background: var(--idle-bg); border-color: var(--idle-line); }

/* role badges: owner/admin = dark pills, user = plain text */
.table-status.role-owner,
.table-status.role-admin {
  color: #dfe4ec;
  background: var(--ink-800);
  border-color: var(--ink-800);
}
.table-status.role-owner::before,
.table-status.role-admin::before { display: none; }
.table-status.role-user {
  color: var(--tx-2);
  background: none;
  border-color: transparent;
  padding-left: 0;
}
.table-status.role-user::before { display: none; }

/* mono technical columns in generated rows */
.documents-card tbody td:first-child,
.ingestions-card tbody td:nth-child(3),
.audit-card tbody td:nth-child(4),
#dashboard-documents-attention-body td:first-child {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--tx);
}

/* filenames: long unbroken names wrap inside their cell so every column
   (actions included) stays reachable without horizontal table scrolling.
   `anywhere` lets the auto table layout shrink the filename column to fit;
   .table-wrap keeps overflow-x: auto as a safety net at narrow widths. */
.documents-card tbody td:first-child,
.ingestions-card tbody td:nth-child(3),
#dashboard-documents-attention-body td:first-child,
#dashboard-ingestions-body td:nth-child(3),
.purge-summary p strong {
  overflow-wrap: anywhere;
}
/* floor the filename column of the two large tables so a ~120-char name
   wraps on <=3 lines instead of being squeezed by the nowrap columns, and
   tighten the horizontal padding of these dense tables so all 7-8 columns
   plus the floored filename fit without horizontal scrolling at 1280px */
.ingestions-card .table-wrap th,
.ingestions-card .table-wrap td {
  padding-left: 10px;
  padding-right: 10px;
}
/* Documents page trims cell padding a touch tighter (7px) so the no-wrap
   actions column (Archive + Retry ingestion on a single line) still fits a
   1280px viewport without horizontal scroll. Scoped to .documents-card so the
   ingestions table keeps its 10px padding. */
.documents-card .table-wrap th,
.documents-card .table-wrap td {
  padding-left: 7px;
  padding-right: 7px;
}
/* 324px = 40 mono chars per line: a 120-char name fits on 3 lines, and the
   8 columns (worst case: stacked badges + "Purge permanently") still fit a
   1280px viewport without horizontal scroll */
.documents-card tbody td:first-child,
.ingestions-card tbody td:nth-child(3) {
  min-width: 324px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.document-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.document-actions .compact-action {
  white-space: nowrap;
  padding: 6.5px 9px;
}
.pagination-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 4px;
  justify-content: flex-end;
}
.pagination-info {
  font-size: 12.5px;
  color: var(--tx-2);
}
.compact-select {
  font-size: 12px;
  font-weight: 500;
  color: var(--tx);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  padding: 5px 8px;
  background: #fff;
}

/* forms */
label { font-size: 12.5px; font-weight: 600; color: var(--tx-2); }
form label,
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
input[type="text"], input[type="search"], input[type="email"], input[type="password"],
input[type="number"], input[type="datetime-local"], input[type="date"],
select, textarea {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--tx);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  padding: 9px 12px;
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--tx-3); }

.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
}
.checkbox-row input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
}
.checkbox-label input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

.form-status {
  font-size: 12px;
  color: var(--tx-2);
  min-height: 1em;
  line-height: 1.5;
}
.upload-note { font-size: 11.5px; color: var(--tx-3); line-height: 1.5; font-weight: 400; }

/* compact scope select (ask bar, chat header) */
.base-select {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  background: #fff;
  padding: 7px 7px 7px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tx-2);
}
.base-select svg { color: var(--tx-3); flex: 0 0 auto; }
.base-select-label { font-size: 11.5px; font-weight: 600; color: var(--tx-3); flex: 0 0 auto; }
.base-select select {
  border: none;
  outline: none;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tx);
  max-width: 170px;
  padding: 0;
  box-shadow: none;
}

/* filter strips (Documents + Audit) */
.audit-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfbf9;
}
.audit-filters label { min-width: 140px; flex: 0 1 auto; }
.audit-filters label span {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.audit-filters input, .audit-filters select { padding: 7px 10px; font-size: 12.5px; }
.audit-filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* auth prompt cards (signed-out hints inside views) */
.chat-auth-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  padding: 16px 20px;
  margin: 16px 20px;
}
.chat-auth-card h3 { font-size: 14px; font-weight: 650; }
.chat-auth-card p { font-size: 12.5px; color: var(--tx-2); margin-top: 3px; max-width: 64ch; }
.chat-auth-card button {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  transition: background .12s;
}
.chat-auth-card button:hover { background: var(--accent-d); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.qa-panel {
  display: flex;
  gap: 0;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r);
  box-shadow: var(--sh);
  overflow: hidden;
}
.qa-main { flex: 1 1 auto; min-width: 0; padding: 24px 28px; }
.qa-main > h2 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  margin-top: 9px;
}
.ask-form {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fbfbf9;
  padding: 7px 7px 7px 8px;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.ask-form:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}
.ask-form .base-select { background: #fff; flex: 0 0 auto; }
.ask-form input[type="text"] {
  flex: 1 1 auto;
  border: none;
  background: none;
  font-size: 14px;
  min-width: 0;
  padding: 6px 4px;
  box-shadow: none;
}
.ask-form button[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  transition: background .12s;
  flex: 0 0 auto;
}
.ask-form button[type="submit"]:hover { background: var(--accent-d); }

.trust-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--tx-2);
}
.trust-line svg { color: var(--ok); flex: 0 0 auto; }
.trust-line .mono { font-size: 11.5px; }
.mock-note { font-size: 12px; color: var(--tx-3); margin-top: 8px; }
.mock-note:empty { display: none; }

.manage-rail {
  flex: 0 0 250px;
  border-left: 1px solid var(--line);
  background: #fafaf8;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  justify-content: center;
}
.manage-rail h3 { font-size: 13px; font-weight: 600; color: var(--tx-2); margin: -2px 0 2px; }
.manage-rail .secondary-action { justify-content: flex-start; }

/* metrics */
.dashboard-metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.dashboard-metric-card { padding: 16px 18px; }
.dashboard-metric-card strong {
  display: block;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -.02em;
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
}
.dashboard-metric-card span { display: block; font-size: 12px; color: var(--tx-2); margin-top: 4px; }

/* getting started wizard (existing hooks, restyled) */
.wizard-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.onboarding-list {
  list-style: none;
  padding: 4px 20px 8px;
  display: flex;
  flex-direction: column;
}
.onboarding-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--tx-2);
}
.onboarding-list li:last-child { border-bottom: none; }
.onboarding-list li > div { flex: 1 1 auto; min-width: 0; }
.onboarding-list li strong { font-size: 13px; font-weight: 650; color: var(--tx); display: block; }
.onboarding-list li p { font-size: 12px; color: var(--tx-2); margin-top: 2px; }
.onboarding-list li > span {
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tx-3);
  white-space: nowrap;
}
.onboarding-list li.is-done > span { color: var(--ok); }
.onboarding-list li.is-current > span { color: var(--accent); }
.onboarding-list li.is-attention > span { color: var(--err); }
.onboarding-list li.is-optional > span { color: var(--tx-3); }
.onboarding-list li.is-done strong { color: var(--tx-3); text-decoration: line-through; }
.onboarding-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 20px 16px;
}

/* document bases section (no card wrapper) */
.bases-section .section-header {
  border-bottom: none;
  padding: 0 0 14px;
}
.bases-section .section-header h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.bases-section .section-header p { font-size: 12.5px; color: var(--tx-2); margin-top: 3px; }
.base-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.base-grid > .empty-state { grid-column: 1 / -1; }

.base-card {
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 19px 20px;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.base-card:hover { box-shadow: var(--sh-lg); transform: translateY(-2px); }
.base-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.base-card-header h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3.5px 10px 3.5px 8px;
  border-radius: 20px;
  border: 1px solid var(--ok-line);
  color: var(--ok);
  background: var(--ok-bg);
  white-space: nowrap;
  text-transform: capitalize;
}
.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.status-muted { color: var(--idle); background: var(--idle-bg); border-color: var(--idle-line); }
.base-card .metric { margin-top: 12px; font-size: 13px; color: var(--tx-2); }
.meter {
  height: 5px;
  border-radius: 5px;
  background: #ecece8;
  overflow: hidden;
  margin-top: 13px;
}
.meter span { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.base-share { font-size: 11.5px; color: var(--tx-2); margin-top: 10px; }
.indexed-at {
  font-size: 11.5px;
  color: var(--tx-2);
  margin-top: 10px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

/* bottom grid */
.bottom-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  align-items: start;
}
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.health-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.health-heading h2 { font-size: 14px; font-weight: 650; }
.health-heading p { font-size: 12px; color: var(--tx-3); margin-top: 2px; }
.health-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  padding: 4px 20px 8px;
}
.health-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9.5px 0;
  border-bottom: 1px solid var(--line);
}
.health-list li:last-child { border-bottom: none; }
.health-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-bg);
  flex: 0 0 auto;
}
.health-list li span { font-size: 13px; font-weight: 550; flex: 1 1 auto; }
.health-list li strong { font-size: 12px; color: var(--tx-2); font-weight: 500; }

.dashboard-recent-activity { border-top: 1px solid var(--line); }
.dashboard-recent-activity .compact-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px 8px;
}
.dashboard-recent-activity .compact-section-header h3 { font-size: 13px; font-weight: 650; }
.dashboard-recent-activity .compact-section-header p { font-size: 11.5px; color: var(--tx-3); margin-top: 1px; }
.compact-list {
  list-style: none;
  padding: 0 20px 14px;
  display: flex;
  flex-direction: column;
}
.compact-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.compact-list li:last-child { border-bottom: none; }
.compact-list li strong { font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.compact-list li span { font-size: 11px; color: var(--tx-3); }

/* ============================================================
   CHAT (Thread layout)
   ============================================================ */
.chat-view { min-height: 0; }
.chat-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 460px;
  flex: 1 1 auto;
}
.app-shell.chat-view-active .chat-layout { min-height: 0; }

/* legacy companion sources panel + its toggle: permanently hidden in Thread
   layout (main.js still writes into #sources-list — harmless, off-screen) */
.sources-panel, .sources-toggle-button { display: none !important; }

.chat-conversations-panel {
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r);
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.chat-conversations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
}
.chat-conversations-header h2 { font-size: 13.5px; font-weight: 650; }
.chat-conversations-header button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5.5px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: #fff;
  transition: background .12s;
  white-space: nowrap;
}
.chat-conversations-header button:hover { background: #f4f5f3; }
.chat-conversations-header button::before { content: "+"; font-weight: 700; color: var(--tx-2); }

.chat-conversation-search {
  margin: 0 14px 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  padding: 6.5px 10px;
  background: #fbfbf9;
  transition: border-color .12s, box-shadow .12s;
}
.chat-conversation-search:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-conversation-search input {
  border: none;
  background: none;
  font-size: 12.5px;
  width: 100%;
  padding: 0;
  box-shadow: none;
}
.chat-conversation-search button {
  order: -1;
  border: none;
  background: none;
  padding: 0;
  color: var(--tx-3);
  display: inline-flex;
  flex: 0 0 auto;
}
#chat-conversations-status { padding: 0 16px 4px; font-size: 11.5px; }
#chat-conversations-status:empty { display: none; }

/* Refonte présentation Run an agent : la vue run RÉUTILISE la grille 3-colonnes du chat
   (classes chat-layout / chat-panel / chat-conversations-panel / answer-card / chat-composer —
   PARTAGÉES, aucune dup). Parité de remplissage viewport via :has() : le chat l'obtient via la
   classe chat-view-active (posée en JS) ; ici sans toucher au JS, quand la vue run est affichée.
   Le fil scrolle dans la zone answer-card ; le composer reste ancré en bas. */
.agents-invoke-view { min-height: 0; }
.app-shell:has(#agents-invoke-view:not(.is-hidden)) .workspace-main {
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  padding-bottom: 26px;
  display: flex;
  flex-direction: column;
}
.app-shell:has(#agents-invoke-view:not(.is-hidden)) #agents-invoke-view { flex: 1 1 auto; min-height: 0; }
#agents-invoke-view #ai-form-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#ai-run-layout { min-height: 0; flex: 1 1 auto; }
/* en-tête du panneau run : libellé + sélecteur d'agent (chips) */
.ai-run-agent-head { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* zone fil : l'empty-state s'efface dès qu'un fil est rendu (#ai-result visible) */
#ai-result:not(.is-hidden) + .ai-thread-empty { display: none; }

.chat-conversations-list {
  overflow-y: auto;
  padding: 4px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  flex: 1 1 auto;
}
.conversation-item {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sm);
  transition: background .1s;
}
.conversation-item:hover { background: #f4f5f3; }
.conversation-item.is-active { background: var(--accent-soft); }
.conversation-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 10px 4px;
  border: none;
  background: none;
  text-align: left;
  min-width: 0;
}
.conversation-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-star { color: var(--accent); margin-right: 5px; font-size: 11px; line-height: 1; }
.conversation-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--tx-3);
  padding: 10px 12px 3px;
  margin: 0;
}
.conversation-group-label:first-child { padding-top: 4px; }
.conversation-item.is-active .conversation-title { color: var(--accent); }
.conversation-meta { font-size: 11px; color: var(--tx-3); }
.conversation-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px 8px;
  visibility: hidden;
}
.conversation-item:hover .conversation-actions,
.conversation-item.is-active .conversation-actions,
.conversation-item:focus-within .conversation-actions { visibility: visible; }
.conversation-actions button {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--tx-3);
  background: none;
  border: none;
  border-radius: 5px;
  padding: 3px 6px;
  transition: background .12s, color .12s;
}
.conversation-actions button:hover { background: #ecede9; color: var(--tx); }
.conversation-empty-state { padding: 22px 14px; text-align: center; }
.conversation-empty-state h3 { font-size: 13px; font-weight: 650; }
.conversation-empty-state p { font-size: 12px; color: var(--tx-3); margin-top: 5px; line-height: 1.5; }
.conversation-empty-state button {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
  padding: 6.5px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: #fff;
  transition: background .12s;
}
.conversation-empty-state button:hover { background: #f4f5f3; }

/* chat panel */
.chat-panel {
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r);
  box-shadow: var(--sh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
}
.chat-panel-header h2 { font-size: 14px; font-weight: 650; }
.chat-panel-header .section-kicker { margin-bottom: 2px; }
.chat-header-actions { display: flex; align-items: center; gap: 8px; }

/* thread area — #answer-card */
.answer-card {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 26px;
  min-height: 180px;
}
.conversation-messages { display: flex; flex-direction: column; gap: 20px; }

.chat-message { display: flex; flex-direction: column; min-width: 0; }
.chat-message.user { align-items: flex-end; }
.chat-message.user .chat-message-role { display: none; }
.chat-message.user .chat-message-content {
  max-width: min(72%, 620px);
  background: var(--ink-800);
  color: #eef0f4;
  border-radius: 14px 14px 4px 14px;
  padding: 11px 16px;
  font-size: 13.5px;
  line-height: 1.55;
}
/* assistant answers fill the usable conversation width — the previous 920px
   cap left a dead column on the right of wide panels */
.chat-message.assistant { align-items: stretch; }
.chat-message.assistant .chat-message-role {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 650;
  color: var(--tx);
  position: relative;
}
.chat-message.assistant .chat-message-role::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--brand-gradient);
  flex: 0 0 auto;
}
.chat-message.assistant .chat-message-role::after {
  content: "";
  width: 8px;
  height: 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  position: absolute;
  left: 5px;
  pointer-events: none;
}
.chat-message.assistant .chat-message-content {
  border: 1px solid var(--line-card);
  border-radius: var(--r);
  background: #fdfdfc;
  padding: 18px 20px;
  font-size: 13.5px;
  line-height: 1.65;
}

/* rendered Markdown inside assistant answers (chat + legacy answer card).
   Scoped so user bubbles and other text are untouched. */
.chat-message.assistant .chat-message-content > :first-child,
.answer-content > :first-child { margin-top: 0; }
.chat-message.assistant .chat-message-content > :last-child,
.answer-content > :last-child { margin-bottom: 0; }
.chat-message.assistant .chat-message-content p,
.answer-content p { margin: 0 0 10px; }
.chat-message.assistant .chat-message-content h1,
.chat-message.assistant .chat-message-content h2,
.chat-message.assistant .chat-message-content h3,
.chat-message.assistant .chat-message-content h4,
.chat-message.assistant .chat-message-content h5,
.chat-message.assistant .chat-message-content h6,
.answer-content h1, .answer-content h2, .answer-content h3,
.answer-content h4, .answer-content h5, .answer-content h6 {
  font-family: var(--serif);
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink-900);
  margin: 18px 0 8px;
}
.chat-message.assistant .chat-message-content h1, .answer-content h1 { font-size: 19px; }
.chat-message.assistant .chat-message-content h2, .answer-content h2 { font-size: 17px; }
.chat-message.assistant .chat-message-content h3, .answer-content h3 { font-size: 15.5px; }
.chat-message.assistant .chat-message-content h4,
.chat-message.assistant .chat-message-content h5,
.chat-message.assistant .chat-message-content h6,
.answer-content h4, .answer-content h5, .answer-content h6 { font-size: 14px; }
.chat-message.assistant .chat-message-content ul,
.chat-message.assistant .chat-message-content ol,
.answer-content ul, .answer-content ol { margin: 0 0 10px; padding-left: 22px; }
.chat-message.assistant .chat-message-content li,
.answer-content li { margin: 3px 0; }
.chat-message.assistant .chat-message-content strong,
.answer-content strong { font-weight: 680; color: var(--ink-900); }
.chat-message.assistant .chat-message-content em,
.answer-content em { font-style: italic; }
.chat-message.assistant .chat-message-content code,
.answer-content code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  padding: 1px 5px;
}
.chat-message.assistant .chat-message-content pre,
.answer-content pre {
  margin: 0 0 10px;
  padding: 12px 14px;
  background: var(--ink-900);
  border-radius: var(--r-sm);
  overflow-x: auto;
}
.chat-message.assistant .chat-message-content pre code,
.answer-content pre code {
  font-size: 12px;
  background: none;
  border: none;
  padding: 0;
  color: #e7ebf1;
}
.chat-message.assistant .chat-message-content blockquote,
.answer-content blockquote {
  margin: 0 0 10px;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--accent-line);
  color: var(--tx-2);
}
.chat-message.assistant .chat-message-content hr,
.answer-content hr {
  border: none;
  border-top: 1px solid var(--line-2);
  margin: 16px 0;
}

/* citation chips + per-message tools */
.message-sources-button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  padding: 3px 8px;
  margin-top: 10px;
  transition: background .12s;
  line-height: 1.4;
}
.message-sources-button:hover { background: #dfeaf3; }
.message-export-button {
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-3);
  background: none;
  border: none;
  border-radius: 6px;
  padding: 3px 6px;
  margin-top: 6px;
  transition: background .12s, color .12s;
}
.message-export-button:hover { background: #f0f1ee; color: var(--tx); }

/* feedback row */
.message-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--tx-3);
}
.message-feedback > span { font-weight: 500; }
.message-feedback button {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
  background: none;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 3.5px 11px;
  transition: all .12s;
}
.message-feedback button:hover:not(:disabled) { background: #f4f5f3; }
.feedback-button.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.feedback-clear { border-color: transparent !important; color: var(--tx-3) !important; }
.feedback-panel {
  flex-basis: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fbfbf9;
  padding: 12px 14px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.feedback-panel > p { font-size: 12px; font-weight: 600; color: var(--tx); }
.feedback-reasons { display: flex; flex-direction: column; gap: 5px; }
.feedback-reasons label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--tx);
}
.feedback-note-label { gap: 4px; }
.feedback-note-label span { font-size: 11.5px; font-weight: 600; color: var(--tx-2); }
.feedback-note-label textarea { font-size: 12.5px; min-height: 56px; }
.feedback-warning { font-size: 11px; color: var(--tx-3); }
.feedback-actions { display: flex; align-items: center; gap: 8px; }
.feedback-actions button {
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
}
.feedback-actions button:first-child {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.feedback-actions button:first-child:hover { background: var(--accent-d); }

/* empty state + quick prompts */
.empty-state-card {
  max-width: 560px;
  margin: 26px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-state-card h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.empty-state-card p { font-size: 13px; color: var(--tx-2); line-height: 1.6; max-width: 60ch; }
.empty-state-kicker {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.empty-state-tags { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.empty-state-tags span {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx-2);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 3px 10px;
  background: #fff;
}
.empty-state-card .secondary-action { margin-top: 4px; }
.quick-prompts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  width: 100%;
}
.quick-prompt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  border: 1px solid var(--line-card);
  border-radius: var(--r-sm);
  background: #fdfdfc;
  padding: 12px 14px;
  transition: border-color .12s, box-shadow .12s;
}
.quick-prompt:hover { border-color: var(--accent-line); box-shadow: var(--sh); }
.quick-prompt-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.quick-prompt strong { font-size: 13px; font-weight: 650; }
.quick-prompt-text { font-size: 11.5px; color: var(--tx-3); }

.answer-loading { padding: 22px 4px; font-size: 13px; color: var(--tx-2); font-style: italic; }
.error-card {
  border: 1px solid var(--err-line);
  background: var(--err-bg);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 13px;
}
.error-card strong { display: block; color: var(--err); font-weight: 650; margin-bottom: 3px; }
.error-card p { color: var(--tx-2); }
.answer-content { font-size: 13.5px; line-height: 1.65; }

/* composer */
.chat-composer {
  border-top: 1px solid var(--line);
  background: #fbfbf9;
  padding: 14px 18px 10px;
  flex: 0 0 auto;
}
.composer-shell {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
.composer-shell:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.composer-shell textarea {
  width: 100%;
  border: none;
  background: none;
  resize: none;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 13px 16px 4px;
  min-height: 48px;
  box-shadow: none;
  display: block;
}
.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 10px 12px;
}
.chat-mode-chips { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.mode-chip {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
  background: none;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px 10px;
  transition: all .12s;
}
.mode-chip:hover { background: #f0f1ee; color: var(--tx); }
.mode-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.composer-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.shape-anchor { position: relative; }
.shape-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 20px;
  padding: 4.5px 11px;
  transition: all .12s;
}
.shape-toggle:hover { background: #f4f5f3; }
/* reply-language pill: sober sibling of .shape-toggle */
.chat-reply-language {
  display: inline-flex;
  /* the composer is a <form>, so `form label { flex-direction: column }`
     (forms section) would otherwise stack the globe ABOVE "Auto". Force a
     centered row so globe and label sit side by side on one line. */
  flex-direction: row;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 20px;
  padding: 4.5px 9px 4.5px 11px;
  color: var(--tx-2);
  line-height: 1;
  white-space: nowrap;
}
/* globe sits inline, vertically centered, to the LEFT of "Auto" — display:block
   removes the inline-SVG baseline gap that pushed it off the text line */
.chat-reply-language svg { color: var(--tx-3); flex: 0 0 auto; display: block; width: 13px; height: 13px; }
.chat-reply-language select {
  border: none;
  outline: none;
  background: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
  padding: 0;
  box-shadow: none;
}
.chat-reply-language select:disabled { color: var(--tx-3); }
/* powerful-mode pill : cohérent avec Auto/Shape dans .composer-right */
label.chat-powerful-toggle {
  display: inline-flex;
  flex-direction: row; /* same form-label guard as .chat-reply-language */
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 20px;
  padding: 4.5px 11px;
  transition: all .12s;
  cursor: pointer;
  user-select: none;
}
label.chat-powerful-toggle:hover { background: #f4f5f3; }
label.chat-powerful-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
label.chat-powerful-toggle:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.shape-toggle[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.composer-send-button {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background .12s;
  flex: 0 0 auto;
}
.composer-send-button:hover:not(:disabled) { background: var(--accent-d); }
.composer-stop-button {
  width: auto;
  padding: 0 13px;
  background: var(--ink-800);
  font-size: 12px;
  font-weight: 600;
}
.composer-stop-button:hover:not(:disabled) { background: var(--ink-700); }

/* shape popover */
.response-customizer-grid {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 330px;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
  padding: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.shape-panel-title { font-size: 12.5px; font-weight: 650; }
.chat-preset-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-preset-row .base-select {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  border: none;
  padding: 0;
  background: none;
}
.chat-preset-row .base-select span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx-2);
}
.chat-preset-row .base-select select {
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  padding: 7px 10px;
  max-width: none;
  width: 100%;
  font-weight: 400;
}
.chat-preset-help { font-size: 11px; color: var(--tx-3); margin-top: 6px; line-height: 1.5; }

.composer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--tx-3);
  padding: 8px 4px 0;
}
.composer-hint .form-status { font-size: 11px; color: var(--tx-3); min-height: 0; flex: 0 1 auto; }
.chat-shape-summary {
  font-size: 11px;
  color: var(--tx-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  text-align: center;
}
.composer-hint .mono { font-size: 10.5px; flex: 0 0 auto; }

/* source cards (citation drawer; same markup also written to hidden #sources-list) */
/* Panneau de sources repliable par message dans le fil du run (inc1) : empile les .source-item
   déjà stylées ; affiché/masqué via .is-hidden par le toggle du run. */
.run-message-sources { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }

.source-item {
  border: 1px solid var(--line-card);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  background: #fdfdfc;
  display: flex;
  gap: 9px;
  transition: border-color .12s, box-shadow .12s;
}
.source-item:hover { border-color: var(--accent-line); box-shadow: var(--sh); }
.source-ref {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 3px 6px;
  height: fit-content;
  flex: 0 0 auto;
}
.source-item > div { min-width: 0; }
.source-badge {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--tx-3);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.source-item h3 {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tx);
  word-break: break-all;
  line-height: 1.4;
  margin-top: 3px;
}
.source-meta { font-size: 10.5px; color: var(--tx-3); margin-top: 3px; }
.source-snippet {
  font-size: 12px;
  color: var(--tx-2);
  line-height: 1.55;
  margin-top: 9px;
  padding-left: 10px;
  border-left: 2px solid var(--line-2);
  font-style: italic;
}

/* ============================================================
   CITATION DRAWER
   ============================================================ */
.citation-drawer { position: fixed; inset: 0; z-index: 60; }
.citation-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 20, 28, .32);
  border: none;
  padding: 0;
  animation: fadein .18s ease;
  width: 100%;
}
.citation-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 92vw;
  background: #fff;
  box-shadow: -12px 0 40px rgba(16, 20, 28, .18);
  display: flex;
  flex-direction: column;
  animation: drawerin .22s ease;
  outline: none;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawerin { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.citation-drawer-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.citation-drawer-header h2 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin-top: 4px; }
.citation-drawer-header p { font-size: 12px; color: var(--tx-2); margin-top: 4px; }
.citation-drawer-header > button,
.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--tx-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 0;
  transition: background .12s;
}
.citation-drawer-header > button::before,
.modal-close::before {
  content: "✕";
  font-size: 12px;
  font-weight: 600;
}
.citation-drawer-header > button:hover,
.modal-close:hover { background: #f4f5f3; }
.citation-drawer-list {
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
}

/* ============================================================
   DOCUMENT BASES
   ============================================================ */
.document-bases-layout {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 16px;
  align-items: start;
}
.base-list { display: flex; flex-direction: column; }
.base-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.base-list-item:last-child { border-bottom: none; }
.base-list-item::before {
  content: "";
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background-color: var(--accent-soft);
  flex: 0 0 auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b5d7c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a1 1 0 011-1h5l2 2h9a1 1 0 011 1v9a1 1 0 01-1 1H4a1 1 0 01-1-1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 19px;
}
.base-list-item > div:first-of-type { flex: 1 1 auto; min-width: 0; }
.base-list-item h3 { font-family: var(--serif); font-size: 15.5px; font-weight: 600; }
.base-list-item > div p { font-size: 12.5px; color: var(--tx-2); margin-top: 2px; }
.base-list-item dl {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--tx-3);
}
.base-list-item dl > div { display: inline-flex; align-items: baseline; gap: 4px; }
.base-list-item dl > div:not(:first-child)::before { content: "·"; margin-right: 6px; color: var(--tx-3); }
.base-list-item dt { font-weight: 400; order: 2; }
.base-list-item dd { font-weight: 600; color: var(--tx); font-variant-numeric: tabular-nums; order: 1; }
.base-list-actions { display: flex; gap: 8px; flex-shrink: 0; }

.create-base-card { padding: 20px; align-self: start; }
.create-base-card h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-top: 8px; }
.base-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }

/* ============================================================
   USERS
   ============================================================ */
.users-layout {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 16px;
  align-items: start;
}
.users-invitations-card { padding: 20px; }
.users-invitations-card h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-top: 8px; }
.users-invitations-card > p { font-size: 11.5px; color: var(--tx-3); margin-top: 6px; line-height: 1.5; }
.users-invitations-card .settings-form { margin-top: 16px; }

.so-host {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  background: #fbfbf9;
}
.so-host .mono { font-size: 11px; color: var(--tx-2); }

/* ============================================================
   AUDIT
   ============================================================ */
.audit-retention-panel {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  background: #fdfdfc;
  font-size: 12px;
  flex-wrap: wrap;
}
.audit-retention-panel > div { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.audit-retention-panel span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--tx-3);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.audit-retention-panel strong { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.audit-retention-panel p { font-size: 11.5px; color: var(--tx-3); margin-left: auto; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-layout { display: flex; flex-direction: column; gap: 16px; }
.settings-card { overflow: hidden; }

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}
/* 2-zone shell (chantier F1): a visible "Answers" zone and a collapsible
   "Advanced" zone, each wrapping whole settings sections. */
.settings-zone {
  border: 1px solid var(--line-card);
  border-radius: var(--r-sm);
  background: #fff;
  overflow: hidden;
}
.settings-zone-title {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--tx-2);
  letter-spacing: .02em;
  margin: 0;
  padding: 13px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--line-card);
}
/* Collapsible section (chantier F1b): a <button aria-expanded> head + [hidden]
   body. Answers sections are rows inside the zone card; Advanced is its own card. */
.settings-collapse { border-top: 1px solid var(--line); }
.settings-zone > .settings-collapse:first-of-type { border-top: none; }
.settings-collapse-zone {
  border: 1px solid var(--line-card);
  border-radius: var(--r-sm);
  background: #fff;
  overflow: hidden;
}
.settings-collapse-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 26px;
  border: none;
  /* chantier F1c — section headers carry a persistent tint at rest (3 levels:
     zone header var(--line-card) >= section header var(--paper) > white body). */
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  color: var(--tx);
  transition: background .12s;
}
.settings-collapse-head:hover { background: #efeee9; }
/* The Advanced collapse head is a ZONE header → the stronger zone tint. */
.settings-collapse-zone > .settings-collapse-head { background: var(--line-card); }
.settings-collapse-zone > .settings-collapse-head:hover { background: #e3e2db; }
.settings-collapse-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-collapse-title { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--tx); }
.settings-collapse-summary { font-size: 12px; color: var(--tx-3); }
.settings-collapse-chevron { color: var(--tx-3); flex: 0 0 auto; transition: transform .15s; }
.settings-collapse-head[aria-expanded="true"] .settings-collapse-chevron { transform: rotate(180deg); }
.settings-collapse-body { border-top: 1px solid var(--line); }
.settings-collapse-zone > .settings-collapse-body { border-top: 1px solid var(--line); }

/* chantier F6 — contextual help affordance. A discreet "?" opens a short bubble;
   one open at a time, click-outside/Escape closes (JS). Section help overlays
   the collapse head as a SIBLING of the head button (never nested inside it, so
   F1b/F1c stay intact); field help sits inline after the label text. */
.settings-collapse { position: relative; }
.settings-help { position: relative; display: inline-flex; vertical-align: middle; }
.settings-help-section { position: absolute; top: 13px; right: 48px; z-index: 2; }
.settings-field-head { display: flex; align-items: center; gap: 6px; }
.settings-help-toggle {
  width: 18px; height: 18px; padding: 0; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: #fff; color: var(--tx-3);
  font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer;
  transition: color .12s, border-color .12s;
}
.settings-help-toggle:hover { color: var(--tx); border-color: var(--tx-3); }
.settings-help-toggle:focus-visible { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.settings-help-bubble {
  /* chantier F8 — fixed positioning so the bubble is never clipped by the
     Advanced zone's overflow:hidden; JS (positionHelpBubble) sets top/left and
     clamps it inside the viewport so it stays fully visible. */
  position: fixed; top: 0; left: 0; z-index: 60;
  width: 264px; max-width: calc(100vw - 16px);
  padding: 10px 12px;
  background: var(--tx); color: #fff;
  border-radius: var(--r-sm);
  font-size: 12px; line-height: 1.45; font-weight: 400;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .2);
}
.settings-help-bubble[hidden] { display: none; }
/* chantier F8 — Scope section: line up the Sectors label + listbox with the
   scope-mode dropdown above. Both the single <select> and the <select multiple>
   are forced to the full column width (border-box) so their left edge and width
   match exactly; the labels share the same column structure. */
#settings-section-scope > label { align-items: stretch; }
#settings-scope-mode,
#settings-scope-sectors { width: 100%; box-sizing: border-box; }
.settings-reassurance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--tx-3);
}
.settings-reassurance svg { color: var(--accent); flex: 0 0 auto; }
/* Unified "Response models" list (chantier F2a): slim rows, name + format pill +
   on/off toggle + delete (owner, non-built-in only). */
.response-template-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-top: 1px solid var(--line);
}
.response-template-row:first-child { border-top: none; }
.response-template-name { font-weight: 600; color: var(--tx); min-width: 0; overflow-wrap: anywhere; }
.response-template-format { flex: 0 0 auto; }
.response-template-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.response-template-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tx-2); cursor: pointer; }
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
}
.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8.5px 12px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-2);
  text-align: left;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.settings-tab:hover { background: #f4f5f3; color: var(--tx); }
.settings-tab.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.settings-section {
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.compact-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 0;
  border-bottom: none;
}
.settings-section .compact-header h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin-top: 6px;
}
.settings-section .compact-header > div > p:not(.section-kicker) {
  font-size: 12.5px;
  color: var(--tx-2);
  margin-top: 4px;
  max-width: 70ch;
}

/* configuration hierarchy (numbered) */
.settings-hierarchy {
  counter-reset: h;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.settings-hierarchy li {
  counter-increment: h;
  display: flex;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.settings-hierarchy li:last-child { border-bottom: none; }
.settings-hierarchy li::before {
  content: counter(h, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}
.settings-hierarchy strong { font-size: 13px; font-weight: 650; display: block; }
.settings-hierarchy span { font-size: 12px; color: var(--tx-2); display: block; margin-top: 2px; }

/* overview status cards */
.settings-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.settings-status-card {
  background: #fff;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.settings-status-card > span {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.settings-status-card > strong { font-size: 13px; font-weight: 600; }
.settings-status-card .compact-action { margin-top: 2px; }

/* facts grids */
.settings-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.settings-facts > div {
  background: #fff;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.settings-facts dt {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.settings-facts dd { margin: 5px 0 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }

.settings-form { display: flex; flex-direction: column; gap: 14px; }
.settings-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-form-grid .upload-note,
.settings-form-grid .settings-actions,
.settings-form-grid .form-status,
.settings-form-grid .checkbox-label,
.settings-form-grid .settings-byok-label { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .settings-form-grid { grid-template-columns: 1fr; }
}
.settings-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-form button[type="submit"]:not(.secondary-action):not(.secondary-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--sh);
  transition: background .12s;
  align-self: flex-start;
}
.settings-form button[type="submit"]:not(.secondary-action):not(.secondary-button):hover:not(:disabled) {
  background: var(--accent-d);
}

/* preset / skill rows generated by main.js */
.prompt-presets-list { display: flex; flex-direction: column; }
.prompt-preset-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.prompt-preset-item:last-child { border-bottom: none; }
.prompt-preset-item.is-disabled .prompt-preset-heading { opacity: .55; }
.prompt-preset-item.is-selected {
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  padding-left: 10px;
  padding-right: 10px;
}
.prompt-preset-heading { flex: 1 1 220px; min-width: 0; }
.prompt-preset-heading strong, .prompt-preset-heading b { font-size: 13px; font-weight: 600; display: block; }
.prompt-preset-heading p, .prompt-preset-heading span {
  font-size: 11.5px;
  color: var(--tx-2);
  display: block;
  margin-top: 1px;
}
.preset-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--tx-2);
  white-space: nowrap;
  margin-right: 4px;
}
.prompt-preset-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* preset pack panels */
.prompt-preset-pack-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fbfbf9;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prompt-preset-pack-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.prompt-preset-pack-header h4 { font-size: 13px; font-weight: 650; }
.prompt-preset-pack-header p { font-size: 11.5px; color: var(--tx-3); margin-top: 2px; }
.preset-pack-summary {
  font-size: 12px;
  color: var(--tx-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-xs);
  padding: 10px 12px;
  background: #fff;
  line-height: 1.55;
}
.prompt-preset-import-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fbfbf9;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prompt-preset-import-panel pre,
#guided-skill-library-preview {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--tx-2);
  background: #fff;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-xs);
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  line-height: 1.5;
}

.settings-info-list { display: flex; flex-direction: column; gap: 8px; }
.settings-info-list p { font-size: 13px; color: var(--tx-2); line-height: 1.6; }

.settings-note-card { padding: 18px 20px; }
.settings-note-card h2 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin-top: 7px; }
.settings-note-card p:not(.section-kicker) { font-size: 12.5px; color: var(--tx-2); margin-top: 8px; line-height: 1.55; }

/* ============================================================
   MODALS (login, upload, purge, access)
   ============================================================ */
.login-modal, .upload-modal, .purge-modal, .access-modal, .password-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 20, 28, .4);
  animation: fadein .16s ease;
}
.login-panel, .upload-panel, .purge-panel, .access-panel, .password-modal-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--sh-modal);
  width: 480px;
  max-width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  animation: modalin .2s ease;
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@keyframes modalin {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.login-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.login-modal-heading h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin-top: 6px; }
.login-modal-heading p:not(.eyebrow) {
  font-size: 12.5px;
  color: var(--tx-2);
  margin-top: 5px;
  line-height: 1.5;
}
.login-context { font-size: 11.5px; color: var(--tx-3); line-height: 1.5; }
.login-actions { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.login-actions button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--sh);
  transition: background .12s;
}
.login-actions button[type="submit"]:hover:not(:disabled) { background: var(--accent-d); }
.purge-panel .login-actions button[type="submit"] {
  background: #fff;
  border-color: var(--err-line);
  color: var(--err);
  box-shadow: none;
}
.purge-panel .login-actions button[type="submit"]:hover:not(:disabled) { background: var(--err-bg); }

.upload-dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-sm);
  background: #fbfbf9;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: border-color .12s, background .12s;
}
.upload-dropzone:hover, .upload-dropzone:focus-within {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.upload-dropzone svg { color: var(--tx-2); }
.upload-dropzone b { font-size: 13px; font-weight: 600; }
.upload-dropzone span { font-size: 11.5px; color: var(--tx-3); }
.upload-dropzone input[type="file"] {
  font-size: 12px;
  color: var(--tx-2);
  border: none;
  background: none;
  padding: 4px 0 0;
  box-shadow: none;
  max-width: 100%;
}

.purge-summary {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fbfbf9;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.purge-summary p { font-size: 12.5px; color: var(--tx-2); }
.purge-summary p strong { font-family: var(--mono); font-size: 12px; color: var(--tx); }
.purge-summary .empty-state { padding: 8px 0; text-align: left; }

.access-user-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
}
.access-user-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}
.access-user-item:last-child { border-bottom: none; }
.access-user-item input[type="checkbox"] {
  order: 2;
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}
.access-user-item > span {
  order: 1;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.access-user-item strong { font-size: 13px; font-weight: 600; }
.access-user-item small { font-size: 11.5px; color: var(--tx-2); text-transform: capitalize; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-region {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  width: min(480px, calc(100vw - 40px));
}
.toast-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ink-800);
  color: #eef0f4;
  border-radius: 10px;
  box-shadow: var(--sh-lg);
  padding: 12px 16px;
  animation: modalin .2s ease;
}
.toast-card p { flex: 1 1 auto; font-size: 13px; }
.toast-action {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: none;
  border-radius: var(--r-xs);
  padding: 6px 12px;
  transition: background .12s;
  white-space: nowrap;
}
.toast-action:hover { background: rgba(255, 255, 255, .2); }
.toast-close {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--on-ink-2);
  background: none;
  border: none;
  padding: 6px 4px;
  transition: color .12s;
}
.toast-close:hover { color: #fff; }

/* ============================================================
   SIGNED-OUT PAGE
   ============================================================ */
.signed-out-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-900);
  position: relative;
  overflow: hidden;
  padding: 30px;
}
.signed-out-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(800px 500px at 75% 20%, rgba(72, 116, 155, .18), transparent 65%);
}
.signed-out-card {
  position: relative;
  width: 430px;
  max-width: 92vw;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .45);
  padding: 34px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.signed-out-brand { padding: 0; }
.signed-out-brand .brand-name { color: var(--tx); }
.signed-out-brand .brand-subtitle { color: var(--tx-3); }
.signed-out-card h1 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 8px;
}
.signed-out-copy { font-size: 13.5px; color: var(--tx-2); line-height: 1.6; }
.signed-out-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--sh);
  transition: background .12s;
}
.signed-out-button:hover { background: var(--accent-d); }

/* ============================================================
   SCROLLBARS (subtle)
   ============================================================ */
.answer-card::-webkit-scrollbar,
.chat-conversations-list::-webkit-scrollbar,
.citation-drawer-list::-webkit-scrollbar,
.access-user-list::-webkit-scrollbar { width: 8px; }
.answer-card::-webkit-scrollbar-thumb,
.chat-conversations-list::-webkit-scrollbar-thumb,
.citation-drawer-list::-webkit-scrollbar-thumb,
.access-user-list::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 8px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1320px) {
  .base-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-metrics-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1120px) {
  .bottom-grid, .document-bases-layout, .users-layout { grid-template-columns: 1fr; }
  .qa-panel { flex-direction: column; }
  .manage-rail {
    flex: 1 1 auto;
    border-left: none;
    border-top: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px 24px;
  }
  .manage-rail .section-kicker, .manage-rail h3 { width: 100%; margin: 0; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-conversations-panel { max-height: 260px; }
  .app-shell.chat-view-active .workspace-main { height: auto; overflow: visible; }
  .settings-panel { grid-template-columns: 1fr; }
  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 880px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    position: static;
    padding: 14px;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label { width: 100%; padding: 8px 12px 4px; }
  .nav-item { width: auto; }
  .nav-item.is-active::before { display: none; }
  .instance-card { margin-top: 12px; }
  .workspace-main { padding: 20px 16px 36px; }
  .topbar { padding: 11px 16px; }
  .dashboard-metrics-grid, .base-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .dashboard-metrics-grid, .base-grid, .quick-prompts { grid-template-columns: 1fr; }
  .ask-form { flex-wrap: wrap; }
  .ask-form .base-select { width: 100%; }
  .audit-filters label { min-width: 100%; }
  .audit-filter-actions { margin-left: 0; }
  .citation-drawer-panel { width: 100vw; max-width: 100vw; }
  .topbar-title { gap: 8px; }
  .instance-label, .topbar-divider { display: none; }
}
