/* T262 Advancement Dashboard - dark theme, troop red + amber accents.
   Everything here is local; no webfonts, no CDN, no analytics (minors' data). */

:root {
    --t262-red: #e63946;
    --t262-amber: #ffd166;
    --t262-green: #2fbf71;
    --t262-bg: #14171c;
    --t262-panel: #1c2128;
    --t262-panel-2: #232a33;
    --t262-line: #2f3742;
    --t262-text: #e8edf3;
    --t262-muted: #97a3b2;
}

body {
    background-color: var(--t262-bg);
    color: var(--t262-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

/* ---------- chrome ---------- */

.t262-nav {
    background: linear-gradient(90deg, #1b1f26 0%, #232a33 100%);
    border-bottom: 2px solid var(--t262-red);
}

.navbar-brand { color: var(--t262-text) !important; font-weight: 600; letter-spacing: .01em; }

.t262-mark {
    background: var(--t262-red);
    color: #fff;
    font-weight: 700;
    border-radius: .4rem;
    padding: .12rem .45rem;
    font-size: .95rem;
    letter-spacing: .02em;
}

.t262-footer { color: var(--t262-muted); font-size: .8rem; border-top: 1px solid var(--t262-line); }

.t262-page-title { font-size: 1.35rem; font-weight: 650; margin: 0; }

.t262-sub { color: var(--t262-muted); font-size: .85rem; }

/* ---------- summary tiles ---------- */

.t262-tiles { display: flex; flex-wrap: wrap; gap: .5rem; }

.t262-tile {
    background: var(--t262-panel);
    border: 1px solid var(--t262-line);
    border-radius: .6rem;
    padding: .45rem .7rem;
    min-width: 5.5rem;
}

.t262-tile .n { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.t262-tile .k { font-size: .72rem; color: var(--t262-muted); text-transform: uppercase; letter-spacing: .04em; }
.t262-tile.is-close .n { color: var(--t262-green); }
.t262-tile.is-stalled .n { color: var(--t262-amber); }

/* ---------- patrol filter ---------- */

.t262-filter { display: flex; flex-wrap: wrap; gap: .4rem; }

.t262-chip {
    display: inline-block;
    border: 1px solid var(--t262-line);
    background: var(--t262-panel);
    color: var(--t262-text);
    border-radius: 2rem;
    padding: .3rem .85rem;
    font-size: .85rem;
    text-decoration: none;
    white-space: nowrap;
}

.t262-chip:hover { border-color: var(--t262-red); color: var(--t262-text); }

.t262-chip.active {
    background: var(--t262-red);
    border-color: var(--t262-red);
    color: #fff;
    font-weight: 600;
}

/* ---------- patrol section ---------- */

.t262-patrol-head {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    margin: 1.25rem 0 .6rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--t262-line);
}

.t262-patrol-head h2 { font-size: 1.05rem; font-weight: 650; margin: 0; }
.t262-patrol-head .count { color: var(--t262-muted); font-size: .8rem; }

/* ---------- scout card ---------- */

.t262-card {
    display: block;
    background: var(--t262-panel);
    border: 1px solid var(--t262-line);
    border-left: 3px solid var(--t262-line);
    border-radius: .6rem;
    padding: .7rem .85rem;
    height: 100%;
    text-decoration: none;
    color: inherit;
    transition: border-color .12s ease, background-color .12s ease;
}

.t262-card:hover, .t262-card:focus-visible {
    background: var(--t262-panel-2);
    border-color: var(--t262-red);
    color: inherit;
    outline: none;
}

.t262-card.is-close { border-left-color: var(--t262-green); }
.t262-card.is-stalled { border-left-color: var(--t262-amber); }
.t262-card.is-complete { border-left-color: var(--t262-green); }
.t262-card.is-ontrack { border-left-color: var(--t262-red); }

.t262-name { font-weight: 650; font-size: 1rem; line-height: 1.25; }

.t262-meta { color: var(--t262-muted); font-size: .78rem; }

/* ---------- status badge ---------- */

.t262-badge {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: 2rem;
    padding: .15rem .5rem;
    white-space: nowrap;
}

.t262-badge.is-close, .t262-badge.is-complete { background: rgba(47,191,113,.16); color: var(--t262-green); }
.t262-badge.is-stalled { background: rgba(255,209,102,.16); color: var(--t262-amber); }
.t262-badge.is-ontrack { background: rgba(230,57,70,.16); color: #ff8a93; }

/* ---------- journey bars ---------- */

.t262-journey { display: grid; grid-template-columns: 1fr; gap: .3rem; margin-top: .6rem; }

.t262-stage { display: grid; grid-template-columns: 5.4rem 1fr 2.6rem; align-items: center; gap: .5rem; }

.t262-stage .lbl { font-size: .72rem; color: var(--t262-muted); white-space: nowrap; }
.t262-stage .pct { font-size: .72rem; color: var(--t262-muted); text-align: right; font-variant-numeric: tabular-nums; }

.t262-bar {
    background: #10131a;
    border-radius: 2rem;
    height: .5rem;
    overflow: hidden;
}

.t262-bar > span {
    display: block;
    height: 100%;
    border-radius: 2rem;
    background: var(--t262-red);
}

/* A finished stage always reads green, whatever the scout's overall status. */
.t262-bar > span.done { background: var(--t262-green); }
.t262-bar > span.low { background: var(--t262-amber); }

.t262-stage.is-current .lbl { color: var(--t262-text); font-weight: 600; }
.t262-stage.is-current .pct { color: var(--t262-text); }

/* ---------- detail page ---------- */

.t262-panel {
    background: var(--t262-panel);
    border: 1px solid var(--t262-line);
    border-radius: .7rem;
    padding: .9rem 1rem;
}

/* ---------- rank picker (server-side GET form; works with JS off) ---------- */

.t262-rankpick {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    padding-bottom: .85rem;
    margin-bottom: .85rem;
    border-bottom: 1px solid var(--t262-line);
}

.t262-rankpick label { font-size: .9rem; white-space: nowrap; }

.t262-rankpick .form-select {
    background-color: #10131a;
    border-color: var(--t262-line);
    color: var(--t262-text);
    width: auto;
    min-width: 12rem;
    flex: 1 1 12rem;
}

.t262-rankpick .form-select:focus {
    border-color: var(--t262-red);
    box-shadow: 0 0 0 .2rem rgba(230,57,70,.2);
}

.t262-stage-block { border-top: 1px solid var(--t262-line); padding-top: .85rem; margin-top: .85rem; }
.t262-stage-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

/* The rank currently chosen in the picker reads as the focused one. */
.t262-stage-block.is-selected { border-left: 2px solid var(--t262-red); padding-left: .6rem; }
.t262-stage-block.is-selected .t262-stage-title h3 { color: var(--t262-text); }

.t262-working { text-transform: uppercase; letter-spacing: .04em; font-size: .68rem; }

.t262-stage-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.t262-stage-title h3 { font-size: 1rem; font-weight: 650; margin: 0; }

.t262-needs { list-style: none; padding: 0; margin: .6rem 0 0; }

.t262-needs li {
    display: flex;
    gap: .6rem;
    padding: .45rem 0;
    border-top: 1px dashed var(--t262-line);
    font-size: .9rem;
    line-height: 1.35;
}

.t262-needs li:first-child { border-top: 0; }

.t262-code {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .78rem;
    font-weight: 700;
    color: var(--t262-amber);
    background: rgba(255,209,102,.1);
    border-radius: .3rem;
    padding: .05rem .4rem;
    height: fit-content;
    min-width: 3.2rem;
    text-align: center;
}

.t262-req-missing { color: var(--t262-muted); font-style: italic; }

.t262-back { color: var(--t262-muted); font-size: .85rem; text-decoration: none; }
.t262-back:hover { color: var(--t262-text); }

/* ---------- login ---------- */

.t262-login-wrap { max-width: 22rem; margin: 3rem auto; }

.t262-login .form-control {
    background: #10131a;
    border-color: var(--t262-line);
    color: var(--t262-text);
}

.t262-login .form-control:focus {
    background: #10131a;
    color: var(--t262-text);
    border-color: var(--t262-red);
    box-shadow: 0 0 0 .2rem rgba(230,57,70,.2);
}

.btn-t262 { background: var(--t262-red); border-color: var(--t262-red); color: #fff; font-weight: 600; }
.btn-t262:hover, .btn-t262:focus { background: #cf2f3c; border-color: #cf2f3c; color: #fff; }

.t262-alert {
    background: rgba(230,57,70,.12);
    border: 1px solid rgba(230,57,70,.4);
    color: #ff9ba2;
    border-radius: .5rem;
    padding: .5rem .7rem;
    font-size: .85rem;
}

.t262-note {
    background: rgba(255,209,102,.1);
    border: 1px solid rgba(255,209,102,.35);
    color: var(--t262-amber);
    border-radius: .5rem;
    padding: .5rem .7rem;
    font-size: .8rem;
}

@media (max-width: 420px) {
    .t262-stage { grid-template-columns: 4.6rem 1fr 2.4rem; }
    .t262-stage .lbl { font-size: .68rem; }
}

/* ---------- main nav links ---------- */

.t262-navlinks { display: flex; gap: .25rem; align-items: center; }

.t262-navlink {
    color: var(--t262-muted);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    padding: .3rem .6rem;
    border-radius: .4rem;
    white-space: nowrap;
}

.t262-navlink:hover, .t262-navlink:focus-visible {
    color: var(--t262-text);
    background: rgba(255,255,255,.06);
    outline: none;
}

/* ---------- planning page ---------- */

.t262-plancontrols .form-control {
    background-color: #10131a;
    border-color: var(--t262-line);
    color: var(--t262-text);
    width: auto;
    flex: 0 1 11rem;
}

.t262-plancontrols .form-control:focus {
    background-color: #10131a;
    color: var(--t262-text);
    border-color: var(--t262-red);
    box-shadow: 0 0 0 .2rem rgba(230,57,70,.2);
}

/* The unit count is a single digit; it does not need the picker's 12rem minimum. */
.t262-plancontrols .form-select.t262-units { min-width: 4.5rem; flex: 0 0 auto; }

.t262-unit { display: flex; flex-direction: column; }

.t262-unit-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--t262-line);
}

.t262-unit-head h2 { font-size: 1.05rem; font-weight: 650; margin: 0; }

.t262-leaders {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .6rem;
}

.t262-leader {
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .02em;
    border: 1px solid rgba(230,57,70,.45);
    background: rgba(230,57,70,.12);
    color: #ff9ba2;
    border-radius: 2rem;
    padding: .12rem .55rem;
    white-space: nowrap;
}

.t262-unit-section { margin-top: .85rem; }

.t262-unit-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--t262-muted);
    font-weight: 700;
}

.t262-unit-label .t262-sub { text-transform: none; letter-spacing: 0; font-weight: 400; }

.t262-roster { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }

.t262-roster-item {
    display: inline-flex;
    align-items: baseline;
    gap: .4rem;
    background: var(--t262-panel-2);
    border: 1px solid var(--t262-line);
    border-radius: .4rem;
    padding: .22rem .5rem;
    font-size: .82rem;
    text-decoration: none;
    color: inherit;
}

.t262-roster-item:hover, .t262-roster-item:focus-visible {
    border-color: var(--t262-red);
    color: inherit;
    outline: none;
}

/* The number beside a name is how many requirements that scout still owes. */
.t262-roster-item .rc {
    font-size: .7rem;
    font-variant-numeric: tabular-nums;
    color: var(--t262-muted);
}

.t262-topics li { align-items: baseline; }

/* Coverage is the reason a topic was picked, so it sits at the end of every row. */
.t262-coverage {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    color: var(--t262-muted);
    white-space: nowrap;
}

.t262-coverage.is-universal { color: var(--t262-green); font-weight: 700; }

.t262-topics li.is-universal .t262-code {
    color: var(--t262-green);
    background: rgba(47,191,113,.12);
}

/* ---------- requirement times ---------- */

/* Per-topic minutes, tinted by how much the number is worth trusting: a DEFAULT is a
   placeholder nobody has looked at, and it should not read as confidently as a DERIVED one. */
.t262-mins {
    flex: 0 0 auto;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding: .05rem .35rem;
    border-radius: 4px;
    margin-left: auto;
    background: rgba(151,163,178,.12);
    color: var(--t262-muted);
}

.t262-mins.t262-src-derived { color: var(--t262-text); }
.t262-mins.t262-src-edited { background: rgba(47,191,113,.14); color: var(--t262-green); }
.t262-mins.t262-src-default { color: var(--t262-amber); background: rgba(255,209,102,.10); }

/* Coverage already claims margin-left:auto; once minutes sit beside it only one of them
   can push, so the minutes take the gap and coverage follows immediately after. */
.t262-topics li .t262-coverage { margin-left: .5rem; }

/* Members of an all-or-nothing teaching station. */
.t262-groupchip {
    flex: 0 0 auto;
    font-size: .65rem;
    letter-spacing: .02em;
    text-transform: uppercase;
    padding: .05rem .35rem;
    border-radius: 4px;
    border: 1px solid var(--t262-line);
    color: var(--t262-muted);
    white-space: nowrap;
}

.t262-unit-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}

.t262-plantotal {
    border-top: 1px dashed var(--t262-line);
    padding-top: .45rem;
}

/* The "12/60" on the headline tile: the budget is context, not the number itself. */
.t262-unit-min {
    font-size: .6em;
    color: var(--t262-muted);
    font-weight: 500;
}

/* ---------- config page ---------- */

.t262-timetable { font-size: .82rem; }
.t262-timetable th { color: var(--t262-muted); font-weight: 600; }
.t262-timetable td { vertical-align: middle; }

.t262-timetable .t262-minutes { width: 5.5rem; }
.t262-timetable .t262-group { width: 11rem; }

.t262-srcbadge {
    display: inline-block;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: .1rem .4rem;
    border-radius: 4px;
    white-space: nowrap;
}

.t262-srcbadge.is-derived { background: rgba(151,163,178,.16); color: var(--t262-text); }
.t262-srcbadge.is-edited { background: rgba(47,191,113,.16); color: var(--t262-green); }
.t262-srcbadge.is-default { background: rgba(255,209,102,.16); color: var(--t262-amber); }

/* A rejected row has to be findable in a table of 131. */
.t262-row-error > td { background: rgba(230,57,70,.10); }

.t262-field-error {
    font-size: .68rem;
    color: #ff8a93;
    margin-top: .2rem;
}

.t262-note.t262-error {
    border-color: rgba(230,57,70,.45);
    background: rgba(230,57,70,.10);
}

/* ---- Climbing knots (Longhorn Instructor Training) ---------------------- */
/* Thumb is a circle so the row reads as a pill rather than a card grid; the
   expanded still is full width because the knot is the content. */
.t262-knot-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.t262-knot-num {
    min-width: 1.9em;
    font-variant-numeric: tabular-nums;
    opacity: .6;
}

.t262-knot-name {
    font-weight: 600;
}

.t262-knot-big {
    width: 100%;
    max-width: 420px;
    height: auto;
    border-radius: .5rem;
    display: block;
}

.t262-knots .accordion-button {
    gap: .25rem;
}

/* Invite keys are read off the screen and copied by hand: big, spaced, monospace. */
.t262-invite-keys {
    font-size: 1.15rem;
    line-height: 1.9;
    letter-spacing: .08em;
    white-space: pre;
    margin: 0;
}

/* The invite key is typed from paper: wide tracking, monospace, no autocorrect surprises. */
.t262-keyfield {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .12em;
    text-transform: uppercase;
}

/* Project tiles: whole card is the target, so it works with a thumb on a phone. */
.t262-tile { color: inherit; transition: border-color .12s ease; }
a.t262-tile:hover { border-color: rgba(255,255,255,.35); }
.t262-tile-soon { opacity: .55; }
.t262-tile-flag {
    display: inline-block;
    font-size: .72rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .6;
}

/* ---- First year handbook ------------------------------------------------ */
/* The source page shipped its own inline <style>; CSP is style-src 'self', so the rules it
   actually relies on live here instead. */
.t262-handbook { max-width: 46rem; }
.t262-handbook header h1 { font-size: 1.5rem; letter-spacing: -.01em; }
.t262-handbook .toc {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: .75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.t262-handbook .toc h2 { font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.t262-handbook section { padding-top: .5rem; margin-bottom: 2rem; }
.t262-handbook h2 { font-size: 1.15rem; margin-bottom: .6rem; }
.t262-handbook .num {
    display: inline-block; min-width: 1.6em;
    opacity: .5; font-variant-numeric: tabular-nums;
}
.t262-handbook .callout {
    border-left: 3px solid rgba(255,255,255,.3);
    padding: .6rem 0 .6rem 1rem;
    margin: 1rem 0;
    background: rgba(255,255,255,.03);
}
.t262-handbook .src-note { font-size: .8rem; opacity: .55; }
.t262-handbook .contact-card {
    border: 1px solid rgba(255,255,255,.12);
    border-radius: .75rem; padding: 1rem;
}
.t262-handbook .schedule { width: 100%; }
.t262-handbook .schedule td, .t262-handbook .schedule th {
    padding: .35rem .6rem; border-bottom: 1px solid rgba(255,255,255,.08);
}
.t262-handbook .back-top { font-size: .8rem; opacity: .6; }

/* ---- Knots on a phone ---------------------------------------------------- */
/* Bootstrap's dark accordion dims body text through its own custom properties, which read as
   "greyed out" rather than as prose. State the colour rather than inheriting it. */
.t262-knots .accordion-body { color: var(--bs-body-color); }
.t262-knots .accordion-button { color: var(--bs-body-color); }
.t262-knot-note { font-size: 1rem; margin-bottom: .75rem; }

/* The still must never be tall enough to push the link past the bottom of the screen: the
   link is the whole point of the page. */
.t262-knot-big { max-height: 45vh; object-fit: contain; }

/* ---------- flag training tracker ---------- */

.t262-progress { height: .55rem; accent-color: var(--t262-red); }
