:root {
  --bg: #0b0916;
  --bg2: #120f22;
  --glass: rgba(255, 255, 255, .045);
  --glass2: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .09);
  --text: #eeeaf8;
  --muted: #9c95b8;
  --accent: #8b5cf6;
  --accent2: #c084fc;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --r: 18px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Space Grotesk', var(--font);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 10% -10%, rgba(139, 92, 246, .22), transparent 60%),
    radial-gradient(700px 500px at 110% 10%, rgba(192, 132, 252, .12), transparent 60%);
  background-attachment: fixed;
  font-size: 15px; line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent2); text-decoration: none; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  border-right: 1px solid var(--line); background: rgba(10, 8, 20, .55); backdrop-filter: blur(18px);
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 22px rgba(139, 92, 246, .45);
}
.brand b { font-family: var(--display); font-size: 17px; display: block; }
.brand span { font-size: 12px; color: var(--muted); }
.nav {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--muted); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav svg { width: 20px; height: 20px; flex: none; }
.nav:hover { background: var(--glass); color: var(--text); }
.nav.on { background: rgba(139, 92, 246, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .3); }
.side .grow { flex: 1; }
.status-pill { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 10px 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); flex: none; }
.dot.bad { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }

main { padding: 28px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { font-size: 28px; }
.head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Mobile ---------- */
.tabbar { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding: 18px 16px 96px; }
  .head h1 { font-size: 24px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(12, 10, 24, .88); backdrop-filter: blur(18px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar .nav { flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 2px; text-align: center; justify-content: center; }
}

/* ---------- Éléments ---------- */
.card {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r); padding: 18px;
  backdrop-filter: blur(12px);
}
.card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass2); padding: 9px 14px; cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s; color: var(--text);
}
.btn:hover { background: rgba(255, 255, 255, .12); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #a855f7); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(139, 92, 246, .35); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .3); }
.btn.ghost { background: none; border-color: transparent; }
.btn.icon { padding: 9px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.input {
  width: 100%; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .2); }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.chip {
  border: 1px solid var(--line); background: var(--glass); border-radius: 999px; padding: 6px 13px; font-size: 13px; cursor: pointer;
  color: var(--muted); white-space: nowrap; transition: all .15s;
}
.chip:hover { color: var(--text); }
.chip.on { background: rgba(139, 92, 246, .2); border-color: rgba(139, 92, 246, .45); color: #fff; }
.chip .n { opacity: .6; margin-left: 4px; font-size: 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, .14); cursor: pointer; transition: .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

.bar { height: 8px; background: rgba(255, 255, 255, .08); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }
.bar.multi { display: flex; }
.bar.multi i { border-radius: 0; }

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

/* ---------- Accueil ---------- */
.stat .v { font-family: var(--display); font-size: 28px; font-weight: 600; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; font-size: 19px; background: var(--glass2); }
.battery { display: flex; align-items: center; gap: 16px; }
.battery .cell { position: relative; width: 64px; height: 30px; border: 2px solid rgba(255, 255, 255, .5); border-radius: 7px; padding: 2px; }
.battery .cell::after { content: ''; position: absolute; right: -6px; top: 8px; width: 4px; height: 10px; border-radius: 0 3px 3px 0; background: rgba(255, 255, 255, .5); }
.battery .cell i { display: block; height: 100%; border-radius: 4px; background: var(--ok); }
.addr { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .22); margin-bottom: 8px; font-family: ui-monospace, monospace; font-size: 13.5px; }
.addr a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.spark i { flex: 1; background: linear-gradient(to top, rgba(139, 92, 246, .45), var(--accent2)); border-radius: 3px 3px 0 0; min-height: 2px; }
.tip { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .22); font-size: 13.5px; margin-bottom: 14px; }
.tip.info { background: rgba(139, 92, 246, .09); border-color: rgba(139, 92, 246, .25); }

/* ---------- Photos ---------- */
.month { font-family: var(--display); font-size: 16px; margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px; position: sticky; top: 0; z-index: 5; padding: 8px 0; background: linear-gradient(var(--bg) 70%, transparent); }
.month:first-child { margin-top: 0; }
.month span { color: var(--muted); font-size: 13px; font-family: var(--font); font-weight: 400; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
@media (max-width: 820px) { .pgrid { grid-template-columns: repeat(3, 1fr); gap: 2px; } }
.ph {
  position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 6px; background: rgba(255, 255, 255, .05); cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
@media (max-width: 820px) { .ph { border-radius: 2px; } }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s, transform .2s; }
.ph img.ld { opacity: 1; }
.ph:hover img { transform: scale(1.03); }
.ph .badge { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .6); border-radius: 6px; padding: 2px 6px; font-size: 11px; display: flex; align-items: center; gap: 3px; }
.ph .fav { position: absolute; left: 6px; bottom: 5px; font-size: 14px; filter: drop-shadow(0 1px 2px #000); }
.ph .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; color: var(--muted); }
.ph .sel {
  position: absolute; left: 7px; top: 7px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .9);
  background: rgba(0, 0, 0, .25); display: none; place-items: center; font-size: 14px; color: #fff;
}
.selecting .ph .sel { display: grid; }
.ph.picked .sel { background: var(--accent); border-color: var(--accent); }
.ph.picked img { transform: scale(.86); border-radius: 8px; }
.ph.picked { background: rgba(139, 92, 246, .25); }

.selbar {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 45; display: flex; align-items: center; gap: 6px;
  background: rgba(20, 16, 38, .94); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 18px; padding: 8px 8px 8px 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2); max-width: calc(100vw - 20px); overflow-x: auto;
}
.selbar.on { transform: translate(-50%, 0); }
.selbar b { margin-right: 8px; white-space: nowrap; }
@media (max-width: 820px) { .selbar { bottom: calc(76px + env(safe-area-inset-bottom)); } .selbar .btn span { display: none; } }

.drop {
  position: fixed; inset: 0; z-index: 60; background: rgba(11, 9, 22, .85); backdrop-filter: blur(6px); display: none; place-items: center;
}
.drop.on { display: grid; }
.drop div { border: 2px dashed var(--accent); border-radius: 28px; padding: 60px 80px; text-align: center; font-family: var(--display); font-size: 22px; }

/* Envois en cours */
.uploads {
  position: fixed; right: 20px; bottom: 20px; width: 320px; z-index: 50; background: rgba(20, 16, 38, .96); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); backdrop-filter: blur(18px);
}
@media (max-width: 820px) { .uploads { left: 12px; right: 12px; width: auto; bottom: calc(80px + env(safe-area-inset-bottom)); } }
.uploads .t { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 600; font-size: 14px; }

/* Visionneuse */
.lb { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; flex-direction: column; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.lb .top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); background: linear-gradient(rgba(0, 0, 0, .7), transparent); z-index: 2; gap: 10px; transition: opacity .2s; }
.lb .top .info { min-width: 0; }
.lb .top .info b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .top .info span { font-size: 12px; color: #bbb; }
.lb .stage { flex: 1; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.lb .stage img, .lb .stage video { max-width: 100%; max-height: 100vh; object-fit: contain; transition: transform .2s; user-select: none; -webkit-user-drag: none; }
.lb .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 22px; cursor: pointer; z-index: 2; }
.lb .nav-btn:hover { background: rgba(255, 255, 255, .2); }
.lb .prev { left: 14px; } .lb .next { right: 14px; }
@media (max-width: 820px) { .lb .nav-btn { display: none; } }
.lb.chrome-off .top { opacity: 0; pointer-events: none; }
.lb .btn { background: rgba(255, 255, 255, .1); border: 0; }

/* Modales */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(5, 4, 12, .7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 440px; background: #16122a; border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); max-height: 90vh; overflow: auto; }
.modal h2 { font-size: 20px; margin-bottom: 6px; }
.modal p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast {
  position: fixed; top: 18px; left: 50%; transform: translate(-50%, -150%); z-index: 90; background: #221b3d; border: 1px solid var(--line);
  padding: 11px 18px; border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); transition: transform .25s; font-size: 14px; max-width: 90vw;
}
.toast.on { transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(248, 113, 113, .4); }

/* ---------- Sites / jeux ---------- */
.site { display: flex; flex-direction: column; gap: 12px; }
.site .preview { aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #fff; position: relative; border: 1px solid var(--line); }
.site .preview iframe { width: 400%; height: 400%; transform: scale(.25); transform-origin: 0 0; border: 0; pointer-events: none; }
.site .preview a { position: absolute; inset: 0; }
.site .meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.site .meta b { font-family: var(--display); font-size: 16px; }
.appcard { display: flex; gap: 16px; align-items: center; }
.appcard .ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: linear-gradient(135deg, rgba(139, 92, 246, .3), rgba(192, 132, 252, .15)); flex: none; }
.appcard .body { flex: 1; min-width: 0; }
.appcard b { font-family: var(--display); font-size: 17px; }

.setrow { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: 0; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 30px; }
.login .logo { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 18px; display: grid; place-items: center; font-size: 30px; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 10px 40px rgba(139, 92, 246, .5); }
.login h1 { text-align: center; font-size: 24px; }
.login p { text-align: center; color: var(--muted); margin: 6px 0 22px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin: -4px 0 8px; }

.spin { width: 20px; height: 20px; border: 2px solid rgba(255, 255, 255, .2); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* =================== v2 : navigation, accueil, modules =================== */
.navsep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); opacity: .7; padding: 16px 12px 6px; }
.side .nav { padding: 9px 12px; }
main { animation: fade .2s; }

/* Menu « Plus » (mobile) */
.sheet-bg { position: fixed; inset: 0; z-index: 75; background: rgba(5, 4, 12, 0); transition: background .2s; }
.sheet-bg.on { background: rgba(5, 4, 12, .6); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: #17122b; border-radius: 24px 24px 0 0; border-top: 1px solid var(--line);
  padding: 10px 14px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .9, .3, 1);
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sheet-bg.on .sheet { transform: none; }
.grip { grid-column: 1/-1; width: 40px; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .2); margin: 0 auto 8px; }
.sheet-item { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); font-weight: 600; font-size: 15px; cursor: pointer; }
.sheet-item svg { width: 22px; height: 22px; color: var(--accent2); }
.sheet-item.on { background: rgba(139, 92, 246, .18); border-color: rgba(139, 92, 246, .4); }

/* Accueil */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .16), rgba(52, 211, 153, .06)); }
.hero-l { display: flex; align-items: center; gap: 16px; min-width: 0; }
.hero-t { font-family: var(--display); font-size: 19px; font-weight: 600; }
.hero-addr { margin: 0; min-width: 0; max-width: 100%; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); flex: none; position: relative; box-shadow: 0 0 14px var(--ok); }
.pulse::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--ok); animation: ring 2s infinite; }
.pulse.warn { background: var(--warn); box-shadow: 0 0 14px var(--warn); }
.pulse.warn::after { border-color: var(--warn); }
@keyframes ring { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.qtile { text-align: left; border: 1px solid var(--line); background: var(--glass); border-radius: 18px; padding: 16px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; transition: transform .12s, border-color .15s, background .15s; position: relative; overflow: hidden; color: var(--text); }
.qtile::before { content: ''; position: absolute; inset: auto -30% -60% auto; width: 120px; height: 120px; border-radius: 50%; background: var(--c); opacity: .14; filter: blur(10px); }
.qtile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.qtile .qi { font-size: 26px; margin-bottom: 6px; }
.qtile b { font-family: var(--display); font-size: 16px; }
.qtile > span:last-child { color: var(--muted); font-size: 12.5px; }
.lg { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
@media (max-width: 820px) { .qgrid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .qtile { padding: 14px; } }

/* Segmented control */
.seg { display: inline-flex; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--muted); padding: 7px 12px; border-radius: 9px; cursor: pointer; font-weight: 500; font-size: 13.5px; }
.seg button.on { background: var(--accent); color: #fff; }
.field .seg { margin-top: 2px; }
input[type=range] { width: 100%; accent-color: var(--accent); margin-top: 6px; }
textarea.input { resize: vertical; min-height: 70px; line-height: 1.45; }

/* Jeux */
.game { padding: 0; overflow: hidden; }
.game-banner { height: 96px; display: flex; align-items: flex-start; justify-content: space-between; padding: 14px 16px; position: relative; }
.game-banner > span { font-size: 46px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .3)); align-self: flex-end; line-height: 1; }
.game.off .game-banner { filter: grayscale(.8) brightness(.6); }
.game-body { padding: 16px 18px 18px; }
.game-t { font-family: var(--display); font-size: 19px; }
.badge-st { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: rgba(255, 255, 255, .08); color: var(--muted); white-space: nowrap; }
.badge-st.ok { background: rgba(52, 211, 153, .14); color: var(--ok); }
.badge-st.bad { background: rgba(248, 113, 113, .14); color: var(--bad); }
.qrbox { background: #fff; border-radius: 16px; padding: 14px; width: min(280px, 100%); margin: 0 auto; }
.qrbox svg { display: block; width: 100%; height: auto; }

/* Test de débit */
.speed { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: center; }
@media (max-width: 820px) { .speed { grid-template-columns: 1fr; gap: 6px; } .speed-g { max-width: 240px; margin: 0 auto; } }
.gauge { width: 100%; display: block; }
.gauge .g-v { font: 700 38px var(--display); fill: var(--text); }
.gauge .g-u { font: 500 13px var(--font); fill: var(--muted); }
.gauge .g-l { font: 600 14px var(--font); fill: var(--accent2); }
.sp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
@media (max-width: 520px) { .sp-tiles { grid-template-columns: repeat(2, 1fr); } }
.sp-t { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.sp-t span { display: block; font-size: 12px; color: var(--muted); }
.sp-t b { font: 600 22px var(--display); }
.sp-t i { font-style: normal; font-size: 12px; color: var(--muted); margin-left: 4px; }
.spark.mini { height: 32px; }

/* Sécurité */
.sec-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .sec-stats { grid-template-columns: 1fr; } }
.sec-stats > div { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.sec-stats b { font: 600 24px var(--display); }
.sec-stats span { font-size: 13px; color: var(--muted); }
.sec-stats .warn b { color: var(--warn); } .sec-stats .bad b { color: var(--bad); } .sec-stats .ok b { color: var(--ok); }
.log { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.log-r { display: grid; grid-template-columns: 28px 130px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
.log-r:last-child { border-bottom: 0; }
.log-r.fail { background: rgba(248, 113, 113, .05); }
.log-w { color: var(--muted); } .log-ip { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .log-r { grid-template-columns: 24px 1fr; } .log-d, .log-ip { grid-column: 2; } }

/* Outils */
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.act { border: 1px solid var(--line); background: rgba(0, 0, 0, .2); border-radius: 16px; padding: 14px; text-align: left; cursor: pointer; color: var(--text); display: flex; flex-direction: column; gap: 2px; transition: .15s; }
.act span { font-size: 24px; margin-bottom: 4px; }
.act i { font-style: normal; font-size: 12px; color: var(--muted); }
.act:hover { border-color: rgba(139, 92, 246, .4); }
.act.live { background: rgba(248, 113, 113, .14); border-color: rgba(248, 113, 113, .5); animation: shake .5s infinite; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1deg); } 75% { transform: rotate(1deg); } }
.clip { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: rgba(0, 0, 0, .18); }
.clip-t { white-space: pre-wrap; word-break: break-word; font-size: 14px; max-height: 120px; overflow: auto; }
.clip-m { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.clip-m .btn.icon { padding: 6px; }

/* Caméra */
.cam-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .cam-layout { grid-template-columns: 1fr; } }
.cam-side { display: grid; gap: 14px; }
.cam-frame { position: relative; width: 100%; aspect-ratio: 16/9; max-height: 72vh; margin: 0 auto; background: #000; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.cam-frame:fullscreen { max-height: none; border-radius: 0; border: 0; }
.cam-frame img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); object-fit: cover; }
.cam-over { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.cam-live { background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 4px 9px; border-radius: 7px; animation: blink 2s infinite; }
.cam-live.off { background: rgba(0, 0, 0, .6); animation: none; }
@keyframes blink { 50% { opacity: .65; } }
.cam-info { background: rgba(0, 0, 0, .55); font-size: 12px; padding: 4px 9px; border-radius: 7px; }
.cam-info:empty { display: none; }
.cam-msg { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; text-align: center; padding: 20px; background: rgba(0, 0, 0, .6); font-size: 14px; }
.cam-motion { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .08); }
.cam-motion i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #fbbf24, #ef4444); transition: width .4s; }
.cam-ctrl { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cam-ctrl .btn.on { background: rgba(251, 191, 36, .2); border-color: rgba(251, 191, 36, .5); }
@media (max-width: 820px) { .cam-ctrl .btn span, .view-camera .head .btn span { display: none; } .cam-ctrl { justify-content: space-between; } .cam-ctrl .btn { flex: 1; } }

/* Fichiers */
.search .input { padding: 9px 13px; width: 200px; }
@media (max-width: 820px) { .search { width: 100%; order: 3; } .search .input { width: 100%; } }
.fbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; font-size: 14px; }
.crumbs button { border: 0; background: none; color: var(--text); padding: 6px 8px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.crumbs button:hover { background: var(--glass2); }
.crumbs span { color: var(--muted); }
.fgrid.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fgrid.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.fi { position: relative; border: 1px solid var(--line); background: var(--glass); border-radius: 16px; cursor: pointer; transition: border-color .15s, background .15s; user-select: none; }
.fi:hover { border-color: rgba(255, 255, 255, .2); }
.fi.picked { border-color: var(--accent); background: rgba(139, 92, 246, .12); }
.fgrid.grid .fi { display: flex; flex-direction: column; padding: 10px; }
.fgrid.grid .fi-ico { aspect-ratio: 4/3; border-radius: 12px; background: color-mix(in srgb, var(--kc) 14%, transparent); display: grid; place-items: center; position: relative; overflow: hidden; margin-bottom: 8px; }
.fi-ico span { font-size: 38px; }
.fi-ico img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fi-ico img + span { display: none; }
.fi-t { min-width: 0; display: flex; flex-direction: column; }
.fi-t b { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-t span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-chk { position: absolute; left: 16px; top: 16px; z-index: 2; width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .35);
  color: #fff; font-size: 13px; display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s; padding: 0; }
.fi:hover .fi-chk, .fi.picked .fi-chk, .fgrid:has(.picked) .fi-chk { opacity: 1; }
.fi.picked .fi-chk { background: var(--accent); border-color: var(--accent); }
.fi-more { position: absolute; right: 8px; top: 8px; z-index: 2; background: rgba(0, 0, 0, .35); padding: 4px 8px; font-size: 16px; line-height: 1; }
.fgrid.list .fi { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.fgrid.list .fi:last-child { border-bottom: 0; }
.fgrid.list .fi-ico { width: 40px; height: 40px; border-radius: 10px; flex: none; background: color-mix(in srgb, var(--kc) 14%, transparent); display: grid; place-items: center; position: relative; overflow: hidden; }
.fgrid.list .fi-ico span { font-size: 20px; }
.fgrid.list .fi-t { flex: 1; }
.fgrid.list .fi-chk { position: static; opacity: 1; flex: none; width: 22px; height: 22px; border-color: rgba(255, 255, 255, .35); background: none; }
.fgrid.list .fi-more { position: static; background: none; }
@media (hover: none) { .fi-chk { opacity: .9; } }
.pop { position: fixed; z-index: 85; background: #1e1837; border: 1px solid var(--line); border-radius: 14px; padding: 6px; min-width: 210px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); animation: fade .12s; }
.pop button { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--text); padding: 10px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.pop button:hover { background: var(--glass2); }
.pop button.danger { color: var(--bad); }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.mv-list { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.mv-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); padding: 11px 14px; cursor: pointer; }
.mv-list button:hover { background: var(--glass2); }
.stage.preview { padding: 70px 16px 16px; }
.stage.preview video, .stage.preview img { max-height: calc(100vh - 90px); }
.pdf { width: min(1000px, 100%); height: calc(100vh - 90px); border: 0; border-radius: 10px; background: #fff; }
.textbox { width: min(1000px, 100%); max-height: calc(100vh - 90px); overflow: auto; background: #120f22; border: 1px solid var(--line); border-radius: 12px; padding: 18px; font-size: 13px; white-space: pre-wrap; word-break: break-word; margin: 0; }
.audiobox { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.audiobox .big { font-size: 64px; }
.audiobox audio { width: min(420px, 90vw); }
.uploads.files { bottom: 110px; }
@media (max-width: 820px) { .uploads.files { bottom: calc(160px + env(safe-area-inset-bottom)); } }

/* Connexion biométrique */
.bio-btn { width: 100%; padding: 14px; font-size: 15px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 18px 0 14px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Envolées / bourse */
.bx-value { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.bx-value b { font: 600 28px var(--display); }
.up { color: var(--ok); } .down { color: var(--bad); }
.pz-card.mirrored { border-color: rgba(52, 211, 153, .45); box-shadow: 0 0 0 1px rgba(52, 211, 153, .2) inset; }
.bt-tab { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.bt-tab th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.bt-tab td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
