/*
 * Écran Référentiel (admin, T46) : en-tête, tuiles de couverture, onglets soulignés,
 * filtres, panneau tableau, pastilles de statut et boutons. Tableaux : components/_table.css.
 */
.rb-referential {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: rbFade 0.35s ease both;
}

.rb-referential__header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rb-referential__eyebrow {
    margin: 0;
    font-family: var(--rb-font-mono);
    font-size: 10.5px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #FF8E8E;
}

.rb-referential__title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--rb-text-heading);
}

.rb-referential__subtitle {
    margin: 0;
    max-width: 720px;
    font-size: 14px;
    color: var(--rb-text-subdued);
}

/* Tuiles de couverture */
.rb-referential__tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.rb-referential__tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    color: inherit;
    text-decoration: none;
    background-color: var(--rb-bg-surface);
    border: 1px solid var(--rb-border-default);
    border-radius: 12px;
    transition: border-color 0.15s ease;
}

.rb-referential__tile:hover {
    border-color: var(--rb-border-chip);
}

.rb-referential__tile-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.rb-referential__tile-title {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--rb-text-label);
}

.rb-referential__tile-count {
    font-family: var(--rb-font-mono);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: var(--rb-text-faint);
}

.rb-referential__tile-ratio {
    font-family: var(--rb-font-mono);
    font-size: 26px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--rb-text-heading);
}

.rb-referential__tile-bar {
    position: relative;
    height: 4px;
    overflow: hidden;
    background-color: var(--rb-bg-inset);
    border-radius: 999px;
}

.rb-referential__tile-bar::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--rb-tile-ratio, 0%);
    background-image: linear-gradient(90deg, var(--rb-accent-cyan-dark), var(--rb-accent-cyan));
    border-radius: inherit;
}

.rb-referential__tile-detail {
    font-size: 12px;
    color: var(--rb-accent-green);
}

.rb-referential__tile-detail--pending {
    color: var(--rb-accent-gold);
}

/* Onglets soulignés */
.rb-referential__tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--rb-border-default);
}

.rb-referential__tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -1px;
    padding: 11px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--rb-text-subdued);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.rb-referential__tab:hover {
    color: var(--rb-text-muted);
}

.rb-referential__tab--active {
    color: var(--rb-text-heading);
    border-bottom-color: var(--rb-accent-cyan);
}

.rb-referential__tab-count {
    padding: 1px 7px;
    font-family: var(--rb-font-mono);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--rb-border-input);
    border-radius: 999px;
}

.rb-referential__tab-count--pending {
    color: var(--rb-accent-gold);
}

.rb-referential__tab-count--done {
    color: var(--rb-accent-green);
}

/* Filtres */
.rb-referential__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.rb-referential__search {
    position: relative;
    flex: 1 1 280px;
    max-width: 420px;
}

.rb-referential__search-icon {
    position: absolute;
    top: 50%;
    left: 11px;
    transform: translateY(-50%);
    color: var(--rb-text-faint);
    pointer-events: none;
}

.rb-referential__search-input,
.rb-referential__select {
    width: 100%;
    padding: 8px 12px;
    font-family: var(--rb-font-sans);
    font-size: 13px;
    color: var(--rb-text-heading);
    background-color: var(--rb-bg-inset);
    border: 1px solid #1A2740;
    border-radius: 8px;
}

.rb-referential__search-input {
    padding-left: 30px;
}

.rb-referential__search-input::placeholder {
    color: var(--rb-text-ghost);
}

.rb-referential__select {
    width: auto;
    max-width: 240px;
}

.rb-referential__search-input:focus-visible,
.rb-referential__select:focus-visible {
    border-color: var(--rb-accent-cyan);
    box-shadow: 0 0 0 3px rgb(95 227 245 / 12%);
}

/* Boutons */
.rb-referential__button {
    padding: 7px 14px;
    font-family: var(--rb-font-sans);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    color: #B9CADE;
    cursor: pointer;
    background-color: var(--rb-bg-inset);
    border: 1px solid var(--rb-border-chip);
    border-radius: 8px;
}

.rb-referential__button:hover {
    color: var(--rb-text-heading);
    border-color: var(--rb-accent-cyan);
}

.rb-referential__button--primary {
    font-weight: 700;
    color: var(--rb-text-on-accent);
    background-image: linear-gradient(100deg, var(--rb-accent-cyan), var(--rb-accent-cyan-dark));
    border-color: transparent;
}

.rb-referential__button--primary:hover {
    color: var(--rb-text-on-accent);
    border-color: transparent;
    filter: brightness(1.1);
}

.rb-referential__button--confirm {
    color: var(--rb-accent-green);
    background-color: rgb(74 222 155 / 8%);
    border-color: rgb(74 222 155 / 40%);
}

.rb-referential__button--confirm:hover {
    color: var(--rb-accent-green);
    border-color: var(--rb-accent-green);
}

.rb-referential__button--ghost {
    color: var(--rb-text-subdued);
    background-color: transparent;
}

/* Panneau tableau */
.rb-referential__panel {
    min-width: 0;
    overflow-x: auto;
    background-color: var(--rb-bg-surface);
    border: 1px solid var(--rb-border-default);
    border-radius: 12px;
}

.rb-referential__panel .rb-table__header {
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--rb-text-faint);
}

.rb-referential__name {
    font-weight: 600;
    color: var(--rb-text-heading);
}

.rb-referential__ref {
    font-family: var(--rb-font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--rb-text-muted);
}

.rb-referential__match--pending {
    color: var(--rb-accent-gold);
}

.rb-referential__warning {
    color: var(--rb-accent-gold);
}

.rb-referential__actions form {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 2px 0;
}

/* Pastille de statut : losange + libellé, la couleur n'est jamais seule. */
.rb-referential__status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--rb-text-muted);
    border: 1px solid var(--rb-border-chip);
    border-radius: 999px;
}

.rb-referential__status::before {
    content: "";
    width: 5px;
    height: 5px;
    background-color: currentcolor;
    transform: rotate(45deg);
}

.rb-referential__status--weak,
.rb-referential__status--to-confirm {
    color: var(--rb-accent-gold);
    border-color: rgb(232 195 122 / 30%);
}

.rb-referential__status--none {
    color: var(--rb-accent-red);
    border-color: rgb(255 107 107 / 30%);
}

.rb-referential__status--unmatchable {
    color: var(--rb-text-faint);
}

/* État vide « tout est résolu » */
.rb-referential__success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 44px 20px;
    text-align: center;
    border: 1px solid rgb(74 222 155 / 25%);
    border-radius: 12px;
}

.rb-referential__success-mark {
    width: 34px;
    height: 34px;
    background-color: rgb(74 222 155 / 12%);
    border: 1px solid var(--rb-accent-green);
    transform: rotate(45deg);
}

.rb-referential__success-detail {
    margin: 0;
    font-family: var(--rb-font-mono);
    font-size: 12px;
    color: var(--rb-text-subdued);
}

/* Pagination en pied de panneau */
.rb-referential__pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--rb-text-subdued);
    border-top: 1px solid var(--rb-border-row);
}

.rb-referential__pagination-total {
    margin-right: auto;
    font-family: var(--rb-font-mono);
    color: var(--rb-text-faint);
}

.rb-referential__pagination a {
    color: var(--rb-accent-cyan);
    text-decoration: none;
}

.rb-referential__pagination a:hover {
    text-decoration: underline;
}

@media (max-width: 760px) {
    .rb-referential__title {
        font-size: 22px;
    }

    .rb-referential__search,
    .rb-referential__select {
        flex: 1 1 100%;
        max-width: none;
    }
}

/*
 * Sélecteur de carte Riftcodex (§4, T47/T48) : combobox texte + suggestions, repli <select>.
 */
.rb-card-picker {
    position: relative;
    display: flex;
}

.rb-card-picker__input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--rb-border-input);
    border-radius: var(--rb-radius-sm);
}

.rb-card-picker__listbox {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    width: 100%;
    max-height: 240px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    background: var(--rb-bg-surface);
    border: 1px solid var(--rb-border-input);
    border-radius: var(--rb-radius-sm);
}

.rb-card-picker__suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    cursor: pointer;
}

.rb-card-picker__suggestion[aria-selected="true"] {
    background: var(--rb-bg-hover);
}

.rb-card-picker__thumb {
    width: 24px;
    height: auto;
}

.rb-card-picker__set-number {
    margin-left: auto;
    color: var(--rb-text-muted);
    font-variant-numeric: tabular-nums;
}

.rb-card-picker__fallback {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--rb-border-input);
    border-radius: var(--rb-radius-sm);
}
