/* ============================================================
   Intranet IT ACD — Design system v3
   Console admin : rail sombre + topbar claire + accent indigo
   ============================================================ */
:root {
    --accent:     #4f46e5;
    --accent-700: #4338ca;
    --accent-50:  #eef2ff;
    --accent-100: #e0e7ff;
    --accent-text:#4338ca;

    --sidebar:    #0f172a;
    --sidebar-2:  #1e293b;
    --sb-text:    #94a3b8;
    --sb-active:  rgba(99,102,241,.18);

    --bg:         #f7f8fb;
    --surface:    #ffffff;
    --surface-2:  #f1f5f9;
    --ink:        #0f172a;
    --muted:      #64748b;
    --border:     #e9edf3;
    --border-strong:#d7deea;

    --ok:     #16a34a;  --ok-bg:     #e8f6ee;
    --danger: #dc2626;  --danger-bg: #fdecec;
    --warn:   #d97706;  --warn-bg:   #fdf3e3;

    --radius:    14px;
    --radius-sm: 9px;
    --pill:      999px;

    --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
    --shadow:    0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md: 0 8px 24px rgba(15,23,42,.10);
    --ring:      0 0 0 3px rgba(79,70,229,.25);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 8px; }
h3 { font-size: .95rem; font-weight: 650; margin: 0 0 8px; }
p  { margin: 0 0 10px; }
a  { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .875rem; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .85em; }

/* ---------- Shell : rail sombre + zone principale ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px; flex-shrink: 0;
    background: var(--sidebar); color: var(--sb-text);
    display: flex; flex-direction: column; padding: 0 12px 16px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 8px 16px; margin-bottom: 8px;
    border-bottom: 1px solid rgba(148,163,184,.16);
}
.sidebar-brand .logo { height: 30px; width: auto; }
.sidebar-brand .brand-text { font-size: 1.4rem; font-weight: 800; letter-spacing: 1px; color: #fff; }
.sidebar-brand .brand-sub { color: var(--sb-text); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }

.nav-group {
    font-size: .66rem; text-transform: uppercase; letter-spacing: .12em;
    color: #64748b; font-weight: 700; padding: 16px 12px 6px;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; margin: 2px 0;
    color: var(--sb-text); font-size: .875rem; font-weight: 500;
    border-radius: var(--radius-sm); transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(148,163,184,.10); color: #e2e8f0; text-decoration: none; }
.nav-item.active { background: var(--sb-active); color: #fff; font-weight: 600; }
.nav-item.disabled { color: #475569; }
.nav-item.disabled:hover { background: transparent; }
.nav-item.disabled em { font-size: .72rem; font-style: normal; }
.nav-item svg { width: 18px; height: 18px; flex: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar claire ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 24px; height: 60px;
}
.topbar-left { font-weight: 650; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.who { font-size: .85rem; color: var(--ink); white-space: nowrap; }
.role-pill { background: var(--surface-2); color: var(--muted); border-radius: var(--pill); padding: 2px 9px; font-size: .72rem; text-transform: capitalize; }
.btn-logout { color: var(--muted); font-size: .82rem; border: 1px solid var(--border-strong); padding: 7px 12px; border-radius: var(--radius-sm); }
.btn-logout:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.viewas-form { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.viewas-form select { padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); font-size: .8rem; height: auto; width: auto; }
.explo-pill { background: var(--ok-bg); color: #0f7a43; padding: 5px 12px; border-radius: var(--pill); font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.explo-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.explo-pill.backup { background: #eef6f0; }

/* Ready (prise de poste) — topbar claire */
.ready-btn {
    display: inline-flex; align-items: center; gap: 7px; font-family: inherit;
    border: 1px solid var(--accent); background: var(--accent-50); color: var(--accent-text);
    font-size: .82rem; font-weight: 600; padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer;
    transition: background .15s;
}
.ready-btn:hover { background: var(--accent-100); }
.ready-btn svg { width: 16px; height: 16px; }
.ready-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.ready-btn.done { background: var(--ok); border-color: var(--ok); color: #fff; cursor: default; }

/* View-as banner */
.viewas-banner { background: var(--warn-bg); border-bottom: 1px solid #f0d8a8; padding: 9px 24px; font-size: .85rem; color: #7a4d06; }

/* ---------- Contenu ---------- */
.content { flex: 1; padding: 28px 32px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.hero { margin-bottom: 24px; }
.hero h1 { font-size: 1.7rem; }
.section-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 24px 0 10px; }

/* ---------- Cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.card h3 { font-size: 1rem; }
.card-accent { border-top: 2px solid var(--accent); }
a.card { color: inherit; transition: box-shadow .15s, transform .15s, border-color .15s; }
a.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); text-decoration: none; }
.cards-grid .card > h3:first-child { font-size: 1.9rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-bottom: 2px; }

.icon-chip { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-50); color: var(--accent); margin-bottom: 12px; }
.icon-chip svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-chip.green { background: var(--ok-bg); color: #0f7a43; }
.module-card { display: flex; flex-direction: column; }
.module-card .desc { flex: 1; }
.module-card .btn, .module-card form { margin-top: 14px; align-self: flex-start; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: .85rem; font-weight: 600; line-height: 1; color: #fff; background: #94a3b8; cursor: pointer;
    transition: background .15s, box-shadow .15s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-700); }
.btn-outline { background: var(--surface); color: var(--accent-text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--accent-50); border-color: var(--accent); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-block { width: 100%; }
.btn-mini { height: 30px; padding: 0 11px; font-size: .78rem; background: var(--accent); }
.btn-mini.btn-danger { background: var(--danger); }

/* ---------- Formulaires ---------- */
label { display: block; font-size: .8rem; font-weight: 600; color: #334155; margin: 12px 0 5px; }
input, select, textarea {
    width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font: inherit; font-size: .875rem; color: var(--ink); background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.pwd-row { display: flex; gap: 8px; align-items: center; }
.pwd-row input { flex: 1; }
form > button { margin-top: 16px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; }
.table th { background: var(--surface-2); color: var(--muted); text-align: left; padding: 10px 14px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 14px; border-top: 1px solid var(--border); font-size: .875rem; vertical-align: middle; }
.table tbody tr:first-child td { border-top: none; }
.table tbody tr:hover td { background: #fafbff; }
.table .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table .actions form { margin: 0; }
.table .actions button { margin: 0; }

/* ---------- Badges / statuts ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--pill); font-size: .75rem; font-weight: 600; background: var(--surface-2); color: #475569; }
.badge-green { background: var(--ok-bg); color: #0f7a43; }
.badge-red { background: var(--danger-bg); color: #b91c1c; }
.badge-warn { background: var(--warn-bg); color: #92600a; }
.badge-grey { background: var(--surface-2); color: #475569; }
.badge-green::before, .badge-red::before, .badge-warn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .875rem; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: #0f7a43; border-color: #b6e2c7; }
.flash-error { background: var(--danger-bg); color: #b91c1c; border-color: #f3b9b2; }
.flash-info { background: var(--accent-50); color: var(--accent-text); border-color: #c7cdf7; }

/* ---------- Login ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(1200px 600px at 30% -10%, #1e293b 0%, var(--sidebar) 55%); padding: 20px; }
.login-card { background: var(--surface); border-radius: 18px; padding: 36px 32px; width: 370px; box-shadow: var(--shadow-md); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand img { max-height: 48px; }
.login-brand-text { font-size: 2.1rem; font-weight: 800; color: var(--accent); letter-spacing: 1px; }
.login-brand p { color: var(--muted); margin: 6px 0 0; font-size: .85rem; }
.login-card .btn { margin-top: 20px; }

/* ---------- Pages d'erreur ---------- */
.error-page { max-width: 470px; margin: 56px auto; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 42px 32px; box-shadow: var(--shadow-sm); }
.error-icon { width: 66px; height: 66px; border-radius: 50%; margin: 0 auto 18px; background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.error-icon svg { width: 30px; height: 30px; }
.error-icon-deny { background: var(--danger-bg); color: var(--danger); }
.error-page h1 { margin-bottom: 8px; }
.error-page .btn { margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px; overflow-x: auto; }
    .sidebar-brand { border-bottom: none; padding: 6px 8px; margin: 0 8px 0 0; }
    .nav-group { display: none; }
    .nav-item { margin: 2px; white-space: nowrap; }
    .nav-item.disabled { display: none; }
    .content { padding: 20px 16px; }
    .who { display: none; }
}

/* ---------- A11y ---------- */
a:focus-visible, button:focus-visible, .nav-item:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } a.card:hover { transform: none; } }
