/* ==========================================================================
   AK Squad — Dark/orange theme inspired by the forum + 2026 mockup
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Inter+Tight:wght@600;700;800&display=swap');

:root {
    --bg:            #0a0a0a;
    --bg-2:          #111;
    --bg-card:       #161616;
    --bg-card-hover: #1d1d1d;
    --text:          #f5f5f5;
    --text-muted:    #888;
    --text-dim:      #555;
    --accent:        #ff8c42;
    --accent-hover:  #ff6f12;
    --accent-dim:    #b85a1f;
    --border:        #262626;
    --border-bright: #3a3a3a;
    --good:          #4ade80;
    --bad:           #f87171;

    --nav-width:     210px;
    --topbar-h:      72px;
    --topbar-stuck-h: 109px;   /* used as `top` for sticky table headers — covers banner topbar */

    --font-display:  'Inter Tight', 'Inter', -apple-system, sans-serif;
    --font-body:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-weight: 400;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }
code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.85em;
    background: var(--bg-2);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    color: var(--accent);
}

/* ==========================================================================
   Top bar (banner OR brand+motto fallback)
   Sticky at the top of the viewport so the banner stays visible on scroll.
   Sits to the LEFT of the fixed sidenav.
   ========================================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-right: var(--nav-width);
}

/* Minimal text fallback when banner.png is missing */
.topbar--minimal {
    height: var(--topbar-h);
    padding: 0 2rem;
}

/* Full-width image banner when banner.png is present */
.topbar--banner {
    min-height: 60px;
    padding: 0.3rem 1rem;
    /* Dark warm-tinted overlay (sits ABOVE the tile) so the background
       harmonizes with the site's --accent orange but stays dark. Tune the
       last alpha (0.55) to taste — higher = darker, lower = more texture. */
    background-image:
        linear-gradient(rgba(20, 10, 5, 0.3), rgba(20, 10, 5, 0.3)),
        url('bg_header.png');
    background-repeat: repeat-x, repeat-x;
    background-position: center center, center center;
}
.banner-link {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.banner-link img {
    max-width: 100%;
    max-height: 96px;
    height: auto;
    width: auto;
    object-fit: contain;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
}
.brand .shield {
    width: 32px; height: 32px;
    color: var(--accent);
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}
.brand-text .name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.06em;
}
.brand-text .sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.18em;
    margin-top: 0.2rem;
}
.motto {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* Mobile menu button - fixed top-right, hidden on desktop */
.menu-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 60;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid var(--border-bright);
    color: var(--text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 3px;
}
.menu-toggle svg { width: 28px; height: 28px; }

/* ==========================================================================
   Right vertical nav
   ========================================================================== */
.sidenav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--nav-width);
    background: var(--bg);
    border-left: 1px solid var(--border);
    padding: 1.5rem 0 0;
    overflow-y: auto;
    z-index: 40;
    display: flex;
    flex-direction: column;
}
.sidenav ul { flex: 1 0 auto; }   /* push squad-status to the bottom */

.sidenav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidenav li { margin: 0; }
.sidenav a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.5rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}
.sidenav a:hover {
    background: var(--bg-card);
    color: var(--accent);
}
.sidenav a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--bg-card);
}
.sidenav svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ==========================================================================
   Main content layout
   The .main-wrap sits between the topbar and footer, with right margin to
   clear the fixed sidenav. Everything inside it (hero, container, stats,
   footer) gets that breathing room automatically.
   ========================================================================== */
.main-wrap {
    margin-right: var(--nav-width);
    min-height: 60vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1500px;          /* room for most tables; pages that need the
                                   full width can opt-in via .container--wide */
    margin: 0 auto;
    padding: 2.5rem 2rem;
    width: 100%;
}
/* Opt-in for pages with very wide tables (e.g. FSO Apply with ~10 columns). */
.container.container--wide { max-width: none; }

/* ==========================================================================
   Hero (home page)
   ========================================================================== */
.hero {
    position: relative;
    height: 80vh;
    min-height: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg);
}

.hero-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    /* Crossfade between A and B at the loop boundary (see index.php script).
       1.875s = FADE (1.5 video-seconds) / RATE (0.8) — wall-clock duration. */
    opacity: 1;
    transition: opacity 1.875s linear;
}
.hero-video--b { opacity: 0; }
.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg,
        rgba(10,10,10,0.45) 0%,
        rgba(10,10,10,0.15) 50%,
        rgba(10,10,10,0.85) 100%);
}

.hero-tagline {
    position: relative;
    z-index: 2;
    color: var(--accent);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
    margin: 0 0 2rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

.hero-emblem {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}
.hero-emblem img {
    width: clamp(180px, 26vw, 320px);
    filter: drop-shadow(0 10px 30px rgba(0,0,0,0.7));
}
/* Recruiting CTA — sits centered just below the coat of arms. URL is
 * admin-editable via app_settings.recruit_link_url. */
.hero-cta {
    display: inline-block;
    margin-top: 1.25rem;
    padding: 0.75rem 2rem;
    background: var(--accent);
    color: #1a1208;
    text-decoration: none;
    border-radius: 999px;
    font: 700 1.05rem/1 var(--font-display, system-ui);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 6px 22px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.2) inset;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}
.hero-cta:hover {
    transform: translateY(-2px);
    background: var(--accent-light, #ffae6b);
    box-shadow: 0 10px 30px rgba(0,0,0,0.65), 0 0 0 1px rgba(0,0,0,0.25) inset;
}
.hero-cta:active { transform: translateY(0); }

/* ---- Inline section editor on /come-fly-with-us.php (admin-only) ----------- */
.recruit-section { position: relative; }
.recruit-edit-pencil {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 2.1rem;
    height: 2.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent-dim);
    border-radius: 50%;
    background: rgba(20, 14, 8, 0.85);
    color: var(--accent);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.12s ease, transform 0.12s ease, color 0.12s ease;
    z-index: 2;
}
.recruit-edit-pencil:hover {
    background: var(--accent);
    color: #1a1208;
    transform: scale(1.08);
}
.recruit-edit-form {
    display: block;
    margin: 0;
}
.recruit-edit-label {
    display: block;
    font-family: var(--font-display, system-ui);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 0.45rem;
}
.recruit-edit-form textarea {
    width: 100%;
    background: var(--bg-1);
    border: 1px solid var(--accent-dim);
    border-radius: 3px;
    color: var(--text);
    padding: 0.7rem 0.85rem;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.88rem;
    line-height: 1.5;
    resize: vertical;
}
.recruit-edit-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

/* Full squadron banner (replaces the emblem stack when banner.png exists) */
.hero-banner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1000px;
    padding: 0 1.5rem;
    margin: 0 auto;
}
.hero-banner img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 28px rgba(0,0,0,0.75));
}
.hero-emblem .script {
    font-family: 'Brush Script MT', cursive;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: #e8e8e8;
    margin: 0.5rem 0 0.25rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}
.hero-emblem .motto-banner {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: #d0a070;
    text-transform: uppercase;
    text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}

.cta {
    position: relative;
    z-index: 2;
    display: inline-block;
    padding: 1rem 3.5rem;
    background: var(--accent);
    color: #0a0a0a;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-radius: 2px;
    margin-top: 2.5rem;
    transition: all 0.15s ease;
    box-shadow: 0 4px 24px rgba(255, 140, 66, 0.3);
}
.cta:hover {
    background: var(--accent-hover);
    color: #0a0a0a;
    transform: translateY(-1px);
    box-shadow: 0 6px 30px rgba(255, 140, 66, 0.5);
}

/* ==========================================================================
   Section pattern (centered title with orange underline)
   ========================================================================== */
.section { padding: 4rem 2rem; }
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}
.section-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 1rem;
    color: var(--text);
}
.section-header .underline {
    width: 60px;
    height: 3px;
    background: var(--accent);
    margin: 0 auto;
}
.section-header p {
    color: var(--text-muted);
    margin-top: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Generic page heading (interior pages) */
.page-heading {
    margin-bottom: 2rem;
}
.page-heading h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}
.page-heading .accent-bar {
    width: 60px;
    height: 3px;
    background: var(--accent);
    margin-top: 1rem;
}
.page-heading p {
    color: var(--text-muted);
    margin-top: 1rem;
    max-width: 700px;
}

/* ==========================================================================
   Feature cards (Our Strength style)
   ========================================================================== */
.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    padding: 2rem 1.75rem;
    transition: all 0.2s ease;
}
.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-dim);
    transform: translateY(-2px);
}
.feature-card .icon {
    color: var(--accent);
    margin-bottom: 1.25rem;
}
.feature-card .icon svg { width: 28px; height: 28px; }
.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin: 0 0 0.75rem;
    color: var(--text);
    font-weight: 700;
}
.feature-card p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.93rem;
}

/* ==========================================================================
   Stats strip
   ========================================================================== */
.stats-strip {
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 3rem 2rem;
}
.stats-strip-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}
.stat-item .number {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-item .label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-top: 0.6rem;
}

/* ==========================================================================
   Data tables (kill board, roster, awards, etc.)
   ========================================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin: 1rem 0 2rem;
    font-size: 0.93rem;
}
.data-table th,
.data-table td {
    /* Tightened from 0.85rem 1.1rem (2026-05-20) so site-wide tables match the
     * denser look used on /pilot-tour.php score-cards. Roughly halves the
     * vertical breathing room while keeping legibility. */
    padding: 0.4rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table thead th {
    background: var(--bg-2);
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    white-space: nowrap;
    /* Stick under the (sticky) banner topbar so long tables keep headers visible while scrolling.
       Note: with border-collapse:collapse, borders belong to the TABLE, not the cell, so they
       don't travel with a sticky <th>. Use box-shadow instead — it paints with the cell. */
    border-bottom: 0;
    box-shadow: inset 0 -2px 0 var(--accent-dim);
    position: sticky;
    top: var(--topbar-stuck-h);
    z-index: 5;
}
/* For tables with TWO header rows (e.g. fso-apply's grouped header), the second
   row sits just under the first. */
.data-table thead tr:nth-child(2) th {
    top: calc(var(--topbar-stuck-h) + 2.5rem);
}
.data-table thead th a { color: inherit; display: block; }
.data-table thead th a:hover { color: var(--text); }
.data-table thead th .sort-arrow { color: var(--accent); padding-left: 0.3em; font-size: 0.65rem; }
.data-table tbody tr { transition: background 0.1s ease; }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table th.num,
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .group-header td {
    background: #050505;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    /* Slightly more vertical room than a data row so the band still
     * reads as a separator after the global tightening. */
    padding: 0.5rem 0.85rem;
}

/* fso-apply.php column-group tint: visually group the 3 FSO cols vs the 3 KB cols
   without using a two-row header (which fights position:sticky). Header cells carry
   the .fso-col / .kb-col class; body cells are tinted by column position.

   Header backgrounds MUST be fully opaque (sticky headers reveal what's behind them
   when scrolling). We layer the tint as a gradient on top of var(--bg-2) so the
   tint look survives any change to --bg-2. Body cells can stay transparent. */
.fso-compare-table tbody td:nth-child(3),
.fso-compare-table tbody td:nth-child(4),
.fso-compare-table tbody td:nth-child(5) {
    background: rgba(255, 140, 66, 0.06);
}
.fso-compare-table thead th.fso-col {
    background: linear-gradient(rgba(255, 140, 66, 0.14), rgba(255, 140, 66, 0.14)), var(--bg-2);
    color: var(--accent);
}
.fso-compare-table tbody td:nth-child(6),
.fso-compare-table tbody td:nth-child(7),
.fso-compare-table tbody td:nth-child(8) {
    background: rgba(255, 255, 255, 0.025);
}
.fso-compare-table thead th.kb-col {
    background: linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06)), var(--bg-2);
}

/* ==========================================================================
   Pilot page header + stat cards
   ========================================================================== */
.pilot-header {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-left: 4px solid var(--accent);
    padding: 1.75rem 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}
.pilot-header h1 {
    font-family: var(--font-display);
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: 0.04em;
}
.pilot-header .meta {
    color: var(--text-muted);
    font-size: 0.92rem;
}
.pilot-header .meta span { margin-right: 1.25rem; }
.pilot-header .meta strong { color: var(--text); font-weight: 600; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.5rem 1rem;
    text-align: center;
    transition: border-color 0.15s ease;
}
.stat-card:hover { border-color: var(--accent-dim); }
.stat-card .value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-card .label {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 0.6rem;
}

/* ==========================================================================
   Status badges
   ========================================================================== */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: var(--font-display);
    margin-right: 0.4rem;
}
.status-badge.active   { background: #143a1c; color: #4ade80; border: 1px solid #1f5a2a; }
.status-badge.on_leave { background: #3a2a08; color: #fbbf24; border: 1px solid #5a4012; }
.status-badge.retired  { background: #2a2a2a; color: #aaa;    border: 1px solid #3a3a3a; }
.status-badge.fallen   { background: #3a0a0a; color: #f87171; border: 1px solid #5a1010; }
.status-badge.discharged { background: #1a1a2a; color: #9ca3af; border: 1px solid #2a2a3a; text-decoration: line-through; }

/* ==========================================================================
   Award icons + article (squad history)
   ========================================================================== */
.award-icon {
    width: 38px;
    height: 38px;
    object-fit: contain;
    vertical-align: middle;
}

/* Visual award picker on /admin/awards.php — clickable grid of icon tiles.
   Driven by JS in awards.php (pickAwardCode/filterAwardPicker). */
.award-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 0.4rem;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.6rem;
    margin-top: 0.6rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 2px;
}
.award-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.3rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.1s, border-color 0.1s, transform 0.1s;
}
.award-tile:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-dim);
    color: var(--text);
    transform: translateY(-1px);
}
.award-tile.picked {
    border-color: var(--accent);
    background: rgba(255, 140, 66, 0.08);
    color: var(--text);
}
.award-tile img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.award-tile-code {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* /forum.php — phpBB embedded inside our sidenav layout WITH our site banner
   still showing. The forum's own banner is cropped via overflow:hidden on the
   frame wrapper plus a negative margin on the iframe — tune --forum-header-crop
   to match the phpBB theme's header height. */
/* phpBB now runs in-house at /forum/ and the banner has been removed inside
 * the forum itself, so no more crop trick. The iframe just fills its frame.
 * (Previously there was a --forum-header-crop variable + negative offset to
 *  hide phpBB's banner; obsolete since 2026-05-20.) */
.forum-embed {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}
.forum-embed-frame {
    flex: 1;
    background: #fff;
    min-height: 80vh;
}
.forum-embed-frame iframe {
    display: block;
    width: 100%;
    height: 100vh;
    border: 0;
    background: #fff;
}

.article {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2.5rem 3rem;
    max-width: 900px;
    margin: 0 auto;
}
.article h2 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    border-bottom: 1px solid var(--border-bright);
    padding-bottom: 0.5rem;
    margin-top: 2.5rem;
}
.article h3 {
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 700;
    margin-top: 1.5rem;
}
.article p { color: #d0d0d0; margin: 1rem 0; }
.article img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border: 1px solid var(--border-bright);
    border-radius: 2px;
}

/* ==========================================================================
   Panels (used on home page top-5, etc.)
   ========================================================================== */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.5rem;
}
.panel h2,
.panel h3 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--text);
}

/* ==========================================================================
   Footer (3 columns)
   ========================================================================== */
.site-footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 3.5rem 2rem 2rem;
    margin-top: auto;
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 3rem;
}
.footer-col h4 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text);
    margin: 0 0 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.footer-col h4 svg { width: 18px; height: 18px; color: var(--accent); }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.6rem; }
.footer-col a { color: var(--text-muted); font-size: 0.9rem; }
.footer-col a:hover { color: var(--accent); }
.footer-col p { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1rem; }
.footer-col .motto-line {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-top: 1.5rem;
}
.footer-bottom {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ==========================================================================
   Squad status indicator — bottom of the sidenav
   ========================================================================== */
.sidenav .squad-status {
    margin: 1rem 1rem 1rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-left: 3px solid var(--accent);
    font-size: 0.75rem;
}
.sidenav .squad-status .label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.6rem;
    margin-bottom: 0.2rem;
}
.sidenav .squad-status .state {
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.95rem;
}
.sidenav .squad-status .next {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}
/* Country-specific accent: replaces the orange left-border + state color so
   the panel visually matches which side AK is flying for that month. */
.sidenav .squad-status--knights { border-left-color: #ffce3c; }
.sidenav .squad-status--knights .state { color: #ffce3c; }
.sidenav .squad-status--rooks   { border-left-color: #44dd44; }
.sidenav .squad-status--rooks   .state { color: #44dd44; }
.sidenav .squad-status--bishops { border-left-color: #c95dff; }
.sidenav .squad-status--bishops .state { color: #c95dff; }

/* ==========================================================================
   Pilot Scores tab strip
   ========================================================================== */
.scores-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-bright);
}
.scores-tabs a {
    padding: 0.6rem 1.2rem;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s ease;
}
.scores-tabs a:hover {
    color: var(--accent);
    text-decoration: none;
}
.scores-tabs a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ==========================================================================
   Admin UI
   ========================================================================== */

/* Sub-navigation strip across the top of every admin page */
.admin-subnav {
    background: var(--bg-2);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 2px;
}
.admin-subnav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.admin-subnav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.admin-subnav-links a {
    color: var(--text-muted);
    padding: 0.4rem 0.85rem;
    border-radius: 2px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.1s ease;
}
.admin-subnav-links a:hover {
    background: var(--bg-card);
    color: var(--text);
}
.admin-subnav-links a.active {
    background: var(--accent);
    color: #0a0a0a;
}
/* Thin vertical separator between groups of admin-subnav links (Roster | FSO |
   System). To revert grouping entirely, delete this rule AND swap admin_subnav()
   in includes/admin-ui.php back to a flat list — see the comment there. */
.admin-subnav-sep {
    display: inline-block;
    width: 1px;
    align-self: stretch;
    background: var(--border-bright);
    margin: 0.25rem 0.4rem;
}
.admin-subnav-user {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.admin-subnav-user strong { color: var(--text); }
.admin-subnav-user a { color: var(--accent); }

/* Role badges */
.user-role-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: var(--font-display);
    margin-left: 0.3rem;
}
.user-role-badge.admin   { background: #5a1010; color: #f87171; border: 1px solid #7a1818; }
.user-role-badge.officer { background: #3a2a08; color: #fbbf24; border: 1px solid #5a4012; }
.user-role-badge.pilot   { background: #143a1c; color: #4ade80; border: 1px solid #1f5a2a; }

/* Flash messages */
.flash {
    padding: 0.85rem 1.1rem;
    margin: 0 0 1.25rem;
    border: 1px solid var(--border-bright);
    border-radius: 2px;
    font-size: 0.93rem;
}
.flash-ok    { background: #143a1c; color: #4ade80; border-color: #1f5a2a; }
.flash-error { background: #3a0a0a; color: #f87171; border-color: #5a1010; }
.flash-warn  { background: #3a2a08; color: #fbbf24; border-color: #5a4012; }

/* Forms */
.admin-form { max-width: 640px; }
.admin-form--inline { max-width: none; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.login-wrap { max-width: 420px; margin: 2rem auto; }
.form-row { margin-bottom: 1.1rem; }
.form-row label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.form-row .req { color: var(--accent); }
.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="date"],
.form-row input[type="number"],
.form-row select,
.form-row textarea,
.admin-form--inline input,
.admin-form--inline select {
    background: var(--bg-2);
    border: 1px solid var(--border-bright);
    color: var(--text);
    padding: 0.55rem 0.75rem;
    border-radius: 2px;
    font: inherit;
    width: 100%;
    transition: border-color 0.15s ease;
}
.admin-form--inline input,
.admin-form--inline select { width: auto; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.form-row small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.5rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn:hover { background: var(--bg-card-hover); color: var(--accent); border-color: var(--accent-dim); }
.btn-primary { background: var(--accent); color: #0a0a0a; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: #0a0a0a; border-color: var(--accent-hover); }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.82rem; }

.link-btn, .link-btn-danger {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}
.link-btn-danger { color: var(--bad); }
.link-btn:hover, .link-btn-danger:hover { opacity: 0.7; }

.row-actions { display: flex; gap: 0.85rem; align-items: center; }
.row-actions a, .row-actions .link-btn, .row-actions .link-btn-danger { font-size: 0.85rem; }


/* Quick actions list on dashboard */
.quick-actions { list-style: none; padding: 0; margin: 0; }
.quick-actions li { margin-bottom: 0.6rem; }
.quick-actions li a { font-weight: 500; }

/* Kill-board edit table cells */
.kb-cell { width: 100%; }
.kb-cell-num { width: 5rem; text-align: right; }

/* Audit log JSON diffs */
.audit-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.5rem; }
.audit-diff pre {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.6rem;
    font-size: 0.75rem;
    max-height: 240px;
    overflow: auto;
    white-space: pre-wrap;
}
@media (max-width: 700px) { .audit-diff { grid-template-columns: 1fr; } }

/* Pagination */
.pagination { display: flex; gap: 0.3rem; margin: 1.5rem 0; flex-wrap: wrap; }
.pagination .page {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-bright);
    color: var(--text-muted);
    border-radius: 2px;
    font-size: 0.85rem;
}
.pagination .page:hover { color: var(--accent); border-color: var(--accent-dim); }
.pagination .page.current { background: var(--accent); color: #0a0a0a; border-color: var(--accent); }

/* Master admin row highlight */
.master-admin-row td { background: rgba(255, 140, 66, 0.05); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .menu-toggle { display: block; }
    .sidenav {
        transform: translateX(100%);
        transition: transform 0.25s ease;
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }
    body.nav-open .sidenav { transform: translateX(0); }
    .main-wrap,
    .topbar { margin-right: 0; }
    .topbar--banner { padding-right: 4rem; } /* clear the menu button */
    .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
    .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
    .squad-status { right: 1rem; bottom: 1rem; }
    .article { padding: 1.5rem 1.5rem; }
}
@media (max-width: 600px) {
    .topbar { padding: 0 1rem; }
    .motto { display: none; }
    .container { padding: 1.5rem 1rem; }
    .pilot-header { padding: 1.25rem; }
    .stat-card .value { font-size: 1.6rem; }
    .data-table { font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.6rem; }
    /* Smaller topbar offset on mobile (banner is smaller or hidden). */
    :root { --topbar-stuck-h: 60px; }
}
