/* ===== CC Pattern Analysis Tool — Conference Demo Styles ===== */

:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #1e2a45;
  --bg-hover: #253554;
  --bg-input: #0f1729;
  --accent: #0f9b8e;
  --accent-light: #14b8a6;
  --accent-dim: #0a7268;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #2d3a56;
  --border-light: #3d4f70;
  --david-color: #c4774d;
  --david-bg: rgba(196, 119, 77, 0.08);
  --david-border: rgba(196, 119, 77, 0.25);
  --sarah-color: #5ba3a3;
  --sarah-bg: rgba(91, 163, 163, 0.08);
  --sarah-border: rgba(91, 163, 163, 0.25);
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */

#app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: -0.3px;
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.api-key-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-key-group label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.api-key-group input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  width: 200px;
  font-family: var(--font-mono);
}

.api-key-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.api-key-group button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
}

.mode-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 5px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.mode-dot.backup { background: var(--warning); }
.mode-dot.live { background: var(--success); }

/* ===== LAYOUT ===== */

#app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: 0; /* flex trick: forces flex: 1 to not exceed viewport */
}

/* ===== SIDEBAR ===== */

#sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.framework-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.fw-toggle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.fw-toggle:hover {
  color: var(--accent-light);
}

.chevron {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.fw-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.2s ease;
  max-height: 500px;
  opacity: 1;
  margin-top: 8px;
}

.fw-body.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.fw-toggle.open .chevron {
  transform: rotate(90deg);
}

.framework-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.fw-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.fontes-item, .katz-item {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.fontes-item .fontes-num {
  color: var(--accent);
  font-weight: 600;
  margin-right: 4px;
}

.fontes-item:hover, .katz-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.fontes-item.active {
  background: rgba(15, 155, 142, 0.15);
  color: var(--accent-light);
  border-left: 2px solid var(--accent);
  padding-left: 4px;
}

/* Pattern Cards */
.patterns-summary {
  padding: 16px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.patterns-total {
  font-size: 15px;
  color: var(--text-secondary);
}

.patterns-total .stat-number {
  color: var(--accent-light);
  font-weight: 700;
  font-size: 18px;
}

.pattern-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
}

.pattern-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.pattern-card-header:hover {
  background: var(--bg-hover);
}

.pattern-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pattern-card-fontes {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pattern-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.pattern-card-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pattern-card-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.pattern-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 16px 8px 20px;
}

.pattern-card-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  max-height: 2000px;
  opacity: 1;
}

.pattern-card-body.collapsed {
  max-height: 0;
  opacity: 0;
}

.pattern-card .chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
  display: inline-block;
}

.pattern-msg {
  padding: 12px 16px 12px 20px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.pattern-msg:hover {
  background: var(--bg-hover);
}

.pattern-msg-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.pattern-msg-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pattern-msg-sender {
  font-size: 11px;
  font-weight: 600;
}

.pattern-msg-sender.david { color: var(--david-color); }
.pattern-msg-sender.sarah { color: var(--sarah-color); }

.pattern-msg-intensity {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}

.pattern-msg-label {
  font-size: 13px;
  color: var(--accent-light);
  font-weight: 500;
  margin-bottom: 4px;
}

.pattern-msg-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
}

/* Sidebar Brand */
.sidebar-brand {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.sidebar-brand a {
  text-decoration: none;
}

.brand-luminate {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #c4774d, #d4a055, #0f9b8e, #5ba3a3, #6b8fb5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Filters */

.filter-group {
  margin-bottom: 10px;
}

.filter-group label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.filter-group select,
.filter-group input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: var(--font);
}

.filter-group input[type="date"] {
  margin-bottom: 4px;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Tactic filter checkboxes */
.tactic-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.tactic-filter-item:hover {
  color: var(--text-primary);
}

.tactic-filter-item input {
  accent-color: var(--accent);
}

.tactic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* ===== BUTTONS ===== */

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--accent-light); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-hover);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 32px; font-size: 15px; }

/* ===== MAIN CONTENT ===== */

#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== TAB BAR ===== */

#tab-bar {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border);
  padding: 0 20px;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: var(--font);
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

/* ===== TAB PANELS ===== */

#tab-panels {
  flex: 1;
  overflow: hidden;
}

.tab-panel {
  display: none;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.msg-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: 12px;
}

/* ===== CORPUS LIST ===== */

.corpus-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}

.msg-item {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 4px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.msg-item:hover {
  background: var(--bg-hover);
}

.msg-item.david {
  border-left-color: var(--david-color);
  background: var(--david-bg);
}

.msg-item.sarah {
  border-left-color: var(--sarah-color);
  background: var(--sarah-bg);
}

.msg-item.highlighted {
  background: rgba(15, 155, 142, 0.2) !important;
  border-left-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent);
}

.msg-meta {
  min-width: 130px;
  flex-shrink: 0;
}

.msg-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.msg-sender {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.msg-sender.david { color: var(--david-color); }
.msg-sender.sarah { color: var(--sarah-color); }

.msg-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.msg-text mark {
  background: rgba(15, 155, 142, 0.35);
  color: var(--text-primary);
  padding: 0 2px;
  border-radius: 2px;
}

.msg-index {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
  font-family: var(--font-mono);
  padding-top: 2px;
}

/* ===== ANALYSIS CONTENT ===== */

.analysis-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.analysis-content h1, .analysis-content h2, .analysis-content h3,
.analysis-content h4, .analysis-content h5, .analysis-content h6 {
  color: var(--text-primary);
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}

.analysis-content h1 { font-size: 22px; color: var(--accent-light); }
.analysis-content h2 { font-size: 18px; color: var(--accent-light); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.analysis-content h3 { font-size: 15px; }
.analysis-content h4 { font-size: 14px; color: var(--text-secondary); }

.analysis-content p {
  margin-bottom: 0.8em;
  color: var(--text-secondary);
}

.analysis-content strong {
  color: var(--text-primary);
}

.analysis-content ul, .analysis-content ol {
  margin-bottom: 0.8em;
  padding-left: 24px;
  color: var(--text-secondary);
}

.analysis-content li {
  margin-bottom: 0.3em;
}

.analysis-content blockquote {
  border-left: 3px solid var(--accent-dim);
  padding: 8px 16px;
  margin: 12px 0;
  background: rgba(15, 155, 142, 0.05);
  color: var(--text-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.analysis-content code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-light);
}

.analysis-content pre {
  background: var(--bg-input);
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.analysis-content pre code {
  background: transparent;
  padding: 0;
}

.analysis-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.analysis-content th {
  background: var(--bg-card);
  color: var(--accent-light);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
}

.analysis-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.analysis-content tr:hover td {
  background: var(--bg-hover);
}

.analysis-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.analysis-content a {
  color: var(--accent-light);
  text-decoration: none;
}

.analysis-content a:hover {
  text-decoration: underline;
}

/* Date references in analysis - clickable */
.date-ref {
  color: var(--accent-light);
  cursor: pointer;
  border-bottom: 1px dashed var(--accent-dim);
}

.date-ref:hover {
  color: var(--accent);
  border-bottom-style: solid;
}

/* ===== STAT CARDS ===== */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 20px 24px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .stat-values {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.stat-card .stat-david {
  font-size: 20px;
  font-weight: 700;
  color: var(--david-color);
}

.stat-card .stat-sarah {
  font-size: 20px;
  font-weight: 700;
  color: var(--sarah-color);
}

.stat-card .stat-ratio {
  font-size: 13px;
  color: var(--accent-light);
  font-weight: 600;
  text-align: center;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.stat-card .stat-names {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.stat-balance {
  display: flex;
  align-items: center;
  height: 16px;
  margin-top: 8px;
}

.stat-bar-left {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  height: 100%;
  align-items: center;
}

.stat-bar-right {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  height: 100%;
  align-items: center;
}

.stat-bar-david {
  height: 6px;
  background: var(--david-color);
  border-radius: 3px 0 0 3px;
  opacity: 0.8;
}

.stat-bar-sarah {
  height: 6px;
  background: var(--sarah-color);
  border-radius: 0 3px 3px 0;
  opacity: 0.8;
}

.stat-bar-center {
  width: 2px;
  height: 14px;
  background: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.stat-card-clickable {
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.stat-card-clickable:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.stat-hint {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card-clickable:hover .stat-hint {
  opacity: 1;
}

.evidence-header {
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.evidence-header h4 {
  color: var(--accent-light);
  margin-bottom: 4px;
}

.evidence-header p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Evidence Items (in modal) */
.evidence-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.evidence-item:hover {
  background: var(--bg-hover);
}

.evidence-item.david { border-left: 3px solid var(--david-color); }
.evidence-item.sarah { border-left: 3px solid var(--sarah-color); }

.evidence-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.evidence-sender {
  font-size: 12px;
  font-weight: 700;
}

.evidence-sender.david { color: var(--david-color); }
.evidence-sender.sarah { color: var(--sarah-color); }

.evidence-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.evidence-idx {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}

.evidence-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.evidence-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.evidence-tactics {
  display: flex;
  gap: 4px;
}

.evidence-tactic {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
}

.evidence-label {
  font-size: 12px;
  color: var(--accent-light);
  font-style: italic;
}

/* Quote Pairs */
.quote-pairs-section {
  padding: 20px 24px;
}

.quote-pairs-title {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.quote-pairs-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quote-pair {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.quote-pair-theme {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-light);
  padding: 10px 16px;
  background: rgba(15, 155, 142, 0.06);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quote-pair-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.quote-col {
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.quote-col:hover {
  background: var(--bg-hover);
}

.quote-col.david {
  border-right: 1px solid var(--border);
  border-left: 3px solid var(--david-color);
  background: var(--david-bg);
}

.quote-col.sarah {
  border-left: 3px solid var(--sarah-color);
  background: var(--sarah-bg);
}

.quote-sender {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.quote-col.david .quote-sender { color: var(--david-color); }
.quote-col.sarah .quote-sender { color: var(--sarah-color); }

.quote-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  font-style: italic;
}

.narrative-toggle-wrap {
  text-align: center;
  padding: 20px;
}

/* ===== LEGAL CARDS ===== */
.legal-selector {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.legal-fw-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.legal-fw-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.legal-fw-btn.active {
  background: rgba(15, 155, 142, 0.15);
  border-color: var(--accent);
  color: var(--accent-light);
  font-weight: 600;
}

.legal-statute {
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px 24px 8px;
  line-height: 1.5;
  font-style: italic;
}

.legal-summary-bar {
  display: flex;
  gap: 16px;
  padding: 8px 24px 16px;
}

.legal-met {
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
}

.legal-rebutted {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-light);
}

.legal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 0 24px 10px;
  overflow: hidden;
}

.legal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}

.legal-card-clickable {
  cursor: pointer;
  transition: background 0.15s;
}

.legal-card-clickable:hover {
  background: var(--bg-hover);
}

.legal-card-msgcount {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.legal-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-card-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
}

.legal-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.legal-card-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legal-verdict {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legal-verdict.met {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.legal-verdict.rebutted {
  background: rgba(20, 184, 166, 0.15);
  color: var(--accent-light);
}

.legal-card-summary {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 16px 10px 52px;
  line-height: 1.5;
}

.legal-card-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  max-height: 500px;
  opacity: 1;
}

.legal-card-body.collapsed {
  max-height: 0;
  opacity: 0;
}

.legal-card-detail {
  padding: 12px 16px 12px 52px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  font-style: italic;
}

.legal-card .chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
  display: inline-block;
}

/* ===== FRAMEWORK EXPLAINER ===== */
.framework-explainer {
  padding: 24px;
  max-width: 800px;
}

.fw-explainer-intro {
  margin-bottom: 24px;
}

.fw-explainer-intro h3 {
  color: var(--accent-light);
  font-size: 18px;
  margin-bottom: 12px;
}

.fw-explainer-intro p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.fw-explainer-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.fw-explainer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.fw-explainer-card h4 {
  color: var(--text-primary);
  font-size: 15px;
  margin-bottom: 6px;
}

.fw-explainer-card p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.fw-explainer-note {
  background: rgba(15, 155, 142, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.fw-explainer-note p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 6px;
}

.fw-explainer-note p:last-child {
  margin-bottom: 0;
}

/* ===== TIMELINE ===== */

#timeline-chart-container {
  padding: 20px 24px 30px;
  height: 380px;
  flex-shrink: 0;
}

.timeline-detail-box {
  background: var(--bg-card);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 12px 24px;
  flex-shrink: 0;
}

.timeline-detail-box h4 {
  color: var(--accent-light);
  font-size: 13px;
  margin-bottom: 6px;
}

.timeline-detail-box .td-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.timeline-detail-box .td-label {
  font-size: 14px;
  color: var(--text-primary);
  margin: 4px 0;
}

.timeline-detail-box .td-tactic {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 12px;
  color: #fff;
  margin-right: 6px;
}

.timeline-detail-box .td-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  padding: 8px;
  background: var(--bg-input);
  border-radius: var(--radius);
  border-left: 3px solid var(--david-color);
}

.timeline-detail-box .td-actions {
  margin-top: 8px;
}

.timeline-detail-box .td-actions button {
  font-size: 12px;
}

/* ===== EXPORT ===== */

.export-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.export-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 500px;
  text-align: center;
}

.export-info h3 {
  font-size: 20px;
  color: var(--accent-light);
  margin-bottom: 12px;
}

.export-info p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 14px;
}

.export-sections {
  text-align: left;
  margin-bottom: 24px;
}

.export-sections label {
  display: block;
  padding: 6px 0;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.export-sections label:hover {
  color: var(--text-primary);
}

.export-sections input {
  accent-color: var(--accent);
  margin-right: 8px;
}

/* ===== MODALS ===== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-wide {
  max-width: 800px;
}

.welcome-content {
  padding: 40px;
  max-width: 560px;
  text-align: left;
}

.welcome-content h2 {
  color: var(--accent-light);
  font-size: 24px;
  margin-bottom: 4px;
}

.welcome-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.welcome-disclaimer {
  background: rgba(15, 155, 142, 0.08);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.welcome-content h4 {
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 10px;
}

.welcome-content ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.welcome-content li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
  line-height: 1.4;
}

.welcome-content li strong {
  color: var(--accent-light);
}

.welcome-contact {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.welcome-credit {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.welcome-content .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 15px;
  color: var(--accent-light);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  overflow-y: auto;
  padding: 20px;
}

.modal-body pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--bg-input);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Modal corpus messages */
.modal-body .msg-item {
  margin-bottom: 6px;
}

/* ===== STATUS BAR ===== */

#status-bar {
  display: flex;
  justify-content: space-between;
  padding: 6px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===== LOADING ===== */

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--accent);
  font-size: 14px;
  padding: 20px;
}

/* ===== SCROLLBAR ===== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1024px) {
  #sidebar {
    width: 240px;
    min-width: 240px;
  }
  .stat-cards {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}
