:root {
  --bg: #0a0f1d;
  --bg2: #0e1528;
  --panel: #121b31;
  --panel2: #172240;
  --line: #22304f;
  --line2: #2c3d63;
  --text: #f3ecdf;
  --muted: #8f9bb8;
  --dim: #5f6d8f;
  --fox: #ff7a3d;
  --fox2: #ffb347;
  --cream: #f6e7c8;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --violet: #a78bfa;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(0,0,0,.6);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 'Plus Jakarta Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { background:
  radial-gradient(1200px 600px at 85% -10%, rgba(255,122,61,.10), transparent 60%),
  radial-gradient(900px 500px at -10% 110%, rgba(96,165,250,.08), transparent 60%), var(--bg); min-height: 100vh; }
a { color: var(--fox2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; outline: none; transition: border .15s; }
input:focus, textarea:focus, select:focus { border-color: var(--fox); }
textarea { resize: vertical; width: 100%; }
.mono { font-family: 'JetBrains Mono', monospace; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(18,27,49,.85), rgba(10,15,29,.85)); backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand .logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; background: linear-gradient(135deg, var(--fox), var(--fox2)); box-shadow: 0 8px 24px -6px rgba(255,122,61,.6); }
.brand b { display: block; font-size: 16px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-weight: 600; text-decoration: none; transition: all .15s; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.on { background: linear-gradient(90deg, rgba(255,122,61,.18), rgba(255,122,61,.03)); color: var(--text); box-shadow: inset 3px 0 0 var(--fox); }
.nav .ico { width: 20px; text-align: center; font-size: 16px; }
.nav .badge { margin-left: auto; background: var(--fox); color: #1a0d05; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 99px; }
.side .foot { margin-top: auto; padding: 14px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.main { padding: 26px 34px 60px; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 800; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.pill .dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.pill .dot.bad { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.pill .dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.pill.demo { color: #1a0d05; background: var(--fox2); border-color: var(--fox2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 650; transition: all .15s; white-space: nowrap; }
.btn:hover { border-color: var(--fox); transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--fox), #ff9a4d); border: 0; color: #1d0e04; box-shadow: 0 8px 22px -8px rgba(255,122,61,.7); }
.btn.ok { background: rgba(52,211,153,.14); border-color: rgba(52,211,153,.4); color: var(--ok); }
.btn.bad { background: rgba(248,113,113,.10); border-color: rgba(248,113,113,.35); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 18px; }
.g-hero { grid-template-columns: 300px 1fr; }
.g-kpi { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: 1.6fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2e { grid-template-columns: 1fr 1fr; }
.card { background: linear-gradient(180deg, rgba(23,34,64,.7), rgba(18,27,49,.7)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; position: relative; overflow: hidden; }
.card h3 { margin: 0 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card h3 .right { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; }
.mt { margin-top: 18px; }

.kpi { padding: 18px 20px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .val { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }
.kpi .val small { font-size: 15px; color: var(--muted); font-weight: 600; }
.kpi .delta { font-size: 12px; font-weight: 700; }
.bar { height: 7px; border-radius: 99px; background: var(--bg2); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--fox), var(--fox2)); transition: width .6s; }
.bar.ok > i { background: linear-gradient(90deg, #10b981, var(--ok)); }
.bar.warn > i { background: linear-gradient(90deg, #f59e0b, var(--warn)); }
.bar.bad > i { background: linear-gradient(90deg, #ef4444, var(--bad)); }

/* Score */
.score-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background:
  radial-gradient(circle at 50% 35%, rgba(255,122,61,.18), transparent 60%), linear-gradient(180deg, rgba(23,34,64,.8), rgba(18,27,49,.8)); }
.gauge { position: relative; width: 190px; height: 190px; }
.gauge svg { transform: rotate(-90deg); }
.gauge .center { position: absolute; inset: 0; display: grid; place-content: center; }
.gauge .num { font-size: 54px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.gauge .of { color: var(--muted); font-size: 13px; font-weight: 600; }
.score-card .grade { margin-top: 10px; font-weight: 700; }
.score-card .when { color: var(--dim); font-size: 12px; margin-top: 4px; }

/* Lists */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.click { cursor: pointer; border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.row.click:hover { background: rgba(255,255,255,.03); }
.ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 15px; background: var(--panel2); border: 1px solid var(--line); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.tag.done, .tag.applied, .tag.faible { background: rgba(52,211,153,.12); color: var(--ok); border-color: rgba(52,211,153,.25); }
.tag.running { background: rgba(96,165,250,.14); color: var(--info); border-color: rgba(96,165,250,.3); }
.tag.queued, .tag.proposed, .tag.moyen { background: rgba(251,191,36,.12); color: var(--warn); border-color: rgba(251,191,36,.25); }
.tag.failed, .tag.critique { background: rgba(248,113,113,.12); color: var(--bad); border-color: rgba(248,113,113,.28); }
.tag.important { background: rgba(255,122,61,.13); color: var(--fox2); border-color: rgba(255,122,61,.3); }
.tag.cancelled, .tag.rejected, .tag.reverted { background: rgba(143,155,184,.12); color: var(--muted); border-color: rgba(143,155,184,.25); }
.tag.src { background: var(--bg2); color: var(--dim); border-color: var(--line); }
.tag.running::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--info); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* Charts */
.chart { width: 100%; height: 220px; display: block; }
.chart text { fill: var(--dim); font-size: 10.5px; font-family: 'Plus Jakarta Sans'; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 1fr 120px 46px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.hbar .bar { margin: 0; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }

/* Log */
.log { font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.7; background: #070b16; border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: 360px; overflow: auto; white-space: pre-wrap; color: #c9d3ea; }
.live { display: flex; align-items: center; gap: 10px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--fox); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--dim); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 10px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: var(--panel); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: rgba(255,255,255,.025); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Filters / tabs */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 9px; font-weight: 650; }
.tabs button.on { background: var(--panel2); color: var(--text); box-shadow: 0 2px 10px -4px rgba(0,0,0,.5); }
.tabs button .n { margin-left: 6px; font-size: 11px; color: var(--fox2); }

/* Changes */
.change { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(14,21,40,.6); margin-bottom: 12px; transition: border .15s; }
.change:hover { border-color: var(--line2); }
.change.sel { border-color: var(--fox); box-shadow: 0 0 0 1px var(--fox) inset; }
.change .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.change .head .title { font-weight: 750; font-size: 15px; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.diff .side-b, .diff .side-a { border-radius: 11px; padding: 12px 14px; font-size: 13px; }
.diff .side-b { background: rgba(248,113,113,.06); border: 1px dashed rgba(248,113,113,.25); }
.diff .side-a { background: rgba(52,211,153,.06); border: 1px solid rgba(52,211,153,.25); }
.diff .lab { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; margin-bottom: 6px; display: flex; gap: 8px; }
.diff .side-b .lab { color: var(--bad); } .diff .side-a .lab { color: var(--ok); }
.diff .k { color: var(--dim); font-size: 11.5px; font-weight: 700; margin-top: 6px; }
.diff .v { word-break: break-word; }
.diff .v.none { color: var(--dim); font-style: italic; }
.cnt { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 6px; margin-left: 6px; }
.cnt.good { background: rgba(52,211,153,.15); color: var(--ok); } .cnt.badc { background: rgba(248,113,113,.15); color: var(--bad); }
.serp { margin-top: 12px; background: #fff; border-radius: 11px; padding: 12px 16px; color: #202124; font-family: Arial, sans-serif; }
.serp .u { font-size: 12px; color: #4d5156; }
.serp .tt { font-size: 18px; color: #1a0dab; line-height: 1.3; margin: 2px 0; }
.serp .dd { font-size: 13px; color: #4d5156; line-height: 1.5; }
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.chk { width: 18px; height: 18px; accent-color: var(--fox); }

/* Modal / drawer */
.overlay { position: fixed; inset: 0; background: rgba(4,7,15,.7); backdrop-filter: blur(4px); z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 6vh 16px; animation: fade .15s; }
.overlay.right { justify-content: flex-end; padding: 0; align-items: stretch; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(680px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 20px; padding: 26px; box-shadow: 0 30px 80px -20px #000; }
.drawer { width: min(720px, 100%); background: var(--panel); border-left: 1px solid var(--line2); padding: 26px; overflow: auto; animation: slide .2s; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.modal h2, .drawer h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.02em; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice { border: 1px solid var(--line2); background: var(--bg2); border-radius: 12px; padding: 12px; cursor: pointer; transition: all .15s; }
.choice:hover { border-color: var(--fox); }
.choice.on { border-color: var(--fox); background: rgba(255,122,61,.08); }
.choice b { display: block; } .choice small { color: var(--muted); font-size: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.presets button { border: 1px solid var(--line2); background: transparent; color: var(--muted); padding: 5px 10px; border-radius: 99px; font-size: 12px; }
.presets button:hover { color: var(--text); border-color: var(--fox); }
.switch { position: relative; width: 44px; height: 24px; border-radius: 99px; background: var(--line2); border: 0; padding: 0; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--fox); } .switch.on::after { transform: translateX(20px); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--bg2); color: var(--muted); padding: 7px 14px; font-weight: 650; }
.seg button.on { background: var(--fox); color: #1d0e04; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* Toasts */
#toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 99; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--ok); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: 380px; animation: slide .2s; }
.toast.err { border-left-color: var(--bad); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: min(400px, 100%); text-align: center; }
.login .logo { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 22px; display: grid; place-items: center; font-size: 40px; background: linear-gradient(135deg, var(--fox), var(--fox2)); box-shadow: 0 20px 50px -12px rgba(255,122,61,.7); }
.login input { width: 100%; margin: 18px 0 12px; padding: 13px 16px; }
.login .btn { width: 100%; justify-content: center; padding: 12px; }

.hero-line { display: flex; gap: 10px; align-items: baseline; }
.callout { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 14px; background: linear-gradient(90deg, rgba(255,122,61,.14), rgba(255,122,61,.03)); border: 1px solid rgba(255,122,61,.35); margin-bottom: 18px; }
.callout .big { font-size: 26px; }

@media (max-width: 1200px) { .g-hero, .g-2 { grid-template-columns: 1fr; } .g-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 12px; }
  .brand, .side .foot { display: none; }
  .nav { display: flex; gap: 4px; } .nav a { white-space: nowrap; }
  .main { padding: 18px 14px; }
  .g-kpi, .g-3, .g-2e, .diff, .choices { grid-template-columns: 1fr; }
}
