:root {
  --bg: #070A0F;
  --bg-soft: #0C1118;
  --panel: #101720;
  --panel-2: #141D28;
  --line: #1E2A38;
  --line-soft: #172230;
  --txt: #E8EEF6;
  --muted: #8497AC;
  --dim: #5D6E82;
  --accent: #00E5A0;
  --accent-2: #38BDF8;
  --violet: #A78BFA;
  --amber: #FBBF24;
  --red: #F87171;
  --radius: 14px;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 600px at 12% -10%, #12202c 0%, transparent 55%),
    radial-gradient(900px 500px at 95% 0%, #141b2e 0%, transparent 50%), var(--bg);
  color: var(--txt);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
table { border-collapse: collapse; width: 100%; }

/* ---------- Gate / login ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: 100%; max-width: 420px; background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 20px; padding: 34px; box-shadow: var(--shadow);
}
.brandmark { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.orb {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 34px;
  background: conic-gradient(from 140deg, var(--accent), var(--accent-2), var(--violet), var(--accent));
  box-shadow: 0 0 26px -6px var(--accent);
}
.brandmark b { font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; }
.brandmark span { color: var(--dim); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; display: block; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  border-right: 1px solid var(--line); background: linear-gradient(180deg, #0A0F16, #070B10);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brandmark { padding: 0 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label { color: var(--dim); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; padding: 16px 10px 7px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 9px 10px; border-radius: 9px; color: var(--muted);
  cursor: pointer; font-size: 13px; transition: background 0.15s, color 0.15s;
}
.nav button:hover { background: #121A24; color: var(--txt); }
.nav button.on { background: linear-gradient(90deg, rgba(0, 229, 160, 0.14), rgba(0, 229, 160, 0.02)); color: var(--accent); font-weight: 600; }
.nav .ico { width: 16px; text-align: center; opacity: 0.9; }
.side-foot { margin-top: 20px; padding: 12px 10px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 11px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 14px; padding: 15px 26px; border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 15, 0.82); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
}
.top h1 { font-size: 17px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 11.5px;
}
.chip b { color: var(--txt); font-weight: 600; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot.off { background: var(--dim); box-shadow: none; }
.spacer { flex: 1; }
.view { padding: 24px 26px 60px; }

/* ---------- Controls ---------- */
select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
select { cursor: pointer; width: auto; padding-right: 26px; }
input:focus, textarea:focus, select:focus { border-color: rgba(0, 229, 160, 0.55); box-shadow: 0 0 0 3px rgba(0, 229, 160, 0.09); }
textarea { resize: vertical; min-height: 78px; }
label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; letter-spacing: 0.02em; }
.field { margin-bottom: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--txt); cursor: pointer; font-size: 13px;
  font-weight: 550; transition: transform 0.12s, background 0.15s, border-color 0.15s; white-space: nowrap;
}
.btn:hover { background: #1B2634; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #05c98d); color: #04231a; border: 0; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.danger { color: var(--red); border-color: rgba(248, 113, 113, 0.3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt { margin-top: 16px; }
.mt-s { margin-top: 9px; }

/* ---------- Cards ---------- */
.card { background: linear-gradient(180deg, rgba(20, 29, 40, 0.9), rgba(16, 23, 32, 0.92)); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; }
.card.pad-0 { padding: 0; }
.card h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13.5px; color: var(--txt); }
.card h3 .sub { color: var(--dim); font-weight: 400; font-size: 11.5px; margin-left: auto; }
.kpi { position: relative; overflow: hidden; }
.kpi .k { color: var(--muted); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.kpi .v { font-size: 27px; font-weight: 700; letter-spacing: -0.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 11.5px; color: var(--dim); }
.kpi .d.up { color: var(--accent); }
.kpi .d.down { color: var(--red); }
.kpi::after { content: ''; position: absolute; inset: 0 auto auto 0; width: 100%; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); opacity: 0.5; }
.kpi.blue::after { background: linear-gradient(90deg, var(--accent-2), transparent); }
.kpi.violet::after { background: linear-gradient(90deg, var(--violet), transparent); }
.kpi.amber::after { background: linear-gradient(90deg, var(--amber), transparent); }

/* ---------- Table ---------- */
table th { text-align: left; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
table td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
table tbody tr:hover { background: rgba(255, 255, 255, 0.017); }
table tbody tr:last-child td { border-bottom: 0; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.sm { font-size: 12px; }
.xs { font-size: 11px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.trunc { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; border: 1px solid transparent; }
.tag.green { background: rgba(0, 229, 160, 0.12); color: var(--accent); border-color: rgba(0, 229, 160, 0.25); }
.tag.blue { background: rgba(56, 189, 248, 0.12); color: var(--accent-2); border-color: rgba(56, 189, 248, 0.25); }
.tag.violet { background: rgba(167, 139, 250, 0.14); color: var(--violet); border-color: rgba(167, 139, 250, 0.28); }
.tag.amber { background: rgba(251, 191, 36, 0.12); color: var(--amber); border-color: rgba(251, 191, 36, 0.26); }
.tag.red { background: rgba(248, 113, 113, 0.12); color: var(--red); border-color: rgba(248, 113, 113, 0.26); }
.tag.grey { background: #17222e; color: var(--muted); border-color: var(--line); }

/* ---------- Kanban ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 11px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #0B1118; border: 1px solid var(--line-soft); border-radius: 12px; padding: 9px; min-height: 160px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 3px 4px 9px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.col-head b { color: var(--txt); font-size: 11.5px; }
.col-sum { font-size: 10.5px; color: var(--dim); padding: 0 4px 8px; }
.mini { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 8px; cursor: grab; transition: border-color 0.15s, transform 0.12s; }
.mini:hover { border-color: rgba(0, 229, 160, 0.4); transform: translateY(-1px); }
.mini .t { font-size: 12.5px; font-weight: 600; margin-bottom: 3px; }
.mini .v { font-size: 11.5px; color: var(--accent); font-variant-numeric: tabular-nums; }
.mini .who { font-size: 10.5px; color: var(--dim); }
.col.drag-over { border-color: rgba(0, 229, 160, 0.6); background: rgba(0, 229, 160, 0.04); }

/* ---------- Misc ---------- */
.bar { height: 6px; border-radius: 999px; background: #17222e; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.gauge { display: flex; align-items: baseline; gap: 6px; }
.gauge .big { font-size: 34px; font-weight: 750; letter-spacing: -0.03em; }
.finding { border-left: 2px solid var(--line); padding: 10px 0 10px 13px; margin-bottom: 12px; }
.finding.critique { border-color: var(--red); }
.finding.majeur { border-color: var(--amber); }
.finding.mineur { border-color: var(--accent-2); }
.finding .ft { font-size: 13px; font-weight: 620; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.finding .fd { font-size: 12px; color: var(--muted); margin-top: 3px; }
.finding .fx { font-size: 12px; color: var(--accent); margin-top: 5px; }
.code { background: #060A0E; border: 1px solid var(--line); border-radius: 10px; padding: 13px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11.5px; color: #B9C9DA; overflow-x: auto; white-space: pre; line-height: 1.6; max-height: 340px; }
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 11px 15px; border-radius: 9px; font-size: 12.5px; box-shadow: var(--shadow); animation: in 0.22s ease both; max-width: 340px; }
.toast.err { border-left-color: var(--red); }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }
.spin { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); border-radius: 50%; animation: sp 0.7s linear infinite; display: inline-block; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 34px 16px; color: var(--dim); font-size: 13px; }
.split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: start; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 15px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 13px; color: var(--muted); cursor: pointer; font-size: 13px; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.hook { background: #0D141B; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; display: flex; gap: 10px; align-items: flex-start; }
.hook .fw { color: var(--violet); font-size: 10px; margin-left: auto; text-align: right; flex: 0 0 118px; }
.scene { display: grid; grid-template-columns: 74px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.scene .tm { color: var(--accent); font-family: ui-monospace, monospace; font-size: 11.5px; }
.scene .sh { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 236px; transform: translateX(-100%); transition: transform 0.25s; z-index: 60; }
  .side.open { transform: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .view { padding: 18px 15px 60px; }
  .top { padding: 12px 15px; }
}
