/* =============================================================================
   Textify — app.css  (redesign-glass)
   Self-contained glass workspace. Tokens are the Glass grammar expressed as a
   standalone dark-first triad so the page renders correctly under the app's
   strict same-origin CSP (no external font or style hosts are reachable), so
   the Fraunces / IBM Plex Sans / IBM Plex Mono faces are self-hosted below as
   same-origin woff2 (OFL, Google Fonts) served from /static/fonts.
   ============================================================================= */

/* ============================= SELF-HOSTED FONTS (OFL) ============================= */
/* Fraunces (display) and IBM Plex Sans (body) ship as variable woff2 (one file
   per subset spans 400-700); IBM Plex Mono ships one static woff2 per weight.
   Same-origin under default-src/font-src 'self' — matches the design artifact,
   which pulls the identical faces from Google Fonts. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/fraunces-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;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/fraunces-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;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/plexsans-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;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/plexsans-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;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/plexmono-400-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;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/plexmono-500-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;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/plexmono-600-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;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/plexmono-400-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;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/plexmono-500-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;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/plexmono-600-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;
}

/* ============================= TOKENS (dark-first) ============================= */
:root {
  --bg: #080c11;
  --bg-soft: #0d141b;
  --rail-bg: rgba(9, 14, 19, 0.72);
  --surface: rgba(198, 224, 222, 0.045);
  --surface-strong: rgba(206, 230, 228, 0.09);
  --surface-hover: rgba(206, 230, 228, 0.065);
  --border: rgba(160, 199, 201, 0.16);
  --border-strong: rgba(160, 199, 201, 0.32);
  --text: #e8f1f1;
  --text-muted: #93a8ac;
  --text-faint: #5c6f73;
  --accent: #57d9c4;
  --accent-soft: rgba(87, 217, 196, 0.14);
  --accent-strong: rgba(87, 217, 196, 0.38);
  --accent-ink: #04211c;
  --amber: #f0b467;
  --amber-soft: rgba(240, 180, 103, 0.16);
  --amber-strong: rgba(240, 180, 103, 0.4);
  --good: #7bd88f;
  --good-soft: rgba(123, 216, 143, 0.14);
  --bad: #ef8686;
  --bad-soft: rgba(239, 134, 134, 0.14);
  --shadow: rgba(0, 0, 0, 0.55);
  --glow-1: rgba(87, 217, 196, 0.18);
  --glow-2: rgba(240, 180, 103, 0.1);
  --focus: #8be8d8;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", SFMono-Regular, Consolas, monospace;

  --r-lg: 20px;
  --r-md: 13px;
  --r-sm: 8px;
  --rail-w: 64px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f1f5f4;
    --bg-soft: #e7eeed;
    --rail-bg: rgba(255, 255, 255, 0.55);
    --surface: rgba(255, 255, 255, 0.58);
    --surface-strong: rgba(255, 255, 255, 0.92);
    --surface-hover: rgba(255, 255, 255, 0.78);
    --border: rgba(19, 44, 43, 0.12);
    --border-strong: rgba(19, 44, 43, 0.22);
    --text: #122221;
    --text-muted: #4b6260;
    --text-faint: #7c908d;
    --accent: #0b7f73;
    --accent-soft: rgba(13, 148, 132, 0.12);
    --accent-strong: rgba(13, 148, 132, 0.34);
    --accent-ink: #ffffff;
    --amber: #9c6118;
    --amber-soft: rgba(156, 97, 24, 0.13);
    --amber-strong: rgba(156, 97, 24, 0.32);
    --good: #1f8a52;
    --good-soft: rgba(31, 138, 82, 0.12);
    --bad: #c0394a;
    --bad-soft: rgba(192, 57, 74, 0.12);
    --shadow: rgba(20, 45, 44, 0.16);
    --glow-1: rgba(13, 148, 132, 0.1);
    --glow-2: rgba(156, 97, 24, 0.08);
    --focus: #0d9484;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f1f5f4;
  --bg-soft: #e7eeed;
  --rail-bg: rgba(255, 255, 255, 0.55);
  --surface: rgba(255, 255, 255, 0.58);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-hover: rgba(255, 255, 255, 0.78);
  --border: rgba(19, 44, 43, 0.12);
  --border-strong: rgba(19, 44, 43, 0.22);
  --text: #122221;
  --text-muted: #4b6260;
  --text-faint: #7c908d;
  --accent: #0b7f73;
  --accent-soft: rgba(13, 148, 132, 0.12);
  --accent-strong: rgba(13, 148, 132, 0.34);
  --accent-ink: #ffffff;
  --amber: #9c6118;
  --amber-soft: rgba(156, 97, 24, 0.13);
  --amber-strong: rgba(156, 97, 24, 0.32);
  --good: #1f8a52;
  --good-soft: rgba(31, 138, 82, 0.12);
  --bad: #c0394a;
  --bad-soft: rgba(192, 57, 74, 0.12);
  --shadow: rgba(20, 45, 44, 0.16);
  --glow-1: rgba(13, 148, 132, 0.1);
  --glow-2: rgba(156, 97, 24, 0.08);
  --focus: #0d9484;
  color-scheme: light;
}

/* ============================= RESET / BASE ============================= */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  text-wrap: balance;
  margin: 0;
  color: var(--text);
}
p {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
::selection {
  background: var(--accent-strong);
  color: var(--accent-ink);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
a {
  color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 8px;
  background-clip: padding-box;
  border: 2px solid transparent;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-faint);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.sr-only-btn {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ============================= APP SHELL ============================= */
.app {
  position: relative;
  min-height: 100vh;
  display: flex;
  background:
    radial-gradient(900px 500px at 85% -8%, var(--glow-1), transparent 60%),
    radial-gradient(700px 420px at -5% 100%, var(--glow-2), transparent 55%),
    var(--bg);
}
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 20px 50px -30px var(--shadow);
}

/* --- rail --- */
.rail {
  width: var(--rail-w);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0;
  background: var(--rail-bg);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}
.rail-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(155deg, var(--accent-soft), transparent);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.brand-code {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
}
.rail-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-decoration: none;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.rail-btn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
.rail-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.rail-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border-strong);
}
.rail-btn .rail-tip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
  box-shadow: 0 8px 24px -12px var(--shadow);
  z-index: 30;
}
.rail-btn:hover .rail-tip,
.rail-btn:focus-visible .rail-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --- shell / topbar --- */
.shell {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(var(--bg-soft), transparent);
}
.topbar-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
}
.topbar-eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.searchpill {
  flex: 1 1 auto;
  max-width: 420px;
  margin: 0 24px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-faint);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.searchpill:hover {
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.searchpill svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  flex: 0 0 auto;
}
.searchpill span {
  font-size: 13px;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--surface-strong);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  flex: 0 0 auto;
}
.chip-dot.warn {
  background: var(--amber);
}
.chip-dot.bad {
  background: var(--bad);
}
.chip-icon {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex: 0 0 auto;
}
.chip.lock {
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.chip.lock:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.iconbtn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.iconbtn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.iconbtn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}

/* --- screens --- */
.screens {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}
.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
}
.screen[hidden] {
  display: none;
}

/* ============================= ASK SCREEN ============================= */
.ask-grid {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 0px;
  height: 100%;
  transition: grid-template-columns 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.ask-grid.detail-open {
  grid-template-columns: 248px minmax(0, 1fr) 328px;
}
/* The collapsed 0px column still holds focusable controls; keep them out of
   the tab order (and off-screen paint) until an excerpt is open. */
.ask-grid:not(.detail-open) .detail-panel {
  visibility: hidden;
}

.sources-pane {
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pane-count {
  color: var(--text-faint);
  font-weight: 400;
}
.pane-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.source-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.source-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.source-item:hover {
  background: var(--surface-hover);
}
.source-item.active {
  background: var(--surface-strong);
  border-color: var(--border-strong);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex: 0 0 auto;
}
.status-dot.indexed {
  background: var(--good);
}
.status-dot.indexing {
  background: var(--amber);
  animation: pulse 1.6s ease-in-out infinite;
}
.status-dot.failed {
  background: var(--bad);
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
.source-item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.source-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}
.rail-cta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
  padding: 9px;
  border-radius: var(--r-sm);
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-size: 12.5px;
  background: transparent;
}
.rail-cta:hover {
  color: var(--accent);
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}
.rail-cta svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.thread-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}
.thread {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 26px 30px 10px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.thread-empty {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  color: var(--text-faint);
  max-width: 34ch;
}
.thread-empty .empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.thread-empty .empty-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}
.thread-empty b {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.thread-empty span {
  font-size: 12px;
  line-height: 1.55;
}
.msg-user {
  align-self: flex-end;
  max-width: 72%;
}
.msg-user .bubble {
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
  padding: 11px 15px;
  border-radius: 16px 16px 4px 16px;
  font-size: 13.5px;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-answer {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.answer-card {
  padding: 16px 18px;
  border-radius: 16px 16px 16px 4px;
}
.answer-card p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
}
.answer-card p + p {
  margin-top: 10px;
}
.answer-card p.thinking {
  color: var(--text-faint);
}
.cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  margin: 0 1px;
  vertical-align: 2px;
  transition: background 0.12s ease;
  cursor: pointer;
}
.cite:hover {
  background: var(--accent-strong);
  color: var(--accent-ink);
}
.cite.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.pipeline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
}
.badge b {
  color: var(--text);
  font-weight: 600;
}
.answer-meta {
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  gap: 12px;
  padding-left: 2px;
  flex-wrap: wrap;
}
.answer-meta .mono {
  color: var(--text-faint);
}

.composer {
  flex: 0 0 auto;
  margin: 0 20px 20px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.composer textarea {
  resize: none;
  background: transparent;
  border: none;
  width: 100%;
  min-height: 38px;
  max-height: 120px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.composer textarea:focus {
  outline: none;
}
.composer textarea::placeholder {
  color: var(--text-faint);
}
.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.composer-hint {
  font-size: 11px;
  color: var(--text-faint);
}
.composer.is-locked textarea {
  color: var(--text-faint);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  transition:
    transform 0.12s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}
.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.06);
}
.btn-primary:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.btn.small {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.btn.danger {
  border-color: var(--bad);
  color: var(--bad);
  background: var(--bad-soft);
}
.btn.danger:hover {
  background: var(--bad-soft);
  filter: brightness(1.1);
}

.detail-panel {
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 18px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.detail-head h3 {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
}
.detail-file {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.excerpt {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-muted);
  padding: 12px 13px;
  border-radius: var(--r-md);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.excerpt mark {
  background: var(--amber-soft);
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
  box-shadow: 0 0 0 1px var(--amber-strong) inset;
}
.detail-note {
  padding: 2px 0;
}
.detail-close {
  margin-left: auto;
}
.detail-open-source {
  align-self: flex-start;
}

/* ============================= SOURCES SCREEN ============================= */
.screen-pad {
  padding: 26px 30px 40px;
  max-width: 1100px;
}
.screen-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.screen-head h2 {
  font-size: 22px;
}
.screen-head .sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
  max-width: 56ch;
}
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.dropzone:hover,
.dropzone:focus-within {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}
.dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--accent);
}
.dropzone-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
.dropzone-text {
  flex: 1 1 auto;
}
.dropzone-text b {
  font-size: 13.5px;
  color: var(--text);
}
.dropzone-text p,
.dropzone-text > span {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
  display: block;
}
.dropzone.drag-over {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}
.dropzone.disabled,
.table-wrap.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.table-wrap {
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
thead th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr {
  transition: background 0.15s ease;
}
tbody tr:hover {
  background: var(--surface-hover);
}
.file-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}
.file-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.file-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
}
.file-name {
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
}
.file-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.status-pill.indexed {
  background: var(--good-soft);
  color: var(--good);
}
.status-pill.indexing {
  background: var(--amber-soft);
  color: var(--amber);
}
.status-pill.failed {
  background: var(--bad-soft);
  color: var(--bad);
}
.row-progress {
  width: 96px;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-strong);
  overflow: hidden;
  margin-top: 5px;
}
.row-progress i {
  display: block;
  height: 100%;
  background: var(--amber);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0;
}
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ============================= NEW WORKSPACE SCREEN ============================= */
.onboard-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.onboard-card {
  width: 100%;
  max-width: 560px;
  border-radius: var(--r-lg);
  padding: 34px 34px 30px;
}
.onboard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.step-pill {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-faint);
}
.step-pill b {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  flex: 0 0 auto;
  font-family: var(--font-mono);
}
.step-pill.on {
  border-color: var(--accent-strong);
  color: var(--text);
}
.step-pill.on b {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.onboard-card h2 {
  font-size: 23px;
  margin-bottom: 6px;
}
.onboard-card > .sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
  max-width: 48ch;
}
.onboard-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 30px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.onboard-drop:hover,
.onboard-drop:focus-visible {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}
.onboard-drop svg {
  width: 26px;
  height: 26px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.5;
}
.onboard-drop b {
  font-size: 13.5px;
  color: var(--text);
}
.onboard-drop span {
  font-size: 11.5px;
  color: var(--text-faint);
}
.field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.field input {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  color: var(--text);
  font-size: 13px;
  width: 100%;
}
.field input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-note {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
}
.onboard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* ============================= SETTINGS SCREEN ============================= */
.settings-grid {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 28px;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
}
.settings-nav button {
  text-align: left;
  padding: 8px 11px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
}
.settings-nav button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.settings-nav button.active {
  background: var(--surface-strong);
  border-color: var(--border);
  color: var(--accent);
  font-weight: 600;
}
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 640px;
}
.setting-card {
  border-radius: var(--r-lg);
  padding: 20px 22px;
}
.setting-card h3 {
  font-size: 14px;
  margin-bottom: 3px;
}
.setting-card .sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 16px;
  max-width: 52ch;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}
.setting-row:first-of-type {
  border-top: none;
  padding-top: 0;
}
.setting-row-label {
  font-size: 13px;
  color: var(--text);
}
.setting-row-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 2px;
}
.usage-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.usage-bar {
  width: 140px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-strong);
  overflow: hidden;
}
.usage-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.segmented {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 2px;
  background: var(--surface-strong);
}
.segmented button {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
}
.segmented button.on {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.switch {
  width: 36px;
  height: 21px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  position: relative;
  flex: 0 0 auto;
  transition: background 0.15s ease;
  padding: 0;
}
.switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text-faint);
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}
.switch.on {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
}
.switch.on i {
  transform: translateX(15px);
  background: var(--accent);
}
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 200px;
}
.range-row input[type="range"] {
  flex: 1 1 auto;
  accent-color: var(--accent);
}
.range-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  min-width: 52px;
  text-align: right;
}
.danger-card {
  border-color: var(--bad-soft);
}
.danger-card h3 {
  color: var(--bad);
}

/* ============================= COMMAND PALETTE ============================= */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 11, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  z-index: 100;
}
.cmdk-overlay[hidden] {
  display: none;
}
.cmdk {
  width: 100%;
  max-width: 520px;
  border-radius: 16px;
  overflow: hidden;
  margin: 0 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px -20px var(--shadow);
}
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input-row svg {
  width: 15px;
  height: 15px;
  stroke: var(--text-faint);
  fill: none;
  stroke-width: 1.8;
}
.cmdk-input-row input {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  font-size: 14.5px;
  color: var(--text);
}
.cmdk-input-row input:focus {
  outline: none;
}
.cmdk-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  margin: 0;
  list-style: none;
}
.cmdk-list li {
  margin: 0;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-muted);
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
}
.cmdk-item svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  flex: 0 0 auto;
}
.cmdk-item:hover,
.cmdk-item.sel {
  background: var(--accent-soft);
  color: var(--text);
}
.cmdk-item .cmdk-tag {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-faint);
}
.cmdk-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ============================= TOAST ============================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(12px);
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  opacity: 0;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  z-index: 120;
  pointer-events: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 20px 50px -20px var(--shadow);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
}
.toast.is-error .toast-dot {
  background: var(--bad);
}
.toast.is-good .toast-dot {
  background: var(--good);
}

/* ============================= LOCK GATE / EMPTY / REMOVE ============================= */
.source-row {
  position: relative;
}
.source-row .source-item {
  padding-right: 30px;
}
.source-remove {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  opacity: 0;
  transition:
    opacity 0.12s ease,
    color 0.12s ease,
    background 0.12s ease;
  background: transparent;
  border: 1px solid transparent;
}
.source-row:hover .source-remove,
.source-row:focus-within .source-remove {
  opacity: 1;
}
.source-remove:hover {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: var(--bad-soft);
}
.source-remove svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.lock-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 12px;
  border-radius: var(--r-md);
  margin-bottom: 6px;
}
.lock-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
}
.lock-card-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}
.lock-card h4 {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.lock-card p {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
}
.lock-card input {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 12.5px;
  width: 100%;
}
.lock-card input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.lock-card .field-error {
  font-size: 10.5px;
  color: var(--bad);
  min-height: 13px;
}
.lock-card .btn-primary {
  width: 100%;
  justify-content: center;
}
.field-error {
  color: var(--bad);
  font-size: 11px;
}
.onboard-error {
  margin-top: 6px;
}

/* --- read-only demo carve-out --- */
.lock-demo-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lock-demo-sep::before,
.lock-demo-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.lock-demo-btn {
  width: 100%;
  justify-content: center;
}
.lock-demo-note {
  font-size: 10.5px;
  color: var(--text-faint);
  line-height: 1.5;
}
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber-strong);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.demo-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.demo-starters {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.demo-starters-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.demo-starters-label {
  font-size: 11.5px;
  color: var(--text-muted);
  flex: 1 1 auto;
  min-width: 120px;
}
.demo-exit {
  margin-left: auto;
}
.demo-starters-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.demo-starter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}
.demo-starter-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
  flex: 0 0 auto;
}
.demo-starter-chip:hover {
  background: var(--surface-hover);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
}
.demo-starter-chip:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}
.source-item.demo-source {
  border-color: var(--amber-strong);
  background: var(--amber-soft);
}
.source-item.demo-source .status-dot {
  background: var(--amber);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 30px 14px;
  color: var(--text-faint);
}
.empty-state .empty-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.empty-state .empty-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}
.empty-state b {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}
.empty-state span {
  font-size: 11.5px;
  max-width: 26ch;
  line-height: 1.5;
}
.empty-state.table-empty {
  padding: 44px 20px;
}

.locked-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--amber-soft);
  border: 1px solid var(--amber-strong);
  color: var(--text);
  font-size: 12.5px;
  margin-bottom: 22px;
}
.locked-inline svg {
  width: 16px;
  height: 16px;
  stroke: var(--amber);
  fill: none;
  stroke-width: 1.8;
  flex: 0 0 auto;
}
.locked-inline b {
  font-weight: 600;
}
.locked-inline .btn {
  margin-left: auto;
  flex: 0 0 auto;
}
.upload-feedback {
  font-size: 11.5px;
  color: var(--text-faint);
  margin: 0 0 20px;
  min-height: 15px;
  transition: color 0.15s ease;
}
.upload-feedback.is-error {
  color: var(--bad);
}
.upload-feedback.is-good {
  color: var(--good);
}
.session-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 14px;
}

/* ============================= RESPONSIVE ============================= */
@media (max-width: 880px) {
  .app {
    flex-direction: column;
  }
  .rail {
    width: 100%;
    height: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    top: auto;
    flex-direction: row;
    padding: 8px 10px;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 50;
  }
  .rail-logo {
    display: none;
  }
  .rail-nav {
    flex-direction: row;
    flex: 1 1 auto;
    justify-content: space-around;
  }
  .rail-bottom {
    flex-direction: row;
  }
  .rail-btn .rail-tip {
    display: none;
  }
  .shell {
    height: 100vh;
    padding-bottom: 60px;
  }
  .ask-grid {
    grid-template-columns: 1fr !important;
  }
  .sources-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 12px;
    align-items: center;
  }
  .sources-pane .pane-label {
    display: none;
  }
  .source-list {
    flex-direction: row;
  }
  .source-item {
    width: auto;
    flex: 0 0 auto;
  }
  .rail-cta {
    margin-top: 0;
  }
  .detail-panel {
    position: fixed;
    inset: auto 0 60px 0;
    max-height: 70vh;
    border-left: none;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    z-index: 40;
  }
  .ask-grid.detail-open {
    grid-template-columns: 1fr !important;
  }
  .ask-grid:not(.detail-open) .detail-panel {
    display: none;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    position: static;
  }
  .settings-nav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .toast {
    bottom: 76px;
    max-width: calc(100% - 24px);
  }
  .topbar {
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 10px 14px;
  }
  .topbar-eyebrow {
    display: none;
  }
  .topbar-titles {
    flex: 1 1 auto;
    order: 1;
  }
  .searchpill {
    order: 3;
    flex: 1 1 100%;
    margin: 0;
    max-width: none;
  }
  .topbar-right {
    order: 2;
    margin-left: auto;
  }
}
@media (max-width: 480px) {
  .searchpill span {
    display: none;
  }
  .searchpill {
    flex: 0 0 auto;
  }
  .chip span:not(.mono) {
    display: none;
  }
  .topbar-right {
    gap: 6px;
  }
  .composer-row {
    flex-wrap: wrap;
  }
  .composer-row .btn {
    white-space: nowrap;
    margin-left: auto;
  }
}
