﻿/*
    Console PxLic — feuille de style unique.

    Écrite à la main plutôt qu'appuyée sur un cadre de style : la console compte une dizaine
    d'écrans denses, tous bâtis sur les mêmes quatre motifs (tableau, fiche, carte de chiffre,
    formulaire). Tirer un cadre complet pour cela ajouterait des centaines de kilo-octets à
    charger et une dépendance de plus à suivre, pour du balisage qui tient en trois cents lignes.

    Les couleurs sont déclarées en variables et déclinées pour les deux thèmes du système. Un
    outil d'administration se consulte aussi bien à midi qu'à vingt-trois heures.
*/

:root {
    color-scheme: light dark;

    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #dfe3e8;
    --text: #1a1d21;
    --text-dim: #5b6470;
    --text-faint: #8b95a1;

    --accent: #2f5bd7;
    --accent-soft: #e8eefc;
    --ok: #1a7f4b;
    --ok-soft: #e3f5eb;
    --warn: #a86a00;
    --warn-soft: #fdf1dc;
    --danger: #c0392b;
    --danger-soft: #fbe9e7;

    --radius: 8px;
    --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 12px rgb(0 0 0 / 4%);
    --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171c;
        --surface: #1c2027;
        --surface-2: #232833;
        --border: #2f3641;
        --text: #e7eaee;
        --text-dim: #a4adb9;
        --text-faint: #75808d;

        --accent: #6f9bff;
        --accent-soft: #1e2a45;
        --ok: #4ec98a;
        --ok-soft: #16301f;
        --warn: #e0a33c;
        --warn-soft: #33280f;
        --danger: #ef6b5c;
        --danger-soft: #3a1c19;

        --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 14px rgb(0 0 0 / 25%);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 22px; font-weight: 650; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
p  { margin: 0 0 12px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ Structure */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--border); }
.brand-mark {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--accent); color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 13px;
}
.brand strong { display: block; font-size: 14px; }
.brand small { display: block; color: var(--text-faint); font-size: 11px; }

.nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-group { padding: 14px 10px 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px; margin-bottom: 1px;
    border-radius: 6px; color: var(--text-dim);
    font-size: 13px; text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-icon { width: 16px; text-align: center; opacity: 0.85; }

.sidebar-footer { border-top: 1px solid var(--border); padding: 12px; }
.who { display: block; margin-bottom: 8px; padding: 6px 8px; border-radius: 6px; color: inherit; text-decoration: none; }
.who:hover { background: var(--surface-2); text-decoration: none; }
.who strong { display: block; font-size: 12px; }
.who small { display: block; color: var(--text-faint); font-size: 11px; }

.content { flex: 1; min-width: 0; padding: 24px 28px 60px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-dim); font-size: 13px; margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.page-message { max-width: 480px; margin: 80px auto; text-align: center; }

/* ------------------------------------------------------------------ Cartes */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; }

.grid { display: grid; gap: 14px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.stat.is-warn .value { color: var(--warn); }
.stat.is-danger .value { color: var(--danger); }
.stat.is-ok .value { color: var(--ok); }

/* ------------------------------------------------------------------ Tableaux */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    text-align: left; font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint);
    padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
    background: var(--surface);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 12px; }

.empty { padding: 40px 16px; text-align: center; color: var(--text-faint); }

/* ------------------------------------------------------------------ Pastilles */

.pill {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap;
    background: var(--surface-2); color: var(--text-dim);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------------ Commandes */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 13px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
    text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); background: var(--danger); }
.btn-quiet { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.field-grow { flex: 1; min-width: 200px; }

input, select, textarea {
    padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
    width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { min-height: 72px; resize: vertical; }
label.inline { display: flex; align-items: center; gap: 7px; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 400; }
/* Sans cette règle, un bouton radio hérite de la largeur pleine des champs et repousse
   son libellé à l'autre bout de la ligne. */
label.inline input[type="checkbox"],
label.inline input[type="radio"] { width: auto; flex: none; }

/* ------------------------------------------------------------------ Fiches */

.dl { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 16px; font-size: 13px; }
.dl dt { color: var(--text-faint); font-size: 12px; }
.dl dd { margin: 0; }

.section { margin-bottom: 22px; }

.banner { padding: 11px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.banner-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.banner-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* Circuit perdu : caché tant que Blazor ne l'affiche pas (voir App.razor). */
#blazor-error-ui {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    padding: 11px 44px 11px 16px; font-size: 13px;
    background: var(--danger-soft); color: var(--danger);
    border-top: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}
#blazor-error-ui .reload { margin-left: 8px; font-weight: 600; }
#blazor-error-ui .dismiss { position: absolute; right: 16px; top: 10px; cursor: pointer; color: inherit; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 16px; font-size: 13px; color: var(--text-dim); }

/* ------------------------------------------------------------------ Graphique */

.chart { display: flex; align-items: flex-end; gap: 2px; height: 130px; padding: 8px 0; }
/* height: 100% est indispensable : « align-items: flex-end » sur .chart donne aux colonnes une
   hauteur ajustée au contenu, et les pourcentages des barres ne résoudraient alors sur rien —
   le graphique resterait désespérément plat. */
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; min-width: 3px; }
.chart-bar { border-radius: 2px 2px 0 0; min-height: 1px; }
.chart-bar.act { background: var(--accent); }
.chart-bar.hb { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.chart-bar.den { background: var(--danger); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.legend span::before { content: "■"; margin-right: 5px; }
.legend .act::before { color: var(--accent); }
.legend .hb::before { color: color-mix(in srgb, var(--accent) 45%, transparent); }
.legend .den::before { color: var(--danger); }

/* ------------------------------------------------------------------ Connexion */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 28px; }
.login-card h1 { text-align: center; margin-bottom: 20px; }
.login-card .field { margin-bottom: 14px; }

/* ------------------------------------------------------------------ Étroit */

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { width: auto; flex: none; height: auto; position: static; flex-direction: column; }
    .nav { display: flex; flex-wrap: wrap; }
    .nav-group { display: none; }
    .content { padding: 16px; }
}

/* ------------------------------------------------------------------ Portail

   Le portail partage les mêmes variables et les mêmes composants — cartes, tableaux, pastilles —
   que la console. Il n'a que sa charpente en propre : un bandeau au lieu d'un menu latéral, et
   une largeur bornée. Un abonné y vient régler une chose précise, pas explorer.
*/

.portal { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.portal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}

.portal-head .brand { border-bottom: none; text-decoration: none; color: inherit; }

.portal-nav { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.portal-nav a { color: var(--text-dim); text-decoration: none; }
.portal-nav a:hover { color: var(--text); }
.portal-nav form { margin: 0; }

.portal-body { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 24px; }

.portal-foot {
    padding: 16px 24px; text-align: center; font-size: 12px; color: var(--text-faint);
    border-top: 1px solid var(--border);
}

.login-card-wide { max-width: 520px; }
.login-card .sub { text-align: center; margin-bottom: 18px; }
.login-alt { text-align: center; font-size: 13px; color: var(--text-dim); margin-top: 14px; }

.login-card fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.login-card legend { font-size: 12px; font-weight: 600; color: var(--text-faint); padding: 0 6px; }

/* ------------------------------------------------------------------ Compléments partagés */

.grid-3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 14px; }

/* Variante de carte de chiffre employée par le portail et les fiches. Les noms sont en
   « stat-* » plutôt qu'en descendants de « .stat » pour pouvoir vivre dans une carte ordinaire,
   sans imbrication supplémentaire. */
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12px; color: var(--text-dim); }

/* Message d'issue d'une action, dans le flux de la page — par opposition à « .banner », qui
   coiffe l'écran entier. */
.notice { padding: 11px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; border: 1px solid var(--border); background: var(--surface-2); }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin-bottom: 0; }
.notice-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.notice-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.invite-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.invite-row:last-child { border-bottom: none; }

.hint { display: block; font-size: 12px; color: var(--text-faint); margin-top: 4px; }

/* Les liens d'invitation et de confirmation sont longs et sans espace : sans coupure explicite,
   ils débordent de leur carte. */
.break { word-break: break-all; font-size: 12px; }

@media (max-width: 640px) {
    .portal-head { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 16px; }
    .portal-nav { justify-content: space-between; }
    .portal-body { padding: 16px; }
    .invite-row { flex-direction: column; align-items: stretch; }
}

/* ------------------------------------------------------------------ Choix du premier espace */

/* Une option par ligne, le champ associé sous son libellé. L'option cochée se voit de loin :
   c'est elle qui décidera de ce que la personne trouvera en arrivant. */
.space-choice { display: grid; gap: 8px; }
.space-choice .choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 13px; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: 0; }
.space-choice .choice:has(input[type="radio"]:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.space-choice .choice input[type="radio"] { width: auto; flex: none; margin-top: 3px; }
.space-choice .choice > span { display: grid; gap: 5px; flex: 1; }
.space-choice .choice .hint { margin-top: 0; }

/* Code d'adhésion : fait pour être lu à voix haute et recopié, donc gros et espacé. */
.join-code { font-size: 20px; letter-spacing: 0.12em; font-weight: 600; margin: 6px 0 10px; }
