/* ============================================================
   ANT — Thème global
   Tout passe par les variables. Jamais de hex dans les pages.
   --primary est surchargée par la couleur de la commune (inline
   sur <html> via layout.php).
   ============================================================ */

:root {
    --bg:           #0f172a;
    --surface:      rgba(255,255,255,.06);
    --surface-2:    rgba(255,255,255,.10);
    --border:       rgba(255,255,255,.14);
    --text:         #f1f5f9;
    --text-muted:   #94a3b8;
    --primary:      #1d4ed8;
    --primary-soft: rgba(29,78,216,.18);
    --accent:       #f59e0b;
    --success:      #10b981;
    --warning:      #f59e0b;
    --danger:       #ef4444;
    --radius:       12px;
    --shadow:       0 4px 24px rgba(0,0,0,.25);
}

html[data-theme="light"] {
    --bg:           #f0f4f8;
    --surface:      rgba(255,255,255,.92);
    --surface-2:    #ffffff;
    --border:       rgba(15,23,42,.10);
    --text:         #0f172a;
    --text-muted:   #64748b;
    --primary-soft: rgba(29,78,216,.10);
    --shadow:       0 4px 24px rgba(15,23,42,.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }

/* ── Layout app ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 1.05rem;
    padding: 6px 10px 18px;
}
.sidebar .brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.sidebar a.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: .92rem;
}
.sidebar a.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.sidebar a.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar .spacer { flex: 1; }

.main { flex: 1; padding: 28px 32px; max-width: 1200px; }

/* ── Bandeau impersonation ── */
.impersonation-banner {
    background: var(--warning);
    color: #1a1a1a;
    padding: 8px 16px;
    text-align: center;
    font-weight: 700;
    font-size: .88rem;
}
.impersonation-banner a { color: #1a1a1a; text-decoration: underline; }

/* ── Composants ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: .92rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.btn-danger { background: var(--danger); }
.btn.btn-sm { padding: 6px 12px; font-size: .84rem; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: .76rem;
    font-weight: 700;
}
.badge-success { background: rgba(16,185,129,.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,.15);  color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,.15);   color: var(--danger); }
.badge-muted   { background: var(--surface-2);      color: var(--text-muted); }

/* ── Formulaires ── */
label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 6px; color: var(--text-muted); }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=color], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: .94rem;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
     color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: .92rem; }
tr:last-child td { border-bottom: none; }

/* ── Flash messages ── */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; font-size: .9rem; }
.flash-success { background: rgba(16,185,129,.12); color: var(--success); border: 1px solid rgba(16,185,129,.3); }
.flash-error   { background: rgba(239,68,68,.12);  color: var(--danger);  border: 1px solid rgba(239,68,68,.3); }

/* ── Dashboard boîte à faire ── */
.todo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.todo-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex; flex-direction: column; gap: 8px;
}
.todo-tile .count { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.todo-tile .label { font-weight: 700; }
.todo-tile .hint  { font-size: .84rem; color: var(--text-muted); }

/* ── Mobile ── */
@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar {
        width: 100%; flex-direction: row; align-items: center;
        overflow-x: auto; padding: 10px 12px; gap: 6px;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .sidebar .brand { padding: 0 8px 0 0; }
    .sidebar a.nav-item { white-space: nowrap; padding: 8px 12px; }
    .sidebar .spacer { display: none; }
    .main { padding: 18px 16px; }
    .form-grid { grid-template-columns: 1fr; }
}
