/*
=========================================================
BOSS DESIGN SYSTEM — authoritative shared components
=========================================================
This is the single authoritative source for the shared UI treatments that were
previously reinvented per page (metrics, the alphabet index, label/value pairs,
dark-surface contrast, page/section headers and the clickable-card helper).

Rules of the road (see docs/BOSS_UI_DESIGN_SYSTEM.md):
  * Buttons come from buttons.css (.boss-button / -primary / -secondary / -danger).
  * Cards come from cards.css (.boss-card[.clickable]).
  * Badges come from badges.css (.boss-badge).
  * Colours/spacing/radius come from variables.css tokens (--boss-blue = #0b3d7a).
  * DO NOT invent a new local treatment when one of these exists.

This file is loaded on every app-shell page, so its component classes are always
available and win over ad-hoc local link/button rules.
*/

/* --- Dark-surface text contract ------------------------------------------- */
/* Anything on a BOSS-blue / dark surface MUST use high-contrast light text. */
:root {
    --on-dark-primary: #ffffff;
    --on-dark-secondary: #e6eefc;   /* high-contrast light neutral, never gray-blue */
    --on-dark-label: #ffffff;
}
.boss-surface-dark {
    background: var(--boss-blue);
    color: var(--on-dark-primary);
}
.boss-surface-dark a { color: var(--on-dark-primary); }
.boss-surface-dark dt,
.boss-on-dark-label { color: var(--on-dark-label); }
.boss-on-dark { color: var(--on-dark-primary); }
.boss-on-dark-secondary { color: var(--on-dark-secondary); }

/* --- Page + section headers ----------------------------------------------- */
.boss-page-header {
    background: var(--boss-blue);
    color: var(--on-dark-primary);
    border-radius: var(--radius-large);
    padding: 22px 28px;
    margin: 0 0 var(--space-lg);
}
.boss-page-header h1 { color: var(--on-dark-primary); margin: 0; }
.boss-section-title {
    background: var(--boss-blue);
    color: var(--on-dark-primary);
    padding: 13px 18px;
    border-radius: var(--radius-medium) var(--radius-medium) 0 0;
    margin: 0;
    font-size: 1.2rem;
}

/* --- Label / value pairs (read-only) -------------------------------------- */
.boss-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-md) var(--space-lg);
}
.boss-field-label {
    font-size: .74rem;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.boss-field-value {
    margin: 3px 0 0;
    font-weight: 650;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
@media (max-width: 760px) { .boss-field-grid { grid-template-columns: 1fr; } }

/* --- Metric / stat component ---------------------------------------------- */
/* Value and label are ALWAYS distinct block elements — never concatenated. */
.boss-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-sm);
    margin: 0 0 var(--space-md);
}
.boss-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-large);
    padding: 16px;
    text-decoration: none;
    box-shadow: var(--shadow-small);
}
a.boss-metric:hover,
a.boss-metric:focus-visible { border-color: var(--boss-blue); outline: none; }
.boss-metric-value {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--boss-blue);
}
.boss-metric-label {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* --- Alphabet index component --------------------------------------------- */
/* Each letter is its OWN button. Available = BOSS-blue/white; current = darker
   ringed; unavailable = muted, non-interactive with disabled semantics. */
.boss-alpha-index {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 var(--space-md);
}
.boss-alpha-letter {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: var(--radius-medium);
    border: 1px solid transparent;
    font-weight: 800;
    font-size: .95rem;
    text-decoration: none;
    cursor: pointer;
}
a.boss-alpha-letter {
    background: var(--boss-blue);
    color: #fff;
    border-color: var(--boss-blue);
}
a.boss-alpha-letter:hover,
a.boss-alpha-letter:focus-visible { background: #072a56; color: #fff; outline: none; }
.boss-alpha-letter.is-selected {
    background: #072a56;
    color: #fff;
    border-color: #072a56;
    box-shadow: 0 0 0 3px rgba(11, 61, 122, .32);
}
.boss-alpha-letter[aria-disabled="true"],
.boss-alpha-letter.is-disabled {
    color: #9fb0c2;
    background: #eef2f7;
    border-color: var(--border-color);
    cursor: default;
    pointer-events: none;
}

/* --- Clickable card helper ------------------------------------------------ */
/* Complements cards.css. Use on an <a>/<button> wrapping a whole card so the
   entire card is one accessible control with a visible focus ring. */
.boss-card-clickable {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color var(--transition-fast),
        box-shadow var(--transition-fast), transform var(--transition-fast);
}
.boss-card-clickable:hover,
.boss-card-clickable:focus-visible {
    border-color: var(--boss-blue);
    box-shadow: var(--shadow-medium);
    transform: translateY(-1px);
    outline: none;
}
.boss-card-clickable:focus-visible { box-shadow: 0 0 0 3px rgba(11, 61, 122, .35); }

/* --- Document page scroll contract ---------------------------------------- */
/* The app shell is a fixed 100vh/overflow:hidden workspace (for the dispatch
   column layout). A document page opts into normal vertical scrolling by giving
   its root this class; fixed operational workspaces (Dispatch) do NOT. */
.boss-document-page {
    height: 100%;
    overflow-y: auto;
}

/* --- Action row: buttons align to the CONTROL, not its label -------------- */
.boss-field-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.boss-field-row > input,
.boss-field-row > select { flex: 1 1 280px; min-height: 44px; }
.boss-field-row > .boss-button { flex: 0 0 auto; min-height: 44px; }
