:root {
    --bg: #0f172a;
    --card: #ffffff;
    --ink: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #2563eb;
    --primary-ink: #ffffff;
    --danger: #dc2626;
    --success-bg: #dcfce7;
    --success-ink: #166534;
    --error-bg: #fee2e2;
    --error-ink: #991b1b;
    --tag-view: #e0e7ff;
    --tag-view-ink: #3730a3;
    --tag-attempt: #fef9c3;
    --tag-attempt-ink: #854d0e;
    --tag-blocked: #fee2e2;
    --tag-blocked-ink: #991b1b;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: #f1f5f9;
    line-height: 1.5;
}

/* ---------- Pages de connexion ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 1.5rem;
}

.login-card {
    background: var(--card);
    width: 100%;
    max-width: 380px;
    padding: 2rem;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.login-title { margin: 0 0 0.25rem; font-size: 1.4rem; }
.login-subtitle { margin: 0 0 1.5rem; color: var(--muted); font-size: 0.95rem; }
.login-footer { margin-top: 1.5rem; color: var(--muted); font-size: 0.8rem; text-align: center; }

/* ---------- Champs & boutons ---------- */
.field { display: block; margin-bottom: 1rem; }
.field-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }

input[type="text"],
input[type="password"],
input[type="date"],
select {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    color: var(--ink);
}

input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
input:disabled { background: #f1f5f9; color: var(--muted); }

.btn {
    display: inline-block;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    background: #e2e8f0;
    color: var(--ink);
}

.btn-primary { background: var(--primary); color: var(--primary-ink); width: 100%; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ---------- Alertes ---------- */
.alert { padding: 0.7rem 0.9rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: var(--error-bg); color: var(--error-ink); }
.alert-success { background: var(--success-bg); color: var(--success-ink); }

/* ---------- Console admin ---------- */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg);
    color: #fff;
}
.admin-header h1 { margin: 0; font-size: 1.15rem; }
.admin-main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.panel-danger { border-color: #fecaca; }
.panel-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; font-size: 1.05rem; }

.badge {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.muted { color: var(--muted); font-size: 0.88rem; }

/* ---------- Filtres ---------- */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1.25rem;
}
.filters .field { margin-bottom: 0; }
.filters-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ---------- Tableaux ---------- */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th, .table td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.table th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table code { font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.tag-view { background: var(--tag-view); color: var(--tag-view-ink); }
.tag-attempt { background: var(--tag-attempt); color: var(--tag-attempt-ink); }
.tag-blocked { background: var(--tag-blocked); color: var(--tag-blocked-ink); }

.row-attempt { background: #fffdf5; }
.row-blocked { background: #fff5f5; }

.inline-form { display: inline; margin: 0; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
