/* ============================================================
   Vision, Design tokens & base
   ============================================================ */
:root {
  /* Warm minimal, light theme, muted palette */
  --bg-0: #f5f1e9;
  --bg-1: #ffffff;
  --bg-2: #fbf7ef;
  --bg-3: #ede7da;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-elev: #ffffff;
  --border: rgba(45, 42, 38, 0.08);
  --border-strong: rgba(45, 42, 38, 0.16);

  --primary: #4a7c7e; /* sage teal */
  --primary-2: #6b9a9c;
  --primary-glow: rgba(74, 124, 126, 0.18);
  --accent: #b87b58; /* warm clay */
  --accent-2: #8a6b97; /* dusty plum */

  --success: #5b8a5d; /* sage green */
  --warning: #c9a168; /* muted sand */
  --danger: #b86056; /* muted brick */

  --node-source: #5b8a5d;
  --node-transform: #4a7c7e;
  --node-analysis: #c9a168;
  --node-ml: #b86056;
  --node-output: #8a6b97;

  --text: #2d2a26;
  --text-2: #635c52;
  --text-dim: #8b8276;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 4px 16px rgba(45, 42, 38, 0.06);
  --shadow-lg: 0 16px 40px rgba(45, 42, 38, 0.10);
  --transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);

  --tabbar-h: 64px;
  --topbar-h: 56px;
}

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

/* Charts wrap, empêche Chart.js de grandir à l'infini quand le parent n'a pas de hauteur fixe */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap > canvas { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; }
.spark-wrap { position: relative; height: 40px; margin-top: 12px; }
.spark-wrap > canvas { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; }

html, body, #app {
  height: 100%;
  overflow: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-0);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(74, 124, 126, 0.06), transparent 60%),
    radial-gradient(1000px 500px at 100% 100%, rgba(184, 123, 88, 0.05), transparent 60%),
    var(--bg-0);
}

#app { position: relative; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
canvas { display: block; max-width: 100%; }
kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}

/* ============================================================
   Screen system
   ============================================================ */
.screen { display: none; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* ============================================================
   Onboarding
   ============================================================ */
.onboarding {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.onboarding.active { display: flex; }

.onboarding-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.logo-big {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  filter: drop-shadow(0 8px 24px var(--primary-glow));
}
.brand {
  text-align: center;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-tagline {
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 24px;
}

.onboarding-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.onboarding-text, .subtle {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.back {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 13px;
  color: var(--text-2);
  padding: 6px 10px;
  border-radius: 6px;
  transition: var(--transition);
}
.back:hover { background: var(--bg-2); color: var(--text); }

.btn-primary, .btn-ghost {
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px var(--primary-glow); }
.btn-primary.small { width: auto; padding: 8px 14px; font-size: 13px; margin: 0; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }
.btn-ghost.small { width: auto; padding: 6px 12px; font-size: 12px; margin: 0 0 6px; display: block; }

/* Lien de retour vers le portfolio sur la welcome screen */
.back-to-portfolio {
  display: block;
  text-align: center;
  margin-top: 18px;
  padding: 8px;
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.02em;
  border-radius: 6px;
  transition: var(--transition);
}
.back-to-portfolio:hover { color: var(--primary); background: var(--bg-2); }

.oauth-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.oauth-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  font-weight: 500;
  text-align: left;
  transition: var(--transition);
}
.oauth-btn:hover { background: var(--bg-3); border-color: var(--primary); }
.oauth-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
}
.oauth-icon.google { background: linear-gradient(45deg, #4285F4, #EA4335, #FBBC05, #34A853); }
.oauth-icon.facebook { background: #1877F2; }
.oauth-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

/* Form */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack label, .modal-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-stack label > span, .modal-card label > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}
.form-stack input, .form-stack select,
.modal-card input, .modal-card select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
}
.form-stack input:focus, .form-stack select:focus,
.modal-card input:focus, .modal-card select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.row-buttons { display: flex; gap: 10px; margin-top: 10px; }
.row-buttons .btn-primary, .row-buttons .btn-ghost { margin-bottom: 0; }

/* ============================================================
   App shell
   ============================================================ */
#shell {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--tabbar-h);
  height: 100%;
}
#shell.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.brand-mini {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.cmdk-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.cmdk-trigger:hover { color: var(--text); border-color: var(--primary); }
.cmdk-trigger > span { min-width: 90px; text-align: left; }
.cmdk-trigger kbd {
  font-size: 10px;
  background: var(--bg-3);
  padding: 1px 5px;
}
.topbar-mid { display: flex; align-items: center; gap: 12px; }

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  padding: 6px 12px;
  background: var(--bg-2);
  border-radius: 999px;
  border: 1px solid var(--border);
}
.api-status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}
.api-status.live .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-2);
}
.lang-toggle button {
  background: transparent;
  color: var(--text-dim);
  padding: 5px 11px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: var(--transition);
  border: 0;
}
.lang-toggle button:hover { color: var(--text-2); }
.lang-toggle button.active {
  background: var(--primary);
  color: #ffffff;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

/* Main scroll */
#main {
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

/* Tabbar */
.tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  padding: 6px;
  transition: var(--transition);
  text-decoration: none;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--primary); }
.tab.active svg path,
.tab.active svg circle { stroke: var(--primary); }
.tab.tab-external { color: var(--accent); }
.tab.tab-external:hover { color: var(--text); background: rgba(184, 123, 88, 0.06); }
.tab.tab-external svg path,
.tab.tab-external svg circle { stroke: currentColor; }

/* ============================================================
   Generic blocks
   ============================================================ */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.page-header .subtle { margin: 0; }

.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-actions { display: flex; align-items: baseline; gap: 12px; }

.kpi-big { font-size: 22px; font-weight: 700; font-family: "JetBrains Mono", monospace; }
.kpi-delta { font-size: 13px; font-weight: 600; font-family: "JetBrains Mono", monospace; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

.link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.link:hover { background: var(--bg-2); }

.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
}

/* News list */
.news-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.news-list li {
  display: flex;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.news-list li:last-child { border-bottom: none; padding-bottom: 0; }
.news-ticker {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  background: rgba(74, 124, 126, 0.10);
  border-radius: 4px;
  color: var(--primary);
  flex-shrink: 0;
  height: fit-content;
}
.news-title { font-size: 13px; line-height: 1.4; }
.news-sentiment.pos { color: var(--success); }
.news-sentiment.neg { color: var(--danger); }
.news-sentiment.neu { color: var(--text-dim); }

/* Portfolio cards */
.asset-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.asset-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 12px 32px rgba(45, 42, 38, 0.10);
}
.asset-card .ticker {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.asset-card .name { font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.asset-card .price { font-family: "JetBrains Mono", monospace; font-size: 20px; font-weight: 700; }
.asset-card .delta { font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 600; }
.asset-card .delta.up { color: var(--success); }
.asset-card .delta.down { color: var(--danger); }
.asset-card .sparkline { width: 100%; height: 100%; }
.asset-card .qty {
  position: absolute;
  top: 14px; right: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  background: var(--bg-3);
  border-radius: 999px;
  color: var(--text-2);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.stat {
  padding: 12px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.stat-label { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-family: "JetBrains Mono", monospace; font-size: 18px; font-weight: 700; }

/* Rules list */
.rules-list { display: flex; flex-direction: column; gap: 10px; }
.rule {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-strong);
}
.rule.ok { border-left-color: var(--success); }
.rule.warn { border-left-color: var(--warning); }
.rule.bad { border-left-color: var(--danger); }
.rule-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.rule.ok .rule-icon { background: rgba(91, 138, 93, 0.15); color: var(--success); }
.rule.warn .rule-icon { background: rgba(201, 161, 104, 0.18); color: var(--warning); }
.rule.bad .rule-icon { background: rgba(184, 96, 86, 0.15); color: var(--danger); }
.rule-text { font-size: 13px; line-height: 1.4; }
.rule-text small { color: var(--text-dim); display: block; margin-top: 2px; }
.rule-value { font-family: "JetBrains Mono", monospace; font-weight: 600; font-size: 13px; }

/* Score card */
.score-card {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 28px;
  background: linear-gradient(135deg, rgba(74, 124, 126, 0.06), rgba(74, 124, 126, 0.01));
  border: 1px solid rgba(74, 124, 126, 0.18);
}
.score-badge {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--bg-1);
  border: 3px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
}
.score-body { flex: 1; min-width: 0; }
.score-body h3 { font-size: 22px; margin-bottom: 6px; }
.score-axes { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.score-axis {
  display: grid;
  grid-template-columns: 110px 1fr 50px;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}
.score-axis .lbl { color: var(--text-2); font-weight: 500; }
.score-axis .bar {
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}
.score-axis .bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.score-axis .val {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  text-align: right;
  color: var(--text);
}

/* Métriques détaillées */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.metric {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 3px solid var(--border-strong);
}
.metric.ok { border-left-color: var(--success); }
.metric.warn { border-left-color: var(--warning); }
.metric.bad { border-left-color: var(--danger); }
.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.metric-status {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}
.metric-status.ok { background: rgba(91, 138, 93, 0.15); color: var(--success); }
.metric-status.warn { background: rgba(201, 161, 104, 0.18); color: var(--warning); }
.metric-status.bad { background: rgba(184, 96, 86, 0.15); color: var(--danger); }
.metric-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.metric-bench {
  font-size: 10px;
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
}
.metric-explain {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}
.metric-formula {
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px dashed var(--border);
  padding-top: 6px;
  margin-top: 2px;
}
.metric-formula summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--primary);
  user-select: none;
}
.metric-formula summary:hover { color: var(--text); }
.metric-formula code {
  display: block;
  margin: 6px 0;
  padding: 6px 8px;
  background: var(--bg-1);
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text);
  white-space: pre-wrap;
}
.metric-formula p { margin-top: 4px; color: var(--text-2); line-height: 1.4; }

/* Recommandations */
.recos-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.recos-list li {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  font-size: 13px;
  line-height: 1.5;
}
.recos-list .reco-icon { font-size: 18px; flex-shrink: 0; line-height: 1.3; }

/* Glossaire */
.glossary-card { background: linear-gradient(135deg, rgba(184, 123, 88, 0.05), rgba(184, 123, 88, 0.01)); border-color: rgba(184, 123, 88, 0.18); }
.glossary-body h4 { font-size: 14px; margin-bottom: 8px; color: var(--text); }
.glossary-body p { font-size: 13px; color: var(--text-2); line-height: 1.55; }

/* Verdict */
.verdict {
  padding: 24px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 20px;
}
.verdict-badge {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.verdict.buy { background: linear-gradient(135deg, rgba(91, 138, 93, 0.10), rgba(91, 138, 93, 0.03)); border: 1px solid rgba(91, 138, 93, 0.25); }
.verdict.buy .verdict-badge { background: var(--success); color: #ffffff; }
.verdict.hold { background: linear-gradient(135deg, rgba(201, 161, 104, 0.10), rgba(201, 161, 104, 0.03)); border: 1px solid rgba(201, 161, 104, 0.25); }
.verdict.hold .verdict-badge { background: var(--warning); color: #ffffff; }
.verdict.sell { background: linear-gradient(135deg, rgba(184, 96, 86, 0.10), rgba(184, 96, 86, 0.03)); border: 1px solid rgba(184, 96, 86, 0.25); }
.verdict.sell .verdict-badge { background: var(--danger); color: #ffffff; }
.verdict-text h4 { font-size: 18px; margin-bottom: 6px; }
.verdict-text p { color: var(--text-2); font-size: 13px; line-height: 1.5; }

/* ============================================================
   Nodal canvas
   ============================================================ */
.nodal-screen {
  display: none;
  grid-template-columns: 260px 1fr;
  gap: 0;
  position: absolute;
  inset: 0;
  top: var(--topbar-h);
  bottom: var(--tabbar-h);
  padding: 0;
  overflow: hidden;
}
.nodal-screen.active { display: grid; }

.nodal-side {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}
.side-section { margin-bottom: 28px; }
.side-section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.param {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.param > span { font-size: 12px; color: var(--text-2); }
.param input[type="range"] { accent-color: var(--primary); }
.param output { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-dim); align-self: flex-end; }
.param select {
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
}

.node-palette {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Bibliothèque */
.lib-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.lib-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.lib-select, .lib-input {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
}
.lib-select:focus, .lib-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.lib-desc {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
  margin: 0;
  min-height: 28px;
}
.lib-row { display: flex; gap: 6px; }
.lib-row .btn-ghost.small { flex: 1; margin: 0; display: block; }
.btn-ghost.small.full, .btn-primary.small.full { width: 100%; display: block; margin: 0; }
.lib-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: grab;
  transition: var(--transition);
}
.palette-item:hover { border-color: var(--primary); color: var(--text); background: var(--bg-3); }
.palette-item:active { cursor: grabbing; }
.palette-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.palette-item.cat-source .palette-dot { background: var(--node-source); }
.palette-item.cat-transform .palette-dot { background: var(--node-transform); }
.palette-item.cat-analysis .palette-dot { background: var(--node-analysis); }
.palette-item.cat-ml .palette-dot { background: var(--node-ml); }
.palette-item.cat-output .palette-dot { background: var(--node-output); }
.palette-item.cat-group .palette-dot { background: #b87b58; }
.palette-item.cat-group {
  border-left: 2px solid #b87b58;
  font-weight: 600;
}

/* Canvas */
.nodal-main {
  display: grid;
  grid-template-rows: 1fr 300px;
  overflow: hidden;
}
.canvas-wrap {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(45, 42, 38, 0.07) 1px, transparent 1px) 0 0/20px 20px,
    var(--bg-3);
  cursor: grab;
}
.canvas-wrap.panning { cursor: grabbing; }
.canvas-viewport {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform-origin: 0 0;
  transform: translate(0, 0) scale(1);
  will-change: transform;
}
.canvas-wires {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.canvas-nodes { position: absolute; inset: 0; z-index: 2; }
.canvas-zoom-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  z-index: 5;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.canvas-zoom-controls button {
  background: transparent;
  color: var(--text-2);
  padding: 6px 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: var(--transition);
}
.canvas-zoom-controls button:last-child { border-right: none; }
.canvas-zoom-controls button:hover { color: var(--text); background: rgba(45,42,38,0.06); }
.canvas-zoom-controls .zoom-pct { min-width: 56px; font-size: 11px; }
.canvas-help {
  position: absolute;
  bottom: 16px;
  left: 16px;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  z-index: 5;
  box-shadow: var(--shadow);
}

/* Node */
.node {
  position: absolute;
  min-width: 160px;
  background: var(--surface-elev);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 12px;
  user-select: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.node:hover { border-color: var(--primary); }
.node.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow), var(--shadow-lg);
}
.node.error { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(184,96,86,0.18); }
.node.computed { border-left: 3px solid var(--success); }

.node-header {
  padding: 8px 12px;
  font-weight: 600;
  background: rgba(45, 42, 38, 0.04);
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: move;
  display: flex;
  align-items: center;
  gap: 6px;
}
.node-cat {
  width: 6px; height: 6px;
  border-radius: 50%;
}
.node-body {
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.node-param {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.node-param > label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.node-param select, .node-param input {
  padding: 4px 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
}
.node-readout {
  padding: 6px 8px;
  background: var(--bg-2);
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-2);
  white-space: pre-wrap;
  min-height: 18px;
  max-height: 100px;
  overflow: auto;
}

.node-port {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-1);
  border: 2px solid var(--text-2);
  cursor: crosshair;
  transition: var(--transition);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
}
.node-port:hover, .node-port.hover { background: var(--primary); border-color: var(--primary-2); transform: translateY(-50%) scale(1.3); }
.node-port.in { left: -7px; }
.node-port.out { right: -7px; }
.node-port.connected { background: var(--primary); border-color: var(--primary-2); }
.port-label {
  position: absolute;
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  top: 50%;
  transform: translateY(-50%);
}
.port-label.in { left: 10px; }
.port-label.out { right: 10px; }

/* Wire */
.wire { fill: none; stroke: var(--primary); stroke-width: 2; opacity: 0.85; vector-effect: non-scaling-stroke; }
.wire.preview { stroke-dasharray: 4 4; opacity: 0.6; }
.wire:hover { stroke: var(--accent); }

/* Results panel */
.nodal-results {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.results-header h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.results-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  align-content: start;
}
.result-tile {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 3px solid var(--border-strong);
}
.result-tile-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.result-status {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}
.result-status.ok { background: rgba(91, 138, 93, 0.15); color: var(--success); }
.result-status.warn { background: rgba(201, 161, 104, 0.18); color: var(--warning); }
.result-status.bad { background: rgba(184, 96, 86, 0.15); color: var(--danger); }
.result-kpi-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.result-kpi-empty {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}
.result-bench {
  font-size: 10px;
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
}
.result-explain {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}
.result-formula {
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px dashed var(--border);
  padding-top: 6px;
  margin-top: 2px;
}
.result-formula summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--primary);
  user-select: none;
}
.result-formula summary:hover { color: var(--text); }
.result-formula code {
  display: block;
  margin: 6px 0;
  padding: 6px 8px;
  background: var(--bg-1);
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text);
  white-space: pre-wrap;
}
.result-formula p { margin-top: 4px; color: var(--text-2); line-height: 1.4; }

/* Verdict tile spécifique */
.result-tile.verdict-tile {
  border-left-color: var(--primary);
  background: linear-gradient(135deg, rgba(74, 124, 126, 0.06), rgba(74, 124, 126, 0.01));
}
.verdict-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.verdict-stars {
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--warning);
}
.verdict-action-pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.verdict-action-pill.buy { background: rgba(91, 138, 93, 0.15); color: var(--success); border: 1px solid rgba(91, 138, 93, 0.3); }
.verdict-action-pill.hold { background: rgba(201, 161, 104, 0.18); color: var(--warning); border: 1px solid rgba(201, 161, 104, 0.3); }
.verdict-action-pill.sell { background: rgba(184, 96, 86, 0.15); color: var(--danger); border: 1px solid rgba(184, 96, 86, 0.3); }
.verdict-title-fr {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.verdict-components {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top: 1px dashed var(--border);
  padding-top: 6px;
}
.verdict-components .vc {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}
.verdict-components .vc > span:first-child { color: var(--text-2); }
.verdict-components .vc strong { font-family: "JetBrains Mono", monospace; color: var(--text); }
.verdict-components .vc-total {
  border-top: 1px solid var(--border);
  padding-top: 3px;
  margin-top: 2px;
  font-weight: 700;
}
.verdict-components .vc-total > span:first-child { color: var(--text); }
.verdict-why {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  font-style: italic;
  padding: 6px 8px;
  background: rgba(45, 42, 38, 0.04);
  border-radius: 4px;
}

/* Chart tile stats */
.chart-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-top: 6px;
}
.chart-stats .cs {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
}
.chart-stats .cs .lbl {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.chart-stats .cs strong { font-family: "JetBrains Mono", monospace; color: var(--text); font-weight: 700; }
.chart-stats .cs strong.ok { color: var(--success); }
.chart-stats .cs strong.bad { color: var(--danger); }

/* Headlines tile */
.result-tile.headlines-tile {
  grid-column: span 2;
  border-left-color: var(--accent);
}
.headlines-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.headline-item {
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.headline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.headline-source { font-weight: 600; color: var(--primary); }
.headline-sent {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.headline-sent.pos { background: rgba(91,138,93,0.15); color: var(--success); }
.headline-sent.neg { background: rgba(184,96,86,0.15); color: var(--danger); }
.headline-sent.neu { background: rgba(110,118,130,0.15); color: var(--text-dim); }
.headline-title { color: var(--text); line-height: 1.4; font-weight: 500; }
.headline-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.headline-cat, .headline-ticker {
  font-size: 9px;
  font-family: "JetBrains Mono", monospace;
  padding: 1px 5px;
  background: var(--bg-2);
  border-radius: 3px;
  color: var(--text-2);
}
.headline-ticker { color: var(--primary); background: rgba(74,124,126,0.10); }
.result-tile.verdict-tile { background: linear-gradient(135deg, rgba(74, 124, 126, 0.10), rgba(74, 124, 126, 0.03)); border-color: var(--primary); }

/* ============================================================
   Modal
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 38, 0.32);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }
.modal-card {
  width: 360px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-card h3 { font-size: 18px; font-weight: 700; }

/* ============================================================
   Brand identity page
   ============================================================ */
.brand-screen { display: none; }
.brand-screen.active { display: block; padding-bottom: 60px; }

.brand-hero {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 40px 0 56px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.brand-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 8px;
}
.brand-headline {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 8px;
}
.brand-subhead {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.5;
}

.brand-section {
  margin-bottom: 56px;
  padding-bottom: 32px;
  border-bottom: 1px dashed var(--border);
}
.brand-section:last-child { border-bottom: none; }
.brand-section-header { margin-bottom: 24px; }
.brand-section-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--primary);
  letter-spacing: 0.08em;
  font-weight: 700;
}
.brand-section h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 4px 0 8px;
}
.brand-section-header p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
  max-width: 600px;
}
.brand-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 20px 0 12px;
}

/* MARK */
.brand-mark-anatomy {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: center;
}
.brand-mark-display {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-anatomy-notes {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
}
.brand-anatomy-notes strong { color: var(--primary); font-weight: 600; }

.brand-variation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.brand-variation { display: flex; flex-direction: column; gap: 8px; }
.brand-variation > span { font-size: 11px; color: var(--text-dim); text-align: center; }
.brand-tile {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; align-items: center; justify-content: center;
  min-height: 100px;
}
.brand-tile.dark { background: var(--bg-3); }

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-right: 12px;
  margin-bottom: 12px;
}
.brand-lockup.vertical { padding: 20px 28px; }
.brand-lockup .lockup-word {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-lockup.vertical .lockup-word { display: block; }
.brand-lockup .lockup-tag {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: 2px;
}

/* PALETTE */
.palette-group { margin-bottom: 28px; }
.palette-group h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.palette-group .palette-role {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 12px;
}
.palette-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}
.swatch {
  border-radius: 6px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 88px;
}
.swatch .step { color: rgba(255,255,255,0.7); font-weight: 600; }
.swatch.light .step { color: rgba(0,0,0,0.5); }
.swatch .hex { color: rgba(255,255,255,0.9); }
.swatch.light .hex { color: rgba(0,0,0,0.7); }
.swatch .label { font-size: 11px; color: var(--text); font-family: inherit; margin-top: 4px; font-weight: 500; }

/* TYPO */
.typo-grid { display: flex; flex-direction: column; gap: 14px; }
.typo-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  align-items: baseline;
}
.typo-spec {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-dim);
}
.typo-display { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.typo-h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.typo-h2 { font-size: 22px; font-weight: 700; }
.typo-h3 { font-size: 16px; font-weight: 600; }
.typo-body { font-size: 14px; font-weight: 400; line-height: 1.5; }
.typo-caption { font-size: 12px; font-weight: 500; color: var(--text-2); }
.typo-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.typo-mono { font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 500; }
.typo-mono-big { font-family: "JetBrains Mono", monospace; font-size: 26px; font-weight: 700; }

/* ICONS */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.icon-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.icon-cell:hover { color: var(--primary); }
.icon-cell span { font-size: 11px; color: var(--text-dim); }

/* VOICE */
.voice-rules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.voice-rule {
  padding: 18px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
}
.voice-rule h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.voice-rule p { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.voice-dodonts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.voice-do, .voice-dont {
  padding: 18px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.voice-do { border-left: 3px solid var(--success); }
.voice-dont { border-left: 3px solid var(--danger); }
.voice-do p:not(.voice-label), .voice-dont p:not(.voice-label) {
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text);
}
.voice-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.voice-label.do { color: var(--success); }
.voice-label.dont { color: var(--danger); }
.voice-dont p:not(.voice-label) { opacity: 0.7; font-style: italic; }

/* APPS */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.app-cell { display: flex; flex-direction: column; gap: 8px; }
.app-cell > span { font-size: 11px; color: var(--text-dim); text-align: center; }
.app-cell.wide { grid-column: span 2; }
.app-favicon, .app-icon-ios, .app-social {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}
.app-icon-ios {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  border-radius: 22px;
  min-height: 140px;
}
.app-social {
  background: var(--primary);
  color: white;
  padding: 28px;
  gap: 20px;
  justify-content: flex-start;
  text-align: left;
}
.app-social p { font-weight: 700; font-size: 16px; }
.app-social .muted { color: rgba(255,255,255,0.75); font-weight: 400; font-size: 13px; margin-top: 4px; }

.brand-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.brand-footer code {
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}

/* ============================================================
   Command Palette
   ============================================================ */
.cmdk {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 38, 0.32);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 3000;
}
.cmdk.hidden { display: none; }
.cmdk-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: cmdk-in 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes cmdk-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdk-icon { color: var(--text-dim); font-family: "JetBrains Mono", monospace; }
#cmdk-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.cmdk-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px;
}
.cmdk-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 10px 12px 4px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}
.cmdk-item:hover, .cmdk-item.active {
  background: var(--bg-2);
}
.cmdk-item.active { background: rgba(74, 124, 126, 0.10); }
.cmdk-item-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.cmdk-item-body { flex: 1; min-width: 0; }
.cmdk-item-title { color: var(--text); font-weight: 500; }
.cmdk-item-desc { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.cmdk-item-shortcut { font-size: 11px; color: var(--text-dim); }
.cmdk-empty { padding: 20px; text-align: center; color: var(--text-dim); font-size: 13px; }
.cmdk-footer {
  display: flex;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 11px;
  color: var(--text-dim);
}

/* Narrative card */
.narrative-card {
  background: linear-gradient(135deg, rgba(74, 124, 126, 0.05), rgba(74, 124, 126, 0.01));
  border-color: rgba(74, 124, 126, 0.18);
}
.narrative-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.narrative-body strong {
  color: var(--primary);
  font-weight: 600;
}
.alloc-subtitle {
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-dim);
}

/* ============================================================
   Toast
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: calc(var(--tabbar-h) + 16px);
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
