/* Disclosure AI — Portal Design System */

:root {
  --color-bg: #EAEDF1;
  --color-surface: #FFFFFF;
  --color-sidebar: #2C3E50;
  --color-sidebar-hover: #34495E;
  --color-sidebar-active: #1ABC9C;
  --color-accent: #1ABC9C;
  --color-accent-hover: #16A085;
  --color-text-main: #34495E;
  --color-text-muted: #7F8C8D;
  --color-border: #DCE1E6;
  --color-success: #1ABC9C;
  --color-warning: #F39C12;
  --color-error: #E74C3C;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, Menlo, monospace;
  --radius-sm: 3px;
  --radius-md: 4px;
  --shadow-card: 0 1px 2px rgba(44, 62, 80, 0.06), 0 2px 8px rgba(44, 62, 80, 0.03);
}

/* ── Global Reset ── */
* {
  box-sizing: border-box;
}

/* ── Sidebar ── */
.sidebar {
  width: 320px;
  background-color: var(--color-sidebar);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,0.1);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.brand-title {
  font-size: 1.125rem;
  font-weight: 600;
  display: block;
}

.brand-tagline {
  opacity: 0.6;
  font-size: 0.75rem;
  display: block;
  margin-top: 4px;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 2px; }
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

.nav-label {
  padding: 0 24px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.4);
}

.fund-nav-item {
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 3px solid transparent;
  text-decoration: none;
  color: inherit;
}

.fund-nav-item:hover {
  background-color: var(--color-sidebar-hover);
}

.fund-nav-item.active {
  background-color: rgba(26, 188, 156, 0.1);
  border-left-color: var(--color-sidebar-active);
}

.nav-fund-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-fund-cik {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.5;
}

.sidebar-footer {
  padding: 20px;
  background: rgba(0,0,0,0.1);
}

.add-btn-small {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1px dashed rgba(255,255,255,0.2);
  color: white;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font-main);
}

.add-btn-small:hover {
  background: rgba(255,255,255,0.15);
}

/* ── Main Panel ── */
.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  position: relative;
}

.top-bar {
  height: 60px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
}

.focus-content {
  flex: 1;
  padding: 32px;
  display: flex;
  gap: 24px;
  overflow: hidden;
}

/* ── Fund Detail Card ── */
.fund-detail-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.detail-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--color-bg);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.detail-title h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.detail-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 8px;
}

/* ── Chat ── */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #FAFBFC;
  overflow: hidden;
}

.chat-scroll {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Message Row (wraps bubble + timestamp) ── */
.message-row {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

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

.message-row--ai {
  align-self: flex-start;
  align-items: flex-start;
}

.message-timestamp {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 6px;
}

/* ── User Bubble ── */
.bubble {
  border-radius: 8px;
  font-size: 0.9375rem;
  line-height: 1.6;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.bubble-user {
  background-color: var(--color-sidebar);
  color: #FFFFFF;
  padding: 16px 20px;
  border-bottom-right-radius: 2px;
}

/* ── AI Bubble (structured: header / content / footer) ── */
.bubble-ai {
  background-color: #FFFFFF;
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 2px;
  position: relative;
  overflow: hidden;
  padding: 0;
}

.bubble-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #F8F9FA;
  border-bottom: 1px solid var(--color-border);
}

.bubble-ai-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-main);
  letter-spacing: 0.03em;
}

.bubble-ai-header-brand::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--color-accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.bubble-ai-header-ref {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--color-text-muted);
}

.bubble-ai-body {
  padding: 20px 24px;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--color-text-main);
}

/* ── Formatted content inside AI body ── */
.bubble-ai-body p {
  margin-bottom: 12px;
}

.bubble-ai-body p:last-child {
  margin-bottom: 0;
}

.bubble-ai-body strong {
  font-weight: 600;
  color: var(--color-text-main);
  background: rgba(26, 188, 156, 0.15);
  padding: 2px 5px;
  border-radius: 3px;
}

.bubble-ai-body em {
  font-style: italic;
}

.bubble-ai-body .highlight {
  background: rgba(26, 188, 156, 0.12);
  color: var(--color-accent-hover);
  padding: 1px 5px;
  border-radius: 2px;
  font-weight: 600;
  border: 1px solid rgba(26, 188, 156, 0.2);
}

.bubble-ai-body blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.875rem;
}

.bubble-ai-body ol {
  list-style: none;
  counter-reset: item;
  padding: 0;
  margin: 12px 0;
}

.bubble-ai-body ol li {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.bubble-ai-body ol li:last-child {
  margin-bottom: 0;
}

.bubble-ai-body ol li::before {
  counter-increment: item;
  content: counter(item);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--color-sidebar);
  color: #FFFFFF;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 2px;
}

.bubble-ai-body ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.bubble-ai-body ul li {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.bubble-ai-body ul li::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 8px;
}

.bubble-ai-body .list-title {
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
  color: var(--color-text-main);
}

.bubble-ai-body .list-desc {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.bubble-ai-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.875rem;
}

.bubble-ai-body thead th {
  text-align: left;
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-main);
  white-space: nowrap;
}

.bubble-ai-body tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid #F0F2F5;
  color: var(--color-text-main);
}

.bubble-ai-body tbody tr:last-child td {
  border-bottom: none;
}

.bubble-ai-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 16px 0 8px;
}

.bubble-disclaimer {
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

/* ── AI Bubble Footer (actions) ── */
.bubble-ai-footer {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  background: #F8F9FA;
  border-top: 1px solid var(--color-border);
}

.bubble-action-btn {
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.bubble-action-btn:hover {
  background: var(--color-sidebar);
  color: white;
  border-color: var(--color-sidebar);
}

.bubble-action-btn--copied {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* ── Simple AI bubble (for welcome message, errors) ── */
.bubble-ai-simple {
  padding: 16px 20px;
}

/* ── Chat Footer / Input ── */
.chat-footer {
  padding: 24px 32px;
  background: #FFFFFF;
  border-top: 1px solid var(--color-border);
}

.input-wrapper {
  display: flex;
  gap: 12px;
  background: #F8F9FA;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 16px;
}

.input-wrapper.disabled {
  background: #F1F3F5;
  opacity: 0.7;
  cursor: not-allowed;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  height: 40px;
  font-size: 0.9375rem;
  outline: none;
  color: var(--color-text-main);
  font-family: var(--font-main);
}

.chat-input:disabled {
  cursor: not-allowed;
}

.send-btn {
  background: var(--color-accent);
  border: none;
  color: #FFFFFF;
  padding: 0 16px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: var(--font-main);
}

.send-btn:hover {
  background: var(--color-accent-hover);
}

.send-btn:disabled {
  background: #E2E8F0;
  color: #94A3B8;
  cursor: not-allowed;
}

/* ── Quick Questions ── */
.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.quick-question-btn {
  padding: 8px 14px;
  font-size: 0.875rem;
  font-family: var(--font-main);
  background: rgba(26, 188, 156, 0.08);
  border: 1px solid rgba(26, 188, 156, 0.3);
  border-radius: 20px;
  color: #128a6e;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.quick-question-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

/* ── Loading / Thinking ── */
.loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1.0); opacity: 1; }
}

.thinking-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 280px;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--color-text-main);
}

.progress-stepper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.step.active {
  color: var(--color-text-main);
  font-weight: 500;
}

.step-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #E2E8F0;
  border-top: 2px solid var(--color-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.progress-bar-container {
  width: 100%;
  height: 4px;
  background: #EDF2F7;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  background: var(--color-accent);
  transition: width 0.5s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: progress-shimmer 1.5s infinite;
}

@keyframes progress-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Indeterminate progress: grows from 0% to 90% with decelerating ease */
.progress-fill-indeterminate {
  animation: progress-grow 25s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes progress-grow {
  0%   { width: 0%; }
  100% { width: 90%; }
}

/* ── Stats Panel ── */
.stats-panel {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-shrink: 0;
}

.stats-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.stats-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  display: block;
}

.doc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-item {
  font-size: 0.8125rem;
  color: var(--color-text-main);
}

.doc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-main);
  text-decoration: none;
}

.doc-link:hover {
  color: var(--color-accent);
}

.doc-icon {
  color: var(--color-accent);
}

/* ── Badges & Pills ── */
.cik-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  background: #F7F9FA;
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px solid var(--color-border);
}

.status-pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.status-pill--ready { background: #EBFDF9; color: var(--color-success); }
.status-pill--processing { background: #FFF9EB; color: var(--color-warning); }
.status-pill--failed { background: #FDEBEB; color: var(--color-error); }
.status-pill--pending { background: #F0F2F5; color: var(--color-text-muted); }

/* ── Inline citation superscripts ── */
.bubble-ai-body .cite-num {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--color-accent);
  vertical-align: super;
  line-height: 0;
  margin: 0 1px;
  cursor: default;
}

/* ── Citations (collapsible) ── */
.citation {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.citation-toggle {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.citation-toggle::-webkit-details-marker { display: none; }

.citation-toggle::before {
  content: '\25B8';
  font-size: 0.625rem;
  transition: transform 0.15s;
}

details.citation[open] > .citation-toggle::before {
  transform: rotate(90deg);
}

.citation-list {
  padding-top: 8px;
}

.citation-item {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  padding: 3px 0 3px 14px;
}

.citation-link {
  color: #117A65;
  text-decoration: none;
}

.citation-link:hover {
  text-decoration: underline;
}

.citation-excerpt-details {
  margin-top: 4px;
}

.citation-excerpt-toggle {
  font-size: 0.625rem;
  color: #117A65;
  cursor: pointer;
  list-style: none;
}

.citation-excerpt-details[open] .citation-excerpt-toggle {
  margin-bottom: 4px;
}

.citation-excerpt {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 8px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
}

/* ── Report Issue Modal ── */
.report-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.report-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  width: 400px;
  max-width: 90vw;
}

.report-modal h3 {
  margin: 0 0 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.report-modal p {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.report-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text-main);
  resize: vertical;
  box-sizing: border-box;
}

.report-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.report-cancel-btn,
.report-submit-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
}

.report-cancel-btn {
  background: transparent;
  color: var(--color-text-muted);
}

.report-cancel-btn:hover {
  color: var(--color-text-main);
}

.report-submit-btn {
  background: var(--color-accent);
  color: white;
}

.report-submit-btn:hover {
  opacity: 0.9;
}

.report-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Toast ── */
.toast-enter {
  animation: toastSlideIn 300ms ease-out;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Dashboard Table ── */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.portal-table th {
  position: sticky;
  top: 0;
  background: #F8F9FA;
  padding: 12px 24px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  z-index: 10;
}

.portal-table td {
  padding: 14px 24px;
  font-size: 0.875rem;
  border-bottom: 1px solid #F0F2F5;
  color: var(--color-text-main);
}

.portal-table tr:hover td { background-color: #FBFCFD; }

/* ── Action Button (dashboard) ── */
.action-btn {
  background: #F0F2F5;
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-main);
}

.action-btn:hover {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.action-btn--primary {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.action-btn--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* ── Add Fund Form (sidebar) ── */
.add-fund-input {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.75rem;
  padding: 6px 10px;
  font-family: var(--font-mono);
  outline: none;
  box-sizing: border-box;
}

.add-fund-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.add-fund-input:focus {
  border-color: rgba(255,255,255,0.3);
}

/* ── Fund Search Autocomplete ── */
.add-fund-form-search {
  margin-top: 12px;
  position: relative;
}

.search-input-wrapper {
  position: relative;
}

.search-results {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--color-sidebar);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
}

.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: white;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-main);
  transition: background 0.1s;
}

.search-result-item:hover {
  background: var(--color-sidebar-hover);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.search-result-name {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.search-result-count {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  opacity: 0.4;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-result-meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  opacity: 0.5;
}

.search-no-results {
  padding: 12px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
}

/* ── Policy / Limitations panels ── */

.policy-details summary::-webkit-details-marker { display: none; }
.policy-details summary::marker { content: ""; }

.policy-arrow {
  font-size: 0.625rem;
  transition: transform 0.15s;
  display: inline-block;
}

.policy-details[open] .policy-arrow {
  transform: rotate(90deg);
}

.policy-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.policy-list li {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  padding: 3px 0 3px 14px;
  position: relative;
}

.policy-list li::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--color-accent);
  border-radius: 50%;
  position: absolute;
  left: 0;
  top: 9px;
}

.policy-list strong {
  font-weight: 600;
  color: var(--color-text-main);
}

.version-tag {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--color-text-main);
  opacity: 0.6;
}

.sidebar-attribution {
  padding: 12px 16px;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.4);
}

.sidebar-attribution .luthor-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.sidebar-attribution .luthor-link:hover {
  color: white;
}

/* ── Eval Dashboard ── */

.eval-page {
  padding: 32px;
  max-width: 1200px;
}

.eval-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 0 0 4px;
}

.eval-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin: 0;
}

.eval-subtitle code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--color-bg);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

.eval-back-link {
  font-size: 0.8125rem;
  color: var(--color-accent);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 8px;
}

.eval-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
  font-size: 0.8125rem;
}

.eval-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.eval-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.eval-row { cursor: pointer; }
.eval-row:hover { background: rgba(26, 188, 156, 0.04); }

.eval-label { font-weight: 600; }
.eval-sha { font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-text-muted); }
.eval-tokens { font-family: var(--font-mono); font-size: 0.75rem; }
.eval-time { font-family: var(--font-mono); font-size: 0.75rem; }
.eval-date { font-size: 0.75rem; color: var(--color-text-muted); }

.eval-score { font-weight: 600; }
.score-good { color: var(--color-success); }
.score-ok { color: var(--color-warning); }
.score-bad { color: var(--color-error); }
.score-na { color: var(--color-text-muted); }

.eval-delta { font-size: 0.6875rem; font-weight: 500; }
.eval-delta--up { color: var(--color-success); }
.eval-delta--down { color: var(--color-error); }

/* Trend bars */
.eval-trends {
  margin-top: 40px;
}

.eval-trends h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin: 0 0 16px;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.trend-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.trend-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 80px;
  margin-top: 12px;
}

.trend-bar-wrapper {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.trend-bar {
  width: 100%;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

.trend-bar.score-good { background: var(--color-success); }
.trend-bar.score-ok { background: var(--color-warning); }
.trend-bar.score-bad { background: var(--color-error); }
.trend-bar.score-na { background: var(--color-border); }

.trend-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.625rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Summary cards (show page) */
.eval-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.eval-summary-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.eval-summary-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.eval-summary-score {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
}

.eval-summary-sub {
  display: block;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.eval-score-bar {
  height: 4px;
  background: var(--color-bg);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.eval-score-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.eval-score-fill.score-good { background: var(--color-success); }
.eval-score-fill.score-ok { background: var(--color-warning); }
.eval-score-fill.score-bad { background: var(--color-error); }

/* Per-question detail (show page) */
.eval-detail {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 8px;
  overflow: hidden;
}

.eval-detail-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.8125rem;
}

.eval-detail-summary::-webkit-details-marker { display: none; }
.eval-detail-summary::marker { content: ""; }

.eval-detail-q {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  min-width: 24px;
}

.eval-detail-question {
  flex: 1;
  color: var(--color-text-main);
  font-weight: 500;
}

.eval-detail-scores {
  display: flex;
  gap: 4px;
}

.eval-mini-score {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--color-bg);
}

.eval-mini-score.score-good { background: rgba(26, 188, 156, 0.15); }
.eval-mini-score.score-ok { background: rgba(243, 156, 18, 0.15); }
.eval-mini-score.score-bad { background: rgba(231, 76, 60, 0.15); }

.eval-detail-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  min-width: 60px;
  text-align: right;
}

.eval-detail-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--color-border);
}

.eval-detail-meta {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding: 12px 0 8px;
}

.eval-detail-meta code {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  background: var(--color-bg);
  padding: 1px 4px;
  border-radius: 2px;
}

.eval-judge-notes {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
}

.eval-response-content {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--color-text-main);
  margin-top: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.eval-empty {
  text-align: center;
  padding: 64px 0;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.eval-empty code {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--color-surface);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}

/* ── Mobile Sidebar Toggle ── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 60;
  background: var(--color-sidebar);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── Sidebar Overlay (mobile backdrop) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}

/* ── Responsive: Tablet (≤1024px) ── */
@media (max-width: 1024px) {
  .stats-panel { display: none; }
  .focus-content { gap: 0; }
  .chat-scroll { padding: 24px; }
  .chat-footer { padding: 16px 24px; }
  .detail-header { padding: 20px 24px; }
}

/* ── Responsive: Mobile (≤768px) ── */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }

  /* Sidebar slides in as fixed overlay, toggled via .open class */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 280px;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .main-panel { width: 100%; }

  /* Left padding accommodates the fixed hamburger button */
  .top-bar {
    padding: 0 16px 0 60px;
    height: 52px;
    font-size: 0.75rem;
  }

  .focus-content {
    padding: 12px;
    padding-bottom: 0;
    gap: 0;
    flex-direction: column;
    overflow-y: auto;
  }

  .detail-header {
    padding: 16px;
    flex-direction: column;
    gap: 8px;
  }

  .detail-title h1 { font-size: 1.125rem; }

  .detail-meta {
    gap: 8px;
    flex-wrap: wrap;
  }

  /* Let chat scroll naturally; footer is pinned below */
  .chat-container {
    overflow: visible;
    display: block;
  }

  .chat-scroll {
    padding: 16px;
    gap: 16px;
    overflow: visible;
    padding-bottom: 130px;
  }

  .message-row { max-width: 90%; }

  .bubble-ai-body { padding: 16px; }
  .bubble-user { padding: 12px 16px; }

  .bubble, .bubble-ai-body {
    font-size: 0.875rem;
    line-height: 1.6;
  }

  /* Pin quick questions and chat input to bottom of screen */
  .quick-questions {
    position: fixed;
    bottom: 62px;
    left: 0;
    right: 0;
    z-index: 50;
    background: #FAFBFC;
    border-top: 1px solid var(--color-border);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 8px 12px;
  }

  .quick-question-btn {
    flex-shrink: 0;
    font-size: 0.8125rem;
    padding: 6px 12px;
  }

  .chat-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 10px 12px;
    background: #FFFFFF;
    border-top: 1px solid var(--color-border);
  }

  .input-wrapper { padding: 6px 12px; }

  .chat-input {
    height: 36px;
    font-size: 0.875rem;
  }

  .send-btn {
    padding: 0 12px;
    font-size: 0.8125rem;
  }

  .thinking-status { min-width: unset; }
  .report-modal { width: 90vw; }
  .version-tag { display: none; }
}
