:root {
  --bg: #0c1314;
  --bg-deep: #080d0e;
  --panel: #141d1f;
  --panel-raised: #192325;
  --panel-soft: #11191b;
  --border: #2a3638;
  --border-strong: #3b484a;
  --text: #f0ece4;
  --text-muted: #98a3a5;
  --text-faint: #6f7b7d;
  --accent: #bd342d;
  --accent-bright: #eb5a50;
  --accent-dark: #7e211d;
  --accent-wash: rgba(189, 52, 45, 0.14);
  --success: #6eb78b;
  --warning: #d4a24c;
  --danger: #ed6b61;
  --info: #70a6b2;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  --font-display: "Bahnschrift", "DIN Alternate", sans-serif;
  --font-body: "Aptos", "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", monospace;
  --sidebar-width: 264px;
  --header-height: 84px;
  --radius: 7px;
  --focus: 0 0 0 3px rgba(235, 90, 80, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: var(--accent-bright);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

[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;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.mobile-bar,
.sidebar-scrim {
  display: none;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-deep);
  padding: 22px 16px 16px;
}

.brand-block {
  padding: 4px 8px 28px;
}

.wordmark,
.mobile-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0;
}

.wordmark {
  font-size: 1.16rem;
}

.wordmark span,
.mobile-wordmark span {
  color: var(--accent-bright);
}

.brand-block p {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 0.74rem;
}

.primary-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 9px 11px;
  text-align: left;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.nav-item svg,
.send-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-item:hover {
  background: var(--panel);
  color: var(--text);
}

.nav-item.is-active {
  border-color: rgba(189, 52, 45, 0.28);
  background: var(--accent-wash);
  color: var(--text);
}

.nav-item.is-active svg {
  color: var(--accent-bright);
}

.history-region {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  margin-top: 28px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px 7px 10px;
}

.section-heading-row h2 {
  margin: 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.icon-button.compact {
  width: 30px;
  height: 30px;
  border-color: transparent;
  background: transparent;
  font-size: 1.15rem;
}

.history-list {
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  scrollbar-color: var(--border-strong) transparent;
}

.history-list button {
  display: block;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list button:hover {
  background: var(--panel);
  color: var(--text);
}

.history-empty {
  margin: 4px 10px;
  color: var(--text-faint);
  font-size: 0.78rem;
  line-height: 1.45;
}

.account-block {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding: 15px 7px 2px;
}

.avatar {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(235, 90, 80, 0.42);
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent-bright);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
}

.account-copy {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 2px;
}

.account-logout {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 6px 2px;
}

.account-logout:hover,
.account-logout:focus-visible {
  color: var(--text);
}

.account-copy strong,
.account-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 0.78rem;
  font-weight: 600;
}

.account-copy span {
  color: var(--text-faint);
  font-size: 0.68rem;
}

.main-area {
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    var(--bg);
  background-size: 100% 42px;
}

.view {
  min-width: 0;
  height: 100%;
}

.chat-view {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.view-header {
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 19, 20, 0.92);
  padding: 16px clamp(22px, 4vw, 48px);
}

.view-header h1 {
  margin: 1px 0 0;
  font-family: var(--font-display);
  font-size: 1.34rem;
  font-weight: 650;
}

.eyebrow {
  margin: 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 0.72rem;
}

.connection-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.connection-label::before,
.connection-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  content: "";
}

.connection-label.is-busy::before,
.connection-mark.is-busy {
  background: var(--warning);
}

.connection-label.is-error::before,
.connection-mark.is-error {
  background: var(--danger);
}

.auth-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(237, 107, 97, 0.35);
  background: rgba(126, 33, 29, 0.22);
  padding: 13px clamp(22px, 4vw, 48px);
}

.auth-notice strong {
  font-size: 0.84rem;
}

.auth-notice p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.thread {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: 34px clamp(22px, 6vw, 72px) 46px;
  scroll-behavior: smooth;
  scrollbar-color: var(--border-strong) transparent;
}

.thread > * {
  width: min(100%, 850px);
  margin-inline: auto;
}

.welcome {
  display: grid;
  min-height: 100%;
  align-content: center;
  justify-items: start;
  padding: 38px 0 70px;
}

.evidence-emblem {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 22px;
  border: 1px solid var(--accent-dark);
  border-left-width: 4px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-wash);
  color: var(--accent-bright);
  font-family: Georgia, serif;
  font-size: 1.45rem;
}

.welcome h2 {
  max-width: 620px;
  margin: 9px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.2vw, 2.45rem);
  font-weight: 620;
  line-height: 1.12;
}

.welcome > p:not(.eyebrow) {
  max-width: 610px;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.suggestion-list {
  display: grid;
  width: min(100%, 620px);
  gap: 7px;
  margin-top: 30px;
}

.suggestion-list button {
  position: relative;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(20, 29, 31, 0.68);
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px 42px 10px 13px;
  text-align: left;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.suggestion-list button::after {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--accent-bright);
  content: "\2192";
  transform: translateY(-50%);
}

.suggestion-list button:hover {
  border-color: var(--accent-dark);
  color: var(--text);
  transform: translateX(3px);
}

.message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 28px;
  animation: message-rise 220ms ease both;
}

.user-message {
  align-items: flex-end;
}

.message-author {
  margin-bottom: 7px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message-body {
  max-width: 100%;
  color: var(--text);
  line-height: 1.67;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.user-message .message-body {
  max-width: min(76%, 640px);
  border: 1px solid rgba(189, 52, 45, 0.34);
  border-radius: 12px 12px 2px 12px;
  background: var(--accent-wash);
  padding: 10px 15px;
  line-height: 1.5;
}

.assistant-message.is-error .message-body {
  border-left: 3px solid var(--danger);
  color: var(--text-muted);
  padding-left: 14px;
}

.assistant-message.is-empty .message-body {
  border-left: 3px solid var(--warning);
  color: var(--text-muted);
  padding-left: 14px;
}

.source-section {
  width: 100%;
  margin-top: 16px;
}

.source-section h3 {
  margin: 0 0 9px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--panel-soft);
}

.source-card[open] {
  background: var(--panel);
}

.source-card summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  cursor: pointer;
  padding: 9px 12px;
  list-style: none;
}

.source-card summary::-webkit-details-marker {
  display: none;
}

.source-number {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid var(--accent-dark);
  border-radius: 4px;
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.source-title {
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-score {
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  white-space: nowrap;
}

.source-content {
  border-top: 1px solid var(--border);
  padding: 12px 14px 14px 45px;
}

.source-content .mail-download {
  display: block;
  margin: 0.7rem 0;
  overflow-wrap: anywhere;
}

.mail-attachments {
  margin-top: 0.5rem;
  overflow-wrap: anywhere;
}

.mail-processing-notice {
  display: block;
  margin-top: 0.35rem;
  color: #f4ce7d;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mail-processing-notice[hidden] {
  display: none;
}

.mail-processing-button {
  display: block;
  margin-top: 0.8rem;
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.mail-processing-result {
  margin-top: 0.8rem;
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.mail-processing-items {
  margin: 0.8rem 0 0;
  padding-left: 1.35rem;
}

.mail-processing-item {
  margin-top: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.mail-processing-item p {
  margin: 0.35rem 0;
}

.search-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.search-selection select {
  max-width: 100%;
  min-width: 0;
  font: inherit;
  padding: 0.35rem;
}

.source-content blockquote {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.source-content a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.no-sources {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text-muted);
  padding: 10px 12px;
  font-size: 0.78rem;
}

.no-sources strong {
  color: var(--warning);
}

.thinking {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
}

.thinking span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: think-pulse 1s ease-in-out infinite;
}

.thinking span:nth-child(2) {
  animation-delay: 130ms;
}

.thinking span:nth-child(3) {
  animation-delay: 260ms;
}

.composer-region {
  border-top: 1px solid var(--border);
  background: rgba(12, 19, 20, 0.96);
  padding: 15px clamp(22px, 6vw, 72px) 18px;
}

.search-selection,
.composer,
.composer-note {
  width: min(100%, 850px);
  margin-inline: auto;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 7px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-wash);
}

.composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 150px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 9px;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: var(--text-faint);
}

.send-button,
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 650;
}

.send-button {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 9px 14px;
}

.send-button:hover,
.button.primary:hover {
  border-color: var(--accent-bright);
  background: var(--accent-bright);
}

.send-button:disabled,
.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.composer-note {
  margin-top: 8px;
  margin-bottom: 0;
  color: var(--text-faint);
  font-size: 0.68rem;
  text-align: center;
}

.button {
  border: 1px solid var(--border-strong);
  padding: 8px 13px;
  font-size: 0.8rem;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.secondary {
  background: var(--panel);
  color: var(--text-muted);
}

.button.secondary:hover {
  border-color: var(--accent-dark);
  color: var(--text);
}

.admin-view {
  overflow-y: auto;
  scroll-padding-top: calc(var(--header-height) + 12px);
  scrollbar-color: var(--border-strong) transparent;
}

.admin-header {
  position: sticky;
  z-index: 10;
  top: 0;
}

.admin-content {
  width: min(100%, 1120px);
  margin-inline: auto;
  padding: 30px clamp(22px, 4vw, 48px) 70px;
}

.admin-summary {
  display: flex;
  justify-content: flex-end;
  min-height: 22px;
  margin-bottom: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.67rem;
}

.admin-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar {
  display: none;
}

.admin-tabs button {
  min-height: 43px;
  flex: 0 0 auto;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px 2px;
  margin-right: 28px;
  font-size: 0.82rem;
}

.admin-tabs button[aria-selected="true"] {
  border-color: var(--accent-bright);
  color: var(--text);
}

.admin-panel {
  padding-top: 26px;
}

.panel-heading {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1.2fr);
  gap: 30px;
  align-items: end;
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 620;
}

.panel-heading > p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-explanation {
  margin-bottom: 18px;
  padding: 20px 22px;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  background: var(--panel);
}

.admin-explanation:empty,
.admin-source-details:empty {
  display: none;
}

.admin-explanation h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.admin-explanation p {
  max-width: 78ch;
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.admin-explanation p:first-of-type {
  color: var(--text);
}

.admin-source-details {
  margin-top: 16px;
}

.admin-source-disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 18px;
}

.admin-source-disclosure summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
  line-height: 1.5;
}

.admin-source-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.admin-source-item {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-source-item strong {
  overflow-wrap: anywhere;
}

.admin-source-item p,
.admin-source-notice {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.admin-source-item .admin-source-muted,
.admin-source-muted {
  color: var(--text-faint);
  font-size: 0.77rem;
}

.admin-report-button {
  margin-top: 2px;
}

.storage-intro {
  padding: 16px 18px;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.storage-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin: 20px 0 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.storage-breadcrumbs strong,
.storage-crumb {
  overflow-wrap: anywhere;
}

.storage-crumb {
  border: 0;
  background: transparent;
  color: var(--accent-bright);
  padding: 5px 0;
  font: inherit;
  cursor: pointer;
}

.storage-rows,
.storage-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.storage-row,
.storage-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: left;
  color: var(--text);
  font: inherit;
}

.storage-row { cursor: pointer; }
.storage-row:hover,
.storage-row:focus-visible { border-color: var(--accent-bright); }
.storage-row strong,
.storage-item strong { overflow-wrap: anywhere; }
.storage-row span,
.storage-item span,
.storage-notice {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.storage-filter {
  min-width: 0;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.storage-actions { margin-top: 16px; }
.storage-original-link { color: var(--accent-bright); font-size: 0.82rem; }
.storage-attachments { display: grid; gap: 8px; min-width: 0; }

.admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(150px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 62px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 11px 14px;
}

.admin-row-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.admin-row-main strong,
.admin-row-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-main strong {
  font-size: 0.84rem;
}

.admin-row-main span,
.admin-row-detail {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.67rem;
}

.admin-row-detail {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#panel-errors .admin-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
}

#panel-errors .admin-row-main strong,
#panel-errors .admin-row-main span {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

#panel-errors .admin-row-main span {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.5;
}

#panel-errors .admin-row-detail {
  min-width: 3ch;
  color: var(--text);
  font-size: 1rem;
  font-weight: 650;
}

.quarantine-region {
  margin-top: 28px;
  min-width: 0;
}

.quarantine-region > p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.quarantine-region .source-title {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.quarantine-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  white-space: nowrap;
}

.state-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--info);
  content: "";
}

.state-badge.success::before {
  background: var(--success);
}

.state-badge.warning::before {
  background: var(--warning);
}

.state-badge.error::before {
  background: var(--danger);
}

.empty-panel,
.loading-panel,
.error-panel {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(17, 25, 27, 0.62);
  color: var(--text-muted);
  padding: 28px;
  text-align: center;
}

.empty-panel strong,
.error-panel strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.empty-panel p,
.error-panel p {
  max-width: 560px;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
}

.error-panel {
  border-color: rgba(237, 107, 97, 0.42);
}

noscript {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  padding: 30px;
  text-align: center;
}

@keyframes message-rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes think-pulse {
  0%, 75%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 56px minmax(0, 1fr);
  }

  .mobile-bar {
    position: relative;
    z-index: 30;
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--bg-deep);
    padding: 8px 12px;
  }

  .mobile-bar .icon-button {
    width: 36px;
    height: 36px;
  }

  .mobile-wordmark {
    justify-self: center;
    font-size: 0.96rem;
  }

  .connection-mark {
    justify-self: end;
    margin-right: 12px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar-width));
    transform: translateX(-102%);
    transition: transform 190ms ease;
    box-shadow: var(--shadow);
  }

  .app-shell.is-menu-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 15;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.58);
    cursor: pointer;
  }

  .app-shell.is-menu-open .sidebar-scrim {
    display: block;
  }

  .main-area {
    grid-row: 2;
  }

  .view-header {
    min-height: 72px;
  }

  .header-meta .status-pill {
    display: none;
  }

  .thread {
    padding-top: 28px;
  }

  .welcome {
    align-content: start;
    padding-top: 12vh;
  }

  .admin-header {
    top: 0;
  }
}

@media (max-width: 620px) {
  .view-header {
    padding-inline: 17px;
  }

  .view-header h1 {
    font-size: 1.12rem;
  }

  .chat-header .eyebrow,
  .connection-label {
    display: none;
  }

  .thread {
    padding: 24px 16px 32px;
  }

  .welcome {
    padding-top: 7vh;
  }

  .welcome h2 {
    font-size: 1.65rem;
  }

  .user-message .message-body {
    max-width: 88%;
  }

  .source-card summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .source-score {
    grid-column: 2;
  }

  .source-content {
    padding-left: 14px;
  }

  .composer-region {
    padding: 10px 10px 12px;
  }

  .composer {
    gap: 5px;
  }

  .send-button {
    width: 42px;
    height: 42px;
    padding: 0;
  }

  .send-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .composer-note {
    display: none;
  }

  .auth-notice {
    align-items: flex-start;
    padding-inline: 16px;
  }

  .auth-notice p {
    display: none;
  }

  .admin-content {
    padding: 18px 15px 50px;
  }

  .admin-header .button span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .admin-tabs button {
    min-width: 0;
    min-height: 48px;
    margin: 0;
    border: 1px solid transparent;
    border-bottom-color: var(--border);
    padding: 8px 10px;
    text-align: left;
    white-space: normal;
  }

  .admin-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .admin-tabs button[aria-selected="true"] {
    border-color: var(--accent-bright);
    background: var(--accent-wash);
  }

  .panel-heading {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .admin-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .admin-row-detail {
    grid-column: 1 / -1;
  }

  #panel-errors .admin-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #panel-errors .admin-row-main {
    grid-column: 1 / -1;
  }

  #panel-errors .admin-row-detail {
    grid-column: 1;
    grid-row: 2;
  }

  #panel-errors .state-badge {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: #566467;
    --border-strong: #758184;
    --text-muted: #c2cbcc;
    --text-faint: #aab4b6;
  }
}
