/* ACTUPOD DESK — interface noir & or inspirée d'iPadOS */
:root {
  --bg: #000;
  --glass: rgba(30, 30, 34, .62);
  --glass-strong: rgba(36, 36, 40, .82);
  --glass-border: rgba(255, 255, 255, .09);
  --text: #f5f5f7;
  --text-2: #a1a1a8;
  --text-3: #6e6e75;
  --gold: #d9b45f;
  --gold-hi: #f6dc94;
  --gold-lo: #9a7430;
  --gold-grad: linear-gradient(135deg, #f8e2a0 0%, #d9b45f 45%, #a57b32 100%);
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --radius: 26px;
  --radius-s: 16px;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --side: 92px;
  --top: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }
.ic { width: 1em; height: 1em; fill: currentColor; stroke: currentColor; stroke-width: 0; flex: none; }
.hidden { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

/* Fond : halos dorés discrets pour donner de la matière au verre */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: #000; }
.backdrop::before, .backdrop::after { content: ""; position: absolute; border-radius: 50%; opacity: .55; will-change: transform; } /* dégradés déjà doux : pas de filtre de flou (coûteux à chaque image) */
body.calm .backdrop::before, body.calm .backdrop::after, body.standby-on .backdrop::before, body.standby-on .backdrop::after { animation-play-state: paused; }
.backdrop::before { width: 60vmax; height: 60vmax; left: -18vmax; top: -22vmax; background: radial-gradient(circle, rgba(217,180,95,.34), rgba(217,180,95,.12) 35%, transparent 68%); animation: drift 38s ease-in-out infinite alternate; }
.backdrop::after { width: 55vmax; height: 55vmax; right: -20vmax; bottom: -25vmax; background: radial-gradient(circle, rgba(165,123,50,.28), rgba(165,123,50,.1) 35%, transparent 68%); animation: drift 46s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(6vmax, 5vmax) scale(1.08); } }

/* ---------- Structure ---------- */
.app { position: fixed; inset: 0; z-index: 1; display: grid; grid-template-columns: calc(var(--side) + var(--sal)) 1fr; grid-template-rows: calc(var(--top) + var(--sat)) 1fr; }
.sidebar { grid-row: 1 / 3; padding: calc(var(--sat) + 14px) 10px calc(var(--sab) + 14px) calc(var(--sal) + 10px); display: flex; flex-direction: column; align-items: center; gap: 6px; background: rgba(18,18,20,.55); -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%); border-right: 1px solid var(--glass-border); }
.brand { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; background: #0b0b0c; border: 1px solid rgba(217,180,95,.35); box-shadow: 0 0 24px rgba(217,180,95,.15) inset; overflow: hidden; }
.brand img { width: 100%; height: 100%; object-fit: cover; }
.brand span { font-weight: 800; font-size: 17px; letter-spacing: .5px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-btn { width: 70px; padding: 7px 0 6px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-2); font-size: 11px; font-weight: 500; transition: background .25s var(--ease), color .25s, transform .15s; }
.nav-btn .ic { font-size: 23px; }
.nav-btn.active { color: var(--gold-hi); background: rgba(217,180,95,.14); }
.nav-btn:active { transform: scale(.94); }
.nav-spacer { flex: 1; }

.topbar { display: flex; align-items: center; gap: 14px; padding: var(--sat) calc(var(--sar) + 20px) 0 24px; }
.topbar h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.4px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 small { font-size: 14px; font-weight: 600; color: var(--gold); letter-spacing: 2px; margin-left: 10px; vertical-align: middle; }
.pill { height: 40px; padding: 0 16px; border-radius: 20px; display: inline-flex; align-items: center; gap: 8px; background: var(--glass); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border: 1px solid var(--glass-border); font-size: 14px; font-weight: 600; transition: transform .15s; }
.pill:active { transform: scale(.95); }
.pill .ic { font-size: 19px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 0 currentColor; flex: none; }
.dot.online { background: var(--green); box-shadow: 0 0 10px rgba(48,209,88,.8); }
.dot.connecting { background: var(--orange); animation: pulse 1.1s infinite; }
.dot.offline, .dot.revoked { background: var(--red); }
@keyframes pulse { 50% { opacity: .3; } }
.icon-btn { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--glass-border); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); transition: transform .15s; }
.icon-btn .ic { font-size: 20px; }
.icon-btn:active { transform: scale(.92); }

.main { position: relative; overflow: hidden; }
.page { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px calc(var(--sar) + 20px) calc(var(--sab) + 28px) 24px; opacity: 0; transform: translateY(14px) scale(.995); pointer-events: none; transition: opacity .32s var(--ease), transform .42s var(--ease); }
.page.active { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Cartes en verre ---------- */
.card { position: relative; border-radius: var(--radius); background: linear-gradient(160deg, rgba(40,38,34,.82), rgba(24,24,27,.86)); border: 1px solid var(--glass-border); padding: 18px 20px; overflow: hidden; contain: layout paint; }
body.glass-max .card { background: var(--glass); -webkit-backdrop-filter: blur(34px) saturate(170%); backdrop-filter: blur(34px) saturate(170%); }
.card h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.1px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.card h3 .ic { font-size: 16px; color: var(--gold); }
.card h3 .right { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.section-title { font-size: 20px; font-weight: 700; margin: 22px 4px 12px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.gold { color: var(--gold); }
.gold-text { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Grille de widgets ---------- */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 172px; grid-auto-flow: dense; gap: 16px; }
.w { grid-column: span 1; grid-row: span 1; display: flex; flex-direction: column; animation: rise .5s var(--ease) both; }
.w.size-m { grid-column: span 2; }
.w.size-l { grid-column: span 2; grid-row: span 2; }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.w-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.edit-tools { display: none; position: absolute; top: 10px; right: 10px; gap: 6px; z-index: 5; }
.editing .w { animation: jiggle .32s ease-in-out infinite alternate; }
.editing .w:nth-child(2n) { animation-delay: -.16s; }
.editing .edit-tools { display: flex; }
@keyframes jiggle { from { transform: rotate(-.6deg); } to { transform: rotate(.6deg); } }
.tool { width: 34px; height: 34px; border-radius: 17px; display: grid; place-items: center; background: rgba(60,60,66,.92); border: 1px solid var(--glass-border); }
.tool .ic { font-size: 16px; }
.tool.danger { background: var(--red); }

/* Horloge */
.clock-time { font-size: 92px; font-weight: 200; letter-spacing: -3px; line-height: 1; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.size-l .clock-time { font-size: 128px; }
.clock-sec { font-size: .32em; letter-spacing: 0; font-weight: 300; margin-left: 6px; }
.clock-date { font-size: 21px; font-weight: 500; color: var(--text); margin-top: 8px; }
.clock-date::first-letter, .sb-date::first-letter, .hist-day::first-letter { text-transform: uppercase; }
.clock-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; }

/* Météo */
.wx-main { display: flex; align-items: center; gap: 12px; }
.wx-main .ic { font-size: 46px; color: var(--gold-hi); }
.wx-temp { font-size: 46px; font-weight: 300; }
.wx-desc { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.wx-days { display: flex; gap: 10px; margin-top: auto; }
.wx-day { flex: 1; text-align: center; font-size: 13px; color: var(--text-2); }
.wx-day .ic { font-size: 22px; color: var(--gold); display: block; margin: 4px auto; }

/* Micro */
.mic-row { display: flex; align-items: center; gap: 18px; flex: 1; }
.mic-btn { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; flex: none; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.12); transition: transform .18s var(--ease), background .25s, box-shadow .25s, border-color .25s; }
.mic-btn .ic { font-size: 42px; }
.mic-btn:active { transform: scale(.92); }
.mic-btn.live { background: radial-gradient(circle at 35% 30%, #ff6b61, #d70015); border-color: rgba(255,120,110,.8); box-shadow: 0 0 34px rgba(255,69,58,.55); }
.mic-btn.off { background: rgba(255,255,255,.06); color: var(--text-2); }
.size-l .mic-btn { width: 150px; height: 150px; }
.size-l .mic-btn .ic { font-size: 64px; }
.mic-state { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.mic-state.live { color: #ff6b61; }
.mic-name { font-size: 13px; color: var(--text-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.onair { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 800; letter-spacing: 2px; background: var(--red); color: #fff; margin-bottom: 8px; }
.onair.off { background: rgba(255,255,255,.1); color: var(--text-2); }

/* Vumètre */
.meter { position: relative; height: 12px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.meter-fill { position: absolute; inset: 0; background: linear-gradient(90deg, #30d158 0%, #30d158 62%, #ffd60a 80%, #ff453a 100%); }
.meter-cover { position: absolute; inset: 0; background: #1c1c1f; transform-origin: right center; transform: scaleX(1); will-change: transform; }
.meter-peak { position: absolute; top: 0; bottom: 0; width: 3px; border-radius: 2px; background: #fff; left: 0; opacity: .85; will-change: transform; }
.meter-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-3); margin-top: 4px; }

/* Curseurs façon iPadOS */
.slider { position: relative; height: 46px; border-radius: 15px; background: rgba(255,255,255,.1); overflow: hidden; touch-action: none; cursor: pointer; }
.slider-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,.92); transition: width .12s var(--ease); }
.slider.gold .slider-fill { background: var(--gold-grad); }
.slider.dragging .slider-fill { transition: none; }
.slider-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; font-size: 15px; font-weight: 600; mix-blend-mode: difference; color: #fff; pointer-events: none; }
.slider-label .ic { font-size: 20px; }
.slider.vertical { height: 100%; width: 100%; border-radius: 22px; }
.slider.vertical .slider-fill { top: auto; right: 0; width: 100% !important; height: 0; transition: height .12s var(--ease); }
.slider.vertical.dragging .slider-fill { transition: none; }
.slider.vertical .slider-label { flex-direction: column-reverse; justify-content: space-between; padding: 14px 0; }
.slider.disabled { opacity: .4; pointer-events: none; }

/* Stats système */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }
.size-l .stats { grid-template-columns: repeat(2, 1fr); gap: 16px 22px; }
.stat-k { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; font-weight: 600; letter-spacing: .3px; }
.stat-k .ic { color: var(--gold); font-size: 14px; }
.stat-v { font-size: 24px; font-weight: 600; margin-top: 3px; }
.stat-v small { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--gold-grad); transition: width .6s var(--ease); }
.bar.warn > i { background: linear-gradient(90deg, #ff9f0a, #ff453a); }

/* Tuiles d'action */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.tile { position: relative; min-height: 96px; border-radius: 20px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; background: rgba(255,255,255,.07); border: 1px solid var(--glass-border); transition: transform .16s var(--ease), background .2s; font-size: 14px; font-weight: 600; }
.tile .ic { font-size: 26px; color: var(--gold); }
.tile:active { transform: scale(.95); background: rgba(255,255,255,.14); }
.tile.on { background: var(--gold-grad); color: #1a1406; }
.tile.on .ic { color: #1a1406; }
.tile.red.on { background: var(--red); color: #fff; }
.tile.red.on .ic { color: #fff; }
.tile.danger .ic { color: var(--red); }
.tile .sub { font-size: 12px; font-weight: 500; color: var(--text-2); margin-top: 2px; }
.tile.on .sub { color: inherit; opacity: .75; }
.w .tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.w .tile { min-height: 0; height: 100%; padding: 12px; }
.empty { color: var(--text-2); font-size: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; justify-content: center; flex: 1; }

/* Listes */
.list { border-radius: var(--radius-s); background: var(--glass); border: 1px solid var(--glass-border); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; min-height: 54px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 16px; }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.row .ic-badge { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(217,180,95,.16); color: var(--gold); flex: none; }
.row .ic-badge .ic { font-size: 18px; }
.row button.link { color: var(--gold); font-weight: 600; }
.row button.danger-link { color: var(--red); font-weight: 600; }
.row select, .row input[type=text] { background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); border-radius: 10px; padding: 8px 12px; max-width: 320px; }

.switch { position: relative; width: 52px; height: 32px; border-radius: 16px; background: rgba(120,120,128,.36); transition: background .25s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.3); transition: transform .3s var(--ease); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }

.btn { height: 48px; padding: 0 22px; border-radius: 14px; font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: rgba(255,255,255,.1); transition: transform .15s, opacity .2s; }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--gold-grad); color: #1a1406; }
.btn.danger { background: var(--red); color: #fff; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Bandeau arrêt programmé ---------- */
.banner { position: fixed; z-index: 40; left: 50%; top: calc(var(--sat) + 10px); transform: translate(-50%, -140%); display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; border-radius: 22px; background: rgba(60, 14, 12, .9); border: 1px solid rgba(255,69,58,.5); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); font-weight: 600; transition: transform .5s var(--ease); }
.banner.show { transform: translate(-50%, 0); }
.banner .btn { height: 38px; font-size: 14px; }

/* ---------- Centre de contrôle ---------- */
.cc { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; align-items: flex-start; padding: calc(var(--sat) + 70px) calc(var(--sar) + 20px) 20px 20px; background: rgba(0,0,0,0); pointer-events: none; transition: background .35s var(--ease); }
.cc.open { background: rgba(0,0,0,.42); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: auto; }
.cc-panel { width: 430px; max-width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 92px; gap: 12px; transform-origin: top right; transform: scale(.85) translateY(-20px); opacity: 0; transition: transform .45s var(--ease), opacity .3s var(--ease); }
.cc.open .cc-panel { transform: none; opacity: 1; }
.cc-tile { border-radius: 24px; background: var(--glass-strong); border: 1px solid var(--glass-border); -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text); transition: transform .15s var(--ease), background .2s; text-align: center; padding: 6px; }
.cc-tile .ic { font-size: 28px; }
.cc-tile:active { transform: scale(.93); }
.cc-tile.on { background: var(--gold-grad); color: #1a1406; }
.cc-tile.red.on { background: var(--red); color: #fff; }
.cc-tile.wide { grid-column: span 2; flex-direction: row; justify-content: flex-start; padding: 0 18px; gap: 14px; font-size: 15px; text-align: left; }
.cc-tile.wide .ic { font-size: 34px; }
.cc-tile.tall { grid-row: span 2; padding: 0; overflow: hidden; }
.cc-status { grid-column: span 4; height: 60px; align-self: start; border-radius: 20px; padding: 0 18px; flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 14px; }
.cc-status .sp { flex: 1; }

/* ---------- Feuilles (dialogues) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,0); pointer-events: none; transition: background .3s var(--ease); }
.sheet-wrap.open { background: rgba(0,0,0,.55); pointer-events: auto; }
.sheet { width: 480px; max-width: calc(100vw - 40px); max-height: calc(100vh - 80px); overflow-y: auto; border-radius: 30px; background: rgba(28,28,30,.94); border: 1px solid var(--glass-border); -webkit-backdrop-filter: blur(40px); backdrop-filter: blur(40px); padding: 26px; transform: translateY(40px) scale(.96); opacity: 0; transition: transform .45s var(--ease), opacity .3s; }
.sheet-wrap.open .sheet { transform: none; opacity: 1; }
.sheet h2 { margin: 0 0 8px; font-size: 22px; }
.sheet p { margin: 0 0 18px; color: var(--text-2); line-height: 1.45; }
.sheet .actions { display: flex; gap: 12px; margin-top: 20px; }
.sheet .actions .btn { flex: 1; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field input, .field select { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.07); padding: 0 16px; font-size: 17px; outline: none; }
.field input:focus { border-color: var(--gold); }
.field input.code { font-size: 30px; letter-spacing: 12px; text-align: center; font-weight: 700; }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin-top: -4px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 70; left: 50%; bottom: calc(var(--sab) + 24px); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 12px 20px; border-radius: 18px; background: rgba(44,44,48,.95); border: 1px solid var(--glass-border); font-size: 15px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: toastIn .4s var(--ease); max-width: 80vw; }
.toast.error { border-color: rgba(255,69,58,.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.95); } }

/* ---------- Veille : grande horloge ---------- */
.standby { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .8s var(--ease); }
.standby.on { opacity: 1; pointer-events: auto; }
.sb-inner { display: flex; flex-direction: column; align-items: center; transition: transform 6s ease-in-out; }
.sb-time { font-size: min(30vw, 300px); font-weight: 100; letter-spacing: -.04em; line-height: .9; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sb-date { font-size: 30px; font-weight: 400; color: #c8c8cc; margin-top: 16px; }
.sb-meta { display: flex; gap: 22px; margin-top: 30px; font-size: 20px; color: var(--text-2); align-items: center; }
.sb-meta .ic { font-size: 24px; color: var(--gold); vertical-align: -4px; margin-right: 6px; }
.sb-mic { padding: 6px 14px; border-radius: 10px; font-weight: 800; letter-spacing: 2px; font-size: 15px; }
.sb-mic.live { background: var(--red); color: #fff; }
.sb-mic.off { border: 1px solid #3a3a3c; color: #8e8e93; }
.standby.dim .sb-inner { opacity: .55; }

/* ---------- Écran d'accueil (appairage) ---------- */
.onboard { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 30px; }
.onboard .card { width: 560px; max-width: 100%; padding: 34px; }
.logo-big { width: 92px; height: 92px; border-radius: 26px; margin: 0 auto 18px; display: grid; place-items: center; background: #0b0b0c; border: 1px solid rgba(217,180,95,.4); box-shadow: 0 0 50px rgba(217,180,95,.25); overflow: hidden; }
.logo-big img { width: 100%; height: 100%; object-fit: cover; }
.logo-big span { font-size: 30px; font-weight: 800; }
.steps { margin: 0 0 22px; padding-left: 22px; color: var(--text-2); line-height: 1.6; font-size: 15px; }

/* ---------- Mode bureau (immersif) ---------- */
.desk-mode .app { grid-template-columns: 0 1fr; grid-template-rows: calc(var(--sat) + 8px) 1fr; }
.desk-mode .sidebar, .desk-mode .topbar { opacity: 0; pointer-events: none; }
.desk-handle { position: fixed; z-index: 45; top: calc(var(--sat) + 8px); right: calc(var(--sar) + 12px); display: none; }
.desk-mode .desk-handle { display: flex; gap: 8px; }

/* ---------- Historique ---------- */
.hist-day { font-size: 13px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; margin: 18px 4px 8px; }

/* ---------- Portrait ---------- */
@media (orientation: portrait), (max-width: 900px) {
  :root { --side: 0px; }
  .app { grid-template-columns: 1fr; grid-template-rows: calc(var(--top) + var(--sat)) 1fr calc(76px + var(--sab)); }
  .sidebar { grid-row: 3; grid-column: 1; flex-direction: row; justify-content: space-around; padding: 6px calc(var(--sar) + 10px) calc(var(--sab) + 6px) calc(var(--sal) + 10px); border-right: 0; border-top: 1px solid var(--glass-border); }
  .brand, .nav-spacer { display: none; }
  .topbar { grid-column: 1; padding-left: calc(var(--sal) + 20px); }
  .main { grid-column: 1; grid-row: 2; }
  .page { padding-left: calc(var(--sal) + 18px); padding-right: calc(var(--sar) + 18px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 168px; }
  .cols { grid-template-columns: 1fr; }
  .cc-panel { width: 100%; }
  .desk-mode .app { grid-template-rows: calc(var(--sat) + 8px) 1fr 0; }
}

/* =================== v0.2 : nouvelles pages =================== */
.p-only { display: none !important; }
.sidebar { overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.bell { position: relative; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.lvl-crit, .lvl-warn { background: rgba(255,69,58,.18) !important; color: var(--red) !important; }
.lvl-warn { background: rgba(255,159,10,.18) !important; color: var(--orange) !important; }
.sheet.wide { width: 760px; }

/* Contrôle segmenté façon iPadOS */
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.07); border: 1px solid var(--glass-border); margin: 4px 0 16px; flex-wrap: wrap; }
.segmented button { height: 36px; padding: 0 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; transition: background .25s var(--ease), color .2s; }
.segmented button .ic { font-size: 16px; }
.segmented button.on { background: rgba(255,255,255,.14); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.25); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .row-inline select, #seAdd { height: 40px; border-radius: 12px; background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); padding: 0 12px; }
.grow { flex: 1; }
.row-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); font-size: 14px; font-weight: 600; color: var(--text-2); transition: all .2s; }
.chip.on { background: rgba(217,180,95,.2); border-color: rgba(217,180,95,.6); color: var(--gold-hi); }
.icon-btn.on { background: rgba(217,180,95,.25); color: var(--gold-hi); }
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); min-width: 260px; flex: 1; max-width: 420px; }
.search input { background: none; border: 0; outline: none; flex: 1; font-size: 16px; }
.search .ic { color: var(--text-2); }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-3); flex: none; position: relative; }
.radio.on { border-color: var(--gold); }
.radio.on::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--gold); }
.app-ic { width: 28px; height: 28px; object-fit: contain; flex: none; }
.tile .app-ic { width: 30px; height: 30px; }
.tile-label { line-height: 1.2; }
.flash { animation: flashIt .3s; }
@keyframes flashIt { 50% { background: rgba(217,180,95,.35); } }
textarea { width: 100%; border-radius: 14px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.07); color: var(--text); padding: 12px 14px; font: inherit; font-size: 16px; resize: vertical; -webkit-user-select: text; user-select: text; outline: none; }
.steps { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); line-height: 1.6; font-size: 14px; }
.warn-card { display: flex; gap: 14px; align-items: flex-start; border-color: rgba(255,159,10,.35); font-size: 14px; line-height: 1.5; }
.warn-card > .ic { font-size: 24px; color: var(--orange); }
.hot { color: var(--orange); font-weight: 700; }

/* Écran à distance */
.screen-view { position: relative; border-radius: 18px; overflow: hidden; background: #050505; border: 1px solid var(--glass-border); min-height: 420px; touch-action: none; display: grid; place-items: center; }
.screen-view img { width: 100%; height: auto; display: block; -webkit-user-drag: none; user-select: none; }
.screen-view img:not([src]) { display: none; }
.screen-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 30px; color: var(--text-2); }
.screen-empty > .ic { font-size: 48px; color: var(--gold); }
.kb-capture { position: fixed; left: -1000px; top: 0; width: 10px; height: 10px; opacity: 0; }
.immersive-screen .app { grid-template-columns: 0 1fr; grid-template-rows: 0 1fr; }
.immersive-screen .sidebar, .immersive-screen .topbar { display: none; }
.immersive-screen #page-control .segmented { display: none; }
.immersive-screen #page-control .page, .immersive-screen #page-control { padding-top: calc(var(--sat) + 8px); }

/* Trackpad */
.trackpad-wrap { display: flex; flex-direction: column; gap: 14px; }
.trackpad { height: min(52vh, 480px); border-radius: 26px; background: radial-gradient(circle at 30% 20%, rgba(217,180,95,.12), rgba(255,255,255,.04) 60%); border: 1px solid var(--glass-border); touch-action: none; display: grid; place-items: center; transition: background .2s, border-color .2s; }
.trackpad.active { border-color: rgba(217,180,95,.5); }
.pad-hint { text-align: center; color: var(--text-3); font-size: 14px; line-height: 1.7; pointer-events: none; }
.pad-hint .ic { font-size: 40px; color: rgba(217,180,95,.5); }
.pad-buttons { display: grid; grid-template-columns: 1fr 120px 1fr; gap: 12px; }
.pad-btn { height: 74px; border-radius: 20px; background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); font-weight: 600; touch-action: none; transition: background .12s, transform .12s; }
.pad-btn.down { background: rgba(217,180,95,.3); transform: scale(.97); }
.live-input { width: 100%; height: 56px; border-radius: 14px; border: 1px solid rgba(217,180,95,.4); background: rgba(217,180,95,.08); padding: 0 16px; font-size: 17px; outline: none; }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.keys.fkeys { margin-top: 10px; grid-template-columns: repeat(6, 1fr); }
.keys.combos { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.keys.media { grid-template-columns: repeat(6, 1fr); }
.key { height: 50px; border-radius: 12px; background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); font-size: 14px; font-weight: 600; display: grid; place-items: center; transition: transform .1s; }
.key .ic { font-size: 20px; }
.key:active { transform: scale(.94); }
.clip-out { max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-word; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.25); -webkit-user-select: text; user-select: text; }

/* Applis */
.win-row.active { background: rgba(217,180,95,.08); }
.app-badge { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.07); flex: none; }
.app-badge .ic { font-size: 20px; color: var(--gold); }
.win-row .grow { cursor: pointer; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
.app-tile { position: relative; }
.app-launch { width: 100%; height: 118px; border-radius: 20px; background: rgba(255,255,255,.06); border: 1px solid var(--glass-border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 10px; font-size: 13px; font-weight: 600; text-align: center; transition: transform .15s; }
.app-launch:active { transform: scale(.95); }
.app-launch .app-ic, .app-launch .ic { width: 40px; height: 40px; font-size: 36px; color: var(--gold); }
.app-launch span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
.app-pin { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; color: var(--text-3); }
.app-pin.on { color: var(--gold); }

/* Fichiers */
.root-chips { margin: 4px 0 14px; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; }
.crumbs button { color: var(--gold); display: inline-flex; align-items: center; gap: 6px; }
.crumbs span { color: var(--text-3); }
.file-row { width: 100%; text-align: left; }
.file-ic { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.07); flex: none; overflow: hidden; }
.file-ic .ic { font-size: 22px; color: var(--text-2); }
.file-ic.dir .ic { color: var(--gold); }
.file-ic.image .ic { color: #64d2ff; } .file-ic.music .ic { color: #ff375f; } .file-ic.video .ic { color: #bf5af2; }
.file-ic img { width: 100%; height: 100%; object-fit: cover; }
.file-ic.big { width: 72px; height: 72px; }
.file-head { display: flex; gap: 16px; align-items: center; }
.transfers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.xfer { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-border); }
.xfer .ic { color: var(--gold); }
.preview { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 14px; background: #000; margin-bottom: 6px; }

/* Système */
.perf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.perf-card { padding: 14px 16px 10px; }
.perf-card canvas { width: 100%; height: 54px; display: block; margin-top: 6px; }
.perf-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 18px; }
.perf-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; flex: 1; }
.perf-mini canvas { width: 100%; height: 70px; display: block; margin-top: 6px; }
.perf-mini .stat-k b { color: var(--text); margin-left: 4px; }
.proc-list .row { padding: 10px 16px; min-height: 0; }
.proc-head { font-size: 12px; color: var(--text-2); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.pc { width: 110px; text-align: right; } .pm { width: 100px; text-align: right; }
.sensor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.sensor-grid .list { background: none; border: 0; }
.speed-vals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sv { font-size: 44px; font-weight: 300; margin-top: 4px; }
.sv small { font-size: 15px; color: var(--text-2); font-weight: 500; }

/* Scènes */
.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.scene-card { position: relative; border-radius: 24px; background: var(--glass); border: 1px solid var(--glass-border); overflow: hidden; transition: transform .2s var(--ease), border-color .3s; }
.scene-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--c) 35%, transparent), transparent 70%); opacity: .55; pointer-events: none; }
.scene-card.active { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 10px 40px color-mix(in srgb, var(--c) 30%, transparent); }
.scene-card.running { animation: pulseBorder 1.2s infinite; }
@keyframes pulseBorder { 50% { border-color: var(--c); } }
.scene-run { position: relative; width: 100%; min-height: 150px; padding: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; }
.scene-run:active { transform: scale(.97); }
.scene-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 25%, rgba(0,0,0,.3)); color: var(--c); margin-bottom: 8px; }
.scene-ic .ic { font-size: 28px; }
.scene-name { font-size: 20px; font-weight: 700; }
.scene-sub { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.scene-edit { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; background: rgba(0,0,0,.3); color: var(--text-2); }
.run-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 14px 18px; border-color: rgba(217,180,95,.4); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 22px; border: 2px solid rgba(255,255,255,.15); position: relative; overflow: hidden; transition: transform .15s; }
.swatch.on { border-color: #fff; transform: scale(1.1); }
.swatches.small .swatch { width: 32px; height: 32px; }
.swatch.custom { display: grid; place-items: center; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.custom .ic { color: #fff; filter: drop-shadow(0 1px 2px #000); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: end; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-pick button { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.07); display: grid; place-items: center; font-size: 22px; color: var(--text-2); }
.icon-pick button.on { background: rgba(217,180,95,.25); color: var(--gold-hi); }
.steps-list .step-row { align-items: flex-start; }
.step-fields { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.step-fields input[type=text] { flex: 1; min-width: 200px; height: 38px; border-radius: 10px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.07); padding: 0 12px; }
.step-fields input[type=number], .step-fields select { height: 38px; border-radius: 10px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.07); padding: 0 10px; }
.step-fields input[type=color] { width: 54px; height: 38px; border: 0; background: none; padding: 0; }
input[type=range] { accent-color: var(--gold); }
input[type=time] { height: 40px; border-radius: 12px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.08); padding: 0 12px; color: var(--text); }

/* Accueil : modes */
.mode-row { display: grid; gap: 10px; flex: 1; align-content: center; }
.mode-btn { height: 92px; min-width: 0; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 700; background: color-mix(in srgb, var(--c) 14%, rgba(255,255,255,.04)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); transition: transform .15s var(--ease); }
.mode-btn .ic { font-size: 28px; color: var(--c); }
.mode-btn.active { background: var(--c); color: #111; }
.mode-btn.active .ic { color: #111; }
.mode-btn.running { animation: pulse 1s infinite; }
.mode-btn:active { transform: scale(.94); }
.cc-modes { grid-column: span 4; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cc-tile.mode .ic { color: var(--c); }
.cc-tile.mode.on { background: var(--c); color: #111; }
.cc-tile.mode.on .ic { color: #111; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.alert-list { max-height: 50vh; overflow-y: auto; }
.sess { padding: 14px 18px; }
.sess-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sess-head .title { font-weight: 600; }
.sess-head .sub { font-size: 13px; color: var(--text-2); }
.mini-meter { height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.mini-meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width .15s linear; }

@media (orientation: portrait), (max-width: 900px) {
  .p-hide { display: none !important; }
  .p-only { display: flex !important; }
  .sidebar { overflow: visible; }
  .perf-grid { grid-template-columns: repeat(2, 1fr); }
  .pad-buttons { grid-template-columns: 1fr 90px 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
  .pc { width: 80px; } .pm { width: 80px; }
}

/* =================== v1.0 =================== */
.demo-banner { display: none; position: fixed; z-index: 75; left: 50%; bottom: calc(var(--sab) + 14px); transform: translateX(-50%); align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 16px; background: rgba(94,92,230,.92); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .4px; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.demo-banner button { height: 30px; padding: 0 12px; border-radius: 10px; background: rgba(255,255,255,.2); font-weight: 700; }
body.demo-mode .demo-banner { display: flex; }
@media (orientation: portrait), (max-width: 900px) { .demo-banner { bottom: calc(var(--sab) + 88px); } }
.diag-list .row { align-items: flex-start; }
.diag-ok .ic-badge { background: rgba(48,209,88,.16); color: var(--green); }
.diag-warn .ic-badge { background: rgba(255,159,10,.16); color: var(--orange); }
.diag-fail .ic-badge { background: rgba(255,69,58,.18); color: var(--red); }
.diag-info .ic-badge { background: rgba(255,255,255,.08); color: var(--text-2); }
.advice { margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--gold-hi); }
.log { max-height: 260px; overflow: auto; padding: 14px; border-radius: 14px; background: rgba(0,0,0,.45); border: 1px solid var(--glass-border); font-size: 12px; line-height: 1.5; white-space: pre-wrap; -webkit-user-select: text; user-select: text; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(217,180,95,.3); border-top-color: var(--gold); animation: spin .8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
