:root {
    --bg: #0b0f17;
    --panel: #121826;
    --panel-2: #172033;
    --line: rgba(255, 255, 255, .07);
    --text: #e8edf6;
    --muted: #8b97ad;
    --accent: #38bdf8;
    --free: #22c55e;
    --busy: #ef4444;
    --warn: #f59e0b;
    --reserved: #64748b;
    --side-w: 232px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
small, .small { font-size: .78rem; }
.muted { color: var(--muted); }
.pad { padding: 4px 4px 0; }

/* Sidebar */
.side {
    position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
    background: #0d121d; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 20px 14px;
}
.logo { padding: 4px 8px 22px; }
.logo img { display: block; height: 28px; width: auto; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--muted); text-align: left; transition: background .15s, color .15s;
}
.nav button:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav button.active { background: rgba(56, 189, 248, .12); color: var(--accent); }
.nav em {
    margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 700;
    background: var(--warn); color: #1c1203; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 999px;
}
.side-foot { margin-top: auto; display: grid; gap: 10px; font-size: .75rem; color: var(--muted); padding: 0 8px; }
.side-foot a:hover { color: var(--text); }

/* Main */
.main { margin-left: var(--side-w); min-height: 100vh; }
.top {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
    padding: 14px 28px; background: rgba(11, 15, 23, .88); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.resto small { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .68rem; }
.resto h1 { font-size: 1.25rem; font-weight: 650; }
.status { list-style: none; display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.status li { display: flex; align-items: center; gap: 7px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--free); box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.controls { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clock { display: grid; text-align: right; margin-right: 6px; }
.clock small { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; }
.clock b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.btn { padding: 9px 15px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 550; transition: border-color .15s, transform .15s; }
.btn:hover { border-color: rgba(56, 189, 248, .5); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #04121a; border-color: transparent; }
.btn.primary.on { background: var(--warn); }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; margin-top: 18px; padding: 12px; }
.burger { display: none; font-size: 1.4rem; padding: 4px 8px; }

.demo-banner { background: rgba(245, 158, 11, .1); color: #fbbf24; font-size: .78rem; text-align: center; padding: 6px 12px; border-bottom: 1px solid rgba(245, 158, 11, .2); }
.content { padding: 24px 28px 60px; display: grid; gap: 20px; }
.vtitle { font-size: 1.1rem; font-weight: 600; color: var(--muted); }
#view { display: grid; gap: 20px; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-h h3 { font-size: .98rem; font-weight: 600; }
.pill { background: rgba(245, 158, 11, .16); color: #fbbf24; font-weight: 700; font-size: .75rem; padding: 2px 9px; border-radius: 999px; }
.live-dot { color: var(--busy); font-size: .7rem; font-weight: 700; letter-spacing: .08em; }
.live-dot::before { content: "● "; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.kpis { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.kpis.six { grid-template-columns: repeat(6, 1fr); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.kpi span { color: var(--muted); font-size: .76rem; }
.kpi strong { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.kpi.busy::after { background: var(--busy); } .kpi.free::after { background: var(--free); } .kpi.warn::after { background: var(--warn); }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.grid-main.eq { grid-template-columns: 1fr 1fr; }
.grid-sub { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.col { display: grid; gap: 20px; }

/* Plan de salle */
.room {
    position: relative; container-type: inline-size; aspect-ratio: 16 / 10;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 36px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 36px),
        #0e1422;
    border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px;
}
.room-label { position: absolute; left: 50%; transform: translateX(-50%); font-size: max(8px, 1cqw); letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .28); }
.room-label.top { top: 1.2%; } .room-label.bottom { bottom: 1.2%; }
.tbl {
    position: absolute; transform: translate(-50%, -50%);
    display: grid; place-items: center; text-align: center;
    border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 18%, #0e1422);
    color: var(--text); transition: background .4s, border-color .4s, transform .2s, box-shadow .2s;
}
.tbl.round { border-radius: 50%; } .tbl.square { border-radius: 14%; } .tbl.rect { border-radius: 10px; }
.tbl:hover { transform: translate(-50%, -50%) scale(1.04); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); z-index: 3; }
.tbl.sel { box-shadow: 0 0 0 3px #fff; z-index: 4; }
.tone-free { --c: var(--free); } .tone-busy { --c: var(--busy); } .tone-warn { --c: var(--warn); } .tone-reserved { --c: var(--reserved); }
.tone-warn.tbl { animation: glow 2s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 18px color-mix(in srgb, var(--warn) 55%, transparent); } }
.tone-heat { --c: var(--accent); background: rgba(56, 189, 248, var(--heat)) !important; }
.tbody { display: grid; gap: 1px; line-height: 1.2; font-size: max(8px, 1.05cqw); }
.tbody b { font-size: max(8.5px, 1.1cqw); letter-spacing: .03em; }
.tbody span { color: rgba(255, 255, 255, .8); }
.chair { position: absolute; width: 11%; aspect-ratio: 1; border-radius: 50%; background: #1f2a40; border: 1px solid rgba(255, 255, 255, .1); transform: translate(-50%, -50%); }
.tbl.rect .chair, .tbl.square .chair { width: 13%; border-radius: 4px; aspect-ratio: 1.5; }
.chair.taken { background: color-mix(in srgb, var(--c) 70%, #fff); border-color: transparent; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: .8rem; }
.legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.dot.free { background: var(--free); } .dot.busy { background: var(--busy); } .dot.warn { background: var(--warn); } .dot.reserved { background: var(--reserved); }

/* Alertes */
.alerts { display: grid; gap: 10px; }
.alert {
    display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; text-align: left; width: 100%;
    padding: 11px 13px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--lc);
    transition: transform .15s, background .15s;
}
button.alert:hover { transform: translateX(3px); background: #1c2740; }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } }
.alert b { font-size: .82rem; letter-spacing: .03em; align-self: center; }
.alert > span:last-child { grid-column: 1 / -1; color: #c3ccdc; font-size: .84rem; }
.alert.static { grid-template-columns: auto 1fr; } .alert.static > span:last-child { grid-column: auto; }
.badge { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--lc) 20%, transparent); color: var(--lc); align-self: center; }
.lv-urgent { --lc: #f87171; } .lv-attention { --lc: #fbbf24; } .lv-info { --lc: #60a5fa; }
.alerts.wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.chip.on { background: rgba(56, 189, 248, .14); color: var(--accent); border-color: transparent; }

/* Flux */
.feed { list-style: none; display: grid; gap: 2px; }
.feed li { display: flex; gap: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: .86rem; }
.feed li:last-child { border: 0; }
.feed time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 42px; }
.feed li.is-alert { color: #fbbf24; }

/* Caméra simulée */
.cam { position: relative; border-radius: 12px; overflow: hidden; background: #05070b; border: 1px solid rgba(255, 255, 255, .1); }
.cam-bar, .cam-foot {
    display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    padding: 8px 12px; font: 600 .7rem ui-monospace, Menlo, monospace; letter-spacing: .06em; color: #e5e7eb; background: #000;
}
.cam-foot { color: #9ca3af; }
.rec { color: #f87171; } .ia { color: #4ade80; }
.cam-floor {
    position: relative; overflow: hidden; container-type: inline-size; aspect-ratio: 16 / 10;
    background:
        radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .65) 100%),
        repeating-linear-gradient(90deg, rgba(120, 90, 60, .12) 0 38px, rgba(0, 0, 0, .1) 38px 40px),
        linear-gradient(#2a2118, #1b1510);
    filter: saturate(.8) contrast(1.05);
}
.cam-floor::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 3px); }
.cam-box { position: absolute; transform: translate(-50%, -50%); border: 1.5px solid var(--c); border-radius: 4px; background: color-mix(in srgb, var(--c) 8%, transparent); z-index: 2; cursor: pointer; }
.cam-box .shape { position: absolute; inset: 22% 18%; background: #6b4f33; border-radius: 6px; box-shadow: 0 3px 8px rgba(0, 0, 0, .55); opacity: .85; }
.cam-box .shape.round { border-radius: 50%; inset: 20%; }
.cam-box u { position: absolute; width: 17%; aspect-ratio: 1; border-radius: 50%; background: #c9a98a; transform: translate(-50%, -50%); filter: blur(.6px); opacity: .85; text-decoration: none; }
.cam-tag { position: absolute; left: -1.5px; bottom: 100%; margin-bottom: 1px; display: grid; background: var(--c); color: #0b0f17; padding: 2px 5px; font: 700 max(7px, .85cqw) ui-monospace, Menlo, monospace; line-height: 1.25; white-space: nowrap; border-radius: 3px 3px 3px 0; z-index: 3; }
.cam-tag em { font-style: normal; font-weight: 600; }

/* Stats */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: rgba(255, 255, 255, .07); }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .val { fill: var(--text); font-size: 11px; font-weight: 600; }
.chart .bar { fill: #2b6f94; } .chart .bar.hi { fill: var(--accent); }
.rots { display: grid; gap: 9px; }
.rot { display: grid; grid-template-columns: 64px 1fr 22px; gap: 10px; align-items: center; font-size: .82rem; }
.rot > div { height: 10px; background: rgba(255, 255, 255, .05); border-radius: 99px; overflow: hidden; }
.rot i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s; }
.rot b { text-align: right; }
.journey { position: relative; height: 96px; margin: 18px 40px 6px; }
.jline { position: absolute; left: 0; right: 0; top: 10px; height: 3px; background: linear-gradient(90deg, var(--accent), var(--free)); border-radius: 2px; }
.jstep { position: absolute; top: 0; transform: translateX(-50%); display: grid; justify-items: center; gap: 4px; text-align: center; }
.jstep i { width: 15px; height: 15px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); }
.jstep b { font-size: .86rem; margin-top: 4px; } .jstep span { color: var(--muted); font-size: .76rem; }
.tscroll { overflow-x: auto; }
.tbl-h { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl-h th { text-align: left; color: var(--muted); font-weight: 500; font-size: .76rem; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl-h td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }

/* Réglages */
.set { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set:last-child { border: 0; } .set span { display: block; color: var(--muted); font-size: .8rem; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); font-size: .8rem; }
.switch input { display: none; }
.switch > span { width: 36px; height: 20px; border-radius: 99px; background: #2a3550; position: relative; transition: background .2s; flex: none; display: inline-block; }
.switch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

/* Tiroir table */
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); z-index: 50; overflow-y: auto;
    background: #0f1523; border-left: 1px solid var(--line); padding: 22px; transform: translateX(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
    box-shadow: -20px 0 50px rgba(0, 0, 0, .4);
}
.drawer.open { transform: none; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; }
.d-head small { color: var(--muted); } .d-head h2 { font-size: 1.5rem; }
.x { font-size: 1.8rem; line-height: 1; color: var(--muted); padding: 0 6px; } .x:hover { color: #fff; }
.big { font-size: 1.15rem; font-weight: 600; margin: 8px 0 16px; }
.drawer h4 { margin: 20px 0 10px; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.two small { display: block; color: var(--muted); } .two b { font-size: 1.05rem; }
.steps { list-style: none; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.steps i { width: 22px; height: 22px; display: grid; place-items: center; font-style: normal; font-size: .75rem; border-radius: 50%; background: rgba(255, 255, 255, .05); }
.steps li.done { color: var(--text); } .steps li.done i { background: rgba(34, 197, 94, .18); color: var(--free); }
.steps li.wait { color: #fbbf24; } .steps li.wait i { background: rgba(245, 158, 11, .15); }
.steps time { margin-left: auto; color: var(--muted); font-size: .78rem; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 80; background: #1e293b; border: 1px solid var(--line); padding: 11px 18px; border-radius: 12px; transition: .3s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Responsive */
@media (max-width: 1280px) {
    .kpis { grid-template-columns: repeat(4, 1fr); }
    .kpis.six { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
    .grid-main, .grid-main.eq, .grid-sub { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .side { transform: translateX(-100%); transition: transform .25s; }
    body.menu .side { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .6); }
    .main { margin-left: 0; }
    .burger { display: block; }
    .top { padding: 12px 16px; gap: 14px; }
    .status { display: none; }
    .content { padding: 18px 16px 50px; }
    .kpis, .kpis.six { grid-template-columns: repeat(2, 1fr); }
    .journey { margin-inline: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
