/* PRYSMIAL — identité « prisme » : base sombre premium + accent spectre (violet→bleu→cyan).
   Palette + tokens copiés depuis l'extension (chrome-extension/sidepanel.css) pour identité identique. */
:root {
  --prism-1: #b25cff;
  --prism-2: #2e6bff;
  --prism-3: #28d6c8;
  --grad: linear-gradient(125deg, #2e6bff 0%, #28d6c8 26%, #c8f04a 50%, #b25cff 100%);
  --bg: #080a10;
  --bg-2: #0c0f17;
  --surface: #12151f;
  --surface-2: #171b28;
  --border: #232a3a;
  --border-2: #2c3447;
  --text: #eef0f6;
  --text-2: #9aa3b8;
  --text-3: #626c80;
  --r: 12px;
  --r-sm: 9px;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(120% 80% at 100% 0%, #11132099 0%, transparent 55%), var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- header marque ---- */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 5;
}
.logo { width: 26px; height: 26px; flex: none; }
.brand { font-weight: 700; font-size: 15px; letter-spacing: 0.04em; }
.brand .x {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.who { margin-left: auto; font-size: 12px; color: var(--text-3); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- nav segmentée ---- */
.nav {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}
.nav button {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.nav button.on { background: var(--surface-2); color: var(--text); }
.nav button:hover:not(.on) { color: var(--text); }

/* ---- conteneur central ---- */
.wrap { max-width: 980px; width: 100%; margin: 0 auto; flex: 1; }
.view { padding: 18px 16px 32px; }
.hidden { display: none !important; }
h2 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
.sub { font-size: 12.5px; color: var(--text-3); margin: 0 0 16px; line-height: 1.55; max-width: 620px; }

/* ---- champs ---- */
input, textarea {
  width: 100%;
  padding: 11px 13px;
  margin-bottom: 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, textarea:focus { outline: none; border-color: var(--prism-2); box-shadow: 0 0 0 3px #3b82f622; }

/* ---- boutons ---- */
.row { display: flex; gap: 8px; align-items: flex-start; }
button {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s;
}
button:hover { background: #1d2331; }
button.primary { border: none; background: var(--grad); color: #fff; font-weight: 600; }
button.primary:hover { opacity: 0.92; }
button.ghost { background: var(--surface-2); }
button:disabled { opacity: 0.45; cursor: default; }
.link { background: none; border: none; color: var(--text-3); font-size: 12.5px; padding: 8px 0; cursor: pointer; }
.link:hover { color: var(--text-2); }

/* ---- messages ---- */
.msg { font-size: 12px; margin-top: 6px; min-height: 15px; line-height: 1.4; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

/* ---- compte / fiche ---- */
.field { margin-bottom: 14px; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 7px; font-weight: 600; }
.value { font-size: 14px; color: var(--text); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg button { border: none; background: none; padding: 7px 18px; border-radius: 999px; font-size: 13px; color: var(--text-2); }
.seg button.on { background: var(--grad); color: #fff; font-weight: 600; }

/* ---- case à cocher (ex. métier actif) ---- */
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--text); }
.check input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--prism-2); }

/* ---- split clients (liste | détail) ---- */
.split { display: grid; grid-template-columns: 280px 1fr; gap: 22px; margin-top: 6px; align-items: start; }
.col-list { min-width: 0; }
.col-detail { min-width: 0; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }

/* ---- liste clients ---- */
.client-list { display: flex; flex-direction: column; gap: 6px; }
.client-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; font: inherit; font-size: 13px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 12px; cursor: pointer;
}
.client-row:hover { border-color: var(--border-2); }
.client-row.on { border-color: var(--prism-2); box-shadow: 0 0 0 2px #3b82f622; }
.cstatut { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; flex: none; }
.muted { color: var(--text-3); font-size: 12.5px; padding: 12px 2px; line-height: 1.5; }

/* ---- pipeline (colonnes par étape) ---- */
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 6px;
  align-items: start;
}
@media (max-width: 900px) { .pipeline-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .pipeline-board { grid-template-columns: 1fr; } }
.pipe-col {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px;
}
.pipe-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 2px; padding: 2px 2px 8px; border-bottom: 1px solid var(--border);
}
.pipe-col-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.pipe-col-count {
  font-size: 11px; font-weight: 600; color: var(--text-3); flex: none;
  background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
.pipe-row { flex-direction: column; align-items: stretch; gap: 8px; cursor: default; padding: 10px; }
.pipe-row:hover { border-color: var(--border); }
.pipe-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pipe-select {
  width: 100%; margin: 0; padding: 7px 9px; font-size: 12px;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.pipe-select:focus { outline: none; border-color: var(--prism-2); box-shadow: 0 0 0 3px #3b82f622; }
.pipe-select:disabled { opacity: 0.5; }

/* ---- captcha (Turnstile) : marge autour du widget injecté dans #turnstileSlot ---- */
.turnstile-slot { margin: 10px 0 4px; min-height: 0; }

/* ---- lien d'invitation : champ URL readonly (réutilise input, juste un indice visuel) ---- */
#inviteUrl[readonly] { color: var(--text-2); background: var(--surface); cursor: text; }

/* ---- équipe : sélecteur d'organisation (réutilise sinon .field / .client-row / .row) ---- */
#orgSelect {
  width: 100%; margin: 0; padding: 11px 13px; font-size: 14px; font-family: inherit;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
#orgSelect:focus { outline: none; border-color: var(--prism-2); box-shadow: 0 0 0 3px #3b82f622; }

/* ---- empty state ---- */
.empty { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 40px 14px; line-height: 1.6; border: 1px dashed var(--border); border-radius: var(--r); }
.empty .glyph { font-size: 26px; opacity: 0.5; margin-bottom: 8px; }

/* ---- abonnement (Stripe Checkout) ---- */
.billing-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); border-radius: var(--r); transition: box-shadow 0.3s, background 0.3s; }
.billing-block.flash { box-shadow: 0 0 0 2px var(--prism-2); background: #11132066; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 2px; }
@media (max-width: 560px) { .plans { grid-template-columns: 1fr; } }
.plan {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  text-align: left; padding: 14px 14px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
}
.plan:hover { border-color: var(--prism-2); box-shadow: 0 0 0 2px #3b82f622; background: var(--surface); }
.plan-name { font-size: 13px; font-weight: 600; color: var(--text); }
.plan-price {
  font-size: 13px; font-weight: 600;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}

/* ---- bloc documents ---- */
.docs-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.docs { margin-top: 4px; }
.dropzone {
  display: block; cursor: pointer; border: 1px dashed var(--border-2); border-radius: var(--r);
  background: var(--surface); padding: 18px 14px; text-align: center; transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover { border-color: var(--prism-2); }
.dropzone.over { border-color: var(--prism-3); background: #0e1622; }
.dz-icon {
  font-size: 20px; margin-bottom: 6px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.dz-text { font-size: 12px; color: var(--text-3); line-height: 1.5; }

.doc-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.doc-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px;
}
.doc-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.doc-meta { font-size: 11px; color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }
.doc-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 8px; border-radius: 999px; flex: none; }
.doc-badge.rag { color: #fff; background: var(--grad); }
.doc-badge.inject { color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border-2); }
.doc-del {
  flex: none; padding: 5px 9px; font-size: 12px; line-height: 1; color: var(--text-3);
  background: none; border: 1px solid var(--border); border-radius: var(--r-sm);
}
.doc-del:hover { color: var(--err); border-color: var(--err); background: #f8717111; }

/* ---- listes lecture seule (projets / appels / relances par client) ---- */
.read-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.read-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px;
}
.read-row-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-width: 0;
}
.read-toggle {
  text-align: left; font: inherit; color: var(--text);
  background: none; border: none; padding: 0; cursor: pointer;
}
.read-title { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.read-sub { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.read-task.done .read-title { color: var(--text-3); text-decoration: line-through; }
.read-brief {
  margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2); line-height: 1.55;
}
.read-brief h1, .read-brief h2, .read-brief h3 { font-size: 13px; font-weight: 600; color: var(--text); margin: 8px 0 4px; }
.read-brief p { margin: 0 0 8px; }
.read-brief ul { margin: 0 0 8px; padding-left: 18px; }
.read-brief li { margin: 2px 0; }
.read-brief strong { color: var(--text); }
