/* Le Ministère — hub interne du duo (Assemblée). Dashboard sobre et lisible. */

:root {
  --bg: #f5f5f6;
  --panel: #ffffff;
  --ink: #20242e;
  --soft: #6c7079;
  --faint: #9a9ea7;
  --line: #e7e7ea;
  --accent: #b3392c;
  --accent-soft: #f8ece9;
  --ok: #2e7d4f;
  --blue: #2f4a86;
  --gold: #9a7818;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20,24,30,.04), 0 1px 3px rgba(20,24,30,.05);
  --sans: -apple-system, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Iowan Old Style", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 244px; flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 18px 14px;
}
.brand { padding: 6px 10px 16px; }
.brand .name { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.brand .tag { font-size: 12px; color: var(--soft); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--sans); font-size: 14px;
  width: 100%; text-align: left;
  background: none; border: 0; cursor: pointer;
  color: var(--soft);
  padding: 9px 11px; border-radius: 8px;
}
.nav button svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; }
.nav button:hover { background: var(--bg); color: var(--ink); }
.nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.members { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.member { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }
.avatar.val { background: var(--blue); }
.avatar.quentin { background: var(--accent); }
.member .who-name { font-size: 13px; font-weight: 600; }
.member .who-role { font-size: 11px; color: var(--soft); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: rgba(245,245,246,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 18px 30px;
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; }
.topbar p { margin: 2px 0 0; font-size: 13px; color: var(--soft); }

.content { padding: 26px 30px 70px; max-width: 980px; }
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- Cartes ---------- */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card h3 { margin: 0 0 12px; font-size: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h3 { margin: 0; }

.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.mb { margin-bottom: 16px; }

/* ---------- Accueil ---------- */
.banner {
  background: linear-gradient(135deg, #23262f, #2f3340);
  color: #fff; border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow);
}
.banner .pill { display: inline-block; background: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; }
.banner h2 { font-family: var(--serif); font-size: 22px; margin: 12px 0 6px; }
.banner p { margin: 0; color: #cfd2da; max-width: 62ch; font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .num { font-size: 26px; font-weight: 700; font-family: var(--serif); }
.stat .lbl { font-size: 13px; color: var(--soft); margin-top: 2px; }

.list-clean { margin: 0; padding: 0; list-style: none; }
.list-clean li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.list-clean li:first-child { border-top: 0; }

.links { display: flex; flex-wrap: wrap; gap: 10px; }
.links a {
  font-size: 13px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; background: var(--panel);
}
.links a:hover { border-color: var(--ink); }
.links a.disabled { color: var(--faint); pointer-events: none; }

/* ---------- Atelier (événements) ---------- */
.ev-card { margin-bottom: 16px; }
.ev-top { display: flex; gap: 8px; margin-bottom: 8px; }
.chip { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 2px 9px; border-radius: 20px; }
.chip.scandale { background: var(--accent-soft); color: var(--accent); }
.chip.gaffe { background: #f7f0db; color: var(--gold); }
.chip.crise { background: #e9eef8; color: var(--blue); }
.chip.statut { background: var(--bg); color: var(--soft); }
.ev-brut { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 0 0 14px; }
.ev-spin { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.ev-spin .choix { font-size: 13px; font-weight: 600; color: var(--blue); }
.ev-spin .une { font-family: var(--serif); font-style: italic; font-size: 15px; }
.ev-spin .effet { display: block; font-style: normal; font-family: var(--sans); font-size: 12px; color: var(--soft); margin-top: 3px; }
.ev-note { font-size: 13px; color: var(--soft); margin-top: 12px; }

/* ---------- Roadmap ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kcol { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.kcol > h3 { font-size: 13px; margin: 0 0 12px; display: flex; align-items: center; gap: 7px; }
.kcol > h3 .dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.en_cours { background: var(--accent); }
.dot.idee { background: var(--gold); }
.dot.fait { background: var(--ok); }
.task-card { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; margin-bottom: 10px; }
.task-card:last-child { margin-bottom: 0; }
.task-title { font-size: 14px; font-weight: 500; }
.task-note { font-size: 12px; color: var(--soft); margin-top: 4px; }
.task-who { font-size: 11px; color: var(--soft); margin-top: 6px; }

/* ---------- Décisions ---------- */
.dec-card { margin-bottom: 14px; }
.dec-date { font-size: 12px; color: var(--soft); }
.dec-title { font-family: var(--serif); font-size: 18px; margin: 3px 0 8px; }
.dec-choix { font-size: 14px; margin: 0 0 8px; }
.dec-why { font-size: 13px; color: var(--soft); margin: 0; }
.dec-why b { color: var(--ink); }

/* ---------- vides ---------- */
.empty { color: var(--soft); font-size: 14px; text-align: center; padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); }

/* ---------- boutons ---------- */
.btn {
  font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 8px; padding: 8px 13px;
}
.btn:hover { border-color: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #9c2f24; border-color: #9c2f24; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.toolbar .right { display: flex; gap: 6px; }

/* contrôles édition par carte (discrets, révélés au survol) */
.row-actions {
  position: absolute; top: 12px; right: 12px;
  display: flex; gap: 2px; opacity: 0; transition: opacity .15s;
}
.card:hover .row-actions, .task-card:hover .row-actions { opacity: 1; }
.icon-btn {
  width: 28px; height: 28px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 7px;
  cursor: pointer; color: var(--soft);
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; }

.task-card { position: relative; }
.task-card .row-actions { top: 8px; right: 8px; }
.task-card .icon-btn { width: 24px; height: 24px; }

/* marqueur "ça fait marrer" */
.fun-btn {
  margin-left: auto; font: inherit; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--soft);
  border-radius: 20px; padding: 3px 11px;
}
.fun-btn:hover { border-color: var(--soft); }
.fun-btn.yes { background: #e9f6ee; border-color: #bfe2cd; color: var(--ok); }
.fun-btn.meh { background: #fdf3e6; border-color: #f0dcae; color: var(--gold); }

/* bouton + Tâche en bas de colonne */
.kcol-add {
  width: 100%; margin-top: 4px; cursor: pointer;
  border: 1px dashed var(--line); background: transparent; color: var(--soft);
  border-radius: 8px; padding: 8px; font: inherit; font-size: 13px;
}
.kcol-add:hover { color: var(--ink); border-color: var(--soft); }

/* ---------- roadmap graphe (façon Obsidian) ---------- */
.river-legend { display: inline-flex; gap: 14px; align-items: center; font-size: 12px; color: var(--soft); }
.river-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.river-legend .lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.river-legend .lg.val { background: var(--blue); }
.river-legend .lg.quentin { background: var(--accent); }
.river-legend .lg.duo { background: var(--ok); }
.graph-hint { font-size: 12px; color: var(--faint); margin-right: 4px; }
.toolbar .right { align-items: center; }

.graph-card { padding: 0; overflow: hidden; }
.graph-svg {
  display: block; width: 100%; height: 560px;
  background: radial-gradient(circle at 50% 42%, #fbfaf7, #efece5);
  touch-action: none; cursor: grab;
}
.graph-svg:active { cursor: grabbing; }

.edge { stroke: #c8ccd3; stroke-width: 1.5; }
.edge.locked { stroke: #dde0e5; stroke-dasharray: 4 5; }

.gnode { cursor: pointer; }
.gcircle { stroke-width: 3; transition: stroke-width .1s ease; }
.gcircle.todo { stroke-dasharray: 3.5 3.5; }
.gcircle.active { stroke-width: 4; }
.gnode:hover .gcircle { stroke-width: 5; }
.gcircle-trunk { fill: var(--ink); }
.glabel { font-family: var(--sans); font-size: 12px; fill: var(--ink); pointer-events: none; }
.glabel-trunk { fill: #fff; font-family: var(--serif); font-size: 12px; font-weight: 700; pointer-events: none; }

/* survol : on isole le nœud et ses voisins (façon Obsidian) */
.graph-svg.dim .gnode { opacity: .22; transition: opacity .12s; }
.graph-svg.dim .gnode.hl { opacity: 1; }
.graph-svg.dim .edge { opacity: .12; }
.graph-svg.dim .edge.hl { opacity: 1; }

/* bouton + (greffer) révélé au survol */
.gadd { opacity: 0; transition: opacity .12s ease; cursor: pointer; }
.gnode:hover .gadd { opacity: 1; }
.gadd-bg { fill: #fff; stroke: var(--line); stroke-width: 1.2; }
.gadd:hover .gadd-bg { stroke: var(--accent); }
.gadd-plus { stroke: var(--soft); stroke-width: 1.8; }
.gadd:hover .gadd-plus { stroke: var(--accent); }
.graph-hint-text { fill: var(--faint); font-size: 13px; font-family: var(--sans); }

/* bouton supprimer dans la modale */
.btn.ghost.danger { color: var(--accent); }
.foot-spacer { flex: 1; }

/* ---------- section Game design ---------- */
.gd-h { font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 26px 0 4px; }
.gd-h:first-child { margin-top: 0; }
.gd-lead { color: var(--soft); font-size: 14px; margin: 0 0 16px; }

.gd-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.gd-step { display: flex; gap: 14px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.gd-step.vigilance { border-color: #e6c9a8; background: #fdf6ec; }
.gd-num { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; }
.gd-step-title { font-weight: 600; font-size: 15px; }
.gd-step-text { color: var(--soft); font-size: 14px; margin-top: 2px; }
.gd-vig { margin-top: 8px; font-size: 13px; color: var(--accent); }

.book-card { color: var(--ink); }
.book-role { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.book-title { font-family: var(--serif); font-size: 18px; font-weight: 700; margin: 3px 0 2px; }
.book-meta { font-size: 13px; color: var(--soft); }
.book-essence { font-size: 14px; margin-top: 8px; }

.gd-libstats { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 16px; }
.gd-libstat .num { font-family: var(--serif); font-size: 26px; font-weight: 700; }
.gd-libstat .lbl { font-size: 13px; color: var(--soft); }
.gd-sublabel { font-size: 12px; color: var(--soft); text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 8px; }
.fam-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.fam-chip { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line); color: var(--soft); }
.fam-chip.game { background: var(--accent-soft); border-color: #ecd5d0; color: var(--accent); }
.gd-note { font-size: 12px; color: var(--faint); }

/* ---------- modale ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 14px;
  width: min(560px, 92vw);
  box-shadow: 0 24px 70px rgba(20,24,30,.3);
  color: var(--ink);
}
dialog.modal::backdrop { background: rgba(20,24,30,.42); backdrop-filter: blur(2px); }
.modal-form { display: flex; flex-direction: column; }
.modal-title { margin: 0; padding: 18px 20px; border-bottom: 1px solid var(--line); font-size: 16px; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; max-height: 68vh; overflow: auto; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; color: var(--soft); font-weight: 600; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); width: 100%;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* éditeur de spins dans la modale */
.spins-editor { display: flex; flex-direction: column; gap: 10px; }
.spin-edit { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 10px 10px; display: flex; flex-direction: column; gap: 7px; }
.spin-edit .si { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); }
.spin-edit .si:focus { outline: none; border-color: var(--accent); }
.spin-remove { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: transparent; color: var(--faint); cursor: pointer; }
.spin-remove:hover { color: var(--accent); }
.spin-remove svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.add-spin { align-self: flex-start; cursor: pointer; border: 1px dashed var(--line); background: transparent; color: var(--soft); border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 13px; }
.add-spin:hover { color: var(--ink); border-color: var(--soft); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; gap: 6px; overflow-x: auto; padding: 10px; }
  .brand { padding: 0 12px 0 4px; white-space: nowrap; }
  .nav { flex-direction: row; }
  .nav button span { display: none; }
  .members { display: none; }
  .cols-2, .cols-3, .stats, .kanban { grid-template-columns: 1fr; }
  .ev-spin { grid-template-columns: 1fr; }
  .content { padding: 20px; }
}
