:root {
    --bg: #fafafa;
    --panel: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #9ca3af;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { text-decoration: none; color: inherit; }

/* ---------- Layout ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
}

.brand {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 32px;
    padding-left: 8px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar nav a {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 500;
    transition: background .15s, color .15s;
}

.sidebar nav a:hover { background: #f3f4f6; color: var(--text); }
.sidebar nav a.active { background: var(--accent); color: white; }

.logout-link {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 13px;
}
.logout-link:hover { color: var(--danger); }

.content {
    margin-left: 220px;
    padding: 32px 40px;
    flex: 1;
    max-width: 1280px;
}

/* ---------- Titres / sections ---------- */

h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.page-subtitle { color: var(--muted); margin: 0 0 28px; font-size: 14px; }

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 28px 0 14px;
}
.section-header span {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--muted);
    white-space: nowrap;
}
.section-header .line {
    height: 1px;
    background: var(--border);
    flex: 1;
}

/* ---------- Cartes stats ---------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.stat-card .label { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .value.accent { color: var(--accent); }

/* ---------- Boutons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.btn:hover { background: #f3f4f6; }

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 600;
}
.btn-accent:hover { background: var(--accent-hover); }

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ---------- Formulaires ---------- */

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-group .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

input[type=text], input[type=email], input[type=password], input[type=number],
select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    background: white;
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
textarea { resize: vertical; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
th, td {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
th {
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .04em;
    background: #fbfbfc;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafb; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}
.badge-draft { background: #f3f4f6; color: #6b7280; }
.badge-sending { background: #fef3c7; color: #92400e; }
.badge-sent { background: #d1fae5; color: #065f46; }
.badge-paused { background: #fee2e2; color: #991b1b; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #f3f4f6; color: #6b7280; }

/* ---------- Panels ---------- */

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

/* ---------- Flash messages ---------- */

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13.5px;
}
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }

/* ---------- Login ---------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px;
    width: 380px;
}
.login-box h1 { text-align: center; margin-bottom: 4px; }
.login-box .page-subtitle { text-align: center; margin-bottom: 28px; }

/* ---------- Grid actions ---------- */

.actions-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.progress-bar-track {
    height: 8px;
    background: #eef0f3;
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
