:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1f2430;
    --fg: #e6e8ee;
    --muted: #8b93a7;
    --accent: #4f8cff;
    --ok: #34d399;
    --off: #6b7280;
    --danger: #f87171;
    --border: #262b36;
    --radius: 10px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
    background: var(--panel-2);
    padding: .1rem .4rem;
    border-radius: 5px;
    font-size: .9em;
}
.muted { color: var(--muted); }

/* Icônes Material (monochrome, héritent de la couleur du texte) */
.material-icons-outlined {
    font-family: 'Material Icons Outlined';
    font-weight: normal; font-style: normal;
    font-size: 20px; line-height: 1;
    display: inline-flex; vertical-align: middle;
    letter-spacing: normal; text-transform: none; white-space: nowrap;
    word-wrap: normal; direction: ltr;
    -webkit-font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
}
.ico-sm { font-size: 18px; }
.ico-inline { font-size: 18px; margin-right: .35rem; }

.brand { font-size: 1.25rem; font-weight: 700; color: var(--fg); text-decoration: none; }
.brand span { color: var(--accent); }
.who { color: var(--muted); font-size: .85rem; }
.inline { display: inline; margin: 0; }
.btn-link {
    background: none; border: none; color: var(--accent);
    cursor: pointer; font-size: .9rem; padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: var(--danger); }

.badge {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    padding: .15rem .5rem; border-radius: 999px; font-weight: 600;
}
.badge-admin { background: rgba(79,140,255,.18); color: #9cc0ff; }
.badge-client { background: rgba(52,211,153,.16); color: #6ee7b7; }

/* ── App shell : sidebar + zone principale ── */
.nav-toggle { display: none; }
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px; flex-shrink: 0; background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.1rem .6rem; }
.nav-close { display: none; cursor: pointer; color: var(--muted); font-size: 1.1rem; }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: .6rem .6rem; overflow-y: auto; flex: 1; }
.side-link {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem;
    border-radius: 8px; color: var(--fg); text-decoration: none;
}
.side-link:hover { background: var(--panel-2); text-decoration: none; }
.side-link.active { background: rgba(79,140,255,.14); }
.side-link.active .side-label { color: #9cc0ff; }
.side-ico { font-size: 20px; width: 1.5rem; color: var(--muted); flex-shrink: 0; }
.side-link:hover .side-ico { color: var(--fg); }
.side-link.active .side-ico { color: var(--accent); }
.side-text { display: flex; flex-direction: column; line-height: 1.25; }
.side-label { font-size: .92rem; font-weight: 600; }
.side-tip { font-size: .72rem; color: var(--muted); }

.sidebar-bottom { padding: .9rem 1rem; border-top: 1px solid var(--border); }
.user-box { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.btn-logout {
    width: 100%; padding: .45rem; background: var(--panel-2); color: var(--fg);
    border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.btn-logout:hover { border-color: var(--accent); color: #9cc0ff; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mobile-bar { display: none; align-items: center; gap: 1rem; padding: .7rem 1rem;
    background: var(--panel); border-bottom: 1px solid var(--border); }
.nav-open { cursor: pointer; font-size: 1.3rem; color: var(--fg); }

/* ── Responsive : sidebar coulissante ── */
@media (max-width: 860px) {
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%);
        transition: transform .2s ease; box-shadow: 2px 0 20px rgba(0,0,0,.4);
    }
    .nav-toggle:checked ~ .app .sidebar { transform: translateX(0); }
    .nav-close { display: block; }
    .mobile-bar { display: flex; }
}

/* Layout — pleine largeur */
.container { width: 100%; max-width: 1600px; margin: 0; padding: 1.8rem 2.2rem 3rem; }
.page-title { font-size: 1.5rem; margin: .2rem 0 1rem; }
.section-title { font-size: 1.05rem; margin: 2rem 0 .8rem; color: var(--fg); }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 0 2.5rem; }
.crumb { margin: 0 0 .6rem; }
.crumb-link { display: inline-flex; align-items: center; gap: .25rem; font-size: .9rem; }
.crumb-link .material-icons-outlined { font-size: 18px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem 1.2rem;
}
.card-value { font-size: 1.9rem; font-weight: 700; }
.card-ok { color: var(--ok); }
.card-label { color: var(--muted); font-size: .85rem; margin-top: .2rem; }

/* Table */
.table { width: 100%; border-collapse: collapse; background: var(--panel);
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--border); }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--panel-2); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--panel-2); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .25rem; }
.dot-on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot-off { background: var(--off); }

/* Bar chart (top apps) */
.bars { display: flex; flex-direction: column; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 90px; align-items: center; gap: .8rem; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.bar-track { background: var(--panel-2); border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #7aa8ff); border-radius: 6px; }
.bar-val { text-align: right; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* Hourly activity */
.hours { display: flex; align-items: flex-end; gap: 4px; height: 130px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; }
.hour-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.hour-bar { width: 70%; background: linear-gradient(180deg, #7aa8ff, var(--accent)); border-radius: 4px 4px 0 0; min-height: 3px; }
.hour-lbl { font-size: .6rem; color: var(--muted); margin-top: .25rem; transform: rotate(-45deg); white-space: nowrap; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem; }
.shot { display: block; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.shot img { width: 100%; height: 130px; object-fit: cover; display: block; }
.shot-time { display: block; padding: .4rem .6rem; font-size: .75rem; color: var(--muted); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
    padding: 2rem; width: 100%; max-width: 360px; }
.login-logo { font-size: 1.8rem; font-weight: 700; text-align: center; margin: 0; }
.login-logo span { color: var(--accent); }
.login-sub { text-align: center; color: var(--muted); margin: .3rem 0 1.5rem; }
.login-card label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .9rem; }
.login-card input {
    width: 100%; margin-top: .3rem; padding: .6rem .7rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px; color: var(--fg); font-size: .95rem;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.btn {
    display: inline-block; width: 100%; text-align: center; padding: .65rem 1rem; margin-top: .4rem;
    background: var(--accent); color: #fff; border: none; border-radius: 8px;
    font-size: .95rem; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #3f7bf0; text-decoration: none; }
.alert { background: rgba(248,113,113,.14); color: #fca5a5; border: 1px solid rgba(248,113,113,.3);
    padding: .6rem .8rem; border-radius: 8px; font-size: .88rem; margin-bottom: 1rem; }

.machine-head { display: flex; align-items: center; gap: .8rem; justify-content: space-between; flex-wrap: wrap; }
.error-box { text-align: center; padding: 4rem 1rem; }

/* Select dans les formulaires */
.form-card select {
    width: 100%; margin-top: .3rem; padding: .55rem .7rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px; color: var(--fg); font-size: .92rem;
}
.form-card select:focus { outline: none; border-color: var(--accent); }

/* Callouts */
.callout { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; margin: 1rem 0 1.6rem; }
.callout h3 { margin: 0 0 .5rem; }
.callout-ok { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.35); }
.callout-info { background: var(--panel); }
.snippet-label { display: block; font-size: .78rem; color: var(--muted); margin: .9rem 0 .25rem; text-transform: uppercase; letter-spacing: .03em; }
.snippet {
    background: #0b0d12; border: 1px solid var(--border); border-radius: 8px;
    padding: .8rem 1rem; overflow-x: auto; font-size: .82rem; color: #c9d3e6;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace; margin: 0;
}
.howto { margin-top: 1rem; font-size: .9rem; }
.howto ol { margin: .4rem 0 .4rem 1.1rem; padding: 0; }
.howto li { margin-bottom: .3rem; }

/* Guide */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.1rem; }
.guide-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.guide-card h3 { margin: 0 0 .6rem; font-size: 1.05rem; }
.guide-card p { font-size: .9rem; margin: .4rem 0; }
.guide-card ul, .guide-card ol { font-size: .88rem; margin: .4rem 0 .4rem 1.1rem; padding: 0; }
.guide-card li { margin-bottom: .35rem; }
.guide-rgpd { background: rgba(180,83,9,.08); border-color: rgba(180,83,9,.35); }

/* Boutons avec icône */
.btn-ico { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-ico .material-icons-outlined { font-size: 18px; }
.btn-ghost { background: var(--panel-2); color: var(--fg); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--panel); border-color: var(--accent); }

/* Icônes dans les titres / callouts */
.guide-card h3, .callout h3 { display: flex; align-items: center; gap: .5rem; }
.guide-card h3 .material-icons-outlined, .callout h3 .material-icons-outlined { font-size: 20px; color: var(--accent); margin: 0; }
.guide-rgpd h3 .material-icons-outlined { color: #fcd34d; }
.callout-ok h3 .material-icons-outlined { color: var(--ok); }

/* Pills (statuts) */
.pill { font-size: .72rem; padding: .15rem .55rem; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.pill-on  { background: rgba(52,211,153,.16); color: #6ee7b7; }
.pill-off { background: rgba(248,113,113,.16); color: #fca5a5; }

/* Boutons additionnels */
.btn-inline, .btn-auto { width: auto; display: inline-block; }
.btn-auto { padding: .5rem .9rem; font-size: .9rem; }
.btn-warn { background: #b45309; }
.btn-warn:hover { background: #92400e; }

/* Formulaires */
.form-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.2rem; max-width: 620px; }
.form-card label, .form-inline-card label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .9rem; }
.form-card input, .form-card textarea {
    width: 100%; margin-top: .3rem; padding: .55rem .7rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px; color: var(--fg); font-size: .92rem; font-family: inherit;
}
.form-card input:focus, .form-card textarea:focus { outline: none; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check { display: flex !important; align-items: center; gap: .5rem; color: var(--fg) !important; }
.check input { width: auto !important; margin: 0 !important; }

.form-inline-card { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .9rem; margin-top: .8rem; }
.form-inline-card input { padding: .5rem .7rem; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; color: var(--fg); font-size: .9rem; flex: 1; min-width: 160px; }
.mini-input { padding: .35rem .5rem !important; background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--fg); font-size: .82rem; width: 130px; }

.row-actions { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.row-actions form { display: flex; gap: .35rem; align-items: center; }

/* Flash */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.flash-ok    { background: rgba(52,211,153,.14); color: #6ee7b7; border: 1px solid rgba(52,211,153,.3); }
.flash-err   { background: rgba(248,113,113,.14); color: #fca5a5; border: 1px solid rgba(248,113,113,.3); }
.flash-warn  { background: rgba(180,83,9,.18); color: #fcd34d; border: 1px solid rgba(180,83,9,.4); }
.flash-token { background: var(--panel-2); border: 1px solid var(--accent); }
.token { display: block; word-break: break-all; font-size: .82rem; color: #9cc0ff; }
