/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva,
    Verdana, sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* ===== App Grid Shell ===== */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  height: 100vh;
}

/* ===== Top Bar ===== */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: #0f0f23;
  border-bottom: 1px solid #2a2a3e;
  gap: 12px;
  z-index: 10;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: #888;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}
.sidebar-toggle:hover { color: #e0e0e0; }
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-logo {
  height: 36px;
  width: auto;
}
.topbar-title {
  font-size: 20px;
  font-weight: bold;
  color: #00d4aa;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-email {
  color: #888;
  font-size: 13px;
}
.plan-badge {
  background: #0f3460;
  color: #00d4aa;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}
.plan-badge.free { color: #888; }
.upgrade-btn {
  background: #00d4aa;
  color: #1a1a2e;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-weight: bold;
}
.upgrade-btn:hover { background: #00b894; }
.signout-btn {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 12px;
}
.signout-btn:hover { color: #e0e0e0; }

/* ===== Sidebar ===== */
.sidebar {
  grid-area: sidebar;
  background: #12122a;
  border-right: 1px solid #2a2a3e;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-section {
  margin-bottom: 24px;
}
.sidebar-section:last-child {
  margin-top: auto;
  margin-bottom: 0;
}
.sidebar-label {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  color: #555;
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding: 0 8px;
}

/* Twisty (collapsible sections) */
.sidebar-label.twisty {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
}
.sidebar-label.twisty .coach-info-btn {
  margin-left: auto;
}
.sidebar-label.twisty:hover { color: #888; }
.twisty-chevron {
  display: inline-block;
  font-size: 8px;
  transition: transform 0.2s;
  margin-right: 4px;
}
.twisty-chevron.collapsed {
  transform: rotate(-90deg);
}
.twisty-body {
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.2s ease;
}
.twisty-body.collapsed {
  max-height: 0;
}

/* Coach selector in sidebar */
.coach-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #888;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  margin-bottom: 4px;
}
.coach-btn:hover {
  background: #1a1a3e;
  color: #ccc;
}
.coach-btn.active {
  background: #1a2a3e;
  border-color: #00d4aa;
  color: #00d4aa;
}
.coach-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.coach-btn-text {
  flex: 1;
  min-width: 0;
}
.coach-label {
  display: block;
  font-size: 14px;
  margin-bottom: 1px;
}
.coach-desc {
  font-size: 11px;
  font-weight: normal;
  color: #555;
}
.coach-btn.active .coach-desc {
  color: #6a9;
}
.coach-info-btn {
  color: #555;
  font-size: 16px;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
}
.coach-info-btn:hover {
  color: #00d4aa;
}
.coach-meet-link {
  margin-top: 6px;
  font-size: 12px;
}

/* Nav links */
.sidebar-link {
  display: block;
  padding: 8px 12px;
  color: #888;
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.15s;
}
.sidebar-link:hover {
  background: #1a1a3e;
  color: #ccc;
}
.sidebar-link.active {
  background: #1a2a3e;
  color: #00d4aa;
}
.sidebar-link.disabled {
  color: #444;
  cursor: not-allowed;
  pointer-events: none;
}

/* New Chat button */
.new-chat-btn {
  width: 100%;
  padding: 10px 16px;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
  color: #888;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
}
.new-chat-btn:hover {
  border-color: #00d4aa;
  color: #00d4aa;
}

/* ===== Main Content ===== */
.main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #1a1a2e;
}
.main-header {
  padding: 12px 24px;
  border-bottom: 1px solid #2a2a3e;
  flex-shrink: 0;
}
.subtitle {
  color: #888;
  font-size: 13px;
  font-style: italic;
  margin-bottom: 0;
}
/* Pipe pills in input toolbar */
.pipe-pill {
  padding: 5px 14px;
  background: #1e2240;
  border: 1px solid transparent;
  border-radius: 20px;
  color: #667;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.pipe-pill:hover {
  background: #252a4a;
  color: #99a;
}
.pipe-pill.active {
  background: #1a2a3e;
  border-color: #00d4aa;
  color: #00d4aa;
}

/* ===== Chat Thread ===== */
.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.chat-empty {
  color: #444;
  padding-top: 80px;
  font-size: 15px;
  max-width: 800px;
}
/* Welcome banner for first-time visitors */
.welcome-banner {
  background: linear-gradient(
    135deg, #1a2744, #16213e);
  border: 1px solid #2a3a5a;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 24px;
  max-width: 560px;
}
.welcome-title {
  font-size: 18px;
  font-weight: 700;
  color: #00d4aa;
  margin-bottom: 10px;
}
.welcome-text {
  font-size: 13px;
  color: #aab;
  line-height: 1.5;
  margin: 0 0 8px;
}
.welcome-text strong {
  color: #ccd;
}
.welcome-promo {
  color: #f0a030;
  font-style: italic;
}
.welcome-dismiss {
  margin-top: 10px;
  padding: 8px 18px;
  background: transparent;
  border: 1px solid #00d4aa;
  border-radius: 5px;
  color: #00d4aa;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.welcome-dismiss:hover {
  background: rgba(0, 212, 170, 0.1);
}
.empty-greeting {
  font-style: italic;
  margin-bottom: 24px;
  font-size: 16px;
}
.starter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 500px;
}
.starter-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: #12122a;
  border: 1px solid #2a2a3e;
  border-radius: 8px;
  color: #aaa;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}
.starter-card:hover {
  border-color: #00d4aa;
  color: #e0e0e0;
}
.starter-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.starter-text {
  flex: 1;
}
@media (max-width: 600px) {
  .starter-grid {
    grid-template-columns: 1fr;
  }
}
.chat-msg {
  margin-bottom: 20px;
  line-height: 1.6;
  max-width: 800px;
}
.chat-msg:last-child { margin-bottom: 0; }
.chat-msg-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.chat-msg-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}
.chat-msg-text {
  padding: 12px 16px;
  border-radius: 6px;
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.6;
}
.chat-msg.user .chat-msg-label { color: #888; }
.chat-msg.user .chat-msg-text {
  background: #16213e;
  border: 1px solid #333;
}
.chat-msg.coach .chat-msg-label {
  color: #00d4aa;
}
.chat-msg.coach .chat-msg-text {
  background: #1a2a3e;
  border: 1px solid #1a3a4e;
  white-space: normal;
}
.chat-msg.coach .chat-msg-text h2 {
  color: #00d4aa;
  font-size: 16px;
  margin: 16px 0 8px 0;
}
.chat-msg.coach .chat-msg-text h2:first-child {
  margin-top: 0;
}
.chat-msg.coach .chat-msg-text h3 {
  color: #00d4aa;
  font-size: 15px;
  margin: 12px 0 6px 0;
}
.chat-msg.coach .chat-msg-text p {
  margin-bottom: 8px;
}
.chat-msg.coach .chat-msg-text ul,
.chat-msg.coach .chat-msg-text ol {
  margin: 8px 0;
  padding-left: 20px;
}
.chat-msg.coach .chat-msg-text li {
  margin-bottom: 4px;
}
.chat-msg.coach .chat-msg-text strong {
  color: #fff;
}
.chat-msg.coach .chat-msg-text code {
  background: #0f1a2e;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 13px;
}
.chat-msg.loading .chat-msg-text {
  color: #00d4aa;
  font-style: italic;
}
.chat-msg.error .chat-msg-text {
  border-color: #e74c3c;
  color: #e74c3c;
}
.chat-msg.ungrounded .chat-msg-text {
  font-style: italic;
  border-color: #3a3a2e;
}
.ungrounded-notice {
  font-size: 11px;
  color: #b8860b;
  padding: 4px 16px 0;
  font-style: italic;
}
.chat-msg-sources {
  font-size: 11px;
  color: #666;
  margin-top: 6px;
  padding: 0 16px;
}
.followup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 0 4px;
}
.followup-pill {
  -webkit-appearance: none;
  appearance: none;
  padding: 6px 14px;
  background: #1e2240;
  border: 1px solid transparent;
  border-radius: 20px;
  color: #99a;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  line-height: 1.4;
}
.followup-pill:hover {
  background: #252a4a;
  border-color: #00d4aa;
  color: #00d4aa;
}

/* ===== Input Area ===== */
.input-area {
  padding: 12px 24px 16px;
  border-top: 1px solid #2a2a3e;
  flex-shrink: 0;
  max-width: 848px;
}
.input-area textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 8px 8px 0 0;
  color: #e0e0e0;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 48px;
  max-height: 200px;
}
.input-area textarea:focus {
  border-color: #00d4aa;
}
.input-area textarea.mono {
  font-size: 13px;
  font-family: 'Consolas', 'Courier New',
    monospace;
  min-height: 100px;
}
.input-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #16213e;
  border: 1px solid #333;
  border-top: none;
  border-radius: 0 0 8px 8px;
}
.quota-badge {
  margin-left: auto;
  font-size: 12px;
  color: #666;
  font-weight: 600;
  cursor: default;
  white-space: nowrap;
}
.quota-badge.warning { color: #f0ad4e; }
.quota-badge.exhausted { color: #ff6b6b; }
.submit-btn {
  padding: 8px 20px;
  background: #00d4aa;
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}
.submit-btn:hover { background: #00b894; }
.submit-btn:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}
.file-name {
  color: #00d4aa;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Teaser cards for free report upsell */
.teaser-section {
  margin-top: 20px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid #2a3050;
  border-radius: 8px;
}
.teaser-header {
  font-size: 13px;
  font-weight: 700;
  color: #88a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.teaser-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.teaser-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #2a3050;
  border-radius: 6px;
  position: relative;
  min-height: 56px;
}
.teaser-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  opacity: 0.6;
}
.teaser-info {
  flex: 1;
  font-size: 13px;
  color: #ccd;
}
.teaser-info strong {
  color: #00d4aa;
}
.teaser-sev {
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.6;
}
.teaser-blur {
  font-family: monospace;
  font-size: 12px;
  color: #556;
  filter: blur(3px);
  user-select: none;
  white-space: nowrap;
}
.teaser-cta {
  margin-top: 14px;
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(
    135deg, #1a2744, #16213e);
  border: 1px solid #f0a030;
  border-radius: 6px;
  color: #f0a030;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.teaser-cta:hover {
  background: linear-gradient(
    135deg, #1e2f52, #1a2744);
}
.download-report-btn {
  margin-top: 10px;
  padding: 6px 14px;
  background: #16213e;
  border: 1px solid #00d4aa;
  border-radius: 4px;
  color: #00d4aa;
  font-size: 12px;
  cursor: pointer;
}
.download-report-btn:hover {
  background: #1a2744;
}
.report-pdf-mode {
  color: #111;
  background: #fff;
  border: 1px solid #ccc;
  padding: 12px 16px;
  border-radius: 6px;
  white-space: normal;
  font-size: 15px;
  line-height: 1.6;
}
.report-pdf-mode h2 {
  color: #1a6b55;
  font-size: 16px;
  margin: 16px 0 8px 0;
}
.report-pdf-mode h3 {
  color: #1a6b55;
  font-size: 15px;
  margin: 12px 0 6px 0;
}
.report-pdf-mode strong { color: #111; }
.report-pdf-mode p { margin-bottom: 8px; }
.report-pdf-mode ul,
.report-pdf-mode ol {
  margin: 8px 0;
  padding-left: 20px;
}
.report-pdf-mode li { margin-bottom: 4px; }
.report-pdf-mode .report-banner {
  background: #f5f5f5;
  border-color: #ccc;
}
.report-pdf-mode .banner-name {
  color: #1a6b55;
}
.report-pdf-mode .banner-tagline {
  color: #8b6914;
}
.report-pdf-mode .banner-hero-label {
  color: #666;
}
.report-pdf-mode .banner-villain-name {
  color: #333;
}
.report-pdf-mode .axis-tag {
  background: #e8e8e8;
  color: #333;
  border-color: #ccc;
}
.report-pdf-mode .dossier-stats {
  border-color: #ccc;
}
.report-pdf-mode .dossier-stats thead th {
  background: #e8e8e8;
  color: #333;
  border-color: #ccc;
}
.report-pdf-mode .dossier-stats tbody td {
  border-color: #ddd;
  color: #111;
}
.report-pdf-mode .dossier-stats .axis-label {
  background: #f0f0f0;
  color: #555;
}
.report-pdf-mode .dossier-stats .stat-val {
  color: #111;
}
.report-pdf-mode .dossier-stats .stat-lbl {
  color: #666;
}
.report-pdf-mode .dossier-stats .stat-exploit {
  color: #c0392b;
}
.report-pdf-mode .dossier-stats tr.stat-edge td {
  background: #f9f9f9;
  color: #555;
}
.report-pdf-mode .dossier-sample {
  color: #666;
}
.report-pdf-mode .download-report-btn {
  display: none;
}
.report-pdf-mode .followup-row {
  display: none;
}
.report-pdf-mode .chat-msg-sources {
  display: none;
}
.report-pdf-mode.chat-msg.coach .chat-msg-text,
.report-pdf-mode .chat-msg.coach .chat-msg-text,
.report-pdf-mode .chat-msg-text {
  background: #fff;
  border: none;
  border-left: 3px solid #1a6b55;
  color: #111;
  white-space: normal;
}
.report-pdf-mode .chat-msg.coach .chat-msg-text h2,
.report-pdf-mode .chat-msg-text h2 {
  color: #1a6b55;
}
.report-pdf-mode .chat-msg.coach .chat-msg-text strong,
.report-pdf-mode .chat-msg-text strong {
  color: #111;
}
.report-pdf-mode .chat-msg-label,
.report-pdf-mode .chat-msg.coach .chat-msg-label {
  color: #1a6b55;
}

/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-box {
  text-align: center;
  padding: 48px;
  background: #12122a;
  border-radius: 12px;
  border: 1px solid #2a2a3e;
}
.login-box h1 {
  color: #00d4aa;
  font-size: 28px;
  margin-bottom: 8px;
}
.login-box p {
  color: #888;
  margin-bottom: 24px;
  font-style: italic;
}
.login-logo {
  height: 96px;
  width: auto;
  margin-bottom: 16px;
}
.pdf-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #ddd;
}
.pdf-logo {
  height: 40px;
  width: auto;
}
.pdf-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}
.google-btn {
  background: #4285f4;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}
.google-btn:hover { background: #3367d6; }

/* ===== Hand Review Modal ===== */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  width: 420px;
  max-width: 90vw;
  background: #12122a;
  border: 1px solid #2a2a3e;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  color: #e0e0e0;
  font-size: 15px;
  font-weight: bold;
}
.modal-close {
  background: none;
  border: none;
  color: #666;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: #e0e0e0; }
.modal-textarea {
  width: 100%;
  height: 320px;
  padding: 12px;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 13px;
  font-family: 'Consolas', 'Courier New',
    monospace;
  outline: none;
  resize: none;
}
.modal-textarea:focus {
  border-color: #00d4aa;
}
.modal-submit {
  align-self: flex-end;
  padding: 8px 20px;
  background: #00d4aa;
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}
.modal-submit:hover { background: #00b894; }

/* ===== Upload Modal Lanes ===== */
.upload-modal { width: 480px; }
.upload-lanes {
  display: flex;
  gap: 12px;
}
.upload-lane {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  cursor: pointer;
  transition: all 0.15s;
}
.upload-lane:hover {
  border-color: #00d4aa;
  background: #1a2a3e;
}
.lane-icon {
  font-size: 36px;
  line-height: 1;
}
.lane-title {
  font-size: 15px;
  font-weight: bold;
}
.lane-desc {
  font-size: 12px;
  color: #888;
  text-align: center;
}

/* ===== Report Banner (hero + villain) ===== */
.report-banner {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  background: #1e2240;
  border: 1px solid #333;
  border-radius: 8px;
}
.banner-archetype {
  flex: 0 0 auto;
  text-align: center;
  min-width: 120px;
}
.banner-art {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  margin-bottom: 6px;
}
.banner-name {
  font-size: 16px;
  font-weight: bold;
  color: #00d4aa;
  margin-bottom: 2px;
}
.banner-tagline {
  font-size: 10px;
  font-weight: bold;
  color: #b8860b;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.banner-hero-label {
  font-size: 9px;
  color: #667;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
}
.banner-villain-name {
  font-size: 13px;
  color: #ccc;
  font-style: italic;
  margin-top: 4px;
}
.banner-axes {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.axis-tag {
  padding: 3px 10px;
  background: #1e2240;
  border: 1px solid #333;
  border-radius: 12px;
  font-size: 12px;
  color: #99a;
}
.banner-stats {
  flex: 1;
  min-width: 0;
}
.dossier-stats {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 13px;
}
.dossier-stats thead th {
  text-align: left;
  color: #88a;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 6px;
  border-bottom: 1px solid #333;
}
.dossier-stats tbody td {
  padding: 6px;
  border-bottom: 1px solid #1e2240;
  color: #ccc;
  text-align: center;
}
.dossier-stats .axis-label {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #88a;
  font-weight: bold;
  white-space: nowrap;
}
.dossier-stats .stat-val {
  display: block;
  font-weight: bold;
  font-size: 15px;
  color: #00d4aa;
}
.dossier-stats .stat-lbl {
  display: block;
  font-size: 9px;
  color: #667;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.dossier-stats tr.stat-edge {
  background: rgba(0, 212, 170, 0.06);
}
.dossier-stats .stat-exploit {
  color: #e8b84b;
  font-style: italic;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}
.dossier-sample {
  text-align: center;
  font-size: 11px;
  color: #666;
  margin-top: 6px;
}

/* ===== Leak Cards ===== */
.leak-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.leak-card {
  background: #1a2040;
  border: 1px solid #2a2a3e;
  border-radius: 6px;
  padding: 8px 12px;
  min-width: 120px;
  flex: 0 1 auto;
  text-align: center;
}
.leak-card.leak-major {
  border-color: #ff6b6b;
  border-width: 2px;
}
.leak-card.leak-notable {
  border-color: #f0ad4e;
}
.leak-card.leak-slight {
  border-color: #444;
}
.leak-pos {
  display: block;
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.leak-stat {
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: #e0e0e0;
  margin: 2px 0;
}
.leak-val {
  display: block;
  font-size: 20px;
  font-weight: bold;
}
.leak-delta {
  display: block;
  font-size: 11px;
  color: #888;
}
.leak-dir {
  display: block;
  font-size: 10px;
  color: #aaa;
  margin-top: 2px;
  font-style: italic;
}

/* Leak cards in PDF */
.report-pdf-mode .leak-cards {
  margin-bottom: 12px;
}
.report-pdf-mode .leak-card {
  background: #f5f5f5;
  border-color: #ccc;
}
.report-pdf-mode .leak-card.leak-major {
  border-color: #c0392b;
}
.report-pdf-mode .leak-card.leak-notable {
  border-color: #e67e22;
}
.report-pdf-mode .leak-pos {
  color: #666;
}
.report-pdf-mode .leak-stat {
  color: #333;
}
.report-pdf-mode .leak-delta {
  color: #666;
}
.report-pdf-mode .leak-dir {
  color: #555;
}
@media (max-width: 600px) {
  .report-banner {
    flex-direction: column;
  }
  .banner-archetype {
    min-width: auto;
  }
}

/* ===== Sidebar overlay backdrop ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 19;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .sidebar-toggle { display: block; }
  .sidebar {
    position: fixed;
    top: 56px;
    left: -280px;
    width: 260px;
    height: calc(100vh - 56px);
    z-index: 20;
    transition: left 0.2s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar-backdrop.open { display: block; }
  .topbar-email { display: none; }
  .main-header { padding: 10px 16px; }
  .chat-thread { padding: 16px; }
  .input-area { padding: 10px 16px 12px; }
  .range-grid td, .range-grid th {
    font-size: 9px;
    min-width: 26px; height: 26px;
    padding: 1px;
  }
  .coach-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .coach-card-img {
    width: 160px;
    height: 160px;
  }
  .coach-card-btn {
    align-self: center;
  }
  .coaches-page { padding: 20px 16px; }
  .cluster-explorer-page { padding: 20px 16px; }
  .glossary-page { padding: 20px 16px; }
  .about-page { padding: 20px 16px; }
  .about-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .about-avatar { width: 180px; }
  .cluster-layout {
    flex-direction: column;
  }
  .cluster-grid-col {
    overflow-x: auto;
  }
  #clusterGrid td, #clusterGrid th {
    font-size: 9px;
    min-width: 26px; height: 26px;
    padding: 1px;
  }
}

/* ===== Coaches Page ===== */
.coaches-page {
  padding: 32px 24px;
  overflow-y: auto;
  max-width: 800px;
}
.coaches-title {
  color: #00d4aa;
  font-size: 24px;
  margin-bottom: 8px;
}
.coaches-intro {
  color: #888;
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.5;
}
.coach-card {
  display: flex;
  gap: 24px;
  padding: 24px;
  background: #12122a;
  border: 1px solid #2a2a3e;
  border-radius: 10px;
  margin-bottom: 20px;
}
.coach-card-img {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.coach-card-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.coach-card-name {
  color: #00d4aa;
  font-size: 22px;
  margin: 0;
}
.coach-card-tagline {
  color: #b8860b;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0;
}
.coach-card-desc {
  color: #ccc;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}
.coach-card-philosophy {
  color: #888;
  font-size: 14px;
  font-style: italic;
  margin: 0;
}
.coach-card-catchphrase {
  color: #00d4aa;
  font-size: 15px;
  font-weight: bold;
  margin: 0;
}
.coach-card-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 8px 20px;
  background: #16213e;
  border: 1px solid #00d4aa;
  border-radius: 6px;
  color: #00d4aa;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
}
.coach-card-btn:hover {
  background: #1a2a3e;
}

/* ===== Range Grid ===== */
.range-grid-wrap {
  margin-bottom: 12px;
  overflow-x: auto;
}
.range-grid-label {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.range-grid {
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1;
}
.range-grid th {
  color: #999;
  font-weight: 600;
  text-align: center;
  min-width: 32px;
  height: 22px;
  padding: 2px;
}
.range-grid td {
  text-align: center;
  min-width: 32px;
  height: 28px;
  padding: 2px;
  color: #fff;
  font-weight: 600;
  font-size: 10px;
  border: 1px solid #1a1a2e;
  cursor: default;
}
.range-grid-legend {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 11px;
  color: #aaa;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* ===== Shared page styles ===== */
.page-title {
  color: #00d4aa;
  font-size: 24px;
  margin: 0 0 8px;
}
.page-intro {
  color: #888;
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ===== Cluster Explorer ===== */
.cluster-explorer-page {
  padding: 32px 24px;
  overflow-y: auto;
}
.cluster-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.cluster-grid-col {
  flex-shrink: 0;
}
#clusterGrid {
  border-collapse: collapse;
  font-size: 11px;
}
#clusterGrid th {
  color: #999;
  font-weight: 600;
  min-width: 32px;
  height: 22px;
  text-align: center;
}
#clusterGrid td {
  text-align: center;
  min-width: 32px;
  height: 28px;
  color: #fff;
  font-weight: 600;
  border: 1px solid #1a1a2e;
  transition: background 0.15s;
}
#clusterGrid td.dim {
  background: #2a2a3e;
  color: #555;
}
#clusterGrid td.lit {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.cluster-panel-col {
  flex: 1;
  min-width: 0;
}
.cluster-family-group {
  margin-bottom: 14px;
}
.cluster-family-header {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  transition: opacity 0.15s;
}
.cluster-family-header:hover {
  opacity: 0.7;
}
.cluster-family-header.active {
  text-decoration: underline;
}
.cluster-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  margin: 2px 4px 2px 0;
  background: #12122a;
  border: 1px solid #2a2a3e;
  border-radius: 6px;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.cluster-btn:hover {
  color: #fff;
  border-color: currentColor;
}
.cluster-btn.active {
  color: #fff;
  background: #1a1a3a;
}
.cluster-btn-symbol {
  font-size: 14px;
}
.cluster-btn-name {
  font-weight: 600;
}
.cluster-btn-count {
  color: #666;
  font-size: 10px;
}

/* Cluster info panel */
.cluster-info-panel {
  margin-top: 24px;
  padding: 20px;
  background: #12122a;
  border: 1px solid #2a2a3e;
  border-radius: 10px;
  border-left: 3px solid #2a2a3e;
}
.cluster-info-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.cluster-info-symbol {
  font-size: 28px;
}
.cluster-info-name {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
}
.cluster-info-family {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.cluster-info-hands {
  color: #aaa;
  font-size: 13px;
  margin-bottom: 16px;
  font-family: monospace;
}
.cluster-info-section {
  margin-bottom: 12px;
}
.cluster-info-section h3 {
  color: #00d4aa;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 4px;
}
.cluster-info-section p {
  color: #ccc;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

/* ===== About Page ===== */
.about-page {
  padding: 32px 24px;
  overflow-y: auto;
  max-width: 800px;
  margin: 0 auto;
}
.about-container {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.about-hero {
  flex: 0 0 auto;
}
.about-avatar {
  width: 220px;
  border-radius: 12px;
  border: 2px solid #2a2a3e;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.about-content {
  flex: 1;
}
.about-title {
  color: #00d4aa;
  font-size: 24px;
  margin-bottom: 16px;
}
.about-text {
  color: #ccc;
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.about-text.highlight {
  color: #00d4aa;
  font-weight: bold;
  font-size: 16px;
  margin-top: 8px;
}
.about-beta {
  color: #b8860b;
  font-style: italic;
  font-size: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #2a2a3e;
}
.about-sig {
  color: #888;
  font-size: 14px;
  margin-top: 8px;
}
.about-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #2a2a3e;
}
.about-tech {
  color: #667;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 4px;
}
.about-link {
  color: #4a9eff;
  text-decoration: none;
  margin-left: 4px;
}
.about-link:hover {
  text-decoration: underline;
}

/* About — Roadmap */
.about-roadmap {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #2a3050;
}
.about-roadmap-title {
  font-size: 16px;
  font-weight: 700;
  color: #00d4aa;
  margin-bottom: 16px;
}
.roadmap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.roadmap-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid #2a3050;
  border-radius: 8px;
  padding: 14px 16px;
}
.roadmap-card strong {
  color: #ccd;
  font-size: 13px;
}
.roadmap-card p {
  color: #88a;
  font-size: 12px;
  margin: 4px 0 0;
  line-height: 1.4;
}
.roadmap-icon {
  font-size: 20px;
  margin-right: 6px;
}
@media (max-width: 600px) {
  .roadmap-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Glossary ===== */
.glossary-page {
  padding: 32px 24px;
  overflow-y: auto;
  max-width: 800px;
}
.glossary-section-title {
  color: #00d4aa;
  font-size: 16px;
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2a2a3e;
}
.glossary-section-title:first-of-type {
  margin-top: 0;
}
.glossary-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.glossary-card {
  padding: 12px 14px;
  background: #12122a;
  border: 1px solid #2a2a3e;
  border-radius: 8px;
  position: relative;
}
.glossary-term {
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  display: block;
  margin-bottom: 4px;
}
.glossary-card p {
  color: #aaa;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

/* ===== Ask Coach button ===== */
.ask-coach-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  margin-left: auto;
  background: #16213e;
  border: 1px solid #00d4aa;
  border-radius: 6px;
  color: #00d4aa;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ask-coach-btn:hover {
  background: #00d4aa;
  color: #0d0d1a;
}
.ask-coach-btn.small {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 6px;
  font-size: 13px;
  border: none;
  background: transparent;
  color: #555;
}
.ask-coach-btn.small:hover {
  color: #00d4aa;
  background: transparent;
}

/* ===== RFI Range Viewer ===== */
.rfi-page {
  padding: 32px 24px;
  overflow-y: auto;
}
.rfi-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.rfi-grid-col {
  flex-shrink: 0;
}
.rfi-panel-col {
  flex: 0 0 220px;
}
.rfi-section-label {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #888;
  margin-bottom: 8px;
}
.rfi-btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.rfi-pos-btn,
.rfi-depth-btn {
  padding: 6px 14px;
  background: #12122a;
  border: 1px solid #2a2a3e;
  border-radius: 6px;
  color: #aaa;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.rfi-pos-btn:hover,
.rfi-depth-btn:hover {
  color: #fff;
  border-color: #555;
}
.rfi-pos-btn.active {
  color: #00d4aa;
  border-color: #00d4aa;
  background: #1a1a3a;
}
.rfi-depth-btn.active {
  color: #f0ad4e;
  border-color: #f0ad4e;
  background: #1a1a3a;
}
.rfi-summary {
  margin-top: 8px;
  padding: 16px;
  background: #12122a;
  border: 1px solid #2a2a3e;
  border-radius: 8px;
}
.rfi-summary-count {
  font-size: 28px;
  font-weight: bold;
  color: #00d4aa;
}
.rfi-summary-title {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #888;
  margin-bottom: 8px;
}
.rfi-summary-stat {
  font-size: 14px;
  color: #ccc;
  margin-bottom: 4px;
}
.rfi-big {
  font-size: 24px;
  font-weight: bold;
  color: #00d4aa;
}
.rfi-ask-btn {
  margin-top: 20px;
  width: 100%;
  padding: 10px 16px;
  background: #16213e;
  border: 1px solid #00d4aa;
  border-radius: 6px;
  color: #00d4aa;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
}
.rfi-ask-btn:hover {
  background: #00d4aa;
  color: #0d0d1a;
}
@media (max-width: 700px) {
  .rfi-layout {
    flex-direction: column;
  }
  .rfi-panel-col {
    flex: none;
    width: 100%;
  }
}

/* ===== PT4 Export Guide ===== */
.guide-page {
  padding: 32px 24px;
  overflow-y: auto;
  max-width: 700px;
}
.guide-steps {
  margin-top: 24px;
}
.guide-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.guide-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #00d4aa;
  color: #0d0d1a;
  font-weight: bold;
  font-size: 15px;
  border-radius: 50%;
}
.guide-body {
  font-size: 15px;
  line-height: 1.6;
  padding-top: 4px;
}
.guide-body code {
  background: #16213e;
  padding: 2px 6px;
  border-radius: 4px;
  color: #00d4aa;
  font-size: 13px;
}
.guide-tip {
  margin-top: 24px;
  padding: 14px 16px;
  background: #16213e;
  border: 1px solid #2a2a3e;
  border-left: 3px solid #f0ad4e;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

/* Terms & Privacy */
.terms-heading {
  font-size: 20px;
  color: var(--accent);
  margin: 32px 0 12px;
  padding-top: 24px;
  border-top: 1px solid #2a2a3e;
}
.terms-heading:first-of-type {
  border-top: none;
  margin-top: 24px;
  padding-top: 0;
}
.terms-sub {
  font-size: 15px;
  color: #e0e0e0;
  margin: 18px 0 6px;
}
.terms-text {
  font-size: 14px;
  color: #b0b0c0;
  line-height: 1.6;
  margin: 0 0 8px;
}

/* Upload modal guide link */
.guide-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: #00d4aa;
  font-size: 13px;
  text-decoration: none;
}
.guide-link:hover {
  text-decoration: underline;
}
.guide-hint {
  text-align: center;
  color: #666;
  font-size: 12px;
  margin-top: 6px;
}
