/* Trax Protect · tableau de bord — thème violet/noir */
:root {
  color-scheme: dark;
  --bg: #07050c; --bg2: #0b0714; --panel: #120b1f; --panel2: #170f28; --line: #251733; --line2: #392448;
  --text: #f1ebfb; --muted: #9a8bb8; --accent: #8b5cf6; --accent2: #d946ef;
  --ok: #34d399; --warn: #fbbf24; --danger: #f87171; --soft: #b6a6d6;
  --grad: linear-gradient(135deg, #8b5cf6, #d946ef);
  --radius: 14px; --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 15px/1.55 var(--font);
  background: radial-gradient(1100px 550px at 85% -10%, rgba(139, 92, 246, .22), transparent 60%), radial-gradient(900px 450px at -10% 110%, rgba(217, 70, 239, .12), transparent 60%), var(--bg);
  background-attachment: fixed; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; } h2 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--accent2); text-decoration: none; } a:hover { text-decoration: underline; }
code { font: 600 .86rem ui-monospace, SFMono-Regular, Menlo, monospace; background: rgba(139, 92, 246, .16); color: #e9d5ff; padding: 3px 8px; border-radius: 7px; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .grow { flex: 1; min-width: 0; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ---------- Coquille ---------- */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px 22px; display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, rgba(18, 11, 31, .94), rgba(7, 5, 12, .97)); border-right: 1px solid var(--line); scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; }
.brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 0 0 2px rgba(139, 92, 246, .5); }
.guild-pick { width: 100%; }
.navs { display: grid; gap: 14px; }
.nav-group { display: grid; gap: 2px; }
.nav-title { padding: 8px 10px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #6c5c8c; }
nav { display: grid; gap: 2px; }
nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--soft); font: inherit; font-size: .92rem; cursor: pointer; transition: background .15s, color .15s;
}
nav button:hover { background: rgba(190, 163, 230, .1); color: var(--text); }
nav button[aria-current="page"] { background: linear-gradient(90deg, rgba(139, 92, 246, .3), rgba(217, 70, 239, .1)); color: #fff; box-shadow: inset 2px 0 0 var(--accent2); }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.who img { width: 28px; height: 28px; border-radius: 50%; } .who span { flex: 1; font-weight: 600; } .who a { color: var(--muted); font-size: .82rem; }
main { padding: 30px clamp(16px, 3.5vw, 44px) 80px; max-width: 1180px; width: 100%; }
.page-head { margin-bottom: 22px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.page-head h1 { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stack { display: grid; gap: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }

/* ---------- Panneaux ---------- */
.panel { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 14px; box-shadow: var(--shadow); align-content: start; }
.panel > h2 { display: flex; align-items: center; gap: 10px; }
.panel[data-tone] > h2::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: var(--tone, var(--accent)); }
.panel[data-tone="red"] { --tone: #f87171; } .panel[data-tone="blue"] { --tone: #e879f9; } .panel[data-tone="violet"] { --tone: #c4b5fd; }
.panel.intro { grid-template-columns: minmax(0, 1fr); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.toolbar input[type="search"] { flex: 1 1 240px; max-width: 360px; }
.empty { padding: 26px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: 12px; }

/* ---------- Statistiques ---------- */
.posture-top { display: flex; align-items: baseline; gap: 12px; } .posture-top strong { font-size: 2.3rem; letter-spacing: -.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.strip { display: flex; gap: 4px; } .strip i { flex: 1; height: 8px; border-radius: 4px; background: #231530; } .strip i.on { background: var(--grad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { display: grid; gap: 2px; padding: 14px; background: rgba(10, 6, 18, .6); border: 1px solid var(--line); border-radius: 12px; }
.stat b { font-size: 1.5rem; letter-spacing: -.02em; }

/* ---------- Listes ---------- */
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: rgba(10, 6, 18, .55); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, background .15s; }
.item:hover { border-color: var(--line2); background: rgba(23, 15, 40, .75); }
.item img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.item.cmd .top { margin-bottom: 3px; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: #231530; color: var(--soft); font-size: .76rem; font-weight: 700; white-space: nowrap; }
.badge.ok { background: rgba(52, 211, 153, .14); color: var(--ok); } .badge.hot { background: rgba(248, 113, 113, .16); color: var(--danger); }

/* ---------- Lignes de réglage ---------- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.panel > .row:first-of-type { border-top: 0; }
.name { font-weight: 650; }

/* ---------- Formulaires ---------- */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.f { display: grid; gap: 6px; font-size: .86rem; font-weight: 600; color: #cabde8; }
.f .muted { font-weight: 400; }
input[type="text"], input[type="number"], input[type="url"], input[type="search"], input[type="password"], select, textarea {
  width: 100%; padding: 10px 12px; color: var(--text); font: inherit; font-weight: 400; background: #0d0816; border: 1px solid var(--line2); border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #4c3566; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .28); }
textarea { min-height: 110px; resize: vertical; } select[multiple] { padding: 6px; }
input[readonly] { color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; } .inline-form input { flex: 1 1 180px; width: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 0; border-radius: 10px; font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; color: #fff;
  background: var(--grad); box-shadow: 0 6px 18px rgba(139, 92, 246, .38); transition: transform .12s, filter .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); text-decoration: none; } .btn:active { transform: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.btn.ghost { background: rgba(190, 163, 230, .1); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); } .btn.ghost:hover { background: rgba(190, 163, 230, .18); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #f97316); box-shadow: 0 6px 18px rgba(239, 68, 68, .3); }
.btn.sm { padding: 6px 12px; font-size: .82rem; }

/* Interrupteur */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #2b1d3f; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .4); transition: transform .2s; }
.switch input:checked + span { background: var(--grad); } .switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled { cursor: not-allowed; } .switch input:disabled + span { opacity: .55; }
.switch input:focus-visible + span { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* Segments, puces */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: #0d0816; border: 1px solid var(--line2); border-radius: 11px; }
.seg button { padding: 6px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--grad); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--soft); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: #5d3f85; color: var(--text); }
.chip[aria-pressed="true"] { color: #fff; border-color: transparent; background: #6d4aa8; }
.chip.warn[aria-pressed="true"] { background: #b45309; } .chip.danger[aria-pressed="true"] { background: #b91c1c; } .chip.soft[aria-pressed="true"] { background: #8b5cf6; }

/* Images */
.preview { min-height: 120px; display: grid; place-items: center; padding: 10px; border: 1px dashed var(--line2); border-radius: 12px; background: rgba(10, 6, 18, .55); overflow: hidden; }
.preview img { max-width: 100%; max-height: 280px; border-radius: 8px; }
.dropzone { display: grid; place-items: center; padding: 22px; text-align: center; color: var(--muted); border: 2px dashed var(--line2); border-radius: 12px; cursor: pointer; transition: all .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent2); color: var(--text); background: rgba(217, 70, 239, .08); }

/* ---------- Protections à paliers ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; align-items: start; }
.pcard { display: grid; gap: 12px; padding: 16px; background: rgba(10, 6, 18, .6); border: 1px solid var(--line); border-radius: 13px; transition: border-color .15s, opacity .15s; }
.pcard:hover, .pcard.open { border-color: var(--line2); } .pcard.open { grid-column: 1 / -1; background: rgba(16, 10, 27, .92); }
.pcard.off .ladder, .pcard.off .pcard-head .muted { opacity: .45; }
.pcard-head { display: flex; align-items: flex-start; gap: 14px; }
.ladder { display: flex; flex-wrap: wrap; gap: 6px; }
.rung { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: .78rem; border-radius: 8px; background: #1f1430; color: #d9cdf0; border: 1px solid var(--line); }
.rung b { color: var(--accent2); font-weight: 800; } .rung.win { background: transparent; border-style: dashed; color: var(--muted); }
.pcard-foot { display: flex; justify-content: flex-end; }
.peditor { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.tiers { display: grid; gap: 10px; }
.tier { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.tier-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--grad); color: #fff; }
.tier-body { display: grid; gap: 10px; min-width: 0; }
.tier-top { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; } .tier-top .btn { margin-left: auto; }
.with-unit { display: flex; align-items: center; gap: 8px; } .with-unit input { width: 96px; } .with-unit em { font-style: normal; color: var(--muted); font-weight: 400; }
.dur { display: flex; gap: 8px; } .dur input { width: 96px; } .dur select { width: auto; min-width: 110px; }
.hint { padding: 10px 12px; border-radius: 10px; font-size: .86rem; color: #d9cdf0; background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .3); }
.hint.err { color: #fecaca; background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .35); }

/* ---------- Notifications ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 50; }
.toast { padding: 12px 16px; max-width: 360px; background: #190f28; border: 1px solid var(--line2); border-left: 4px solid var(--ok); border-radius: 10px; box-shadow: var(--shadow); animation: pop .22s ease; }
.toast.err { border-left-color: var(--danger); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Connexion ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(139, 92, 246, .35), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(217, 70, 239, .18), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(139, 92, 246, .14), transparent 60%),
    var(--bg);
}
.login::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(139, 92, 246, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(139, 92, 246, .07) 1px, transparent 1px);
  background-size: 42px 42px; mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent);
}
.login-wordmark { position: relative; display: flex; align-items: baseline; gap: 2px; font-weight: 900; font-size: clamp(2.1rem, 5vw, 3rem); letter-spacing: -.03em; }
.login-wordmark .t1 { color: #fff; } .login-wordmark .t2 { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-tagline { position: relative; margin-top: -6px; font-size: .78rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--soft); }
.login-card {
  position: relative; width: min(100%, 440px); display: grid; gap: 18px; justify-items: center; text-align: center; padding: 44px 34px;
  background: linear-gradient(180deg, rgba(23, 15, 40, .9), rgba(10, 6, 18, .92)); backdrop-filter: blur(6px);
  border: 1px solid var(--line2); border-radius: 22px; box-shadow: 0 30px 90px rgba(0, 0, 0, .55), 0 0 60px rgba(139, 92, 246, .12);
}
.login-card .shield { width: 76px; height: 76px; filter: drop-shadow(0 10px 26px rgba(139, 92, 246, .55)); }
.login-card .btn { width: 100%; font-size: .98rem; padding: 13px 18px; }
.login-foot { position: relative; margin-top: 18px; color: var(--muted); font-size: .8rem; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; gap: 10px; }
  .navs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .navs::-webkit-scrollbar { display: none; }
  .nav-group, .nav-group nav { display: contents; } .nav-title { display: none; }
  nav button { width: auto; flex: none; white-space: nowrap; background: rgba(190, 163, 230, .08); }
  .who { margin-top: 0; }
  main { padding: 20px 14px 70px; }
  .pcard.open { grid-column: auto; }
  .tier { grid-template-columns: 1fr; } .tier-num { display: none; }
  .tier-top .btn { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- Confort de configuration ---------- */
.panel.dirty { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(139, 92, 246, .35), var(--shadow); }
.panel.dirty > h2::after { content: "● Modifié"; margin-left: 10px; padding: 2px 9px; font-size: .72rem; font-weight: 700; color: #fff; background: var(--grad); border-radius: 999px; vertical-align: middle; }
.savebar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; max-width: calc(100vw - 24px); background: rgba(18, 11, 31, .96); border: 1px solid var(--accent); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .55); backdrop-filter: blur(8px); font-size: .9rem; font-weight: 600; animation: savebar-in .18s ease-out; }
.savebar[hidden] { display: none; }
@keyframes savebar-in { from { opacity: 0; transform: translate(-50%, 10px); } }
body.has-savebar main { padding-bottom: 96px; }
@media (max-width: 640px) { .savebar { left: 12px; right: 12px; transform: none; justify-content: space-between; } @keyframes savebar-in { from { opacity: 0; } } }
