/* ==========================================================================
   Veeam M365 Reporting — Design system
   Direction : "salle de contrôle" de capacité — encre profonde + accent
   pétrole (rappel LED de baies de stockage), typographie technique.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    /* --- Palette de marque --- */
    --ink: #0B1220;            /* fond sidebar, texte fort */
    --ink-soft: #16213A;       /* dégradé sidebar */
    --paper: #F6F7FA;          /* fond de page */
    --surface: #FFFFFF;        /* cartes */
    --accent: #0E7C86;         /* pétrole — couleur de marque */
    --accent-soft: #E3F2F1;
    --accent-strong: #095860;

    /* --- Statuts (désaturés, lisibles, pro) --- */
    --ok: #15803D;
    --ok-bg: #E9F6EE;
    --warn: #B45309;
    --warn-bg: #FCF1E3;
    --danger: #B91C1C;
    --danger-bg: #FBEAEA;
    --unknown: #64748B;
    --unknown-bg: #EEF1F5;

    /* --- Neutres --- */
    --text: #101826;
    --text-muted: #5B6B82;
    --border: #E3E7EE;
    --border-soft: #EDF0F4;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 38, 0.06);
    --shadow: 0 4px 14px rgba(16, 24, 38, 0.07), 0 1px 3px rgba(16, 24, 38, 0.05);
    --shadow-lg: 0 12px 32px rgba(16, 24, 38, 0.12);

    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.55;
}

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

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }

code, .mono { font-family: var(--font-mono); }

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

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
    width: 252px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--ink) 0%, var(--ink-soft) 100%);
    color: #B7C2D6;
    padding: 22px 0 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 22px 18px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, #14B3A8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(14, 124, 134, 0.45);
}
.sidebar .brand-text {
    font-family: var(--font-display);
    font-weight: 600;
    color: #fff;
    font-size: 14.5px;
    line-height: 1.25;
}
.sidebar .brand-text small {
    display: block;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 11px;
    color: #8493AC;
    letter-spacing: 0.02em;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 22px;
    color: #AEBAD1;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.12s ease, color 0.12s ease;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
.sidebar nav a.active {
    background: rgba(14, 124, 134, 0.18);
    color: #fff;
    border-left-color: var(--accent);
}
.sidebar .section-label {
    text-transform: uppercase;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #5C6B85;
    padding: 18px 22px 7px;
}

/* ==========================================================================
   Contenu principal
   ========================================================================== */
.main-content {
    flex: 1;
    padding: 30px 36px 60px;
    max-width: 1320px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 26px;
    gap: 16px;
}
.topbar h1 {
    font-size: 24px;
    margin: 0;
    font-weight: 600;
    color: var(--ink);
}
.topbar .user-info {
    font-size: 12.5px;
    color: var(--text-muted);
    text-align: right;
    padding-top: 4px;
}
.topbar .user-info strong { color: var(--text); }

/* ==========================================================================
   Cartes
   ========================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px 24px;
    margin-bottom: 22px;
}
.card h2 {
    margin-top: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}

/* ==========================================================================
   Boutons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-body);
    transition: background 0.12s ease, transform 0.05s ease, box-shadow 0.12s ease;
    box-shadow: 0 1px 2px rgba(14,124,134,0.25);
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn-secondary:hover { background: var(--paper); }
.btn-success { background: var(--ok); box-shadow: 0 1px 2px rgba(21,128,61,0.25); }
.btn-success:hover { background: #0F5C2C; }
.btn-danger { background: var(--danger); box-shadow: 0 1px 2px rgba(185,28,28,0.25); }
.btn-danger:hover { background: #8E1717; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ==========================================================================
   Formulaires
   ========================================================================== */
label { font-weight: 600; font-size: 12.5px; display: block; margin-bottom: 5px; color: var(--text); }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=month], input[type=date], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group { margin-bottom: 17px; }
.form-row { display: flex; gap: 16px; }
.form-row > * { flex: 1; }
.help-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ==========================================================================
   Tableaux
   ========================================================================== */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--border-soft); text-align: left; }
th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--paper);
    border-bottom: 1px solid var(--border);
}
th:first-child { border-radius: var(--radius-sm) 0 0 0; }
th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover td { background: #FAFBFD; }
td.num { text-align: right; font-family: var(--font-mono); font-size: 13px; }
tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: none; }

/* ==========================================================================
   Badges de statut
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge.status-ok { background: var(--ok-bg); color: var(--ok); }
.badge.status-warning { background: var(--warn-bg); color: var(--warn); }
.badge.status-danger { background: var(--danger-bg); color: var(--danger); }
.badge.status-unknown { background: var(--unknown-bg); color: var(--unknown); }

.status-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.status-pill.open { background: var(--warn-bg); color: var(--warn); }
.status-pill.validated { background: var(--ok-bg); color: var(--ok); }

/* ==========================================================================
   Alertes
   ========================================================================== */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    border-left: 3px solid;
}
.alert-success { background: var(--ok-bg); color: #0F5C2C; border-color: var(--ok); }
.alert-danger { background: var(--danger-bg); color: #8E1717; border-color: var(--danger); }
.alert-info { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }

/* ==========================================================================
   Login
   ========================================================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(14,124,134,0.35), transparent 45%),
        radial-gradient(circle at 80% 75%, rgba(20,179,168,0.18), transparent 50%),
        linear-gradient(160deg, var(--ink) 0%, var(--ink-soft) 100%);
    padding: 20px;
}
.login-box {
    background: var(--surface);
    padding: 38px 34px;
    border-radius: var(--radius-lg);
    width: 380px;
    box-shadow: var(--shadow-lg);
}
.login-box .brand-mark {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, #14B3A8 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(14,124,134,0.3);
}
.login-box h1 { font-size: 19px; margin: 0 0 4px; font-weight: 600; }
.login-box .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 26px; }

/* ==========================================================================
   KPI / Dashboard — jauges de capacité (signature visuelle)
   ========================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 19px 21px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.kpi-card .kpi-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.kpi-card .kpi-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    margin-top: 6px;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.kpi-card .kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.kpi-card.accent-bar::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #14B3A8);
}
.kpi-card.danger-bar::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--danger);
}

/* --- Jauge circulaire (donut) de capacité --- */
.gauge-wrap { display: flex; align-items: center; gap: 14px; }
.gauge {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: conic-gradient(var(--gauge-color, var(--accent)) calc(var(--gauge-pct, 0) * 1%), var(--border-soft) 0);
}
.gauge::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--surface);
}
.gauge span {
    position: relative;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}

/* --- Barre de progression linéaire (tableaux) --- */
.capacity-bar {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: var(--border-soft);
    overflow: hidden;
    margin-top: 5px;
}
.capacity-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--gauge-color, var(--accent));
}

.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.editable-input { width: 100px; text-align: right; font-family: var(--font-mono); }
.small-note { font-size: 12px; color: var(--text-muted); }

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.6; }
.empty-state p { max-width: 420px; margin: 0 auto; font-size: 13.5px; }

/* --- Responsive --- */
@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; }
    .main-content { padding: 22px 18px 40px; }
    .form-row { flex-direction: column; }
}
