/*
 * Nexus theme. The site is always dark (data-bs-theme="dark" on <html>); this file maps the
 * Nexus palette, taken from images/nexus-banner.png, onto Bootstrap 5.3 and Blazorise.
 */

/* ---------- Tokens ---------- */

:root {
    /* Surfaces: the page background is the banner's own background so the banner blends in. */
    --nexus-bg: #190c0c;
    --nexus-bg-sunken: #110707;
    --nexus-surface: #231313;
    --nexus-surface-raised: #2c1919;

    /* Lines: the banner's emblem and laurel color. */
    --nexus-line: #302222;
    --nexus-line-strong: #4a3434;

    --nexus-text: #ece2e0;
    --nexus-text-muted: #a8948f;

    /* Crimson, from the banner's rune marks. */
    --nexus-crimson: #8b1e2e;
    --nexus-crimson-bright: #c4334a;

    /* Lore stat colors. */
    --stat-xp: #ff3df2;
    --stat-level: #a64dff;
    --stat-loyalty: #ffe83d;
    --stat-vitality: #ff4d5e;

    /* Currency accents. */
    --currency-retna: #e8c46a;
    --currency-archonite: #5ee7ff;

    /* Money in and out of an account. */
    --nexus-positive: #5fd38d;
    --nexus-negative: #ff7a85;

    --nexus-font-heading: Montserrat, 'Segoe UI', system-ui, sans-serif;
    --nexus-font-mono: 'Source Code Pro', ui-monospace, Consolas, monospace;

    /* Blazorise vertical bar (side menu), dark contrast. */
    --b-bar-dark-background: var(--nexus-bg-sunken);
    --b-bar-dark-color: rgba(236, 226, 224, .62);
    --b-bar-item-dark-hover-color: #fff;
    --b-bar-item-dark-hover-background: rgba(139, 30, 46, .22);
    --b-bar-item-dark-active-color: #fff;
    --b-bar-item-dark-active-background: rgba(139, 30, 46, .45);
    --b-bar-dropdown-dark-background: #0b0404;
    --b-bar-brand-dark-background: rgba(139, 30, 46, .08);
}

/* ---------- Bootstrap 5.3 dark mode, re-colored ---------- */

[data-bs-theme=dark] {
    color-scheme: dark;

    --bs-body-bg: var(--nexus-bg);
    --bs-body-bg-rgb: 25, 12, 12;
    --bs-body-color: var(--nexus-text);
    --bs-body-color-rgb: 236, 226, 224;
    --bs-emphasis-color: #fff;
    --bs-emphasis-color-rgb: 255, 255, 255;
    --bs-heading-color: #fff;

    --bs-secondary-color: var(--nexus-text-muted);
    --bs-secondary-color-rgb: 168, 148, 143;
    --bs-secondary-bg: var(--nexus-surface-raised);
    --bs-secondary-bg-rgb: 44, 25, 25;
    --bs-tertiary-color: rgba(236, 226, 224, .5);
    --bs-tertiary-bg: var(--nexus-surface);
    --bs-tertiary-bg-rgb: 35, 19, 19;

    --bs-border-color: var(--nexus-line);
    --bs-border-color-translucent: rgba(236, 226, 224, .12);

    --bs-link-color: #e0727f;
    --bs-link-color-rgb: 224, 114, 127;
    --bs-link-hover-color: #f19aa4;
    --bs-link-hover-color-rgb: 241, 154, 164;

    --bs-focus-ring-color: rgba(196, 51, 74, .35);
}

body {
    background-color: var(--nexus-bg);
    color: var(--nexus-text);
}

.card {
    --bs-card-bg: var(--nexus-surface);
    --bs-card-border-color: var(--nexus-line);
    --bs-card-cap-bg: rgba(0, 0, 0, .25);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--nexus-crimson-bright);
}

/* ---------- Typography ---------- */

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.nexus-heading {
    font-family: var(--nexus-font-heading);
    font-weight: 700;
    letter-spacing: .01em;
}

.nexus-mono {
    font-family: var(--nexus-font-mono);
    font-variant-numeric: tabular-nums;
}

.nexus-eyebrow {
    font-family: var(--nexus-font-heading);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--nexus-text-muted);
}

/* ---------- Layout and side menu ---------- */

.b-layout-sider {
    background: var(--nexus-bg-sunken);
    border-right: 1px solid var(--nexus-line);
}

.navbar[data-mode^=vertical].navbar-dark .navbar-brand {
    font-family: var(--nexus-font-heading);
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.navbar[data-mode^=vertical].navbar-dark .navbar-nav > .nav-item > .nav-link.active {
    box-shadow: inset 3px 0 0 var(--nexus-crimson-bright);
}

.nexus-page {
    padding: 1.5rem;
}

/* ---------- Banner header ---------- */

.nexus-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    /* "contain" keeps the whole banner (motto and corner laurels) in view; its background matches
       --nexus-bg, so any space around it blends in. */
    height: clamp(160px, 20vw, 300px);
    padding: 0 1rem;
    background: var(--nexus-bg) url("../images/nexus-banner.png") center / contain no-repeat;
    border-bottom: 1px solid var(--nexus-line);
}

.nexus-banner__title {
    max-width: 100%;
    margin: 0;
    padding: .3em 1.1em .35em;
    border: 5px solid #fff;
    border-radius: 16px;
    background: rgba(25, 12, 12, .35);
    color: #fff;
    font-family: var(--nexus-font-heading);
    font-size: clamp(1.4rem, 3.6vw, 3.25rem);
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.nexus-banner__eyebrow {
    display: block;
    margin-bottom: .35em;
    color: var(--nexus-text-muted);
    font-size: max(.7rem, .26em);
    letter-spacing: .3em;
}

/* ---------- Dashboard ---------- */

.nexus-player {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.nexus-player__name {
    margin: 0;
    font-size: 1.5rem;
}

/* On the Overview the name opens the player's profile; the pen shows it can be edited. */
.nexus-player__name a {
    color: inherit;
    text-decoration: none;
}

.nexus-player__edit {
    margin-left: .6rem;
    font-size: .75em;
    color: var(--nexus-text-muted);
    transition: color .15s ease;
}

.nexus-player__name a:hover .nexus-player__edit,
.nexus-player__name a:focus-visible .nexus-player__edit {
    color: #fff;
}

.nexus-player__tagline {
    margin: .25rem 0 0;
    color: var(--nexus-text-muted);
}

.nexus-player__contact {
    color: var(--nexus-text-muted);
    font-size: .875rem;
}

.nexus-section-title {
    margin-bottom: 1rem;
}

/* A section heading with a control on the right, centered on the heading (CharacterRoster's
   "Show inactive characters" switch). */
.nexus-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1.5rem;
    margin-bottom: 1rem;
}

.nexus-section-header > h2,
.nexus-section-header > .form-check {
    margin: 0;
}

/* Character cards */

/* A player's character cards (CharacterRoster). Never more than two across, since a player holds at most two
   factions' slots: two only when each card can be at least 28rem wide (what a card with the archon's Adjust
   buttons needs), otherwise one per row. A track is never narrower than half the row, so a third card can't fit
   beside them. It depends on the space the roster actually has, so the sidebar and browser zoom are accounted
   for. auto-fill (not auto-fit) keeps an empty second column, so a card alone on its row (a single dead
   character, or the archon's character page) stays the width of the cards above instead of stretching. */
.nexus-roster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 28rem), calc((100% - 1.5rem) / 2)), 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.nexus-card {
    /* Lets the stats rearrange themselves when the card itself is narrow (see the @container rule). */
    container-type: inline-size;
    min-width: 0;
    height: 100%;
    padding: 1.25rem 1.25rem 1rem;
    border: 1px solid var(--nexus-line);
    border-top: 3px solid var(--nexus-crimson);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--nexus-surface) 0%, #1d0f0f 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.nexus-card--pending,
.nexus-card--open {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .75rem;
    border: 1px dashed var(--nexus-line-strong);
    background: rgba(0, 0, 0, .15);
    box-shadow: none;
}

.nexus-card--pending {
    opacity: .8;
}

/* A dead or archived character (CharacterCard, shown by the roster's "Show inactive characters"). Everything
   but its action buttons is faded, so Request revival and Archive stay readable. */
.nexus-card--inactive {
    border-top-color: var(--nexus-line-strong);
    box-shadow: none;
}

.nexus-card--inactive > :not(.nexus-card__actions) {
    opacity: .6;
    filter: grayscale(.7);
}

/* Kill, Request revival and Archive, at the foot of a character card. */
.nexus-card__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--nexus-line);
}

.nexus-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin-bottom: 1.25rem;
}

.nexus-card__name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.nexus-card__name a {
    color: #fff;
    text-decoration: none;
}

.nexus-card__name a:hover,
.nexus-card__name a:focus-visible {
    color: var(--bs-link-hover-color);
}

.nexus-card__subtitle {
    color: var(--nexus-text-muted);
    font-size: .875rem;
}

.nexus-card__chips {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
}

.nexus-chip {
    display: inline-block;
    padding: .2rem .6rem;
    border: 1px solid var(--nexus-line-strong);
    border-radius: 999px;
    color: var(--nexus-text);
    font-family: var(--nexus-font-heading);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nexus-chip--rank {
    border-color: var(--nexus-crimson);
    background: var(--nexus-crimson);
    color: #fff;
}

.nexus-chip--pending {
    border-color: #f8b86c;
    color: #f8b86c;
}

.nexus-chip--inactive {
    border-color: var(--nexus-text-muted);
    color: var(--nexus-text-muted);
}

/* Why a character is inactive: dead (it can come back) or archived (it can't). */
.nexus-chip--dead {
    border-color: var(--nexus-negative);
    color: var(--nexus-negative);
}

.nexus-chip--archived {
    border-color: var(--nexus-text-muted);
    background: var(--nexus-bg-sunken);
    color: var(--nexus-text-muted);
}

/* ---------- Name confirmation (Components/NameConfirmationModal.razor) ---------- */

.nexus-warning-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nexus-warning-list li {
    display: flex;
    align-items: baseline;
}

.nexus-warning-list__icon {
    flex: none;
    margin-right: .6rem;
    color: var(--nexus-negative);
}

/* The name to type: kept as typed (no uppercase) so it can be copied exactly. The monospace font's spaces
   look narrow beside the label's, so it gets a little room on each side. */
.nexus-confirm-name {
    margin-inline: .3em;
    font-family: var(--nexus-font-mono);
    user-select: all;
}

/* ---------- Side menu (Components/Layout/SideMenu.razor) ---------- */

/* Icons sit to the left of each item. */
.nexus-menu__icon {
    display: inline-block;
    width: 1.25rem;
    margin-right: .75rem;
    font-size: 1rem;
    text-align: center;
    vertical-align: -.125em;
}

/* Collapsed (SideMenu adds nexus-menu--collapsed): only the icons show, centred. The text stays in the
   page for screen readers; the link's title gives its name on hover. */
.nexus-menu--collapsed .nexus-menu__link {
    position: relative;
    padding-right: 0;
    padding-left: 0;
    text-align: center;
}

.nexus-menu--collapsed .nexus-menu__icon {
    margin-right: 0;
    font-size: 1.15rem;
}

.nexus-menu--collapsed .nexus-menu__text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Collapsed, the approvals count stays visible as a small badge on the icon. */
.nexus-menu--collapsed .nexus-menu__link .badge {
    position: absolute;
    top: .15rem;
    right: .3rem;
    margin-left: 0 !important;
    padding: .2em .45em;
    font-size: .6rem;
}

/* Stats */

.nexus-stats {
    display: grid;
    gap: .9rem;
}

.nexus-stat {
    display: grid;
    grid-template-columns: 1.5rem 1fr auto;
    align-items: center;
    gap: .3rem .6rem;
}

.nexus-stat--xp { --stat-color: var(--stat-xp); }
.nexus-stat--level { --stat-color: var(--stat-level); }
.nexus-stat--loyalty { --stat-color: var(--stat-loyalty); }
.nexus-stat--vitality { --stat-color: var(--stat-vitality); }

.nexus-stat__glyph {
    color: var(--stat-color);
    font-size: 1.25rem;
    line-height: 1;
    text-align: center;
    text-shadow: 0 0 8px color-mix(in srgb, var(--stat-color) 55%, transparent);
}

.nexus-stat__label {
    color: var(--stat-color);
    font-family: var(--nexus-font-heading);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nexus-stat__value {
    color: #fff;
    font-family: var(--nexus-font-mono);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.nexus-stat__track {
    grid-column: 2 / -1;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
}

.nexus-stat__fill {
    height: 100%;
    border-radius: inherit;
    background: var(--stat-color);
    box-shadow: 0 0 10px color-mix(in srgb, var(--stat-color) 70%, transparent);
}

.nexus-stat__caption {
    grid-column: 2 / -1;
    color: var(--nexus-text-muted);
    font-size: .75rem;
}

/* A stat with the archon's Adjust button at the end of its row (StatBar's OnAdjust). */
.nexus-stat--adjustable {
    grid-template-columns: 1.5rem 1fr auto auto;
}

.nexus-stat--adjustable .nexus-stat__track,
.nexus-stat--adjustable .nexus-stat__caption {
    grid-column: 2 / 4;
}

/* In the stat's own colour, tinted, filling on hover, so it reads as an action on that stat. */
/* A card too narrow for label, value and button on one line (a phone): the value moves under the label. */
@container (max-width: 26rem) {
    .nexus-stat--adjustable {
        grid-template-columns: 1.5rem 1fr auto;
    }

    .nexus-stat--adjustable .nexus-stat__label {
        grid-column: 2;
        grid-row: 1;
    }

    .nexus-stat--adjustable .nexus-stat__value {
        grid-column: 2 / -1;
        grid-row: 2;
    }

    .nexus-stat--adjustable .nexus-stat__track {
        grid-column: 2 / -1;
        grid-row: 3;
    }

    .nexus-stat--adjustable .nexus-stat__caption {
        grid-column: 2 / -1;
        grid-row: 4;
    }

    .nexus-stat--adjustable .nexus-stat__adjust.btn {
        grid-column: 3;
    }
}

.nexus-stat__adjust.btn {
    --bs-btn-color: var(--stat-color);
    --bs-btn-bg: color-mix(in srgb, var(--stat-color) 16%, transparent);
    --bs-btn-border-color: var(--stat-color);
    --bs-btn-hover-color: var(--nexus-bg);
    --bs-btn-hover-bg: var(--stat-color);
    --bs-btn-hover-border-color: var(--stat-color);
    --bs-btn-active-color: var(--nexus-bg);
    --bs-btn-active-bg: var(--stat-color);
    --bs-btn-active-border-color: var(--stat-color);
    --bs-btn-focus-box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--stat-color) 45%, transparent);
    grid-column: 4;
    grid-row: 1;
    padding: .15rem .6rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    box-shadow: 0 0 8px color-mix(in srgb, var(--stat-color) 30%, transparent);
}

/* Accounts */

.nexus-ledger {
    display: grid;
    gap: .5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--nexus-line);
}

/* Adjust modals (Components/Characters/AdjustExperienceModal.razor and SetStatModal.razor) */

.nexus-adjust__input {
    display: flex;
    gap: .5rem;
}

.nexus-adjust__input .btn {
    flex: none;
    white-space: nowrap;
}

.nexus-adjust__preview {
    display: grid;
    gap: .5rem;
    justify-items: start;
    min-height: 3rem;
    padding: .75rem 1rem;
    border: 1px solid var(--nexus-line);
    border-radius: 8px;
    background: var(--nexus-bg-sunken);
    font-family: var(--nexus-font-mono);
    font-size: .875rem;
}

.nexus-adjust__change {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    color: var(--nexus-text-muted);
}

.nexus-adjust__change .fa-arrow-right {
    color: var(--stat-xp);
}

.nexus-adjust__result {
    color: var(--nexus-text);
    font-weight: 600;
}

.nexus-adjust__bonus {
    color: var(--nexus-positive);
}

.nexus-adjust__error {
    color: var(--nexus-negative);
}

.nexus-account {
    display: grid;
    grid-template-columns: 2rem 1fr auto 1rem;
    align-items: center;
    gap: 0 .75rem;
    padding: .5rem .75rem;
    border: 1px solid var(--nexus-line);
    border-radius: 8px;
    background: rgba(0, 0, 0, .25);
    color: var(--nexus-text);
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease;
}

a.nexus-account:hover,
a.nexus-account:focus-visible {
    border-color: var(--currency-color, var(--nexus-line-strong));
    background: rgba(255, 255, 255, .04);
    color: var(--nexus-text);
}

.nexus-account--retna,
.nexus-balance--retna,
.nexus-circulation--retna { --currency-color: var(--currency-retna); }

.nexus-account--archonite,
.nexus-balance--archonite,
.nexus-circulation--archonite { --currency-color: var(--currency-archonite); }

.nexus-account__symbol {
    grid-column: 1;
    grid-row: 1 / span 2;
    color: var(--currency-color, var(--nexus-text));
    font-size: 1.5rem;
    line-height: 1;
    text-align: center;
}

.nexus-account__name {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    font-weight: 600;
}

.nexus-account__number {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
    color: var(--nexus-text-muted);
    font-family: var(--nexus-font-mono);
    font-size: .75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nexus-account__balance {
    grid-column: 3;
    grid-row: 1 / span 2;
    white-space: nowrap;
    color: #fff;
    font-family: var(--nexus-font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.nexus-account__go {
    grid-column: 4;
    grid-row: 1 / span 2;
    color: var(--nexus-text-muted);
    font-size: .75rem;
    transition: color .15s ease, transform .15s ease;
}

a.nexus-account:hover .nexus-account__go,
a.nexus-account:focus-visible .nexus-account__go {
    color: var(--currency-color, var(--nexus-text));
    transform: translateX(2px);
}

/* ---------- Account page ---------- */

.nexus-balance {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem 1.75rem;
    border: 1px solid var(--nexus-line);
    border-top: 3px solid var(--currency-color, var(--nexus-crimson));
    border-radius: 12px;
    background: linear-gradient(180deg, var(--nexus-surface) 0%, #1d0f0f 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

.nexus-balance__amount {
    margin: .35rem 0 .5rem;
    color: var(--currency-color, #fff);
    font-family: var(--nexus-font-mono);
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-shadow: 0 0 18px color-mix(in srgb, var(--currency-color, #fff) 35%, transparent);
    overflow-wrap: anywhere;
}

.nexus-balance__meta {
    color: var(--nexus-text-muted);
    font-size: .875rem;
}

.nexus-balance__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .35rem;
}

.nexus-amount {
    font-family: var(--nexus-font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.nexus-amount--in { color: var(--nexus-positive); }
.nexus-amount--out { color: var(--nexus-negative); }

.nexus-chip--reversed {
    margin-left: .5rem;
    color: var(--nexus-text-muted);
}

.nexus-empty {
    color: var(--nexus-text-muted);
    font-size: .875rem;
}

/* ---------- Page alert ---------- */

/* Bootstrap draws the close X as a fixed black image, which vanishes on the dark alerts. Use the X as a
   mask instead, filled with the alert's own text color. */
.nexus-page .alert .btn-close {
    color: inherit;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center / .875em auto no-repeat;
    mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center / .875em auto no-repeat;
    filter: none;
    opacity: .8;
}

.nexus-page .alert .btn-close:hover,
.nexus-page .alert .btn-close:focus-visible {
    opacity: 1;
}

/* A "← Parent" link under a page header. */
.nexus-back {
    margin: -.5rem 0 1.25rem;
    font-size: .875rem;
}

.nexus-back a {
    color: var(--nexus-text-muted);
    text-decoration: none;
}

.nexus-back a:hover,
.nexus-back a:focus-visible {
    color: #fff;
}

/* ---------- Archon: treasury ---------- */

/* One panel per currency, each listing its Treasury and Void accounts. */
.nexus-treasury {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .nexus-treasury {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.nexus-treasury__currency .nexus-card__header {
    align-items: center;
}

.nexus-treasury__currency .nexus-card__name {
    font-size: 1.25rem;
}

/* How much of the currency characters hold (Treasury less Void), at the right of the currency's header. */
.nexus-circulation {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .15rem;
    margin-left: auto;
    text-align: right;
}

.nexus-circulation__label {
    color: var(--nexus-text-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nexus-circulation__amount {
    color: var(--currency-color, #fff);
    font-family: var(--nexus-font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    white-space: nowrap;
}

/* ---------- Archon: toolbar, filters and badges (players and characters lists) ---------- */

.nexus-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1.5rem;
    margin-bottom: 1.5rem;
}

.nexus-toolbar .form-check {
    margin: 0;
}

.nexus-toolbar__summary {
    color: var(--nexus-text-muted);
    font-size: .875rem;
}

.nexus-toolbar__end {
    margin-left: auto;
}

/* Search box with a magnifying glass inside it (Pages/ArchonCharactersPage.razor) */

.nexus-search {
    position: relative;
    flex: 1 1 16rem;
    min-width: 0;
    max-width: 28rem;
}

.nexus-search__icon {
    position: absolute;
    top: 50%;
    left: .8rem;
    color: var(--nexus-text-muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.nexus-search .form-control {
    padding-left: 2.4rem;
}

/* Toggle-chip filter groups (Components/FilterChips.razor) */

.nexus-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 2rem;
    margin: -.5rem 0 1.5rem;
}

.nexus-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .375rem;
}

.nexus-filter__label {
    margin-right: .25rem;
    color: var(--nexus-text-muted);
    font-family: var(--nexus-font-heading);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.nexus-chip--toggle {
    border-color: var(--nexus-crimson);
    background: transparent;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, opacity .15s ease;
}

.nexus-chip--toggle:hover {
    border-color: var(--nexus-crimson-bright);
    color: #fff;
}

.nexus-chip--toggle:focus-visible {
    outline: 2px solid var(--nexus-crimson-bright);
    outline-offset: 2px;
}

.nexus-chip--toggle[aria-pressed="false"] {
    border-color: var(--nexus-line-strong);
    border-style: dashed;
    color: var(--nexus-text-muted);
    opacity: .75;
}

.nexus-chip--toggle[aria-pressed="false"]:hover {
    opacity: 1;
}

.nexus-chip__count {
    margin-left: .45rem;
    opacity: .7;
}

.nexus-badge-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .nexus-badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1200px) {
    .nexus-badge-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.nexus-badge {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--nexus-line);
    border-top: 3px solid var(--nexus-crimson);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--nexus-surface) 0%, #1d0f0f 100%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
    color: var(--nexus-text);
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, opacity .15s ease;
}

.nexus-badge:hover,
.nexus-badge:focus-visible {
    border-color: var(--nexus-crimson-bright);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
    color: var(--nexus-text);
    transform: translateY(-2px);
}

.nexus-badge:focus-visible {
    outline: 2px solid var(--nexus-crimson-bright);
    outline-offset: 2px;
}

.nexus-badge--inactive {
    border-top-color: var(--nexus-line-strong);
    opacity: .6;
}

.nexus-badge--inactive:hover,
.nexus-badge--inactive:focus-visible {
    opacity: .9;
}

.nexus-badge--pending {
    border-top-color: #f8b86c;
}

.nexus-badge__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.nexus-badge__identity {
    min-width: 0;
}

.nexus-badge__name {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.nexus-badge__subtitle,
.nexus-badge__email {
    color: var(--nexus-text-muted);
    font-size: .85rem;
    overflow-wrap: anywhere;
}

.nexus-badge__go {
    margin-top: .35rem;
    color: var(--nexus-text-muted);
    font-size: .8rem;
    transition: color .15s ease, transform .15s ease;
}

.nexus-badge:hover .nexus-badge__go,
.nexus-badge:focus-visible .nexus-badge__go {
    color: var(--nexus-crimson-bright);
    transform: translateX(2px);
}

.nexus-badge__characters {
    display: grid;
    gap: .4rem;
    margin: 0;
    padding: .75rem 0 0;
    border-top: 1px solid var(--nexus-line);
    list-style: none;
}

.nexus-badge__characters li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}

/* The owning player, at the foot of a character badge */
.nexus-badge__player {
    margin-top: auto;
    padding-top: .75rem;
    border-top: 1px solid var(--nexus-line);
    color: var(--nexus-text-muted);
    font-size: .85rem;
}

.nexus-badge__codename {
    margin-right: .15rem;
    font-family: var(--nexus-font-heading);
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.nexus-player__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* Player status chips */

.nexus-chip--active {
    border-color: color-mix(in srgb, var(--nexus-positive) 60%, transparent);
    color: var(--nexus-positive);
}

.nexus-chip--inactive {
    color: var(--nexus-text-muted);
}

.nexus-chip--verified {
    border-color: color-mix(in srgb, #9bd8fe 60%, transparent);
    color: #9bd8fe;
}

.nexus-chip--unverified {
    border-color: #f8b86c;
    color: #f8b86c;
}

/* ---------- Phone input (Components/PhoneInput.razor, built on intl-tel-input) ---------- */

/* The library's own variables, re-colored for the dark theme. On :root because on small screens the country
   list opens as a full-screen popup outside the input. */
:root {
    --iti-border-color: var(--nexus-line-strong);
    --iti-country-selector-bg: var(--nexus-surface-raised);
    --iti-hover-color: rgba(139, 30, 46, .3);
    --iti-icon-color: var(--nexus-text-muted);
}

/* The library's wrapper is inline-block; make the input full width like the other fields. */
.nexus-phone .iti {
    display: block;
    width: 100%;
}

.iti__country-selector {
    color: var(--nexus-text);
}

.iti__search-input {
    background-color: transparent;
    color: var(--nexus-text);
}

.iti__dial-code {
    color: var(--nexus-text-muted);
}

.nexus-phone--invalid .form-control,
.nexus-phone--invalid .form-control:focus {
    border-color: var(--bs-form-invalid-border-color);
}
