/* =========================================================
   Beyond Lightspeed — Tableau de bord (pages/Dashboard.jsx), refondu le
   2026-10-07 sur le gabarit Systèmes. Classes communes reprises : encarts
   .ovp et surfaces .ovs, jauges .sch-meter, choix .ovp-views et puces
   .ovp-chips (systems.css), compteurs .jn-stat, bandeau .jnh et recherche
   .jn-search (journal.css), table .rdt (radars.css), bandeau .fdh
   (fleets.css). Ne figure ici que ce qui est propre au tableau de bord :
   préfixe tb-.
   ========================================================= */

/* ── Tons ── */
.tb-pos { color: var(--color-accent-green); }
.tb-neg { color: #ff8a9b; }
.tb-tone--green { color: var(--color-accent-green); }
.tb-tone--amber { color: var(--color-accent-amber); }
.tb-tone--red { color: #ff8a9b; }
.tb-tone--cyan { color: var(--color-accent-cyan); }
.tb-tone--purple { color: var(--color-accent-purple); }
.tb-tone--muted { color: var(--color-text-secondary); }
.tb-strong { font-weight: 700; }
.tb-muted { color: var(--color-text-muted); }

/* ── En-tête ── */
.btn.tb-resolve { display: inline-flex; align-items: center; gap: 6px; }

/* ── Page ── */
.jn-page.tb-page { gap: 16px; }
.tb-emblem {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--race-color, var(--color-accent-cyan));
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-shadow: 0 0 14px color-mix(in srgb, var(--race-color, var(--color-accent-cyan)) 55%, transparent);
}

/* Trois encarts de synthèse côte à côte, deux puis un sur écran étroit. */
.tb-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}
@media (max-width: 1280px) {
    .tb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tb-grid > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .tb-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ── Finances ── */
.ovs.tb-fin--green { --ovs-accent: var(--color-accent-green); }
.ovs.tb-fin--red { --ovs-accent: var(--color-accent-red); }
.tb-fin .ovs__title { justify-content: space-between; }
.tb-fin__total {
    color: var(--ovs-accent);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    letter-spacing: 0;
    text-transform: none;
}
.ovs.tb-fin--red .tb-fin__total { color: #ff8a9b; }
.tb-fin__lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tb-fin__line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px auto;
    align-items: center;
    gap: 10px;
    font-size: var(--text-xs);
}
.tb-fin__label { color: var(--color-text-secondary); overflow-wrap: anywhere; }
.tb-fin__amount { color: var(--color-text-bright); font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.tb-fin__bar {
    width: 100%;
    height: 6px;
    border: 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
}
.tb-fin__bar::-webkit-meter-bar { height: 6px; border: 0; border-radius: 3px; background: rgba(255, 255, 255, 0.08); }
.tb-fin__bar::-webkit-meter-optimum-value { border-radius: 3px; background: var(--ovs-accent); }
.tb-fin__bar::-moz-meter-bar { border-radius: 3px; background: var(--ovs-accent); }
.ovs.tb-fin-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    --ovs-accent: var(--color-accent-amber);
}
.tb-fin-balance .ovs__title { margin: 0; }
.tb-fin-balance__value { color: var(--color-text-bright); font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 700; }
.ovs.tb-fin-balance--end { margin-top: auto; }
.ovs.tb-fin-balance--end .tb-fin-balance__value { font-size: 1.05rem; }

/* ── Peuple ── */
/* Une ligne par civilisation : nom, population, colons, à coloniser, et la
   jauge de population en filet sous la ligne. */
.ovs.tb-races { display: flex; flex-direction: column; min-height: 0; padding-top: 8px; padding-bottom: 8px; }
.tb-races__list { list-style: none; margin: 0; padding: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.tb-races__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 3rem 5.6rem;
    align-items: baseline;
    gap: 2px 10px;
}
.tb-races__row--head {
    padding-bottom: 4px;
    color: var(--color-text-label);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.tb-races__row--head > :not(:first-child) { text-align: right; white-space: nowrap; }
.tb-races__row.tb-race { padding: 5px 0 4px; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.btn-reset.tb-race__name {
    overflow: hidden;
    color: var(--race-color, var(--color-text-bright));
    font-size: var(--text-xs);
    font-weight: 700;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.btn-reset.tb-race__name:hover,
.btn-reset.tb-race__name:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.tb-race__num { color: var(--color-text-bright); font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 700; text-align: right; white-space: nowrap; }
.tb-race__num small { color: var(--color-text-muted); font-size: inherit; font-weight: 500; }
.sch-meter.tb-race__meter { grid-column: 1 / -1; height: 3px; margin-top: 3px; }
/* Encart étroit (téléphone, fiche serrée) : quatre colonnes ne laissaient que
   deux lettres au nom (« H… »). Le nom prend sa propre ligne, les trois
   nombres s'alignent dessous sous leurs intitulés. */
.ovs.tb-races { container-type: inline-size; }
@container (max-width: 360px) {
    .tb-races__row { grid-template-columns: minmax(0, 1fr) 3.5rem 5.6rem; }
    .tb-races__row > :first-child { grid-column: 1 / -1; }
    .tb-races__row--head > :first-child { display: none; }
    .tb-races__row--head > :nth-child(2) { text-align: left; }
    .tb-race__num:nth-of-type(1) { text-align: left; }
}
@media (pointer: coarse) {
    .btn-reset.tb-race__name { min-height: 28px; }
}
.sch-meter.tb-race__meter::-webkit-meter-bar { height: 3px; }
.tb-races__legend { margin-top: 6px; }
.tb-races__absent { margin-top: auto; }
/* Sur trois ou deux colonnes, l'encart prend la hauteur de ses voisins sans
   la dicter : sa liste défile au-delà. */
@media (min-width: 761px) {
    .tb-grid > .ovp.tb-people { height: 0; min-height: 100%; }
    .tb-people .ovp__body { min-height: 0; overflow: hidden; }
}
.btn-reset.tb-race__link { color: var(--race-color, var(--color-accent-cyan)); font-weight: 600; cursor: pointer; }
.btn-reset.tb-race__link:hover,
.btn-reset.tb-race__link:focus-visible { text-decoration: underline; }
.tb-race-title { display: inline-flex; align-items: center; gap: 8px; color: var(--race-color, var(--color-text-primary)); }

/* ── Journal ── */
/* Boutons d'action des encarts (« Tous les évènements », « Fiche de la
   civilisation ») : liseré et fond teintés à la couleur de l'encart, texte
   clair, pour ressortir sur le bandeau illustré. */
.btn.tb-cta {
    --tb-cta: var(--color-accent-cyan);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border: 1px solid color-mix(in srgb, var(--tb-cta) 75%, transparent);
    border-radius: 8px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--tb-cta) 26%, rgba(5, 10, 20, 0.88)), rgba(5, 10, 20, 0.88));
    color: var(--color-text-bright);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-decoration: none;
    box-shadow: 0 0 14px color-mix(in srgb, var(--tb-cta) 30%, transparent);
    transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn.tb-cta svg { color: var(--tb-cta); flex-shrink: 0; }
.btn.tb-cta:hover,
.btn.tb-cta:focus-visible {
    border-color: var(--tb-cta);
    background: linear-gradient(135deg, color-mix(in srgb, var(--tb-cta) 40%, rgba(5, 10, 20, 0.88)), color-mix(in srgb, var(--tb-cta) 14%, rgba(5, 10, 20, 0.88)));
    color: #fff;
    box-shadow: 0 0 20px color-mix(in srgb, var(--tb-cta) 45%, transparent);
}
.btn.tb-cta--purple { --tb-cta: var(--color-accent-purple); }
.btn.tb-cta--race { --tb-cta: var(--race-color, var(--color-accent-cyan)); }
.tb-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ovs.tb-event { display: flex; align-items: flex-start; gap: 10px; padding-top: 9px; padding-bottom: 9px; }
.tb-event__icon { flex-shrink: 0; color: var(--ovs-accent); }
.tb-event__body { min-width: 0; flex: 1; }
.tb-event__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.tb-event__type {
    color: var(--ovs-accent);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.tb-event__turn { flex-shrink: 0; color: var(--color-text-muted); font-family: var(--font-mono); font-size: var(--text-xs); }
.tb-event__text {
    margin: 0;
    color: var(--color-text-primary);
    font-size: var(--text-xs);
    line-height: 1.45;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Encarts larges : outils de l'en-tête ── */
.ovp__action .tb-search { width: 220px; }
.ovp__action .tb-search .form-input { padding-top: 5px; padding-bottom: 5px; font-size: var(--text-xs); }
.tb-view__count {
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}
.tb-alerts { gap: 6px; }
.tb-alert {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid currentColor;
    background: rgba(0, 0, 0, 0.3);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* ── Tables ── */
/* Dix lignes par page : la table ne défile plus en hauteur. */
.rdt-wrap.tb-table-wrap { max-height: none; min-height: 0; }
.tb-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding-top: 2px;
}
.tb-pager__total {
    color: var(--color-text-label);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.tb-pager__nav { display: inline-flex; align-items: center; gap: 8px; }
.btn.tb-pager__btn { display: inline-grid; place-items: center; min-width: 30px; padding: 4px 8px; }
.tb-pager__label { color: var(--color-text-secondary); font-family: var(--font-mono); font-size: var(--text-xs); }
.rdt.tb-table { font-size: var(--text-xs); }
.rdt.tb-table tbody th,
.rdt.tb-table tbody td { vertical-align: middle; }
.rdt.tb-table tbody th.tb-name { min-width: 150px; }
.rdt.tb-table tbody tr.is-pending th,
.rdt.tb-table tbody tr.is-pending td { background: rgba(255, 179, 0, 0.04); }
.tb-name__line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.tb-name__link {
    color: var(--color-text-bright);
    font-size: var(--text-sm);
    font-weight: 700;
    text-decoration: none;
}
.tb-name__link:hover,
.tb-name__link:focus-visible { color: var(--color-accent-cyan); text-decoration: underline; text-underline-offset: 3px; }
.tb-name__link.is-pending { color: var(--color-accent-amber); font-style: italic; }
.tb-name__sub {
    display: block;
    margin-top: 2px;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 400;
}
.tb-capital {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 6px;
    border-radius: 8px;
    border: 1px solid rgba(255, 209, 102, 0.45);
    color: #ffd166;
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.tb-fleet-num { color: var(--color-text-muted); font-family: var(--font-mono); font-size: var(--text-xs); }
.tb-fleet-wait { color: var(--color-accent-amber); font-size: var(--text-xs); font-style: italic; }
.tb-moving { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--color-accent-amber); }
.tb-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
    vertical-align: 1px;
}
.rdt.tb-table tbody td.tb-empty-row { color: var(--color-text-muted); text-align: center; padding: 18px; }
.ovs.tb-empty,
.ovs.tb-warning { color: var(--color-text-secondary); font-size: var(--text-sm); }
.ovs.tb-warning { --ovs-accent: var(--color-accent-amber); display: flex; align-items: center; gap: 8px; margin: 0; color: var(--color-accent-amber); font-size: var(--text-xs); }

/* Jauges chiffrées des cellules. */
.tb-gauge { display: grid; grid-template-columns: 56px auto; align-items: center; gap: 7px; }
.tb-gauge__meter.sch-meter { height: 8px; }
.tb-gauge__text { color: var(--color-text-bright); font-family: var(--font-mono); white-space: nowrap; }
.tb-gauge__text small { color: var(--color-text-muted); }
.tb-gauge--cargo .sch-meter::-webkit-meter-optimum-value { background: linear-gradient(90deg, rgba(0, 229, 255, 0.4), var(--color-accent-cyan)); }
.tb-gauge--cargo .sch-meter:-moz-meter-optimum::-moz-meter-bar { background: var(--color-accent-cyan); }
.ovs.tb-race .tb-gauge { grid-template-columns: 1fr; min-width: 0; }
.tb-revolt { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; color: #ff8a9b; font-weight: 700; }

/* Lieutenants sur place. */
.tb-assign { display: grid; gap: 4px; min-width: 140px; max-width: 220px; }
.form-input.tb-assign__select { padding: 4px 8px; font-size: var(--text-xs); }
.tb-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.3;
}
.form-input.tb-border--amber { border-color: var(--color-accent-amber); }
.form-input.tb-border--green { border-color: var(--color-accent-green); }
.form-input.tb-border--red { border-color: var(--color-accent-red); }

/* Budgets sur place. */
.tb-budget__field { display: inline-flex; align-items: center; gap: 4px; }
.form-input.tb-budget__input {
    width: 62px;
    padding: 4px 6px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-align: right;
}
.form-input.tb-budget__input--counter { color: #ff8a9b; }
.tb-budget__unit { color: var(--color-text-muted); }
.tb-budget__was { display: block; margin-top: 2px; color: var(--color-accent-amber); font-size: var(--text-xs); }
.tb-budget-total { white-space: nowrap; }
.tb-budget-total__value { font-family: var(--font-mono); font-weight: 700; }
.btn.tb-budget-total__cancel { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 8px; color: var(--color-accent-amber); }

/* Construction : plans dépliables. */
.btn-reset.tb-expand { display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--color-text-secondary); cursor: pointer; }
.btn-reset.tb-expand:hover,
.btn-reset.tb-expand:focus-visible { color: var(--color-accent-cyan); }
.tb-fallback {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--color-accent-amber);
    font-size: var(--text-xs);
    font-weight: 700;
}
.rdt.tb-table tbody tr.tb-row-detail td { background: rgba(255, 255, 255, 0.015); }
.rdt.tb-table tbody td.tb-detail { padding-left: 34px; }
.rdt.tb-table tfoot th,
.rdt.tb-table tfoot td {
    padding: 8px 10px;
    border-top: 1px solid rgba(0, 229, 255, 0.25);
    color: var(--color-text-label);
    font-size: var(--text-xs);
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
}
.rdt.tb-table tfoot td.rdt-num { text-align: right; font-size: var(--text-xs); letter-spacing: 0; }

@media (max-width: 760px) {
    .ovp__action .tb-search { width: 100%; }
}
