:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #e9edfb;
    background: #090d18;
    --bg: #090d18;
    --bg-soft: #0e1424;
    --panel: #121a2b;
    --panel-raised: #18233a;
    --line: rgba(148, 163, 198, .16);
    --muted: #8795b2;
    --text: #e9edfb;
    --primary: #8b78ff;
    --primary-bright: #9c8dff;
    --cyan: #62d5ee;
    --success: #68dfae;
    --danger: #ff879d;
    --shadow: 0 18px 60px rgba(0, 0, 0, .24);
}

:root[data-theme="light"] {
    color: #17213b;
    background: #f4f6fc;
    --bg: #f4f6fc;
    --bg-soft: #fff;
    --panel: #fff;
    --panel-raised: #eef1fb;
    --line: rgba(48, 65, 104, .14);
    --muted: #64718c;
    --text: #17213b;
    --primary: #6355d9;
    --primary-bright: #5748d0;
    --shadow: 0 18px 60px rgba(54, 67, 110, .12);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: radial-gradient(circle at 80% -10%, rgba(103, 91, 255, .18), transparent 35%), var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: var(--primary-bright); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 264px; flex: 0 0 264px; padding: 26px 16px 18px; border-right: 1px solid var(--line); background: rgba(10, 15, 29, .72); display: flex; flex-direction: column; position: relative; z-index: 20; }
:root[data-theme="light"] .sidebar { background: rgba(255,255,255,.86); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #765cf8, #45c9e2); box-shadow: 0 10px 28px rgba(104, 89, 241, .28); }
.brand-mark span { color: #c9f8ff; }
.brand-copy small { display: block; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .03em; margin-top: 3px; }
.workspace-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .16em; margin: 48px 12px 13px; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; transition: .18s ease; }
.nav-link:hover { color: var(--text); background: var(--panel-raised); border-color: var(--line); }
.nav-link.is-active { color: #fff; background: linear-gradient(100deg, rgba(120, 103, 245, .32), rgba(63, 195, 222, .08)); border-color: rgba(139, 120, 255, .26); box-shadow: inset 3px 0 0 var(--primary-bright); }
.nav-icon { width: 20px; color: var(--cyan); font-size: 19px; line-height: 1; text-align: center; }
.sidebar-footer { margin-top: auto; display: grid; gap: 16px; }
.sidebar-status { display: flex; align-items: center; gap: 9px; padding: 12px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(104,223,174,.1); }
.user-menu { display: grid; gap: 9px; }
.user-card { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #fff; font-weight: 800; background: linear-gradient(135deg, #765cf8, #45c9e2); }
.user-card-copy { min-width: 0; display: grid; gap: 2px; }
.user-card-copy strong { max-width: 168px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.user-card-copy small { color: var(--muted); font-size: 10px; }
.logout-link { padding: 0 0 0 44px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; text-align: left; }
.logout-link:hover { color: var(--danger); }
.main-content { flex: 1; min-width: 0; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(20px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(9, 13, 24, .34); backdrop-filter: blur(18px); }
:root[data-theme="light"] .topbar { background: rgba(255,255,255,.58); }
.topbar-leading, .topbar-actions { display: flex; align-items: center; gap: 14px; }
.global-search { width: min(330px, 42vw); display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--panel); }
.global-search input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }
.global-search input::placeholder { color: var(--muted); }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 18px; }
.icon-button:hover { color: var(--text); border-color: var(--line); background: var(--panel-raised); }
.menu-toggle, .sidebar-close { display: none; }
.topbar-divider { width: 1px; height: 22px; background: var(--line); }
.topbar-context { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.topbar-context strong { color: var(--primary-bright); }
.page-content { width: min(1440px, 100%); padding: clamp(26px, 4vw, 52px) clamp(20px, 4vw, 58px); }
.breadcrumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; color: var(--muted); font-size: 11px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary-bright); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 7px 0 8px; color: var(--text); font-size: clamp(28px, 4vw, 42px); line-height: 1.06; letter-spacing: -.045em; }
h2 { margin: 0 0 8px; color: var(--text); font-size: 18px; letter-spacing: -.025em; }
h3 { margin: 0; color: var(--text); font-size: 14px; }
p { line-height: 1.6; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 20px; }
.card, .table-wrap { border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, var(--panel), rgba(18, 26, 43, .72)); box-shadow: var(--shadow); }
:root[data-theme="light"] .card, :root[data-theme="light"] .table-wrap { background: var(--panel); }
.card { padding: 22px; }
.kpi-card { min-height: 128px; position: relative; overflow: hidden; }
.kpi-card::after { content: ""; width: 100px; height: 100px; position: absolute; right: -45px; bottom: -50px; border-radius: 50%; background: rgba(98,213,238,.12); }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.kpi-value { margin-top: 15px; color: var(--text); font-size: 25px; font-weight: 800; letter-spacing: -.04em; }
.kpi-meta { margin-top: 7px; color: var(--muted); font-size: 11px; }
.dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.server-details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.detail-item { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-soft); }
.detail-item span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.detail-item strong { font-size: 13px; }
.service-list { display: grid; gap: 4px; }
.service-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.service-row:last-child { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid rgba(104,223,174,.22); border-radius: 999px; color: var(--success); background: rgba(104,223,174,.08); font-size: 10px; font-weight: 800; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.toolbar form { display: flex; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--primary), #5369e8); box-shadow: 0 9px 22px rgba(99, 85, 217, .22); font-size: 12px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
.btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 13px 26px rgba(99, 85, 217, .3); }
.btn-secondary { color: var(--text); background: var(--panel-raised); border-color: var(--line); box-shadow: none; }
.btn-secondary:hover { color: var(--text); box-shadow: none; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
td { color: var(--text); font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(139,120,255,.05); }
.input, select, textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--text); background: var(--bg-soft); }
.input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139,120,255,.14); }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.validation-summary, .field-validation-error { color: var(--danger); font-size: 12px; }
.empty-state { padding: 46px 20px; text-align: center; }
.empty-icon { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 16px; color: var(--cyan); background: rgba(98,213,238,.1); font-size: 22px; }
.empty-state h2 { margin-bottom: 4px; }
.empty-state p { max-width: 430px; margin: 0 auto 18px; color: var(--muted); font-size: 12px; }
.sidebar-scrim { display: none; }

/* Authentification indépendante du layout administrateur. */
.auth-body { min-height: 100vh; background: #090d18; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); }
.auth-showcase { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(30px, 7vw, 92px); position: relative; overflow: hidden; background: radial-gradient(circle at 20% 30%, rgba(118,92,248,.28), transparent 34%), radial-gradient(circle at 80% 90%, rgba(69,201,226,.14), transparent 35%), #0b1122; }
.auth-showcase::before { content: ""; width: 460px; height: 460px; position: absolute; right: -180px; top: -150px; border: 1px solid rgba(141,122,255,.18); border-radius: 50%; box-shadow: 0 0 0 60px rgba(141,122,255,.025), 0 0 0 120px rgba(141,122,255,.02); }
.auth-showcase-content { max-width: 570px; position: relative; z-index: 1; }
.auth-showcase h1 { max-width: 570px; margin-top: 54px; color: #f5f7ff; font-size: clamp(38px, 5vw, 68px); }
.auth-showcase h1 em { color: #a99cff; font-style: normal; }
.auth-showcase-copy { max-width: 470px; color: #9ca9c7; font-size: 15px; }
.auth-proof { display: flex; align-items: center; gap: 12px; color: #9ca9c7; font-size: 11px; position: relative; z-index: 1; }
.proof-mark { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(104,223,174,.25); border-radius: 50%; color: var(--success); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 30px clamp(22px, 6vw, 82px); background: #10172a; }
.auth-card { width: min(420px, 100%); }
.auth-brand { margin-bottom: 44px; }
.auth-card h1 { margin-top: 0; color: #f4f6ff; font-size: 30px; }
.auth-card .subtitle { margin: 0 0 26px; color: #8e9bb8; font-size: 13px; }
.auth-form { display: grid; gap: 17px; }
.auth-field { display: grid; gap: 7px; }
.auth-field label { color: #bcc6dd; font-size: 12px; font-weight: 700; }
.auth-field input { min-height: 46px; padding: 0 14px; border: 1px solid rgba(148,163,198,.2); border-radius: 10px; outline: 0; color: #f5f7ff; background: #0b1222; }
.auth-field input:focus { border-color: #8b78ff; box-shadow: 0 0 0 3px rgba(139,120,255,.16); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 45px; }
.password-toggle { position: absolute; top: 50%; right: 8px; width: 32px; height: 32px; transform: translateY(-50%); border: 0; border-radius: 7px; color: #8693af; background: transparent; cursor: pointer; }
.password-toggle:hover { color: #fff; background: rgba(255,255,255,.08); }
.auth-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #94a0bb; font-size: 11px; }
.check-option { display: inline-flex; align-items: center; gap: 8px; }
.check-option input { accent-color: var(--primary); }
.auth-submit { width: 100%; min-height: 48px; margin-top: 5px; }
.auth-note { margin-top: 28px; color: #74819d; font-size: 11px; line-height: 1.6; }
.auth-error { padding: 11px 12px; border: 1px solid rgba(255,135,157,.25); border-radius: 9px; color: #ffadba; background: rgba(255,135,157,.08); font-size: 12px; }
.auth-success { padding: 11px 12px; border: 1px solid rgba(104,223,174,.25); border-radius: 9px; color: #9af0c9; background: rgba(104,223,174,.08); font-size: 12px; }
.auth-link { color: #a99cff; text-decoration: none; }
.auth-link:hover { color: #d0c9ff; text-decoration: underline; }
.manage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.manage-card { display: flex; flex-direction: column; gap: 12px; }
.manage-card p { margin: 0; color: var(--muted); font-size: 12px; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: auto; }
.code-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 18px 0; padding: 0; list-style: none; }
.code-list li { padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--bg-soft); font-family: ui-monospace, monospace; text-align: center; }

@media (max-width: 1050px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
    .sidebar { width: 264px; position: fixed; inset: 0 auto 0 0; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 19; background: rgba(4,7,14,.64); }
    .menu-toggle, .sidebar-close { display: inline-grid; }
    .topbar-context, .topbar-divider { display: none; }
    .global-search { width: min(330px, 64vw); }
    .page-heading, .toolbar { align-items: flex-start; flex-direction: column; }
    .toolbar form { width: 100%; }
    .form-grid, .manage-grid { grid-template-columns: 1fr; }
    .auth-shell { display: block; }
    .auth-showcase { min-height: 270px; padding: 28px 24px; }
    .auth-showcase h1 { margin-top: 30px; font-size: 37px; }
    .auth-showcase-copy { display: none; }
    .auth-panel { min-height: calc(100vh - 270px); padding: 42px 24px; }
}
@media (max-width: 460px) {
    .kpis { grid-template-columns: 1fr; }
    .server-details { grid-template-columns: 1fr; }
    .global-search { width: 52vw; }
    .topbar { padding: 0 15px; }
    .page-content { padding: 24px 15px; }
    .auth-showcase { min-height: 225px; }
    .auth-panel { min-height: calc(100vh - 225px); }
}
