/* ===================================================================================================
   ADMIN CONSOLE - pages/admin/
   Built on the account styles rather than a second look: this is an internal tool and every minute
   spent styling it is a minute not spent on what it measures.
   =================================================================================================== */

.adm-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }

.adm-select {
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius-sm);
    background: var(--fm-surface);
    color: var(--fm-ink);
    font-family: inherit;
    font-size: 0.92rem;
}

/* Health sits above everything because it says whether the rest can be believed. */
.adm-health { margin-bottom: 1.6rem; }

.adm-health-box {
    padding: 1rem 1.2rem;
    border-radius: var(--fm-radius);
    border: 1px solid var(--fm-line);
    background: var(--fm-surface-alt);
}
.adm-health-box.is-ok { border-color: #A7F3D0; background: #ECFDF5; }
.adm-health-box.is-ok strong { color: #065F46; }
.adm-health-box.is-bad { border-color: #FCA5A5; background: #FEF2F2; }
.adm-health-box.is-bad strong { color: #991B1B; }

.adm-health-list {
    margin: 0.5rem 0 0;
    padding-left: 1.15rem;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--fm-ink-soft);
}

.acc-tile.adm-tone-warn { border-color: #FCD34D; background: #FFFBEB; }

/* Wide tables must scroll inside their own box, never push the page sideways. */
.adm-scroll { overflow-x: auto; }

.adm-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.adm-table th {
    text-align: left;
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--fm-ink-soft);
    padding: 0.5rem 0.7rem 0.5rem 0;
    border-bottom: 1px solid var(--fm-line);
    white-space: nowrap;
}
.adm-table td {
    padding: 0.6rem 0.7rem 0.6rem 0;
    border-bottom: 1px solid var(--fm-line);
    color: var(--fm-ink);
    white-space: nowrap;
}
.adm-table tr:last-child td { border-bottom: 0; }

.adm-guards { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.8rem; color: var(--fm-ink-soft); }

/* Les onglets ont disparu avec la refonte du 2026-09-25 : la navigation est la barre laterale
   de css/admin-app.css. */

.adm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 900px) { .adm-two { grid-template-columns: 1fr; } }

/* ── Charts ────────────────────────────────────────────────────────────────── */

.adm-chart { position: relative; margin-top: 1rem; }

.adm-legend {
    display: flex;
    gap: 1.1rem;
    margin-top: 0.6rem;
    font-size: 0.84rem;
    color: var(--fm-ink-soft);
}
.adm-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.adm-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.adm-tip {
    position: absolute;
    top: 0;
    pointer-events: none;
    background: var(--fm-ink);
    color: #fff;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    white-space: nowrap;
    z-index: 3;
}

.adm-empty {
    margin: 1.5rem 0;
    padding: 1.2rem;
    border: 1px dashed var(--fm-line);
    border-radius: var(--fm-radius-sm);
    color: var(--fm-ink-soft);
    font-size: 0.9rem;
    text-align: center;
}

/* ── Editable fields ───────────────────────────────────────────────────────── */

.adm-field {
    display: grid;
    grid-template-columns: 220px 1fr auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.8rem 0;
    border-top: 1px solid var(--fm-line);
}
.adm-field:first-child { border-top: 0; }
.adm-field-label { font-weight: 600; font-size: 0.9rem; color: var(--fm-ink); }
.adm-field-note {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.82rem;
    color: var(--fm-ink-soft);
}
@media (max-width: 700px) { .adm-field { grid-template-columns: 1fr; } }

.adm-link { color: var(--fm-accent); font-weight: 600; cursor: pointer; }

/* ── Money fields, written for a person rather than for the schema ─────────── */

.adm-field2 {
    padding: 1.1rem 0;
    border-top: 1px solid var(--fm-line);
}
.adm-field2:first-child { border-top: 0; padding-top: 0.2rem; }

.adm-field2-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.adm-field2-name { font-size: 1rem; color: var(--fm-ink); }
.adm-field2-key {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.74rem;
    color: #94A3B8;
}
.adm-field2-what {
    margin: 0.35rem 0 0.7rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--fm-ink-soft);
    max-width: 70ch;
}
.adm-field2-line { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.adm-field2-input { width: 160px; }
.adm-field2-conv {
    font-weight: 600;
    color: var(--fm-accent);
    font-size: 0.95rem;
    min-width: 12ch;
}
.adm-field2-conseq {
    margin: 0.6rem 0 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--fm-ink-soft);
    padding-left: 0.8rem;
    border-left: 3px solid var(--fm-line);
    max-width: 70ch;
}

/* An explanation block above a group of fields. It exists because a screen of money knobs with no
   preamble is a screen someone changes by guessing. */
.adm-intro {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: var(--fm-radius-sm);
    padding: 1rem 1.2rem;
    margin-bottom: 1.4rem;
}
.adm-intro strong { display: block; color: #1E3A8A; margin-bottom: 0.5rem; }
.adm-intro ul {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--fm-ink-soft);
    font-size: 0.89rem;
    line-height: 1.65;
}

/* ── Danger zone. Visually apart because it is not a setting, it is an irreversible act. ────── */

.adm-danger {
    border: 1px solid #FCA5A5;
    background: #FEF2F2;
    border-radius: var(--fm-radius);
    padding: 1.2rem 1.4rem;
}
.adm-danger strong { display: block; color: #991B1B; margin-bottom: 0.5rem; }
.adm-danger p {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #7F1D1D;
    max-width: 70ch;
}

.adm-btn-danger {
    background: #DC2626;
    color: #fff;
    border: 1px solid #DC2626;
}
.adm-btn-danger:hover:not(:disabled) { background: #B91C1C; border-color: #B91C1C; }
.adm-btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }

/* A heading inside a panel, for a table that belongs with the one above it rather than in its own box. */
.acc-h2.adm-sub {
    margin-top: 1.8rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--fm-line);
    font-size: 1rem;
}

/* ── Provider rate card. Age shown as loudly as value: the failure here is silent and slow. ──── */

.adm-field2.is-stale { background: #FFFBEB; border-left: 3px solid #F59E0B; padding-left: 0.9rem; }

.adm-stale-tag, .adm-fresh-tag {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}
.adm-stale-tag { background: #FEF3C7; color: #92400E; }
.adm-fresh-tag { background: #ECFDF5; color: #065F46; }

.adm-rate-field { display: inline-flex; flex-direction: column; gap: 0.2rem; }
.adm-rate-field span { font-size: 0.74rem; color: var(--fm-ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.adm-rate-input { width: 110px; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.85rem; }
.adm-rate-source { width: 260px !important; font-family: inherit !important; }

/* Les deux cases a cocher d'une ligne de pack. Meme famille que les champs de tarif, mais en
   ligne : un interrupteur au-dessus de son etiquette se lit mal, et ces deux-la decident de ce que
   le site affiche et de ce qu'un achat accorde. */
.adm-pack-check { flex-direction: row !important; align-items: center; gap: 0.4rem; }
.adm-pack-check input { width: auto; }

/* ── Timeline. One feed, because a support question is chronological. ───────── */

.adm-timeline { margin: 0.6rem 0 1.6rem; }

.adm-tl-item {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 0.2rem 1rem;
    padding: 0.55rem 0 0.55rem 0.9rem;
    border-left: 3px solid var(--fm-line);
    font-size: 0.88rem;
}
.adm-tl-when { color: var(--fm-ink-soft); font-size: 0.8rem; white-space: nowrap; }
.adm-tl-label { color: var(--fm-ink); font-weight: 500; }
.adm-tl-detail {
    grid-column: 2;
    color: var(--fm-ink-soft);
    font-size: 0.8rem;
    font-family: "JetBrains Mono", ui-monospace, monospace;
}

/* The colour names the domain, and the label repeats it in words: identity is never colour alone. */
.adm-tl-money { border-left-color: #2a78d6; }
.adm-tl-ai    { border-left-color: #eb6834; }
.adm-tl-key   { border-left-color: #94A3B8; }
.adm-tl-admin { border-left-color: #DC2626; }

@media (max-width: 700px) {
    .adm-tl-item { grid-template-columns: 1fr; }
    .adm-tl-detail { grid-column: 1; }
}

/* Colonnes chiffrees alignees a droite, en chiffres tabulaires : une colonne de montants se lit
   verticalement, et des chiffres de largeur variable la rendent illisible. */
.adm-table td.adm-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Periode libre : les deux champs de dates vivent dans le meme groupe que le selecteur, et non sur
   une ligne a eux, pour qu'on lise "30 derniers jours" ou "du X au Y" au meme endroit. */
.adm-range { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--fm-ink-soft, #475569); }
.adm-range input { min-width: 8.5rem; }

/* Onglet Analyse : les controles sur une grille qui se replie, et non une ligne qui deborde. */
.ana-controls { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; margin: 0.9rem 0 1rem; }
.ana-controls label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--fm-ink-soft, #475569); }
.ana-controls select { min-width: 9rem; }

.adm-budget { min-width: 8rem; }

/* Heures pleines / creuses du fournisseur (2026-09-25). */
.adm-health-box.is-warn { border-color: #FCD34D; background: #FFFBEB; }
.adm-health-box.is-warn strong { color: #92400E; }
.adm-tariff-why { margin: 0.35rem 0 0; font-size: 0.9rem; color: var(--fm-ink-soft); }
.adm-tariff-grid {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.5rem; margin-top: 1rem;
}
@media (max-width: 900px) { .adm-tariff-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 520px) { .adm-tariff-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.adm-tariff-day {
    border: 1px solid var(--fm-line); border-radius: var(--fm-radius); padding: 0.55rem 0.6rem;
    display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.8rem; background: var(--fm-surface-alt);
}
.adm-tariff-day b { font-size: 0.82rem; text-transform: capitalize; }
.adm-tariff-day.is-off { background: #ECFDF5; border-color: #A7F3D0; }
.adm-tariff-day.is-today { outline: 2px solid #2563EB; outline-offset: 1px; }
.adm-tariff-bar { position: relative; height: 6px; border-radius: 3px; background: #D1FAE5; overflow: hidden; }
.adm-tariff-bar i { position: absolute; top: 0; bottom: 0; background: #F59E0B; }
.adm-tariff-what { color: var(--fm-ink-soft); line-height: 1.35; }
