/* =========================================================
   TOCRON DLM v0.5 — Custom CSS
   ========================================================= */

/* ---------------------------------------------------------
   CSS Variables
   --------------------------------------------------------- */
:root {
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 64px;
    --sidebar-bg: #1a1d23;
    --sidebar-text: #b8bcc8;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(99, 102, 241, 0.15);
    --sidebar-active-border: #6366f1;
    --sidebar-header-bg: #12151a;
    --sidebar-footer-bg: #12151a;
    --topbar-height: 52px;
    --content-bg: #eef0f5;
    --card-border-radius: 0.4rem;
    --transition-speed: 0.2s;
}

/* ---------------------------------------------------------
   Base
   --------------------------------------------------------- */
body {
    background-color: var(--content-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.85rem;
    overflow-x: hidden;
}

/* ---------------------------------------------------------
   Sidebar
   --------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-speed) ease, width var(--transition-speed) ease;
}

.sidebar-header {
    position: relative; /* anchor for the absolutely-positioned collapse tab */
    background-color: var(--sidebar-header-bg);
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.sidebar-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-right: 2.25rem; /* keep the brand clear of the collapse tab */
}

.sidebar-brand {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.01em;
    min-width: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-name { color: #ffffff; white-space: nowrap; line-height: 1.15; }

.brand-version {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(184, 188, 200, 0.6);
    white-space: nowrap;
    line-height: 1.15;
}

/* Collapse toggle: a small tab flush with the sidebar's right edge —
   square on the right, pill-rounded on the left. */
.sidebar-collapse-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--sidebar-text);
    font-size: 0.65rem;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border-radius: 0.75rem 0 0 0.75rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.sidebar-collapse-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--sidebar-text-hover);
}

/* Icon visibility lives here (not inline styles) so the collapsed-state
   swap below can actually win the cascade. */
.sidebar-collapse-toggle .bi-chevron-double-right {
    display: none;
}

.sidebar-section-label {
    padding: 0.6rem 1.35rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(184, 188, 200, 0.45);
}

.sidebar-nav {
    list-style: none;
    padding: 0.75rem 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav-item { margin: 0 0.5rem 0.1rem; }

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    border-left: 3px solid transparent;
}

.sidebar-nav-link i {
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: var(--sidebar-text-hover);
}

.sidebar-nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: #ffffff;
    border-left-color: var(--sidebar-active-border);
}

.sidebar-footer {
    background-color: var(--sidebar-footer-bg);
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.sidebar-user { display: flex; align-items: center; gap: 0.75rem; }
.sidebar-user-avatar { font-size: 1.5rem; color: var(--sidebar-text); flex-shrink: 0; }
.sidebar-user-info { min-width: 0; }

.sidebar-username {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.775rem;
    transition: color var(--transition-speed);
}

.sidebar-logout:hover { color: #ff6b6b; }

/* Phase 3G — sidebar active-role switcher / static role label. Both live
   inside .sidebar-user-info, which is already hidden entirely under
   html.sidebar-collapsed (see the collapsed-sidebar rules below), so no
   separate collapse handling is needed here. */
.sidebar-role-label {
    color: var(--sidebar-text);
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

.sidebar-role-switcher { margin-bottom: 0.35rem; }

.sidebar-role-toggle {
    background: none;
    border: none;
    padding: 0;
    color: var(--sidebar-text);
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.sidebar-role-toggle:hover { color: #ffffff; }

.sidebar-role-toggle::after { margin-left: 0.35rem; }

.sidebar-role-menu {
    --bs-dropdown-min-width: 12rem;
    font-size: 0.825rem;
}

.sidebar-role-menu .dropdown-item.active,
.sidebar-role-menu .dropdown-item:active {
    background-color: var(--bs-dropdown-link-hover-bg, rgba(255, 255, 255, 0.1));
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1039;
}

.sidebar-overlay.show { display: block; }

/* ---------------------------------------------------------
   Main Wrapper & Content
   --------------------------------------------------------- */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
}

.topbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    height: var(--topbar-height);
    position: sticky;
    top: var(--cls-banner-h, 0px);
    z-index: 100;
}

.content-area { flex: 1; padding: 0; }

.page-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.65rem 1.25rem;
    position: sticky;
    top: var(--cls-banner-h, 0px);
    z-index: 99;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1d2e;
}

.page-content { padding: 1rem; }

/* ---------------------------------------------------------
   Cards
   --------------------------------------------------------- */
.card {
    border: 1px solid #e2e8f0;
    border-radius: var(--card-border-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow var(--transition-speed);
}

.card-header {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-card {
    cursor: default;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.admin-tile {
    color: inherit;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.admin-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    color: inherit;
}

.dashboard-table-scroll {
    max-height: 28rem;
    overflow-y: auto;
}

.dashboard-table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ---------------------------------------------------------
   Ops Dashboard — Media Ops board scroll caps + quick filters
   --------------------------------------------------------- */
.ops-board-scroll {
    max-height: 420px;
    overflow-y: auto;
}

.ops-board-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.ops-filter-pills {
    background-color: #f9fafb;
}

.ops-filter-pill {
    font-size: 0.75rem;
}

/* Dashboard ticket-card filter pills (tickets-active/backlog/upcoming
   partials) — same compact sizing as the ops-board pills above, which they
   generalize. */
.ticket-filter-pills {
    background-color: #f9fafb;
}

.ticket-filter-pill {
    font-size: 0.75rem;
}

/* ---------------------------------------------------------
   Ops Dashboard — Flight Board (Chunk C, v0.8)
   Dense, two-line-stacked-cell table combining the old separate Active/
   Scheduled flight tables into one. Target: ~33px/row so ~13 rows fit in
   ~440px on a 1080p viewport. `.ops-sub` is the smaller second line inside
   a stacked cell (or a two-line column header); `.ops-sched` additionally
   italicizes + mutes it for the scheduled-time half of a times cell.
   --------------------------------------------------------- */
.ops-board {
    --ops-fs: 0.72rem;
    font-size: var(--ops-fs);
    line-height: 1.15;
}

.ops-board > :not(caption) > * > * {
    padding: 0.14rem 0.4rem;
}

.ops-board thead th {
    font-size: 0.6rem;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bs-body-bg);
}

.ops-board .ops-sub {
    display: block;
    font-size: 0.92em;
    color: var(--bs-secondary-color);
}

.ops-board .ops-sched {
    font-size: 0.88em;
    font-style: italic;
    color: var(--bs-secondary-color);
}

/* Active rows: faint success-colored left rail (no full-row tint -- would
   fight the QSL warn/expire text coloring and the overdue table-warning
   class on scheduled rows). */
.ops-row-active > td:first-child {
    box-shadow: inset 3px 0 0 var(--bs-success);
}

/* Scheduled rows: neutral (unaccented) left rail, so the eye reads the
   active/scheduled boundary from the divider row below rather than a color
   fight between the two sections. */
.ops-row-sched > td:first-child {
    box-shadow: inset 3px 0 0 var(--bs-secondary-color);
}

/* COMMS column: compact per-circuit status chips, only rendered once a
   circuit has a reported check (see flights-board.php's $commChips). A fixed
   4-across grid keeps all 8 circuits to two chip rows, holding the board's
   dense ~33px two-line cell height instead of stacking chips vertically. */
.ops-board .ops-comm-chips {
    display: grid;
    grid-template-columns: repeat(4, max-content);
    gap: 2px;
}

.ops-board .ops-comm-chip {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.1rem 0.25rem;
}

/* Divider row ("Scheduled (±24h)") separating the active and scheduled
   sections of the combined table. */
.ops-board .ops-row-divider > td {
    background: var(--bs-tertiary-bg, #f1f3f5);
    color: var(--bs-secondary-color);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

/* Narrow-viewport degrade: JU/TACAN, EMCON/SIAP, and M2M3/KILO are the
   lowest-priority columns -- hide them below 1400px rather than relying
   solely on .table-responsive's horizontal scroll to keep the higher-value
   columns reachable without scrolling on a laptop-width window. */
@media (max-width: 1399.98px) {
    .ops-board .ops-col-lo {
        display: none;
    }
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: #1a1d2e;
}

.stat-icon {
    font-size: 2.25rem;
    opacity: 0.25;
}

/* ---------------------------------------------------------
   Flash Messages
   --------------------------------------------------------- */
.flash-messages {
    position: sticky;
    top: var(--cls-banner-h, 0px);
    z-index: 98;
}

.flash-alert {
    border-radius: var(--card-border-radius);
    font-size: 0.875rem;
    margin-bottom: 0;
}

/* ---------------------------------------------------------
   Wall Display Mode (Chunk D) — ?display=wall on the Ops tab (GET / or
   GET /ops/refresh). layout.php adds "wall-mode" to <body> and skips the
   sidebar nav / mobile topbar blocks entirely; these rules pick up the
   leftover layout offset and enlarge the Flight Board for at-distance
   reading on a watch-floor wall TV. Selectors mirror layout.php's real
   markup: .main-wrapper carries the sidebar's margin-left offset,
   .flash-messages is the flash-alert wrapper, .page-content is the ops
   tab's inner padding wrapper (see templates/dashboard/partials/ops-tab.php).
   --------------------------------------------------------- */
.wall-mode .main-wrapper {
    /* !important: beats html.sidebar-collapsed .main-wrapper's higher-
       specificity margin-left rule (min-width:992px media query) -- the
       pre-paint script sets sidebar-collapsed on <html> regardless of wall
       mode, so without this wall mode inherits the collapsed-sidebar offset. */
    margin-left: 0 !important;
}

.wall-mode .flash-messages {
    display: none;
}

.wall-mode .page-content {
    padding: 0.5rem;
}

.wall-mode .page-header {
    padding: 0.5rem 0.75rem;
}

.wall-mode .ops-board {
    --ops-fs: clamp(0.95rem, 1.15vw, 1.6rem);
}

.wall-mode .ops-board thead th {
    font-size: 0.72em;
}

.wall-mode .ops-board > :not(caption) > * > * {
    padding: 0.35rem 0.6rem;
}

/* ---------------------------------------------------------
   Gumball Status Indicators
   --------------------------------------------------------- */
.gumball {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gumball-green {
    background-color: #22c55e;
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

.gumball-orange {
    background-color: #f97316;
    box-shadow: 0 0 4px rgba(249, 115, 22, 0.5);
}

.gumball-red {
    background-color: #ef4444;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}

.gumball-gray {
    background-color: #94a3b8;
}

/* ---------------------------------------------------------
   Classification Badges
   --------------------------------------------------------- */
.badge-unclassified { background-color: #22c55e !important; color: #fff; }
.badge-cui          { background-color: #f97316 !important; color: #fff; }
.badge-secret       { background-color: #ef4444 !important; color: #fff; }
.badge-top_secret   { background-color: #7c3aed !important; color: #fff; }

/* ---------------------------------------------------------
   Media Action Status Badges
   --------------------------------------------------------- */
.badge-drop-off    { background-color: #6366f1 !important; color: #fff; }
.badge-extracted   { background-color: #0ea5e9 !important; color: #fff; }
.badge-formatted   { background-color: #8b5cf6 !important; color: #fff; }
.badge-burned      { background-color: #f59e0b !important; color: #fff; }
.badge-picked-up   { background-color: #22c55e !important; color: #fff; }
.badge-flight      { background-color: #14b8a6 !important; color: #fff; }
.badge-ready       { background-color: #22c55e !important; color: #fff; }
.badge-unknown     { background-color: #94a3b8 !important; color: #fff; }
.badge-stale       { background-color: #dc2626 !important; color: #fff; }

/* ---------------------------------------------------------
   Squadron Color Badges
   --------------------------------------------------------- */
.sq-badge {
    display: inline-block;
    padding: 0.2em 0.55em;
    border-radius: 0.35em;
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   Sortable Table Headers
   --------------------------------------------------------- */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable:hover { background-color: rgba(99, 102, 241, 0.07); }
th.sortable .sort-icon {
    display: inline-block;
    margin-left: 0.3em;
    opacity: 0.35;
    font-style: normal;
    font-size: 0.75em;
    vertical-align: middle;
}
th.sortable.asc  .sort-icon,
th.sortable.desc .sort-icon { opacity: 1; }
th.sortable.asc  .sort-icon::after { content: '▲'; }
th.sortable.desc .sort-icon::after { content: '▼'; }
th.sortable:not(.asc):not(.desc) .sort-icon::after { content: '⇅'; }

/* ---------------------------------------------------------
   Gear Issue Severity Badges
   --------------------------------------------------------- */
.badge-no-impact      { background-color: #64748b !important; color: #fff; }
.badge-mission-impact { background-color: #f97316 !important; color: #fff; }
.badge-outage         { background-color: #ef4444 !important; color: #fff; }

/* ---------------------------------------------------------
   PID File Status Badges
   --------------------------------------------------------- */
.badge-pending-add    { background-color: #0ea5e9 !important; color: #fff; }
.badge-active-file    { background-color: #22c55e !important; color: #fff; }
.badge-pending-remove { background-color: #f97316 !important; color: #fff; }

/* ---------------------------------------------------------
   Expiration Date Colors
   --------------------------------------------------------- */
.expiry-ok      { color: #22c55e; }
.expiry-warning { color: #f97316; }
.expiry-danger  { color: #ef4444; }
.expiry-expired { color: #ef4444; font-weight: 700; }

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */
.table > :not(caption) > * > * {
    padding: 0.28rem 0.6rem;
}

.table th {
    font-size: 0.69rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    white-space: nowrap;
}

.table-hover > tbody > tr:hover {
    background-color: rgba(99, 102, 241, 0.04);
}

/* ---------------------------------------------------------
   Flash Messages
   --------------------------------------------------------- */
.flash-alert {
    border-radius: var(--card-border-radius);
    font-size: 0.875rem;
}

/* ---------------------------------------------------------
   Breadcrumb
   --------------------------------------------------------- */
.breadcrumb { font-size: 0.8rem; }
.breadcrumb-item + .breadcrumb-item::before { content: "›"; }

/* ---------------------------------------------------------
   Location Filter Bar
   --------------------------------------------------------- */
.location-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: var(--card-border-radius);
    margin-bottom: 0.75rem;
}

.location-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
}

.location-filter-select {
    background-color: #ffffff;
    border-color: #e5e7eb;
    color: #374151;
    font-size: 0.78rem;
    min-width: 160px;
    max-width: 260px;
}

.location-filter-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.2);
    color: #111827;
}

.location-filter-select option {
    background-color: #ffffff;
    color: #374151;
}

/* ---------------------------------------------------------
   Login Page
   --------------------------------------------------------- */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1a1d23 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-wrapper { width: 100%; max-width: 420px; }
.login-brand { color: #ffffff; }

.login-title {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    margin-bottom: 0;
}

.login-card {
    background-color: #1c2128;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
}

.login-card .form-label { color: rgba(255, 255, 255, 0.8); font-size: 0.875rem; font-weight: 600; }

.login-card .form-control { color: #ffffff; }

.login-card .form-control:focus {
    background-color: #252c36;
    border-color: #6366f1;
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
    color: #ffffff;
}

.login-card .form-control::placeholder { color: rgba(255, 255, 255, 0.3); }

/* System use notice (templates/notice.php) — same shell as login, wider for prose */
.notice-wrapper { max-width: 720px; }
.notice-body { color: rgba(255, 255, 255, 0.85); }
.notice-body p:last-child { margin-bottom: 0; }
.notice-body strong { color: #ffffff; }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
    .sidebar.show { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .page-header { top: var(--topbar-height); }
}

@media (min-width: 992px) {
    .topbar { display: none !important; }
    .sidebar-overlay { display: none !important; }
}

/* ---------------------------------------------------------
   Collapsible Sidebar (icon rail) — desktop only.
   The "sidebar-collapsed" class lives on <html> (set by the
   pre-paint inline script in layout.php, before the sidebar nav
   itself exists in the DOM) so these are all descendant selectors
   rather than rules on .sidebar directly. Scoped to the >=992px
   breakpoint so the mobile offcanvas sidebar always renders full
   width regardless of a collapsed preference persisted from a
   previous desktop session.
   --------------------------------------------------------- */
@media (min-width: 992px) {
    html.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    html.sidebar-collapsed .main-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }

    html.sidebar-collapsed .sidebar-header-row {
        flex-direction: column;
        justify-content: center;
        gap: 0.5rem;
        padding-right: 0;
    }

    html.sidebar-collapsed .sidebar-brand {
        justify-content: center;
    }

    html.sidebar-collapsed .sidebar-brand .sidebar-logo {
        height: 1.4rem !important;
        margin-right: 0 !important;
    }

    html.sidebar-collapsed .brand-text,
    html.sidebar-collapsed .sidebar-section-label,
    html.sidebar-collapsed .sidebar-nav-link span,
    html.sidebar-collapsed .sidebar-user-info {
        display: none;
    }

    /* In the icon rail the header stacks vertically, so the toggle tab
       joins the column flow below the logo — still flush with the
       sidebar's right edge (negative margin cancels the header padding). */
    html.sidebar-collapsed .sidebar-collapse-toggle {
        position: static;
        transform: none;
        align-self: flex-end;
        margin-right: -1.25rem;
    }

    html.sidebar-collapsed .sidebar-collapse-toggle .bi-chevron-double-left {
        display: none;
    }

    html.sidebar-collapsed .sidebar-collapse-toggle .bi-chevron-double-right {
        display: inline-block;
    }

    html.sidebar-collapsed .sidebar-nav-item {
        margin-left: 0.3rem;
        margin-right: 0.3rem;
    }

    html.sidebar-collapsed .sidebar-nav-link {
        justify-content: center;
        gap: 0;
        padding: 0.55rem 0.4rem;
    }

    html.sidebar-collapsed .sidebar-footer {
        padding: 1rem 0.5rem;
    }

    html.sidebar-collapsed .sidebar-user {
        justify-content: center;
        gap: 0;
    }
}

/* ---------------------------------------------------------
   Utilities
   --------------------------------------------------------- */
.font-monospace { font-family: 'Consolas', 'Monaco', 'SF Mono', monospace; }

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ---------------------------------------------------------
   KPI Strip (Dashboard)
   --------------------------------------------------------- */
.kpi-strip {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.kpi-tile {
    background: #ffffff;
    border-radius: var(--card-border-radius);
    border: 1px solid #dee2e6;
    border-left: 3px solid #dee2e6;
    padding: 0.5rem 0.8rem;
    flex: 1;
    min-width: 0;
}

.kpi-tile.kpi-ok   { border-left-color: #22c55e; }
.kpi-tile.kpi-warn { border-left-color: #f59e0b; }
.kpi-tile.kpi-bad  { border-left-color: #ef4444; }
.kpi-tile.kpi-info { border-left-color: #6366f1; }

.kpi-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.12rem;
}

.kpi-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.kpi-sub {
    font-size: 0.68rem;
    color: #6b7280;
    margin-top: 0.1rem;
}

/* ---------------------------------------------------------
   Table row status left-border (Media index)
   --------------------------------------------------------- */
.table tbody tr {
    border-left: 3px solid transparent;
}

.tr-drop-off   { border-left-color: #6366f1; }
.tr-extracted  { border-left-color: #0ea5e9; }
.tr-formatted  { border-left-color: #8b5cf6; }
.tr-burned     { border-left-color: #f59e0b; }
.tr-picked-up  { border-left-color: #22c55e; }
.tr-flight     { border-left-color: #14b8a6; }
.tr-stale      { border-left-color: #dc2626; }

/* PID row left-border */
.tr-pid-generated { border-left-color: #22c55e; }
.tr-pid-pending   { border-left-color: #6366f1; }
.tr-pid-error     { border-left-color: #ef4444; }

/* ---------------------------------------------------------
   Stale overlay pill (shown alongside existing status badge)
   --------------------------------------------------------- */
.stale-pill {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.06rem 0.28rem;
    border-radius: 0.2rem;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* ---------------------------------------------------------
   Compact icon-only action buttons
   --------------------------------------------------------- */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.12s, color 0.12s;
    line-height: 1;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #374151;
}

.btn-icon.btn-icon-primary:hover {
    background: #ede9fe;
    color: #4338ca;
    border-color: #c4b5fd;
}

.btn-icon.btn-icon-danger:hover {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* ---------------------------------------------------------
   FR version mono pill (PID table)
   --------------------------------------------------------- */
.fr-pill {
    display: inline-block;
    font-family: 'Consolas', 'Monaco', 'SF Mono', monospace;
    font-size: 0.72rem;
    background: #f3f4f6;
    color: #374151;
    padding: 0.1rem 0.35rem;
    border-radius: 0.2rem;
    border: 1px solid #e5e7eb;
}

/* ---------------------------------------------------------
   Gear cards — density grid
   --------------------------------------------------------- */
.gear-density-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

@media (max-width: 1399px) { .gear-density-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 991px)  { .gear-density-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px)  { .gear-density-grid { grid-template-columns: 1fr; } }

.gear-card-dense {
    border-top: 3px solid #dee2e6;
}

.gear-card-dense.health-green  { border-top-color: #22c55e; }
.gear-card-dense.health-orange { border-top-color: #f59e0b; }
.gear-card-dense.health-red    { border-top-color: #ef4444; }

.gear-card-dense .card-body {
    padding: 0.55rem 0.7rem;
}

/* Reduced spacing inside dense gear cards */
.gear-card-dense .mb-3 { margin-bottom: 0.35rem !important; }
.gear-card-dense .mb-2 { margin-bottom: 0.25rem !important; }
.gear-card-dense h6    { font-size: 0.82rem; }

/* Thinner progress bars in gear cards */
.gear-card-dense .progress {
    height: 3px;
}

/* QSL notes: detected coordinates (Toc\Flight\QslReport markup hook).
   public/assets/js/qsl-map.js binds a delegated click handler to .qsl-coord[data-lat][data-lon]
   (map dialog) and styles itself; .qsl-preview is the live detected-report line under QSL textareas. */
.qsl-notes { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; overflow-wrap: anywhere;
             margin: 0.15rem 0 0.35rem 0.75rem; padding: 0.3rem 0.5rem; border-radius: 4px; background: var(--bs-tertiary-bg, #f8f9fa); }
button.qsl-coord { background: none; border: 0; padding: 0; font: inherit; color: var(--bs-link-color, #0d6efd); text-decoration: underline dotted; cursor: pointer; }
button.qsl-coord:hover { text-decoration: underline; }

/* ---------------------------------------------------------
   Gear security posture (band, card strip, detail card)
   --------------------------------------------------------- */
.posture-band { background: #fff; border: 1px solid rgba(0,0,0,.1); border-radius: var(--card-border-radius); padding: .5rem .6rem; }
.posture-row { display: flex; align-items: stretch; gap: .5rem; margin-bottom: .4rem; }
.posture-env-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 3.4rem; padding: 0 .4rem;
    font-size: .7rem; font-weight: 700; letter-spacing: .04em; border-radius: 4px; background: #e8eaf6; color: #3949ab; align-self: flex-start; }
.posture-row > .posture-env-chip { align-self: stretch; min-width: 4.4rem; }
.posture-env-chip-eq { background: #eceff1; color: #455a64; }
.posture-tiles { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .4rem; }
.posture-tile { border: 1px solid rgba(0,0,0,.1); border-left-width: 3px; border-radius: 4px; padding: .25rem .5rem; background: #fafbfc; }
.posture-tile-num { font-size: 1.4rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.posture-tile-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: #6c757d; }
.posture-tile-sub { font-size: .68rem; color: #6c757d; }
.posture-tile.posture-bad { border-color: #dc3545; }
.posture-tile.posture-bad .posture-tile-num { color: #dc3545; }
.posture-tile.posture-good .posture-tile-num { color: #198754; }
.posture-footer { font-size: .75rem; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
@media (max-width: 575px) { .posture-row { flex-direction: column; } .posture-row > .posture-env-chip { min-height: 1.4rem; } }

.posture-strip { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; }
.posture-strip-env { font-size: .68rem; font-weight: 700; color: #6c757d; margin-left: .35rem; }
.posture-strip-env:first-child { margin-left: 0; }
.posture-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.posture-dot-current, .posture-dot-ra-ok { background: #22c55e; }
.posture-dot-approaching { background: #f59e0b; }
.posture-dot-out, .posture-dot-ra-high { background: #ef4444; }
.posture-dot-none, .posture-dot-ra-none { background: #94a3b8; }

.posture-env-card { border: 1px solid rgba(0,0,0,.1); border-radius: 4px; padding: .5rem .6rem; height: 100%; }
.posture-dl { display: grid; grid-template-columns: auto 1fr; gap: .1rem .75rem; font-size: .78rem; }
.posture-dl dt { color: #6c757d; font-weight: 400; }
.posture-dl dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------
   Classification banner (templates/partials/classification-banner.php)
   A fixed bar above everything; --cls-banner-h pushes the page, the fixed
   sidebar, the sticky headers (which read the variable above) and Bootstrap
   modals down by its height. Absent banner = variable unset = no offset.
   --------------------------------------------------------- */
.cls-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 22px;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.has-cls-banner { --cls-banner-h: 22px; padding-top: var(--cls-banner-h); }
body.has-cls-banner.login-body { min-height: 100vh; }
body.has-cls-banner .sidebar,
body.has-cls-banner .sidebar-overlay { top: var(--cls-banner-h); }
body.has-cls-banner .modal { top: var(--cls-banner-h); height: calc(100% - var(--cls-banner-h)); }
@media print { .cls-banner { position: static; print-color-adjust: exact; -webkit-print-color-adjust: exact; } body.has-cls-banner { padding-top: 0; } }
