/* Copilote — Chris (Fixer & Videographer)
   Direction : casser le look "SaaS CRM générique" (pas de boîtes bordées partout,
   pas de barre du haut classique). Fond clair par défaut, typographie affirmée,
   sidebar plutôt que topbar, cartes plates avec accent couleur plutôt que bordures.
   Palette : validated default instance from the dataviz skill (references/palette.md). */

:root {
  --page-bg: #f4f3ee;
  --panel-bg: #fcfcfb;
  --raised-bg: #ffffff;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.08);
  --baseline: #c3c2b7;

  --accent: #2a78d6;
  --series-fixer: #1baf7a;
  --series-videographer: #2a78d6;

  --market-slot-1: #2a78d6;
  --market-slot-2: #1baf7a;
  --market-slot-3: #eda100;
  --market-slot-4: #008300;
  --market-slot-5: #4a3aa7;
  --market-slot-6: #e34948;

  --good: #0ca30c;
  --good-text: #006300;
  --critical: #d03b3b;

  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #0d0d0d;
    --panel-bg: #161615;
    --raised-bg: #1f1f1d;
    --surface-1: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #7d7c76;
    --gridline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.08);
    --baseline: #383835;

    --accent: #3987e5;
    --series-fixer: #199e70;
    --series-videographer: #3987e5;

    --market-slot-1: #3987e5;
    --market-slot-2: #199e70;
    --market-slot-3: #c98500;
    --market-slot-4: #35a835;
    --market-slot-5: #9085e9;
    --market-slot-6: #e66767;

    --good: #2fce6a;
    --good-text: #2fce6a;
    --critical: #ef6a6a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---- Shell layout : sidebar + main, pas de topbar générique ---- */
body.shell { display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 232px;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}
.brand-word { font-weight: 900; font-size: 19px; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; margin-left: 18px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-secondary);
  background: var(--raised-bg);
  border-left: 2px solid transparent;
}
.nav-icon { font-size: 10px; color: var(--text-muted); }
.side-nav a.active { color: var(--text-primary); background: color-mix(in srgb, var(--accent) 16%, var(--raised-bg)); border-left-color: var(--accent); }
.side-nav a.active .nav-icon { color: var(--accent); }
.side-nav a:hover:not(.active) { color: var(--text-primary); background: var(--gridline); }

.side-section-label {
  margin-top: 32px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 2px 8px;
}
.side-section-label:first-of-type { margin-top: 36px; }
.track-filter { display: flex; flex-direction: column; gap: 1px; margin-top: 10px; }
.track-opt {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.track-opt::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted);
}
.track-opt-videographer::before { background: var(--series-videographer); }
.track-opt-fixer::before { background: var(--series-fixer); }
.track-opt.active { background: var(--raised-bg); color: var(--text-primary); }
.track-opt:hover:not(.active) { color: var(--text-primary); }

.logout { margin-top: auto; font-size: 12.5px; color: var(--text-muted); font-weight: 600; padding: 10px; }
.logout:hover { color: var(--text-primary); }

.page { flex: 1; padding: 40px 44px 64px; min-width: 0; }
.page-noauth { padding: 0; }

/* ---- Login ---- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--page-bg); }
.login-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 44px 38px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-mark { font-weight: 900; font-size: 22px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.login-sub { margin: -8px 0 6px 18px; color: var(--text-secondary); font-size: 13px; }
.login-error { color: var(--critical); font-size: 13px; margin: 0; }
.login-card input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--raised-bg);
  color: var(--text-primary);
  font-size: 14px;
}
.login-card button {
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* ---- Flux d'intégrations : rend visible ce à quoi le système est branché ---- */
.flow-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px 30px;
  margin-bottom: 36px;
}
.flow-panel-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; gap: 20px; flex-wrap: wrap; }
.flow-title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.flow-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 4px; }

.mode-badge {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.05em;
  padding: 6px 12px; border-radius: 999px;
  white-space: nowrap;
}
.mode-dot { width: 7px; height: 7px; border-radius: 50%; }
.mode-dry { background: color-mix(in srgb, #c98500 18%, transparent); color: #e0a94a; }
.mode-dry .mode-dot { background: #e0a94a; }
.mode-live { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good-text); }
.mode-live .mode-dot { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 25%, transparent); }

.flow-diagram { display: flex; align-items: stretch; overflow-x: auto; padding-bottom: 4px; }
.flow-node {
  flex: 0 0 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
}
.flow-node-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  background: var(--raised-bg);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  margin-bottom: 8px;
}
.flow-node.connected .flow-node-icon {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--raised-bg));
}
.flow-node-label { font-size: 13.5px; font-weight: 800; }
.flow-node-sub { font-size: 11px; color: var(--text-muted); }
.flow-node-metric { font-size: 11.5px; color: var(--text-secondary); font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.flow-node-status { display: flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.flow-node.connected .flow-node-status { color: var(--good-text); }
.flow-node.connected .status-dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.flow-node.pending .flow-node-icon { border-style: dashed; }

.flow-connector {
  flex: 1 1 32px;
  min-width: 24px;
  align-self: center;
  height: 1.5px;
  background: var(--gridline);
  margin: 0 2px 34px;
  position: relative;
}
.flow-connector::after {
  content: "";
  position: absolute; right: 0; top: 50%;
  width: 5px; height: 5px;
  border-right: 1.5px solid var(--gridline);
  border-bottom: 1.5px solid var(--gridline);
  transform: translateY(-50%) rotate(-45deg);
}

/* ---- Stat strip : plate, pas de boîtes bordées, séparateurs fins ---- */
.stat-row {
  display: flex;
  margin-bottom: 40px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-tile {
  flex: 1;
  padding: 20px 24px 20px 0;
  margin-right: 24px;
  border-right: 1px solid var(--border);
}
.stat-tile:last-child { border-right: none; margin-right: 0; }
.stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 40px; font-weight: 800; margin-top: 6px; letter-spacing: -0.03em; line-height: 1; }
.stat-good .stat-value { color: var(--good-text); }
.stat-muted .stat-value { color: var(--text-secondary); }

/* ---- Kanban : colonnes typographiques, cartes plates ---- */
.kanban { display: flex; gap: 28px; overflow-x: auto; padding-bottom: 12px; }
.kanban-column { flex: 0 0 272px; }
.kanban-column-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 2px 14px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 14px;
  font-weight: 800; font-size: 12.5px; color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.kanban-count { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kanban-empty { color: var(--text-muted); font-size: 13px; padding: 12px 2px; }

.prospect-card {
  background: var(--panel-bg);
  border-left: 3px solid var(--series-videographer);
  border-radius: 8px;
  padding: 12px 14px;
  transition: background .12s ease;
}
.prospect-card:hover { background: var(--raised-bg); }
.prospect-card.track-fixer { border-left-color: var(--series-fixer); }

.prospect-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.track-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.track-badge-videographer { color: var(--series-videographer); }
.track-badge-fixer { color: var(--series-fixer); }
.score-badge { font-size: 11px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.prospect-name { font-weight: 700; font-size: 14px; }
.prospect-meta { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.prospect-market { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: capitalize; }

.card-action { margin-top: 10px; }
.card-action-split { display: flex; gap: 8px; }
.card-action form { width: 100%; }
.card-action button {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-align: left;
}
.card-action button::before { content: "→ "; }
.card-action button:hover { color: var(--accent); }
.btn-good:hover { color: var(--good) !important; }
.btn-muted:hover { color: var(--critical) !important; }

/* ---- Diagnostic ---- */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 24px;
}
.panel-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.panel-sub { margin: 5px 0 24px; font-size: 13px; color: var(--text-secondary); }

.funnel { display: flex; flex-direction: column; gap: 14px; }
.funnel-row { display: grid; grid-template-columns: 170px 1fr 56px 56px; align-items: center; gap: 14px; }
.funnel-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.funnel-bar-track { background: var(--raised-bg); border-radius: 3px; height: 22px; overflow: hidden; }
.funnel-bar { height: 100%; max-height: 22px; background: var(--accent); border-radius: 3px; min-width: 2px; }
.funnel-value { font-size: 14px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.funnel-conversion { font-size: 12px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }

.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.market-tile { display: flex; align-items: flex-start; gap: 10px; }
.market-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.market-slot-1 { background: var(--market-slot-1); }
.market-slot-2 { background: var(--market-slot-2); }
.market-slot-3 { background: var(--market-slot-3); }
.market-slot-4 { background: var(--market-slot-4); }
.market-slot-5 { background: var(--market-slot-5); }
.market-slot-6 { background: var(--market-slot-6); }
.market-label { font-size: 13.5px; font-weight: 700; }
.market-total { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.market-won { color: var(--good-text); font-weight: 700; margin-left: 6px; }

@media (max-width: 900px) {
  body.shell { flex-direction: column; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 16px; }
  .side-nav, .track-filter { flex-direction: row; margin-top: 0; }
  .side-section-label { display: none; }
  .logout { margin-top: 0; margin-left: auto; }
  .page { padding: 24px; }
  .stat-row { flex-wrap: wrap; }
  .stat-tile { flex: 1 1 45%; border-right: none; margin-right: 0; padding-bottom: 16px; }
  .funnel-row { grid-template-columns: 110px 1fr 40px 40px; }
}
