/* ===== P7 企业股权穿透可视化 v3.0 — Bold Redesign ===== */
/* OLED Deep Space + Glassmorphism + Golden Ratio */

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

.hidden { display: none !important; }

/* SVG icon system */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.icon-lg { width: 40px; height: 40px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }

:root {
  /* OLED Deep Space palette */
  --bg-abyss: #020617;        /* deepest black-blue */
  --bg-primary: #060b1a;      /* main canvas */
  --bg-surface: #0b1222;      /* card surfaces */
  --bg-elevated: #111a2e;     /* elevated/hover cards */
  --bg-glass: rgba(11, 18, 34, 0.65);  /* glass panels */

  /* Borders */
  --border: rgba(255,255,255,0.06);
  --border-visible: rgba(255,255,255,0.10);
  --border-active: rgba(255,255,255,0.18);
  --border-accent: rgba(212, 168, 83, 0.35);

  /* Text hierarchy */
  --text-primary: #f0f2f5;
  --text-secondary: #a8b4cc;
  --text-dim: #8894ac;
  --text-muted: #6e7d9a;

  /* Premium Gold accent */
  --accent: #d4a853;
  --accent-light: #e8c97a;
  --accent-dim: rgba(212, 168, 83, 0.10);
  --accent-glow: rgba(212, 168, 83, 0.22);

  /* Data Teal */
  --teal: #2dd4bf;
  --teal-dim: rgba(45, 212, 191, 0.10);
  --teal-glow: rgba(45, 212, 191, 0.18);

  /* Semantic */
  --success: #2dd4bf;
  --danger: #f87171;
  --warning: #fbbf24;
  --info: #60a5fa;
  --gold: #d4a853;
  --purple: #a78bfa;

  /* Shadows & Glows */
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-elevated: 0 2px 4px rgba(0,0,0,0.5), 0 8px 32px rgba(0,0,0,0.4);
  --glow-accent: 0 0 24px var(--accent-glow);
  --glow-teal: 0 0 20px var(--teal-glow);

  /* Spacing scale (4px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
}

html { height: 100%; background: var(--bg-abyss); }

body {
  font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    /* subtle grid overlay */
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px),
    /* ambient gradient */
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(212,168,83,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(45,212,191,0.03) 0%, transparent 50%),
    var(--bg-primary);
  background-size:
    64px 64px,
    64px 64px,
    100% 100%,
    100% 100%,
    100% 100%;
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Page switching ===== */
.page { display: none; }
.page.active { display: flex; flex-direction: column; min-height: 100vh; }

/* ============================================
   STEP INDICATOR
   ============================================ */

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-2xl);
  padding: 12px 0;
}

.step-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}

.step-dot.active {
  background: linear-gradient(135deg, var(--accent), #b8922f);
  border-color: var(--accent);
  color: #1a1000;
  box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(212,168,83,0.1);
}

.step-dot.done {
  background: var(--teal);
  border-color: var(--teal);
  color: #02100e;
  box-shadow: 0 0 16px var(--teal-glow);
}

.step-line {
  width: 80px; height: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.step-line.done { background: var(--teal); }

.step-label-row {
  display: flex;
  justify-content: center;
  gap: 100px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.step-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  transition: color 0.25s;
}

.step-label.active { color: var(--accent); font-weight: 600; }

/* ============================================
   STEP 1: Input & Confirm & Action Cards
   ============================================ */

/* Full-bleed immersive layout */
.step1-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-3xl);
  width: 100%;
  position: relative;
}

/* Golden-ratio two-panel layout */
.step1-layout {
  display: flex;
  gap: var(--space-xl);
  align-items: flex-start;
  min-height: 0;
}

.step1-left {
  width: 380px;
  flex-shrink: 0;
  position: sticky;
  top: var(--space-lg);
  align-self: flex-start;
}

.step1-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Header — centered, elegant */
.step1-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.step1-header .logo {
  font-size: 56px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), var(--accent), #b8922f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 8px;
  margin-bottom: var(--space-sm);
  line-height: 1.1;
}

.step1-header .tagline {
  font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 3px;
  word-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.7;
}

/* Input area — glass card */
.input-section {
  background: var(--bg-glass);
  border: 1px solid var(--border-visible);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: var(--space-lg);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-section:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 30px var(--accent-dim);
}

.input-section h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-section .desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: var(--space-md);
}

.input-row {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.input-row textarea {
  flex: 1;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 16px;
  font-size: 14px;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  resize: vertical;
  min-height: 110px;
  line-height: 1.8;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(212,168,83,0.15), 0 0 24px var(--accent-dim);
}

.input-row textarea::placeholder { color: var(--text-muted); }

.input-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 140px;
}

/* Vertical input layout (left panel) */
.input-row-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-row-vertical textarea {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 16px;
  font-size: 14px;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  resize: vertical;
  min-height: 200px;
  line-height: 1.8;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-row-vertical textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(212,168,83,0.15), 0 0 24px var(--accent-dim);
}

.input-row-vertical textarea::placeholder { color: var(--text-muted); }

.input-actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-actions-row .upload-zone {
  flex-direction: row;
  gap: var(--space-sm);
  padding: 10px 16px;
  flex: 0 1 auto;
  min-width: 0;
}

.input-actions-row .upload-zone .upload-icon { color: var(--text-dim); display: flex; }
.input-actions-row .upload-zone .upload-text { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

.input-actions-row .btn-primary { flex-shrink: 0; }

/* Upload zone — glass pill */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 2px dashed var(--border-visible);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  gap: 4px;
  background: rgba(255,255,255,0.02);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--accent-dim);
}

.upload-zone.dragover {
  animation: pulse-border 0.8s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: var(--accent-light); box-shadow: 0 0 20px var(--accent-dim); }
}

.upload-zone .upload-icon { color: var(--text-secondary); opacity: 0.8; display: flex; align-items: center; }
.upload-zone .upload-title { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.upload-zone .upload-formats { font-size: 10px; color: var(--text-muted); }

/* Input meta bar */
.input-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  gap: 12px;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #b8922f);
  color: #0f0800;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  letter-spacing: 0.5px;
  min-height: 44px;
  box-shadow: 0 2px 8px rgba(212,168,83,0.15);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-weight: 500;
  min-height: 44px;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-small {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  min-height: 36px;
}

.btn-small:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ===== Target list (confirmed items) ===== */
.target-list-section {
  margin-bottom: var(--space-lg);
  animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.target-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.target-list-header h3 {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.target-list-header .count-badge {
  background: var(--accent-dim);
  color: var(--accent-light);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.target-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Batch action bar */
.batch-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.batch-bar.hidden { display: none; }

.batch-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
}

/* ═══════════════════════════════════════════
   Target Card — Mobile-first card layout
   ═══════════════════════════════════════════ */
.target-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
}

.target-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-card);
}

.target-card.confirmed {
  border-left-color: var(--teal);
  background: rgba(45,212,191,0.03);
}

.target-card.unresolved {
  border-left-color: var(--warning);
}

.target-card.removing {
  animation: slideOut 0.25s ease forwards;
}

@keyframes slideOut {
  to { opacity: 0; transform: translateX(40px); height: 0; padding: 0; margin: 0; overflow: hidden; }
}

/* ── Top row: number + raw query + status badge ── */
.tc-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tc-num {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  min-width: 22px;
  flex-shrink: 0;
}

.tc-raw {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Status badge ── */
.tc-status-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 10px;
  flex-shrink: 0;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tc-status-badge.tc-ok      { background: rgba(20,184,166,0.12); color: var(--success); }
.tc-status-badge.tc-pending { background: rgba(251,191,36,0.12); color: var(--warning); }
.tc-status-badge.tc-searching { background: rgba(148,163,184,0.12); color: var(--text-dim); }
.tc-status-badge.tc-waiting { background: rgba(148,163,184,0.08); color: var(--text-muted); }

/* ── Card body: matched result / chip area ── */
.tc-body {
  padding: 0;
}

/* Confirmed company display */
.tc-body-confirmed {
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  padding: 12px 14px;
}

.tc-company-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.tc-company-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.tc-meta-tag {
  font-size: 10px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.tc-credit-code {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Fira Code', monospace;
  letter-spacing: 0.5px;
}

.tc-body-searching,
.tc-body-unresolved,
.tc-body-waiting {
  font-size: 13px;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tc-body-searching { color: var(--text-dim); }
.tc-body-unresolved { color: var(--warning); }
.tc-body-waiting    { color: var(--text-muted); }

/* ── Action buttons (change / remove) ── */
.tc-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.tc-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  min-height: 36px;
}

.tc-btn:hover {
  border-color: var(--border-active);
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.tc-btn-change:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tc-btn-remove {
  padding: 8px 10px;
  border-radius: 8px;
}

.tc-btn-remove:hover {
  border-color: #f87171;
  color: #f87171;
  background: rgba(248,113,113,0.08);
}

/* ═══════════════════════════════════════════
   Candidate Chips — horizontally scrollable
   ═══════════════════════════════════════════ */
.tc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.tc-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
  min-height: 44px;
  font-family: inherit;
}

.tc-chip:hover {
  background: var(--accent-dim);
  border-color: var(--border-accent);
  color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-dim);
}

.tc-chip-star {
  background: linear-gradient(135deg, rgba(212,168,83,0.14), rgba(212,168,83,0.04));
  border-color: var(--accent);
  color: var(--accent-light);
  font-weight: 700;
  box-shadow: 0 0 10px var(--accent-dim);
}

.tc-chip-star:hover {
  background: linear-gradient(135deg, rgba(212,168,83,0.22), rgba(212,168,83,0.08));
  box-shadow: 0 4px 16px var(--accent-dim);
}

.tc-chip-manual {
  border-style: dashed;
  color: var(--text-muted);
}

.tc-chip-input {
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  min-width: 180px;
  outline: none;
  min-height: 44px;
}

/* ── Inline search results (below manual input) ── */
.tc-search-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
  padding-left: 4px;
}

.tc-chip-result {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(45,212,191,0.08);
  border: 1px solid rgba(45,212,191,0.25);
  color: var(--teal);
  white-space: nowrap;
  user-select: none;
  min-height: 40px;
  font-family: inherit;
}

.tc-chip-result:hover {
  background: rgba(45,212,191,0.16);
  border-color: var(--teal);
  transform: translateY(-1px);
}

.tc-chip-star-mark {
  color: var(--accent);
  font-size: 11px;
}

.tc-search-hint {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0;
}
.candidate-option .cand-star { color: var(--gold); font-size: 11px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state .empty-icon {
  color: var(--text-dim);
  opacity: 0.5;
  margin-bottom: var(--space-md);
  animation: float 3s ease-in-out infinite;
  display: flex;
  justify-content: center;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.empty-state .empty-text { font-size: 15px; font-weight: 500; }
.empty-state .empty-hint { font-size: 12px; margin-top: var(--space-sm); color: var(--text-dim); }

/* Shortcut hint */
.shortcut-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 14px;
  padding: 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
}

.shortcut-hint kbd {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: inherit;
  border: 1px solid var(--border);
  margin: 0 2px;
}

/* ===== Action Cards — elegant horizontal selectors ===== */
.action-cards-section {
  margin-top: var(--space-sm);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ── Action bar: radios + submit button in one row ── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.action-radios {
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
}

.action-radio:hover:not(.disabled) {
  background: var(--accent-dim);
  border-color: var(--border-accent);
  color: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--accent-dim);
}

.action-radio.selected {
  background: linear-gradient(135deg, rgba(212,168,83,0.18), rgba(212,168,83,0.06));
  border-color: var(--accent);
  color: var(--accent-light);
  font-weight: 700;
  box-shadow: 0 0 20px var(--accent-dim), inset 0 1px 0 rgba(255,255,255,0.05);
}

.action-radio.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.action-radio .radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.action-radio.selected .radio-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-dim);
}

.action-radio.selected .radio-dot::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.action-radio .radio-label { font-size: 13px; }

/* Action submit area (right side of action-bar) */
.action-submit {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

.action-submit .estimate {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Settings panel below pills */
.action-settings-panel {
  margin-top: var(--space-sm);
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.action-settings-panel:empty { display: none; }

.action-settings-panel .setting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.action-settings-panel .setting-row label {
  color: var(--text-dim);
  white-space: nowrap;
  font-weight: 500;
}

.action-settings-panel .setting-row input[type="range"] {
  accent-color: var(--accent);
  height: 4px;
  width: 100px;
}

.action-settings-panel .range-val {
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  min-width: 36px;
}

.action-section-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

.action-section-hint kbd {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: inherit;
  border: 1px solid var(--border);
  margin: 0 2px;
}

/* ── Submit area ── */

/* ICP — centered below step1 content, visible on all devices */
.icp-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 20px 0 8px;
  opacity: 0.4;
  letter-spacing: 0.5px;
}

.btn-large {
  padding: 16px 48px;
  font-size: 16px;
  border-radius: 12px;
  min-width: 220px;
  letter-spacing: 1px;
}

/* ============================================
   STEP 2: Loading
   ============================================ */

.loading-page {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  background: var(--bg-abyss);
}

.loading-page.hidden { display: none !important; }

.spinner {
  position: relative;
  width: 56px; height: 56px;
  margin-bottom: 28px;
}

.spinner::before,
.spinner::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 3px solid transparent;
  animation: spin 1.2s linear infinite;
}

.spinner::before {
  inset: 0;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  opacity: 0.8;
}

.spinner::after {
  inset: 8px;
  border-bottom-color: rgba(255,255,255,0.15);
  border-left-color: rgba(255,255,255,0.15);
  animation-duration: 0.8s;
  animation-direction: reverse;
}

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

.loading-text {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 600;
}

.loading-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.loading-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 340px;
}

.lp-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.lp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 12px var(--accent-glow);
}

.lp-text {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  min-width: 40px;
}

/* ============================================
   STEP 3A: Chart page (Penetration)
   ============================================ */

.chart-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-bottom: 12px;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chart-page.hidden { display: none; }

/* ── Shared result-page headers ── */
.chart-header,
.info-header,
.rel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--space-lg);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
}

.chart-header::after,
.info-header::after,
.rel-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-accent), transparent);
}

.chart-header .header-left,
.info-header .header-left,
.rel-header .header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chart-header .logo,
.info-header .logo,
.rel-header .logo {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chart-header h1,
.info-header h1,
.rel-header h1 {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
}

.chart-header .subtitle,
.rel-header .subtitle {
  font-size: 11px;
  color: var(--text-muted);
}
.info-header .subtitle {
  font-size: 11px;
  color: var(--text-dim);
}

.chart-header .header-right,
.info-header .header-right,
.rel-header .header-right {
  display: flex;
  gap: 8px;
}
.chart-header .header-right {
  align-items: center;
}

/* Chart header — unique: node search input */
.chart-header input[type="text"] {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 7px 12px;
  font-size: 12px;
  width: 170px;
  transition: border-color 0.2s;
}

.chart-header input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.chart-header .control-btn,
.info-header .control-btn,
.rel-header .control-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  white-space: nowrap;
}

.chart-header .control-btn:hover,
.info-header .control-btn:hover,
.rel-header .control-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border-color: var(--border-active);
}

.chart-header .control-btn.export-btn,
.info-header .control-btn.export-btn,
.rel-header .control-btn.export-btn {
  background: linear-gradient(135deg, rgba(212,168,83,0.18), rgba(212,168,83,0.06));
  color: var(--accent-light);
  border-color: var(--border-accent);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 12px var(--accent-dim);
  min-height: 44px;
}

.chart-header .control-btn.export-btn:hover,
.info-header .control-btn.export-btn:hover,
.rel-header .control-btn.export-btn:hover {
  background: linear-gradient(135deg, rgba(212,168,83,0.28), rgba(212,168,83,0.12));
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.chart-header .control-btn.back-btn,
.info-header .control-btn.back-btn,
.rel-header .control-btn.back-btn {
  color: var(--text-dim);
  border-color: var(--border-visible);
  background: rgba(255,255,255,0.03);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  letter-spacing: 0.5px;
  min-height: 44px;
}

.chart-header .control-btn.back-btn:hover,
.info-header .control-btn.back-btn:hover,
.rel-header .control-btn.back-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

/* Chart container — immersive deep space */
.chart-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 400px;
  background:
    radial-gradient(ellipse at center, rgba(11,18,34,0.5) 0%, transparent 70%),
    var(--bg-abyss);
}

.chart-container svg { width: 100%; height: 100%; }

/* D3 Node styles */
.node-group { cursor: pointer; }

.node-rect {
  transition: all 0.2s;
}

.node-group:hover .node-rect {
  filter: brightness(1.3) drop-shadow(0 0 8px rgba(255,255,255,0.15));
}

.node-text {
  font-family: inherit;
  pointer-events: none;
}

.node-subtext {
  font-family: inherit;
  pointer-events: none;
}

.node-group.target-node .node-rect {
  stroke: #d4a853 !important;
  stroke-width: 3px !important;
}

/* Links */
.link {
  fill: none;
  stroke: rgba(255,255,255,0.30);
  stroke-width: 2px;
  transition: all 0.3s;
}

.link.minority { stroke-dasharray: 6,4; stroke: rgba(255,255,255,0.16); stroke-width: 1.5px; }
.link.l0-l1 { stroke-width: 3px; stroke: rgba(212,175,55,0.45); }

/* Search highlight */
.node-group.dimmed { opacity: 0.06; }
.link.dimmed { opacity: 0.04; }

/* Node badges */
.node-badge-minority { pointer-events: none; }
.node-badge-listed { pointer-events: none; }
.node-badge-oversea { pointer-events: none; }

/* Expand button */
.expand-circle {
  fill: rgba(0,0,0,0.5);
  stroke: rgba(255,255,255,0.25);
  stroke-width: 1px;
}

.expand-text {
  fill: #fff;
  font-family: inherit;
  pointer-events: none;
}

.expand-btn { cursor: pointer; }
.expand-btn:hover .expand-circle { fill: var(--accent); stroke: var(--accent); }

/* Stats panel — glass bar */
.stats-panel {
  display: flex;
  gap: var(--space-xl);
  padding: 14px var(--space-lg);
  background: var(--bg-glass);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tooltip — solid card (no backdrop-filter to avoid compositor battles) */
.tooltip {
  position: fixed;
  background: #1a1d2e;
  border: 1px solid var(--border-accent);
  border-radius: 16px;
  padding: 18px 22px;
  width: max-content;
  max-width: 560px;
  min-width: 280px;
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 9999;
  display: none;
  visibility: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 0 1px var(--accent-dim);
  font-size: 12px;
  line-height: 1.6;
}

.tooltip h3 { font-size: 14px; color: var(--accent-light); margin-bottom: 4px; font-weight: 700; }
.tooltip .label { color: var(--text-muted); }
.tooltip .value { color: var(--text-primary); font-weight: 600; }

/* Tooltip grid system */
.tt-subtitle { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; }
.tt-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tt-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.tt-badge-ctrl { background: rgba(45,212,191,0.15); color: var(--teal); }
.tt-badge-minor { background: rgba(212,165,116,0.15); color: #d4a574; }
.tt-badge-listed { background: rgba(212,168,83,0.15); color: var(--accent-light); }
.tt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 16px; margin-bottom: 4px; }
.tt-item { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 0; }
.tt-label { color: var(--text-muted); flex-shrink: 0; margin-right: 8px; font-size: 10.5px; }
.tt-value { color: var(--text-primary); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 11px; }
.tt-sep { grid-column: 1 / -1; border-top: 1px solid var(--border-visible); margin: 6px 0; }
.tt-full { grid-column: 1 / -1; font-size: 11px; color: var(--text-secondary); line-height: 1.5; }
.tt-full b { color: var(--text-dim); }
.tt-hint { font-size: 10px; color: var(--accent); margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border-accent); }

/* Tooltip scrollbar */
.tooltip::-webkit-scrollbar { width: 4px; }
.tooltip::-webkit-scrollbar-track { background: transparent; }
.tooltip::-webkit-scrollbar-thumb { background: rgba(212,168,83,0.2); border-radius: 2px; }

/* Legend — glass panel */
.chart-legend {
  position: fixed;
  top: 80px;
  right: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-visible);
  border-radius: 14px;
  padding: 16px;
  z-index: 100;
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  font-size: 11px;
  max-width: 190px;
  backdrop-filter: blur(12px);
  cursor: grab;
  user-select: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transition: box-shadow 0.3s;
}

.chart-legend:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.5); }

.chart-legend h4 {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 700;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--text-dim);
}

.legend-color {
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}


/* Batch panel */
.batch-panel {
  position: fixed;
  top: 80px;
  left: 16px;
  background: rgba(20,24,39,0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  z-index: 100;
  max-width: 250px;
  backdrop-filter: blur(12px);
  cursor: grab;
  user-select: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.batch-panel h3 { font-size: 13px; color: var(--accent); margin-bottom: 8px; font-weight: 700; }
.batch-panel .batch-count { font-size: 11px; color: var(--text-dim); }

.batch-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }

.batch-item {
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.batch-item:hover { background: rgba(255,255,255,0.04); }
.batch-item.active { background: var(--accent-dim); border-color: var(--accent); }

.batch-item .batch-num { color: var(--text-muted); min-width: 22px; font-weight: 600; }
.batch-item .batch-name { color: var(--text-primary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.batch-item .batch-status { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.batch-item .batch-status.done { background: rgba(20,184,166,0.15); color: var(--success); }
.batch-item .batch-status.error { background: rgba(224,123,90,0.15); color: var(--danger); }
.batch-item .batch-status.partial { background: rgba(212,165,116,0.15); color: var(--warning); }
.batch-item .batch-preview { font-size: 10px; color: var(--accent); font-weight: 600; }

/* ============================================
   STEP 3B: Info page
   ============================================ */

.info-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  animation: fadeIn 0.25s ease;
}
.info-page.hidden { display: none; }

.info-container {
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-lg);
  width: 100%;
}

/* Info overview */
.info-overview {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

.info-logo-wrap { font-size: 52px; }

.info-main .company-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.company-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

.tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
}

.tag.state-owned { background: rgba(196,162,101,0.15); color: var(--accent); border: 1px solid rgba(196,162,101,0.3); }
.tag.status-open { background: rgba(20,184,166,0.15); color: var(--success); border: 1px solid rgba(20,184,166,0.3); }
.tag.listed { background: rgba(56,178,172,0.15); color: var(--blue); border: 1px solid rgba(56,178,172,0.3); }

.company-meta-line { font-size: 12px; color: var(--text-dim); display: flex; gap: 16px; flex-wrap: wrap; }

/* Info cards */
.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.info-card:hover {
  border-color: var(--border-active);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.info-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.info-card-header::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.info-card-header .card-icon { font-size: 18px; }
.info-card-header h2 { font-size: 14px; color: var(--accent); font-weight: 700; }

.info-card-body { padding: 16px 20px; }

/* ── Chain Diagram (Info Card) ── */
.chain-diagram-section {
  margin-bottom: 14px;
}
.chain-zoom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--card-bg, #1a1d2e);
  border: 1px solid var(--accent);
  border-radius: 10px 10px 0 0;
  border-bottom: none;
}
.chain-zoom-bar .zoom-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chain-zoom-btn {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--bg, #0f1117);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 30px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chain-zoom-btn:hover {
  background: var(--accent);
  color: var(--bg, #0f1117);
}
.chain-zoom-btn:active { transform: scale(0.93); }
.chain-zoom-label {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  min-width: 42px;
  text-align: center;
}
.chain-diagram-wrap {
  position: relative;
  background: var(--card-bg, #1a1d2e);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  min-height: 260px;
  cursor: default;
}
.chain-diagram-wrap svg {
  display: block;
  width: 100%;
}
.chain-node { cursor: grab; }
.chain-node:active { cursor: grabbing; }
.chain-node rect {
  stroke-width: 2px;
  rx: 8; ry: 8;
}
.chain-node.upstream rect { stroke: #20B2AA; }
.chain-node.target rect { stroke: #e11d48; }
.chain-node.downstream rect { stroke: #6366f1; }
.chain-link {
  fill: none;
  stroke: rgba(255,255,255,0.22);
  stroke-width: 2;
}
.chain-link.minority {
  stroke-dasharray: 6,4;
  stroke: rgba(255,255,255,0.1);
}
.chain-elabel {
  fill: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

/* KV Grid */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.kv-item {
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.04);
  transition: background 0.2s;
}

.kv-item:hover { background: rgba(255,255,255,0.04); }

.kv-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.kv-value { font-size: 13px; color: var(--text-primary); font-weight: 600; word-break: break-all; }
.kv-value.highlight { color: var(--accent); }

/* Tables */
.info-table-wrap { overflow-x: auto; }

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.info-table th {
  padding: 10px 14px;
  text-align: left;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  letter-spacing: 0.3px;
}

.info-table td {
  padding: 10px 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.info-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

.col-num { color: var(--text-muted); width: 30px; }
.col-ratio { color: var(--accent); font-weight: 700; }

/* Finance grid */
.finance-big-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.finance-big-item {
  padding: 18px 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.finance-big-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.big-value { font-size: 20px; font-weight: 700; color: var(--accent); }
.big-label { font-size: 11px; color: var(--text-dim); margin-top: 6px; font-weight: 500; }
.big-yoy { font-size: 11px; margin-top: 4px; font-weight: 600; }
.big-yoy.up { color: var(--success); }
.big-yoy.down { color: var(--danger); }

/* Risk grid */
.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.risk-item {
  padding: 16px 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 10px;
  text-align: center;
  transition: transform 0.2s;
}

.risk-item:hover { transform: translateY(-2px); }

.risk-num { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.risk-num.safe { color: var(--success); }
.risk-num.warn { color: var(--warning); }
.risk-num.danger { color: var(--danger); }
.risk-label { font-size: 11px; color: var(--text-dim); font-weight: 500; }

/* IP */
.ip-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.ip-item {
  padding: 18px 14px;
  background: linear-gradient(135deg, rgba(56,178,172,0.05), rgba(56,178,172,0.1));
  border: 1px solid rgba(56,178,172,0.15);
  border-radius: 10px;
  text-align: center;
  transition: transform 0.2s;
}

.ip-item:hover { transform: translateY(-2px); }

.ip-num { font-size: 24px; font-weight: 700; color: var(--blue); }
.ip-label { font-size: 11px; color: var(--text-dim); font-weight: 500; }

/* Staff */
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.staff-card {
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
}

.staff-card:hover {
  background: rgba(255,255,255,0.04);
  transform: translateX(3px);
}

.staff-avatar { font-size: 22px; }
.staff-name { font-size: 13px; color: var(--text-primary); font-weight: 600; }
.staff-title { font-size: 11px; color: var(--text-muted); }

/* Changes timeline */
.change-timeline { display: flex; flex-direction: column; }

.change-item {
  display: grid;
  grid-template-columns: 110px 140px 1fr 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  align-items: center;
  font-size: 12px;
  transition: background 0.2s;
}

.change-item:hover { background: rgba(255,255,255,0.02); }

.change-date { color: var(--text-muted); }
.change-field { color: var(--text-dim); font-weight: 600; }
.change-before { color: var(--text-muted); text-decoration: line-through; }
.change-after { color: var(--text-primary); }

/* Rank grid */
.rank-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.rank-item {
  padding: 18px 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  text-align: center;
  transition: transform 0.2s;
}

.rank-item:hover { transform: translateY(-2px); }

.rank-value { font-size: 20px; font-weight: 700; color: var(--accent); }
.rank-label { font-size: 11px; color: var(--text-dim); font-weight: 500; }

/* Source */
.info-source {
  text-align: center;
  padding: 18px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* Bottom action buttons — in flow, visible when scrolled to page bottom */
.info-bottom-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 20px 20px 32px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.info-bottom-actions .control-btn {
  min-width: 160px;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  text-align: center;
}
.info-bottom-actions .export-btn {
  background: var(--accent);
  color: #0d1422;
  border-color: var(--accent);
}
.info-bottom-actions .export-btn:hover {
  filter: brightness(1.2);
}
.info-bottom-actions .back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 768px) {
  .info-bottom-actions {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 16px 28px;
    gap: 10px;
  }
  .info-bottom-actions .control-btn {
    min-width: auto;
    width: 100%;
    padding: 14px;
    font-size: 15px;
  }
}


/* Color box for legend */
.color-box {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ============================================
   STEP 3C: Relationship page
   ============================================ */

.relationship-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  animation: fadeIn 0.25s ease;
}
.relationship-page.hidden { display: none; }

.rel-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 400px;
  background: radial-gradient(ellipse at center, var(--bg-surface) 0%, var(--bg-primary) 100%);
}

.rel-container svg { width: 100%; height: 100%; }

/* Relationship legend */
.rel-legend {
  position: fixed;
  top: 80px;
  right: 16px;
  background: rgba(20,24,39,0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  z-index: 100;
  font-size: 11px;
  backdrop-filter: blur(12px);
  cursor: grab;
  user-select: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.rel-legend h4 {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 700;
}

.rel-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.rel-node-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rel-node-dot.target { background: #d4a853; box-shadow: 0 0 10px rgba(196,162,101,0.6); }
.rel-node-dot.upstream { background: #38b2ac; }
.rel-node-dot.downstream { background: #6366f1; }
.rel-node-dot.shared { background: #d4a574; }

.rel-edge-line {
  width: 20px; height: 2px;
  flex-shrink: 0;
}

.rel-edge-line.direct { background: rgba(255,255,255,0.4); }
.rel-edge-line.indirect { background: repeating-linear-gradient(90deg, rgba(255,255,255,0.3) 0px, rgba(255,255,255,0.3) 3px, transparent 3px, transparent 6px); }

/* D3 force node styles */
.rel-node circle {
  stroke-width: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.rel-node.target circle { fill: #d4a853; stroke: #d4a853; }
.rel-node.upstream circle { fill: #38b2ac; stroke: #178F88; }
.rel-node.downstream circle { fill: #6366f1; stroke: #4338ca; }
.rel-node.shared circle { fill: #d4a574; stroke: #D9531E; }

.rel-node text {
  font-size: 11px;
  fill: var(--text-primary);
  font-family: inherit;
  pointer-events: none;
}

.rel-node .rel-node-type {
  font-size: 9px;
  fill: var(--text-muted);
}

.rel-link {
  stroke: rgba(255,255,255,0.2);
  stroke-width: 1.5px;
}

.rel-link.direct { stroke: rgba(255,255,255,0.35); stroke-width: 2px; }
.rel-link.indirect { stroke: rgba(255,255,255,0.12); stroke-dasharray: 5,4; }

.rel-link-label {
  font-size: 9px;
  fill: var(--text-muted);
  font-family: inherit;
  pointer-events: none;
}

/* Relationship stats */
.rel-stats {
  display: flex;
  gap: 28px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.rel-stats strong {
  color: var(--accent);
  font-size: 16px;
  margin: 0 4px;
  font-weight: 700;
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(196,162,101,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(196,162,101,0.4); }

/* ============================================
   MOBILE-FIRST REDESIGN
   ============================================ */

/* -- Mobile menu button (hidden on desktop) -- */
.mobile-menu-btn {
  display: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-visible);
  color: var(--text-secondary);
  width: 40px; height: 40px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.mobile-menu-btn:active { background: var(--accent-dim); border-color: var(--accent); }

/* -- Header controls wrapper -- */
.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Mobile-only back button (inside dropdown) — hidden on desktop */
.back-btn-mobile { display: none; }

/* -- Bottom sheet handle -- */
.sheet-handle {
  display: none;
  width: 32px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 0 auto 8px;
}

/* -- Stats scroll indicator -- */
.stats-scroll-hint {
  display: none;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0 2px;
}

/* ============================================
   Tablet (≤1024px)
   ============================================ */
@media (max-width: 1024px) {
  .ip-grid { grid-template-columns: repeat(2, 1fr); }
  .rank-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   Phone + Tablet (≤768px)
   ============================================ */
@media (max-width: 768px) {
  /* -- Global -- */
  :root {
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
  }

  body {
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }

  /* Allow text selection in inputs */
  input, textarea, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
  }

  /* -- Show mobile menu button -- */
  .mobile-menu-btn { display: flex; }

  /* -- Hide standalone back button on mobile (it's inside the dropdown) -- */
  .back-btn-standalone { display: none; }

  /* -- Show mobile back button inside dropdown -- */
  .back-btn-mobile {
    display: flex;
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* -- Collapse header controls by default on mobile -- */
  .header-controls {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    order: 10;
  }
  .header-controls.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    width: auto;
    background: #0d1422 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 12px;
    border-radius: 0 0 10px 10px;
    border: 1px solid var(--border);
    border-top: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 99;
  }
  .header-controls input[type="text"] {
    width: 100%;
  }
  .header-controls .control-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .header-controls .export-btn {
    width: 100%;
    text-align: center;
  }

  /* ============================================
     STEP 1 — Vertical stack, bottom submit
     ============================================ */

  .step1-page {
    padding: 16px 12px calc(80px + var(--safe-bottom));
  }

  .step1-header { margin-bottom: var(--space-md); }
  .step1-header .logo { font-size: 36px; letter-spacing: 4px; }
  .step1-header .tagline { font-size: 13px; letter-spacing: 1.5px; }

  /* Step indicator compact */
  .step-indicator { margin-bottom: var(--space-lg); }
  .step-dot { width: 30px; height: 30px; font-size: 12px; }
  .step-line { width: 50px; }
  .step-label-row { gap: 60px; }
  .step-label { font-size: 10px; }

  /* Layout: full stack */
  .step1-layout { flex-direction: column; gap: var(--space-md); }
  .step1-left { width: 100%; position: static; }
  .step1-right { width: 100%; }

  /* Input — full width, larger touch area */
  .input-section {
    padding: 20px 16px;
    border-radius: 16px;
  }
  .input-section h2 { font-size: 14px; }
  .input-row-vertical textarea {
    min-height: 140px;
    font-size: 15px;
    padding: 14px;
  }
  .input-actions-row { flex-wrap: wrap; }
  .input-actions-row .btn-primary {
    flex: 1;
    min-width: 0;
    padding: 14px 20px;
    font-size: 15px;
  }
  .input-actions-row .upload-zone {
    padding: 14px 16px;
  }

  /* Target cards — full width, compact */
  .target-card {
    padding: 12px;
    gap: 8px;
    border-radius: 12px;
  }
  .tc-top { gap: 8px; }
  .tc-raw { font-size: 14px; }
  .tc-company-name { font-size: 14px; }
  .tc-body-confirmed { padding: 10px 12px; }

  /* Chips — horizontal scroll */
  .tc-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding-bottom: 4px;
  }
  .tc-chips::-webkit-scrollbar { display: none; }
  .tc-chip {
    flex-shrink: 0;
    padding: 11px 16px;
    font-size: 13px;
    min-height: 44px;
  }

  /* Action bar — stack vertically */
  .action-bar { flex-direction: column; align-items: stretch; gap: 12px; }
  .action-radios { flex-wrap: wrap; gap: 4px; }
  .action-radio { flex: 1; min-width: 0; padding: 14px 12px; font-size: 13px; justify-content: center; }
  .action-submit { justify-content: flex-end; }
  .action-settings-panel { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Empty state compact */
  .empty-state { padding: var(--space-xl) var(--space-md); }

  /* ── Fixed bottom action bar (thumb zone) ── */
  .action-cards-section {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 500;
    padding: 10px 16px calc(10px + var(--safe-bottom));
    background: var(--bg-glass);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border-top: 1px solid var(--border-visible);
    border-bottom: none;
    margin: 0;
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  .action-submit .estimate {
    font-size: 11px;
    width: 100%;
    text-align: center;
  }
  .btn-large {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    min-width: 0;
    border-radius: 12px;
  }

  /* ============================================
     RESULT PAGES — Simplified headers + bottom sheets
     ============================================ */

  /* -- Header -- */
  .chart-header, .info-header, .rel-header {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .chart-header .header-left,
  .info-header .header-left,
  .rel-header .header-left {
    flex: 1;
    min-width: 0;
    gap: 10px;
  }

  .chart-header .logo,
  .info-header .logo,
  .rel-header .logo {
    font-size: 18px;
  }

  .chart-header h1,
  .info-header h1,
  .rel-header h1 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chart-header .subtitle,
  .info-header .subtitle,
  .rel-header .subtitle {
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Header right: menu button + back button on same row */
  .chart-header .header-right,
  .info-header .header-right,
  .rel-header .header-right {
    gap: 6px;
    flex-wrap: wrap;
  }

  /* Back button — compact but thumb-friendly on mobile */
  .chart-header .control-btn.back-btn,
  .info-header .control-btn.back-btn,
  .rel-header .control-btn.back-btn {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 40px;
    border-radius: 8px;
    order: -1;
  }

  /* Export — inside collapsed menu, full width */
  .header-controls .control-btn.export-btn {
    width: 100%;
    padding: 10px 18px;
    font-size: 13px;
    min-height: 44px;
    border-radius: 10px;
  }

  /* Chart container — fill available space */
  .chart-container {
    height: calc(100vh - 180px);
    min-height: 350px;
  }

  /* ============================================
     STATS PANEL — Horizontal snap scroll
     ============================================ */
  .stats-panel {
    gap: var(--space-lg);
    padding: 10px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .stats-panel::-webkit-scrollbar { height: 0; }
  .stat-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    min-width: 70px;
    justify-content: center;
  }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }
  .stats-scroll-hint { display: block; }

  /* Relationship stats — same horizontal scroll */
  .rel-stats {
    gap: 20px;
    padding: 10px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    font-size: 11px;
  }
  .rel-stats span { flex-shrink: 0; white-space: nowrap; }
  .rel-stats strong { font-size: 14px; }

  /* ============================================
     LEGENDS & PANELS — Bottom sheets
     ============================================ */

  /* Show sheet handle on mobile */
  .sheet-handle { display: block; }

  /* Legend — bottom sheet */
  .chart-legend, .rel-legend {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    max-width: none;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    z-index: 600;
    padding: 12px 20px calc(12px + var(--safe-bottom));
    transform: translateY(calc(100% - 48px));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
  }
  .chart-legend.open, .rel-legend.open {
    transform: translateY(0);
  }
  .chart-legend h4, .rel-legend h4 {
    font-size: 12px;
    text-align: center;
    padding-bottom: 8px;
  }
  .chart-legend .legend-item, .rel-legend .legend-item {
    font-size: 12px;
    padding: 4px 0;
  }

  /* Batch panel — bottom sheet */
  .batch-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    max-width: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    z-index: 600;
    padding: 12px 16px calc(12px + var(--safe-bottom));
    transform: translateY(calc(100% - 44px));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
  }
  .batch-panel.open {
    transform: translateY(0);
  }
  .batch-panel h3 { text-align: center; font-size: 12px; }
  .batch-list { max-height: 250px; }

  /* ============================================
     TOOLTIP — Bottom sheet (tap to show)
     ============================================ */
  .tooltip {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    max-width: none;
    width: auto;
    min-width: 0;
    max-height: 75vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    z-index: 700;
    padding: 16px 16px calc(16px + var(--safe-bottom));
    font-size: 13px;
    display: none;
    visibility: hidden;
    transform: translateY(0);
  }
  .tooltip h3 { font-size: 15px; }
  .tt-grid { grid-template-columns: 1fr 1fr; gap: 2px 10px; }
  .tt-label { font-size: 10px; }
  .tt-value { font-size: 11px; }

  /* ============================================
     INFO PAGE — Mobile layouts
     ============================================ */
  .info-overview {
    flex-direction: column;
    padding: 16px;
    gap: 12px;
  }
  .info-overview .info-logo-wrap { font-size: 36px; }
  .info-overview .company-name { font-size: 18px; }
  .info-container {
    padding: 12px;
    padding-bottom: calc(60px + var(--safe-bottom));
  }

  /* KV grid — 1 column */
  .kv-grid { grid-template-columns: 1fr; }

  /* Finance — 2 columns */
  .finance-big-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .big-value { font-size: 16px; }

  /* Risk — 2 columns */
  .risk-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .risk-num { font-size: 20px; }

  /* IP — 2 columns */
  .ip-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .ip-num { font-size: 18px; }

  /* Rankings — 2 columns */
  .rank-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Staff — 1 column */
  .staff-grid { grid-template-columns: 1fr; }

  /* Changes timeline — horizontal scroll */
  .change-item {
    grid-template-columns: 90px 110px 1fr 1fr;
    font-size: 11px;
    gap: 8px;
    min-width: 500px;
  }

  /* Tables — horizontal scroll */
  .info-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -8px;
    padding: 0 8px;
  }
  .info-table { min-width: 500px; font-size: 11px; }
  .info-table th, .info-table td { padding: 8px 10px; }

  /* Info cards — touch friendly */
  .info-card { border-radius: 12px; margin-bottom: 12px; }
  .info-card-header { padding: 12px 16px; }
  .info-card-body { padding: 12px 16px; }

  /* ============================================
     RELATIONSHIP PAGE — Mobile
     ============================================ */
  .rel-container {
    height: calc(100vh - 200px);
    min-height: 300px;
  }
  .rel-node text { font-size: 10px; }
  .rel-node circle { cursor: pointer; }

  /* ============================================
     LOADING PAGE — Mobile
     ============================================ */
  .loading-text { font-size: 16px; }
  .loading-sub { font-size: 12px; }
  .loading-progress { width: 260px; }

  /* ============================================
     D3 CHART — Touch optimizations
     ============================================ */
  .node-rect {
    cursor: pointer;
  }
  /* Larger expand button touch area on mobile */
  .expand-btn circle { r: 12; }
  .expand-btn text { font-size: 14px; }

  /* Scrollable batch list */
  .batch-list {
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Fade hint for scrollable content */
  .scroll-fade-right {
    position: relative;
  }
  .scroll-fade-right::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, var(--bg-primary));
    pointer-events: none;
  }
}

/* ============================================
   Small phone (≤480px)
   ============================================ */
@media (max-width: 480px) {
  .step1-page { padding: 12px 8px calc(80px + var(--safe-bottom)); }
  .step1-header .logo { font-size: 30px; letter-spacing: 3px; }
  .step1-header .tagline { font-size: 11px; }

  .input-section { padding: 16px 12px; border-radius: 14px; }
  .input-row-vertical textarea { min-height: 120px; font-size: 14px; }
  .input-actions-row .btn-primary { font-size: 14px; padding: 12px 16px; }

  .target-card { padding: 10px 12px; }

  .tc-chip { padding: 10px 14px; font-size: 12px; min-height: 40px; }

  .action-radio { padding: 12px 14px; font-size: 13px; }

  .btn-large { padding: 14px; font-size: 15px; }

  /* Stats — even more compact */
  .stats-panel { padding: 8px 12px; gap: 16px; }
  .stat-value { font-size: 16px; }
  .stat-label { font-size: 9px; }
  .stat-item { min-width: 55px; }

  /* Finance/risk grids — 2 columns */
  .finance-big-grid { grid-template-columns: repeat(2, 1fr); }
  .risk-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .risk-num { font-size: 18px; }

  /* Chart header — more compact */
  .chart-header h1, .info-header h1, .rel-header h1 { font-size: 13px; }
  .chart-header .logo, .info-header .logo, .rel-header .logo { font-size: 16px; }

  /* Back button — compact */
  .chart-header .control-btn.back-btn,
  .info-header .control-btn.back-btn,
  .rel-header .control-btn.back-btn {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 36px;
  }

  /* Info cards */
  .kv-grid { grid-template-columns: 1fr; }
  .finance-big-grid { gap: 6px; }
  .finance-big-item { padding: 12px 8px; }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* prefers-reduced-motion: disable all animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .empty-state .empty-icon { animation: none; }
  @keyframes float { 0%, 100% { transform: none; } }
}

/* Focus-visible: visible ring for keyboard navigation */
.action-radio:focus-visible,
.tc-chip:focus-visible,
.btn-small:focus-visible,
.control-btn:focus-visible,
.mobile-menu-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.node-group:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.chart-header input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
