/* AIBeat — clean, dense, no friction */
:root {
  /* Phantom Telemetry — encre profonde, signal indigo */
  --bg: #070A12;
  --bg-card: #0D1320;
  --panel-left: #0A0E18;
  --line: #232F47;
  --line-dark: #2E3C58;
  --ink: #D3DAE8;
  --ink-2: #9AA6BA;
  --ink-3: #6B7689;
  --blue: #3F63FF;
  --blue-l: rgba(63,99,255,.14);
  --green: #2DD4A0;
  --green-l: rgba(45,212,160,.13);
  --red: #FF5662;
  --red-l: rgba(255,86,98,.12);
  --gold: #E8B15A;
  --gold-l: rgba(232,177,90,.12);
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --r: 6px;
  --left-w: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; height: 100vh; overflow: hidden; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout { display: flex; height: 100vh; }

/* ── Left panel ──────────────────────────────────────────────────────────── */
.left-panel {
  width: var(--left-w); flex-shrink: 0;
  background: var(--panel-left); color: #e2e6ef;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line-dark);
}

.left-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--line-dark);
}
.logo { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; color: #fff; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 5px;
  background: #ffffff15; border: none; color: #fff;
  font-size: 1.1rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.icon-btn:hover { background: #ffffff25; }

.search-wrap { padding: 10px 10px 6px; }
.search-input {
  width: 100%; padding: 6px 10px; border-radius: 5px;
  background: #ffffff10; border: 1px solid #ffffff15;
  color: #e2e6ef; font-size: .8rem; outline: none;
}
.search-input::placeholder { color: #6b7280; }
.search-input:focus { border-color: var(--blue); }

.entity-list { flex: 1; overflow-y: auto; padding: 4px 6px; }
.list-loading, .list-empty {
  padding: 16px 10px; color: #6b7280; font-size: .8rem; line-height: 1.6;
}

.entity-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--r);
  cursor: pointer; transition: background .12s;
  margin-bottom: 2px;
}
.entity-item:hover { background: #ffffff10; }
.entity-item.active { background: var(--blue)25; }
.ei-name {
  font-size: .85rem; font-weight: 500; color: #e2e6ef;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 130px;
}
.ei-type { font-size: .68rem; color: #6b7280; text-transform: uppercase; letter-spacing: .05em; margin-top: 1px; }
.ei-score {
  font-size: .78rem; font-family: var(--mono); font-weight: 600;
  padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.score-na  { color: #6b7280; background: #ffffff08; }
.score-high { color: #4ade80; background: #16a34a20; }
.score-mid  { color: #fbbf24; background: #d9770620; }
.score-low  { color: #f87171; background: #dc262620; }

/* ── Right panel ─────────────────────────────────────────────────────────── */
.right-panel {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}

/* Welcome */
.welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px; gap: 12px;
}
.welcome-icon { font-size: 2.5rem; color: var(--ink-3); margin-bottom: 8px; }
.welcome h1 { font-size: 1.6rem; font-weight: 700; }
.welcome p { color: var(--ink-2); max-width: 380px; line-height: 1.7; }

/* Entity view */
.entity-view {
  flex: 1; flex-direction: column;
  padding: 28px 36px; max-width: 900px; width: 100%;
}

.ev-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 24px; flex-wrap: wrap;
}
.ev-type {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); margin-bottom: 4px;
}
.ev-name { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.ev-context { font-size: .85rem; margin-top: 4px; }
.ev-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; padding-top: 4px; }
.muted { color: var(--ink-3); }

/* Progress */
.progress-bar-wrap {
  height: 36px; background: var(--line); border-radius: var(--r);
  overflow: hidden; position: relative; margin-bottom: 24px;
}
.progress-bar {
  height: 100%; background: var(--blue);
  transition: width .4s ease; border-radius: var(--r);
}
.progress-label {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding: 0 12px; font-size: .8rem; font-weight: 500; color: var(--ink-2);
}

/* No scan */
.no-scan {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center; gap: 12px; color: var(--ink-3);
}
.no-scan-icon { font-size: 2rem; }
.no-scan p { line-height: 1.7; }

/* ── Scores row ──────────────────────────────────────────────────────────── */
.scores-row {
  display: grid; grid-template-columns: auto 1fr 1fr;
  gap: 16px; margin-bottom: 28px;
}
@media (max-width: 700px) { .scores-row { grid-template-columns: 1fr; } }

.score-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px 20px;
}
.score-card.main { display: flex; align-items: center; gap: 18px; }

/* Ring */
.score-ring-wrap {
  position: relative; width: 80px; height: 80px; flex-shrink: 0;
}
.ring-svg { width: 80px; height: 80px; }
#ringCircle { transition: stroke-dashoffset .8s ease, stroke .4s; }
.ring-label {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-num { font-size: 1.4rem; font-weight: 700; line-height: 1; font-family: var(--mono); }
.ring-sub { font-size: .65rem; color: var(--ink-3); }
.score-meta { display: flex; flex-direction: column; gap: 4px; }
.score-main-label { font-weight: 600; font-size: .9rem; }
.score-scan-date { font-size: .75rem; }

.score-stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 8px; }
.score-stat-val { font-size: 1.6rem; font-weight: 700; font-family: var(--mono); margin-bottom: 10px; }
.score-stat-sub { font-size: .72rem; color: var(--ink-3); margin-top: 6px; }

.sentiment-track {
  height: 6px; background: var(--line); border-radius: 3px;
  overflow: hidden; position: relative;
}
.sentiment-fill { height: 100%; border-radius: 3px; transition: width .5s; }
.sentiment-center {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 1px;
  background: var(--ink-3); opacity: .4;
}

.alignment-badges { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.align-badge {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 10px; border-radius: 5px; font-size: .78rem;
  font-weight: 600; border: 1px solid transparent;
}
.align-badge span { font-size: .72rem; opacity: .7; font-weight: 400; font-family: var(--mono); }

/* ── Section ─────────────────────────────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section-title {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); font-weight: 600; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

/* Axes */
.axes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; }
@media (max-width: 600px) { .axes-grid { grid-template-columns: 1fr; } }
.axis-item {}
.axis-top { display: flex; justify-content: space-between; margin-bottom: 5px; }
.axis-name { font-size: .82rem; color: var(--ink-2); }
.axis-val { font-size: .78rem; font-family: var(--mono); font-weight: 600; color: var(--ink); }
.axis-track { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.axis-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }

/* Narratives */
.narratives-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.ntag {
  padding: 4px 10px; border-radius: 12px; font-size: .78rem;
  background: var(--bg-card); border: 1px solid var(--line); color: var(--ink-2);
}

/* Personas */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--line); margin-bottom: 0; overflow-x: auto; }
.ptab {
  padding: 8px 14px; border: none; background: none; cursor: pointer;
  font-size: .82rem; color: var(--ink-3); border-bottom: 2px solid transparent;
  margin-bottom: -2px; white-space: nowrap; font-family: var(--sans);
  transition: color .12s;
}
.ptab:hover { color: var(--ink); }
.ptab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.ppanel { display: none; padding: 16px 0 0; }
.ppanel.active { display: block; }
.ppanel-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.kwtag {
  padding: 2px 7px; border-radius: 10px; font-size: .72rem;
  background: var(--line); color: var(--ink-3);
}
.nline { font-size: .83rem; color: var(--ink-2); padding: 3px 0; }

/* Q&A */
.qa-list { list-style: none; }
.qa-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.qa-item:last-child { border-bottom: none; }
.qa-q { font-size: .75rem; color: var(--ink-3); font-style: italic; margin-bottom: 4px; }
.qa-a { font-size: .855rem; color: var(--ink-2); line-height: 1.65; }

/* History */
.hist-chart-wrap { height: 120px; position: relative; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  padding: 8px 16px; border-radius: var(--r);
  background: var(--blue); border: none; color: #fff;
  font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: background .12s, opacity .12s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  padding: 8px 14px; border-radius: var(--r);
  background: none; border: 1px solid var(--line); color: var(--ink-2);
  font-size: .85rem; cursor: pointer; transition: background .12s;
}
.btn-ghost:hover { background: var(--line); }

/* ── Colors ──────────────────────────────────────────────────────────────── */
.c-green { color: var(--green); }
.c-red   { color: var(--red); }
.c-gold  { color: var(--gold); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 12px; padding: 28px 28px 22px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: .78rem; color: var(--ink-3); margin-bottom: 5px; font-weight: 500; }
.form-row input {
  width: 100%; padding: 9px 11px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--bg);
  font-size: .875rem; color: var(--ink); outline: none; font-family: var(--sans);
}
.form-row input:focus { border-color: var(--blue); background: #fff; }
.type-select { display: flex; gap: 6px; flex-wrap: wrap; }
.type-opt {
  padding: 5px 12px; border-radius: 5px; font-size: .78rem;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  cursor: pointer; transition: all .1s; font-family: var(--sans);
}
.type-opt.active { border-color: var(--blue); background: var(--blue-l); color: var(--blue); font-weight: 600; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }

/* ── Skeleton loading (anti layout-shift) ─────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #2a2f3a 25%, #353b48 50%, #2a2f3a 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
  display: inline-block;
}
.skeleton-light {
  background: linear-gradient(90deg, #ece8e1 25%, #f5f2ec 50%, #ece8e1 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
  display: inline-block;
}
.skel-entity {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; margin-bottom: 4px;
}
.skel-entity-left { flex: 1; }
.skel-line { height: 10px; margin-bottom: 4px; }
.skel-circle { width: 28px; height: 28px; border-radius: 50%; }

/* Squelette résultats scan (côté droit) */
.skel-results { padding: 8px 4px; }
.skel-scores-row { display: flex; gap: 12px; margin-bottom: 24px; }
.skel-card {
  flex: 1; padding: 16px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); min-height: 120px;
}
.skel-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.skel-bar-row .skel-name { width: 90px; }
.skel-bar-row .skel-bar { flex: 1; }
.skel-fade-in { animation: skel-fade-in .2s ease-out; }
@keyframes skel-fade-in { from { opacity: 0; } to { opacity: 1; } }
