/* HolisticCare4U RAG Explorer — calm wellness-adjacent palette, readable type */

:root {
  --bg: #f3f8fb;
  --surface: #ffffff;
  --surface2: #ecf3f8;
  --surface3: #ddeaf4;
  --border: #c9dbe8;
  --text: #183041;
  --muted: #547086;
  --accent: #1ea78a;
  --accent-dim: #16826c;
  --warning: #b58a10;
  --danger: #c85757;
  --ring: rgba(30, 167, 138, 0.25);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 14px;
  --shadow: 0 14px 30px rgba(44, 89, 122, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 110% 75% at 50% -15%, rgba(30, 167, 138, 0.1), transparent),
    radial-gradient(ellipse 90% 65% at 100% 35%, rgba(87, 139, 187, 0.12), transparent),
    radial-gradient(ellipse 75% 50% at 0% 100%, rgba(140, 179, 212, 0.16), transparent);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.tagline code,
code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.14rem 0.34rem;
  border-radius: 6px;
  background: rgba(30, 167, 138, 0.08);
  border: 1px solid rgba(30, 167, 138, 0.2);
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #f8fffc;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.2rem 1.25rem 4rem;
}

header.hero {
  margin-bottom: 2.2rem;
  padding: 1.5rem 1.35rem;
  border: 1px solid rgba(30, 87, 129, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(165deg, rgba(30, 167, 138, 0.08), rgba(255, 255, 255, 0)),
    linear-gradient(0deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.94));
  box-shadow: var(--shadow);
}

header.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.hero-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
}

header.hero .tagline {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 56ch;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: #f7fbfe;
  border: 1px solid rgba(30, 87, 129, 0.16);
  color: var(--text);
  font-size: 0.88rem;
}
.toc a:hover {
  border-color: var(--accent-dim);
  background: rgba(30, 167, 138, 0.12);
  text-decoration: none;
}

section {
  margin-bottom: 2.75rem;
}

section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.card {
  background: linear-gradient(180deg, rgba(30, 167, 138, 0.02), rgba(255, 255, 255, 0)), var(--surface);
  border: 1px solid rgba(30, 87, 129, 0.14);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 1rem;
}

.card:hover {
  border-color: rgba(30, 167, 138, 0.3);
}

.flow-diagram {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre;
  overflow-x: auto;
  margin: 0;
  padding: 1rem;
  background: #f6fbff;
  border-radius: 8px;
  border: 1px solid rgba(30, 87, 129, 0.14);
}

.legend {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

@media (min-width: 640px) {
  .legend {
    grid-template-columns: 1fr 1fr;
  }
}

.legend-item {
  padding: 0.75rem 1rem;
  background: linear-gradient(120deg, rgba(30, 167, 138, 0.08), rgba(236, 243, 248, 0.85));
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.legend-item strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.legend-item span {
  color: var(--muted);
  font-size: 0.88rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

table.feature-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.feature-grid th,
table.feature-grid td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(30, 87, 129, 0.12);
}

table.feature-grid th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-live {
  background: rgba(61, 184, 154, 0.2);
  color: var(--accent);
}

.badge-api {
  background: rgba(201, 162, 39, 0.15);
  color: var(--warning);
}

.badge-core {
  background: rgba(139, 154, 171, 0.15);
  color: var(--muted);
}

.badge-future {
  background: rgba(199, 92, 92, 0.12);
  color: #e08a8a;
}

.grid-forms {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .grid-forms {
    grid-template-columns: 1fr 1fr;
  }
}

.form-panel label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-panel input,
.form-panel textarea,
.form-panel select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(30, 87, 129, 0.22);
  background: #f9fcff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.form-panel textarea {
  min-height: 88px;
  resize: vertical;
}

.form-panel .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-panel .actions {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: none;
  background: linear-gradient(165deg, #3cc6a7, var(--accent-dim));
  color: #f7fffb;
  box-shadow: 0 8px 20px rgba(30, 167, 138, 0.24);
}

button:hover {
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid rgba(30, 87, 129, 0.18);
  box-shadow: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot.ok {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.status-dot.err {
  background: var(--danger);
}

.output {
  margin-top: 0.85rem;
  padding: 1rem;
  background: #f7fbff;
  border-radius: 8px;
  border: 1px solid rgba(30, 87, 129, 0.14);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
  min-height: 3rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.output.error {
  border-color: rgba(199, 92, 92, 0.45);
  color: #e8a0a0;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.results-table th,
.results-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(30, 87, 129, 0.12);
  vertical-align: top;
}

.results-table th {
  color: var(--muted);
  font-weight: 500;
}

.results-table .num {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.dashboard-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  align-items: end;
}

.dashboard-controls label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.dashboard-controls input,
.dashboard-controls select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(30, 87, 129, 0.22);
  background: #f9fcff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.dashboard-actions {
  display: flex;
  align-items: end;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

.kpi-card {
  padding: 1rem 1.1rem;
}

.kpi-card h2 {
  margin: 0 0 0.45rem;
  border: 0;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.kpi-card p {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.dash-heading {
  margin: 0;
  border: 0;
}

.dashboard-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .dashboard-split {
    grid-template-columns: 1fr;
  }
}

.source-chip {
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(30, 87, 129, 0.08);
}

footer.page-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

/* —— Chat page (/chat.html) ——
   Full-width shell: explorer keeps a reading-width column; chat is a workspace UI. */
body.chat-page {
  display: flex;
  flex-direction: column;
}

.chat-page .layout {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1.65rem clamp(0.75rem, 3vw, 3.5rem) 2.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

.chat-page .chat-grid > section {
  margin-bottom: 0;
}

.chat-page .page-footer {
  margin-top: 1.75rem;
}

.chat-page-footer {
  padding: 1.1rem 1.25rem;
  border: 1px solid rgba(30, 87, 129, 0.1);
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(243, 250, 252, 0.75));
  font-size: 0.84rem;
  line-height: 1.55;
  box-shadow: 0 8px 28px rgba(24, 58, 82, 0.06);
}

.chat-workspace {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 2.5vw, 1.35rem);
  border-radius: calc(var(--radius) + 8px);
  border: 1px solid rgba(30, 87, 129, 0.1);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.97) 0%, rgba(250, 253, 255, 0.99) 42%, rgba(236, 246, 250, 0.55) 100%),
    var(--surface);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 28px 56px -24px rgba(15, 52, 72, 0.14),
    0 12px 28px -12px rgba(24, 64, 88, 0.1);
}

.chat-workspace::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--accent) 25%, rgba(100, 160, 200, 0.75) 70%, transparent);
  opacity: 0.85;
  pointer-events: none;
}

.chat-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.35rem;
  padding: 1.2rem 1.35rem;
  border: 1px solid rgba(30, 87, 129, 0.11);
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 252, 255, 0.96) 45%, rgba(232, 248, 242, 0.5) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 18px 40px -18px rgba(15, 52, 72, 0.12),
    0 6px 16px -6px rgba(24, 64, 88, 0.08);
}

.chat-topbar-lead {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.chat-brand-icon {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.85rem;
  background: linear-gradient(145deg, #3ad4b6 0%, var(--accent) 45%, #0f6b58 100%);
  box-shadow:
    0 10px 22px rgba(22, 130, 108, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.chat-topbar-titles {
  min-width: 0;
}

.chat-page .chat-topbar .hero-kicker {
  margin-bottom: 0.35rem;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
}

.chat-hero-title {
  font-size: clamp(1.45rem, 3.2vw, 1.85rem);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.chat-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
}

.chat-topbar-actions .chat-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.95rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(30, 87, 129, 0.14);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.chat-topbar-actions .chat-nav-link:hover {
  border-color: rgba(30, 167, 138, 0.45);
  background: rgba(30, 167, 138, 0.1);
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(30, 167, 138, 0.12);
}

.chat-topbar .status-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(30, 87, 129, 0.12);
}

.chat-usage-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  min-width: 9.5rem;
  max-width: 14rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(30, 87, 129, 0.12);
  font-size: 0.78rem;
  color: var(--muted);
}

.chat-usage-pill.exceeded {
  border-color: rgba(199, 92, 92, 0.45);
  background: rgba(255, 248, 248, 0.95);
}

.chat-usage-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(30, 87, 129, 0.12);
  overflow: hidden;
}

.chat-usage-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), rgba(100, 160, 200, 0.9));
  transition: width 0.25s ease;
}

.chat-usage-pill.exceeded .chat-usage-bar-fill {
  background: linear-gradient(90deg, #c75c5c, #e08a8a);
}

.chat-usage-text {
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-quota-banner {
  margin: 0 1rem 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid rgba(199, 92, 92, 0.45);
  background: rgba(255, 248, 248, 0.95);
}

.chat-quota-banner-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #c75c5c;
}

.chat-quota-banner-detail {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.chat-main-card {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 6px 22px rgba(24, 58, 82, 0.07);
}

@media (min-width: 981px) {
  /* --chat-composer-block-height set on .chat-workspace by chat.js (composer ResizeObserver). */
  .chat-main-card {
    height: var(--chat-composer-block-height, auto);
    min-height: 0;
  }
}

.chat-workspace .chat-main-card,
.chat-workspace .chat-composer {
  border-color: rgba(30, 87, 129, 0.09);
}

.chat-main-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(180deg, #5ee4c4, var(--accent) 40%, rgba(22, 130, 108, 0.65));
  opacity: 0.9;
  pointer-events: none;
}

.chat-panel-head {
  padding: 1.1rem 1.35rem 0.95rem;
  border-bottom: 1px solid rgba(30, 87, 129, 0.09);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 252, 255, 0.15));
}

.chat-panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.chat-panel-sub {
  margin: 0.4rem 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 44ch;
}

.chat-thread-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin: 0.85rem 1.1rem 1.1rem;
  padding: 0.55rem 0.5rem 0.6rem;
  border-radius: 14px;
  border: 1px solid rgba(30, 87, 129, 0.09);
  background:
    radial-gradient(ellipse 90% 80% at 50% 0%, rgba(46, 196, 164, 0.06), transparent 55%),
    linear-gradient(180deg, #feffff 0%, #f1f7fb 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 4px 14px rgba(24, 58, 82, 0.04);
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.45rem 0.4rem 0.55rem;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 87, 129, 0.22) transparent;
}

.chat-thread-load-older {
  flex-shrink: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted, #5a7184);
  padding: 0.35rem 0.5rem;
}

.chat-thread::-webkit-scrollbar {
  width: 7px;
}

.chat-thread::-webkit-scrollbar-thumb {
  background: rgba(30, 87, 129, 0.2);
  border-radius: 99px;
}

.chat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr);
  /* First row sizes to the Session & send column; do not grow with leftover flex space. */
  grid-template-rows: auto auto;
  gap: clamp(1rem, 2.5vw, 1.35rem);
  align-items: stretch;
  align-content: start;
  flex: 1;
  min-height: 0;
}

.chat-composer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 6px 22px rgba(24, 58, 82, 0.07);
}

.chat-composer-head {
  padding: 1.1rem 1.35rem 0.9rem;
  border-bottom: 1px solid rgba(30, 87, 129, 0.09);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 250, 252, 0.2));
}

.chat-composer-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.chat-test-upload {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}

.chat-test-upload-head {
  margin-bottom: 0.65rem;
}

.chat-test-upload-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.chat-test-upload-sub {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.chat-upload-file-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-composer-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.chat-composer-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.5rem 0.55rem 0.5rem 0.45rem;
  border: 1px solid rgba(30, 87, 129, 0.16);
  border-radius: 1.35rem;
  background: #fff;
  box-shadow:
    0 2px 10px rgba(24, 58, 82, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.chat-composer-bar:focus-within {
  border-color: rgba(30, 167, 138, 0.5);
  box-shadow:
    0 0 0 3px var(--ring),
    0 4px 16px rgba(30, 167, 138, 0.1);
}

.chat-composer-attach,
.chat-composer-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease,
    opacity 0.15s ease;
}

.chat-composer-attach {
  color: var(--muted);
  background: transparent;
}

.chat-composer-attach:hover:not(:disabled) {
  color: var(--text);
  background: rgba(30, 87, 129, 0.08);
}

.chat-composer-attach.has-attachment {
  color: var(--accent-dim);
  background: rgba(30, 167, 138, 0.12);
}

.chat-composer-attach:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-composer-send {
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dim));
  box-shadow: 0 6px 16px rgba(30, 167, 138, 0.35);
}

.chat-composer-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(30, 167, 138, 0.42);
}

.chat-composer-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chat-composer-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.chat-composer-textarea {
  flex: 1;
  min-width: 0;
  min-height: 1.5rem;
  max-height: 10rem;
  margin: 0;
  padding: 0.45rem 0.35rem 0.5rem;
  resize: none;
  border: none;
  background: transparent;
  line-height: 1.5;
  font: inherit;
  color: var(--text);
  box-shadow: none;
}

.chat-composer-textarea:focus {
  outline: none;
  box-shadow: none;
}

.chat-composer-textarea::placeholder {
  color: var(--muted);
}

.chat-attachment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 0.15rem;
}

.chat-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.28rem 0.45rem 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(30, 167, 138, 0.28);
  background: rgba(30, 167, 138, 0.1);
  font-size: 0.8rem;
  color: var(--text);
}

.chat-attachment-chip.is-uploading {
  border-style: dashed;
  background: rgba(30, 87, 129, 0.06);
  color: var(--muted);
}

.chat-attachment-chip-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.chat-attachment-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
  font-weight: 500;
}

.chat-attachment-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.chat-attachment-chip-remove:hover {
  background: rgba(30, 87, 129, 0.12);
  color: var(--text);
}

.chat-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}

.chat-composer-clear {
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
}

.chat-composer-footnote {
  margin: 0;
  font-size: 0.75rem;
}

.chat-composer-footnote kbd {
  font-family: var(--font-mono, "IBM Plex Mono", monospace);
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(30, 87, 129, 0.15);
  background: rgba(255, 255, 255, 0.8);
}

.chat-message-form .chat-upload-status {
  margin: 0;
  padding: 0 0.35rem;
  min-height: 1.1em;
}

.chat-upload-status {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.2em;
}

.chat-upload-status.ok {
  color: var(--accent-dim);
}

.chat-upload-status.err {
  color: var(--danger);
}

.chat-composer-sub {
  margin: 0.4rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 42ch;
}

.chat-settings {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr minmax(5rem, 7rem);
  gap: 0.65rem;
  padding: 0.85rem 1.1rem 0.65rem;
  margin-bottom: 0;
}

.chat-field {
  padding: 0.6rem 0.72rem;
  border-radius: 11px;
  border: 1px solid rgba(30, 87, 129, 0.09);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 252, 255, 0.65));
  box-shadow: 0 1px 2px rgba(24, 58, 82, 0.04);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.chat-field:focus-within {
  border-color: rgba(30, 167, 138, 0.45);
  box-shadow: 0 0 0 3px var(--ring);
}

.chat-field label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.78rem;
}

.chat-field input {
  background: #fff;
}

.chat-hint {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.chat-message-form {
  margin: 0;
  padding: 1.1rem 1.35rem 1.25rem;
  border-top: 1px solid rgba(30, 87, 129, 0.09);
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.92), rgba(241, 249, 246, 0.35));
}

.chat-message-form .actions {
  margin-top: 1rem;
  gap: 0.6rem;
}

.chat-session-toolbar button.secondary {
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
}

.chat-session-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1.1rem;
  margin-bottom: 0.6rem;
}

.chat-pipeline-panel {
  grid-column: 1 / -1;
  margin-top: 0.75rem;
  padding: 0;
}

.chat-pipeline-shell {
  position: relative;
  padding: clamp(1.15rem, 2.8vw, 1.65rem);
  border-radius: calc(var(--radius) + 10px);
  border: 1px solid rgba(30, 167, 138, 0.22);
  background:
    radial-gradient(ellipse 85% 120% at 10% -30%, rgba(56, 232, 198, 0.35), transparent 52%),
    radial-gradient(ellipse 70% 90% at 100% 0%, rgba(120, 170, 230, 0.28), transparent 45%),
    radial-gradient(ellipse 60% 80% at 50% 120%, rgba(255, 200, 140, 0.12), transparent 50%),
    linear-gradient(165deg, #f4fffc 0%, #eef8ff 38%, #faf7ff 72%, #f0fbff 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 28px 56px -28px rgba(12, 72, 88, 0.18),
    0 12px 32px -16px rgba(30, 120, 140, 0.12);
  overflow: hidden;
}

.chat-pipeline-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.4) 0%,
    transparent 38%,
    transparent 62%,
    rgba(255, 255, 255, 0.25) 100%
  );
  pointer-events: none;
}

.chat-pipeline-head {
  position: relative;
  z-index: 1;
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(24, 90, 100, 0.12);
}

.chat-pipeline-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.chat-pipeline-live-badge {
  flex-shrink: 0;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #064d3f;
  background: linear-gradient(135deg, #7ff0d4, #3ad4b6 45%, #1ea78a);
  border: 1px solid rgba(6, 77, 63, 0.15);
  box-shadow: 0 4px 14px rgba(30, 167, 138, 0.35);
  animation: chat-pipeline-pulse 2.8s ease-in-out infinite;
}

@keyframes chat-pipeline-pulse {
  0%,
  100% {
    box-shadow: 0 4px 14px rgba(30, 167, 138, 0.35);
    filter: saturate(1);
  }
  50% {
    box-shadow: 0 6px 22px rgba(30, 167, 138, 0.48);
    filter: saturate(1.15);
  }
}

.chat-pipeline-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.8vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  background: linear-gradient(115deg, #0c3d4a 0%, #156b5c 40%, #1a5080 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .chat-pipeline-title {
    color: #0c3d4a;
    background: none;
  }
}

.chat-pipeline-sub {
  margin: 0.55rem 0 0;
  font-size: 0.88rem;
  color: #3a5c6e;
  line-height: 1.55;
  max-width: 58ch;
  font-weight: 500;
}

.chat-pipeline-flow {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  width: 100%;
  max-width: min(26rem, 100%);
  margin: 0 auto 1.15rem;
  padding: 0.75rem 0.65rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(30, 87, 129, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.chat-pipeline-flow-node {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.48rem 0.85rem 0.48rem 0.55rem;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a3d48;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 2px 8px rgba(24, 58, 82, 0.08);
}

.chat-pipeline-flow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.2rem;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.chat-pipeline-flow-node--1 {
  background: linear-gradient(135deg, #fff6e8, #ffe0b8);
}
.chat-pipeline-flow-node--1 .chat-pipeline-flow-num {
  background: linear-gradient(145deg, #ffb347, #e87800);
}

.chat-pipeline-flow-node--2 {
  background: linear-gradient(135deg, #f0e8ff, #ddd6fe);
}
.chat-pipeline-flow-node--2 .chat-pipeline-flow-num {
  background: linear-gradient(145deg, #8b5cf6, #5b21b6);
}

.chat-pipeline-flow-node--3 {
  background: linear-gradient(135deg, #e6fffa, #b2f5ea);
}
.chat-pipeline-flow-node--3 .chat-pipeline-flow-num {
  background: linear-gradient(145deg, #2dd4bf, #0d9488);
}

.chat-pipeline-flow-node--4 {
  background: linear-gradient(135deg, #fdf2f8, #fbcfe8);
}
.chat-pipeline-flow-node--4 .chat-pipeline-flow-num {
  background: linear-gradient(145deg, #ec4899, #be185d);
}

.chat-pipeline-flow-node--5 {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
}
.chat-pipeline-flow-node--5 .chat-pipeline-flow-num {
  background: linear-gradient(145deg, #0ea5e9, #0369a1);
}

.chat-pipeline-flow-chev {
  width: 0.7rem;
  height: 0.55rem;
  margin: 0.12rem auto;
  flex-shrink: 0;
  opacity: 0.55;
  background: linear-gradient(180deg, var(--accent), #6366f1);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.chat-pipeline-meta-box {
  position: relative;
  z-index: 1;
  margin-bottom: 1.1rem;
  padding: 0.75rem 0.9rem 0.85rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(30, 87, 129, 0.12);
  box-shadow: 0 8px 24px rgba(24, 58, 82, 0.07);
  backdrop-filter: blur(8px);
}

.chat-pipeline-meta-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #2d6a7e;
}

.chat-pipeline-grid {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: min(52rem, 100%);
  margin: 0 auto;
}

.chat-pipeline-card {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(30, 87, 129, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(252, 253, 255, 0.92) 100%);
  box-shadow: 0 4px 18px rgba(24, 58, 82, 0.07);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.18s ease;
}

.chat-pipeline-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  border-radius: 16px 16px 0 0;
  opacity: 0.95;
}

.chat-pipeline-card--bm25::before {
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #f97316);
}
.chat-pipeline-card--vector::before {
  background: linear-gradient(90deg, #7c3aed, #a78bfa, #6366f1);
}
.chat-pipeline-card--hybrid::before {
  background: linear-gradient(90deg, #0d9488, #2dd4bf, #14b8a6);
}
.chat-pipeline-card--reranked::before {
  background: linear-gradient(90deg, #db2777, #f472b6, #e11d48);
}
.chat-pipeline-card--filtered::before {
  background: linear-gradient(90deg, #0284c7, #38bdf8, #0ea5e9);
}

.chat-pipeline-card:hover {
  border-color: rgba(30, 167, 138, 0.35);
  box-shadow: 0 14px 36px rgba(24, 58, 82, 0.12);
  transform: translateY(-3px);
}

.chat-pipeline-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.05rem 0.75rem;
  margin-top: 4px;
}

.chat-pipeline-step-badge {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  color: #0f172a;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(236, 243, 248, 0.9));
  border: 1px solid rgba(30, 87, 129, 0.12);
  box-shadow: 0 2px 6px rgba(24, 58, 82, 0.06);
}

.chat-pipeline-card--bm25 .chat-pipeline-step-badge {
  border-color: rgba(245, 158, 11, 0.35);
  color: #9a3412;
}
.chat-pipeline-card--vector .chat-pipeline-step-badge {
  border-color: rgba(124, 58, 237, 0.35);
  color: #5b21b6;
}
.chat-pipeline-card--hybrid .chat-pipeline-step-badge {
  border-color: rgba(13, 148, 136, 0.4);
  color: #115e59;
}
.chat-pipeline-card--reranked .chat-pipeline-step-badge {
  border-color: rgba(219, 39, 119, 0.35);
  color: #9d174d;
}
.chat-pipeline-card--filtered .chat-pipeline-step-badge {
  border-color: rgba(2, 132, 199, 0.4);
  color: #075985;
}

.chat-pipeline-card-head-text {
  min-width: 0;
}

.chat-pipeline-card-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f2740;
}

.chat-pipeline-card-kicker {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #4a6d80;
  letter-spacing: 0.02em;
}

.chat-pipeline-table-wrap {
  margin: 0;
  padding: 0 0.65rem 0.85rem;
  border-top: 1px solid rgba(30, 87, 129, 0.08);
}

.chat-pipeline-table {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(30, 87, 129, 0.08);
}

.chat-pipeline-card .chat-pipeline-table thead {
  background: linear-gradient(180deg, rgba(15, 60, 80, 0.08), rgba(15, 60, 80, 0.04));
}

.chat-pipeline-card .chat-pipeline-table th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #2d4a5c;
  padding: 0.55rem 0.5rem;
}

.chat-pipeline-card .chat-pipeline-table td {
  padding: 0.48rem 0.5rem;
  border-bottom: 1px solid rgba(30, 87, 129, 0.06);
}

.chat-pipeline-card .chat-pipeline-table tbody tr:nth-child(even) {
  background: rgba(30, 120, 150, 0.04);
}

.chat-pipeline-card .chat-pipeline-table tbody tr:hover {
  background: rgba(30, 167, 138, 0.08);
}

.chat-pipeline-card .chat-pipeline-table .num {
  font-weight: 700;
}

.chat-retrieval-meta {
  margin: 0;
  padding: 0.55rem 0.65rem;
  max-height: 6.5rem;
  overflow: auto;
  font-size: 0.76rem;
  line-height: 1.5;
  color: #3d5668;
  background: rgba(248, 252, 255, 0.9);
  border-radius: 10px;
  border: 1px dashed rgba(30, 167, 138, 0.28);
  scrollbar-width: thin;
}

.chat-pipeline-meta-box .output.chat-retrieval-meta {
  margin-top: 0;
  min-height: 2.25rem;
  background: transparent;
  border: none;
  padding: 0.15rem 0 0;
  font-size: 0.75rem;
}

.chat-thread:empty::before {
  content: "No messages yet — send from the composer on the right. Replies stream here as NDJSON (tokens + retrieval_debug).";
  display: block;
  margin: 1.75rem auto 0;
  max-width: 26rem;
  padding: 1.25rem 1.35rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  border-radius: 16px;
  border: 1px dashed rgba(30, 87, 129, 0.22);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 4px 18px rgba(24, 58, 82, 0.05);
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 92%;
  animation: chat-in 0.2s ease-out;
}

@keyframes chat-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg-user {
  align-self: flex-end;
}

.chat-msg-assistant {
  align-self: flex-start;
}

.chat-msg-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 0.15rem;
}

.chat-msg-body {
  padding: 0.85rem 1.05rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.96rem;
  line-height: 1.58;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-user .chat-msg-body {
  background: linear-gradient(155deg, rgba(52, 212, 178, 0.35) 0%, rgba(30, 167, 138, 0.2) 50%, rgba(22, 130, 108, 0.12) 100%);
  border-color: rgba(30, 167, 138, 0.38);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 10px 28px rgba(22, 130, 108, 0.18);
}

.chat-msg-assistant .chat-msg-body {
  background: linear-gradient(180deg, #ffffff 0%, #f4f9fd 100%);
  border-color: rgba(30, 87, 129, 0.12);
  box-shadow: 0 4px 16px rgba(24, 58, 82, 0.06);
}

.chat-msg-assistant .chat-msg-body.streaming {
  border-color: rgba(30, 167, 138, 0.35);
  box-shadow: 0 0 0 1px rgba(30, 167, 138, 0.12), 0 6px 20px rgba(30, 167, 138, 0.1);
}

.chat-msg-body.error {
  border-color: rgba(199, 92, 92, 0.45);
  color: #e8a0a0;
}

.chat-composer .chat-composer-textarea {
  min-height: 1.5rem;
}

.chat-session-list-wrap {
  margin: 0 1rem 0.85rem;
  border: 1px solid rgba(30, 87, 129, 0.12);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(30, 87, 129, 0.04));
  padding: 0.65rem 0.7rem 0.55rem;
}

.chat-session-list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(30, 87, 129, 0.1);
}

.chat-session-list-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.chat-session-list-count {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chat-session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: min(16rem, 38vh);
  overflow-y: auto;
  padding-right: 0.15rem;
  margin: 0 -0.1rem 0 0;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 87, 129, 0.28) transparent;
}

.chat-session-item-wrap,
.chat-session-list-empty-wrap {
  display: block;
  margin: 0;
  padding: 0;
}

.chat-session-list::-webkit-scrollbar {
  width: 6px;
}

.chat-session-list::-webkit-scrollbar-thumb {
  background: rgba(30, 87, 129, 0.22);
  border-radius: 99px;
}

.chat-session-list-empty {
  margin: 0.35rem 0 0.15rem;
  padding: 0.65rem 0.5rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
  border: 1px dashed rgba(30, 87, 129, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}

.chat-session-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  border: 1px solid rgba(30, 87, 129, 0.14);
  border-radius: 11px;
  background: var(--surface);
  text-align: left;
  padding: 0.55rem 0.65rem 0.5rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
  box-shadow: 0 1px 0 rgba(30, 87, 129, 0.04);
}

.chat-session-item:hover {
  border-color: rgba(30, 167, 138, 0.35);
  box-shadow: 0 4px 14px rgba(44, 89, 122, 0.1);
}

.chat-session-item:active {
  transform: scale(0.99);
}

.chat-session-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.chat-session-item-title {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.chat-session-item-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: rgba(30, 87, 129, 0.09);
  color: var(--muted);
  line-height: 1.2;
  margin-top: 0.08rem;
}

.chat-session-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 0;
}

.chat-session-item-time {
  font-variant-numeric: tabular-nums;
}

.chat-session-item-id {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  opacity: 0.92;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.chat-session-item.active {
  border-color: rgba(30, 167, 138, 0.55);
  background: linear-gradient(135deg, rgba(30, 167, 138, 0.12), rgba(30, 167, 138, 0.04));
  box-shadow: 0 0 0 1px rgba(30, 167, 138, 0.12);
}

.chat-session-item.active .chat-session-item-badge {
  background: rgba(30, 167, 138, 0.2);
  color: var(--accent-dim);
}

@media (prefers-reduced-motion: reduce) {
  .chat-pipeline-live-badge {
    animation: none;
  }

  .chat-pipeline-card {
    transition: none;
  }

  .chat-pipeline-card:hover {
    transform: none;
  }
}

@media (max-width: 520px) {
  .layout {
    padding: 1.35rem 0.85rem 2.2rem;
  }

  header.hero {
    padding: 1.05rem 0.9rem;
  }

  .card {
    padding: 1rem;
  }

  .chat-main-card,
  .chat-composer {
    padding: 0;
  }

  .chat-settings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .chat-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    flex: none;
    min-height: unset;
  }

  .chat-main-card {
    min-height: min(52vh, 520px);
    height: auto;
  }

  .chat-thread {
    max-height: min(48vh, 440px);
  }
}
