/*
 * SWISS Virtual Pilot Console — Main Stylesheet
 * ============================================================
 * Unminified, token-driven replacement for pilotconsole.min.css.
 * Requires tokens.css to be loaded FIRST.
 *
 * Token mapping:
 *   #c00 / #CC0000    → var(--color-primary)
 *   #ad0000 / #b30000 → var(--color-primary-hover)
 *   #f2f2f2 / #f5f5f5 → var(--color-surface)
 *   #cdcdcd / #e5e5e5 → var(--color-border)
 *   #46413e            → var(--color-accent)
 *   #666 / #666666     → var(--color-text-muted)
 *   #fff / #ffffff     → var(--color-background)
 *   #000 / #000000     → var(--color-text)
 *   #1e1e1e            → var(--color-text)
 *   #008e17            → var(--color-success)
 *   #f3a200            → var(--color-warning)
 *   #0d82b9            → var(--color-info)
 *
 * Milestone: M002 — CSS Token Architecture
 * Slice: S01 — Design Token Layer + Pilot Console CSS Rewrite
 * ============================================================
 */


/* ========== BASE / LAYOUT ========== */

body {
    width: 100vw;
    margin: 0;
    padding: 0;
    background-color: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 18px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 1s, color 1s;
}

.body-container {
    width: 80vw;
    margin-left: 10vw;
    /* Mobile: nav-row only (~72px). Tablet+: utility-bar + nav-row (~115px). */
    padding-top: 72px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .body-container {
        padding-top: 115px;
    }
}

.body {
    padding-top: 50px;
    margin-bottom: 150px;
}

.row {
    margin-top: 10px;
}

.row > div {
    margin-bottom: 10px;
}

.nomargin {
    margin: 0;
}

.imgauto {
    width: 100%;
}

.float-right {
    float: right;
}

.inline-block {
    display: inline-block;
}

@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }
}


/* ========== HOMEPAGE ALERT ========== */

/* Base rule stripped down — .dash-card handles the chrome.
   The full alert styling lives in the DASHBOARD section. */
.homepage-alert {
    color: var(--color-text);
}

.homepage-alert a {
    color: var(--color-primary);
}

.homepage-alert a:hover {
    color: var(--color-primary-hover);
}


/* ========== TABLE ========== */

.table-placeholder {
    overflow-x: auto;
}

.table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    table-layout: fixed;
    border: 1px solid var(--color-border);
}

.table > thead {
    background-color: var(--color-surface);
}

.table > thead > tr > th {
    padding: 10px;
    padding-top: 20px;
    padding-bottom: 20px;
}

.table > tbody > tr {
    border: 1px solid var(--color-border);
}

.table > tbody > tr > td {
    padding: 10px;
}

.table > tbody > tr:nth-child(even) {
    background-color: var(--color-surface);
}


/* ========== NAVBAR ========== */

/*
 * Two-row header: utility-bar (logout + theme) above nav-row (logo + nav + hamburger).
 * Fixed to top of viewport. Mirrors public-web-5.0 structure exactly.
 *
 * Breakpoints (match public site):
 *   Mobile  <768px:      slide-down .site-nav.is-open
 *   Tablet  768–1023px:  dialog#nav-drawer (showModal)
 *   Desktop ≥1024px:     inline .site-nav; CSS :hover dropdowns
 */

/* ── Header shell ── */
.site-header {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background: var(--color-background);
}

/* ── Utility bar — hidden on mobile, shown tablet+ ── */
.utility-bar {
    display: none;
}

.utility-bar__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text);
    text-decoration: none;
    font-size: inherit;
    transition: color var(--transition-fast);
}

.utility-bar__link:hover {
    color: var(--color-primary);
}

/* ── Utility bar: account button ── */
.utility-bar__account-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text);
    text-decoration: none;
    font-size: inherit;
    transition: color var(--transition-fast);
    padding: 0;
}

.utility-bar__account-btn:hover {
    color: var(--color-primary);
}

.utility-bar__account-btn .icon {
    font-family: var(--font-piktos);
    display: inline-flex;
    justify-content: center;
    font-size: 20px;
}

/* ── Nav row ── */
.nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 72px;
}

/* ── Logo ── */
.site-logo {
    display: block;
    flex-shrink: 0;
}

.site-logo img {
    height: 40px;
    width: auto;
}

/* ── Primary nav (desktop) ── */
.site-nav {
    display: flex;
    align-items: center;
    gap: 36px;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--color-text);
    font-weight: 400;
    font-size: 20.25px;
    text-decoration: none;
    transition: color var(--transition-fast);
    padding: 4.5px 0;
}

.nav-link:hover {
    color: var(--color-primary);
}

/* ── Dropdown groups ── */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: none;
    border: none;
    color: var(--color-text);
    font: inherit;
    font-weight: 400;
    font-size: 20.25px;
    cursor: pointer;
    padding: 4.5px 0;
}

.nav-dropdown-toggle:hover {
    color: var(--color-primary);
}

.dropdown-chevron {
    transition: transform 0.2s ease;
}

.nav-dropdown-toggle[aria-expanded="true"] .dropdown-chevron {
    transform: rotate(180deg);
}

/* Dropdown panel */
.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 1500;
}

.nav-dropdown-menu.align-right {
    right: 0;
    left: auto;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-toggle[aria-expanded="true"] + .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown items */
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--color-text);
    font-size: 20.25px;
    text-decoration: none;
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.nav-dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.nav-dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.nav-dropdown-item:hover {
    background: var(--color-surface);
    color: var(--color-primary);
}

.nav-dropdown-item > .icon {
    font-family: var(--font-piktos);
    display: inline-flex;
    justify-content: center;
    width: 24px;
    font-size: 22px;
    flex-shrink: 0;
}

.nav-dropdown-item > .icon-image {
    height: 20px;
    width: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ── Account dropdown: right-anchored modifier ── */
.nav-dropdown-menu--account {
    right: 0;
    left: auto;
}

/* ── Dropdown separator (logout divider) ── */
.nav-dropdown-separator {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-xs) 0;
}

/* ── Hamburger toggle ── */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-text);
    position: relative;
    transition: background-color var(--transition-fast);
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    width: 24px;
    height: 2px;
    background-color: var(--color-text);
    transition: transform var(--transition-base);
}

.hamburger::before {
    top: -7px;
}

.hamburger::after {
    top: 7px;
}

/* Hamburger → X when open */
.nav-toggle[aria-expanded="true"] .hamburger {
    background-color: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Mobile utility section (inside slide-down, <768px only) ── */
.nav-utils-mobile {
    display: none;
}

/* ── Dialog drawer (tablet 768–1023px) ── */
.nav-drawer {
    display: none;
    border: none;
    padding: 0;
    max-width: none;
    max-height: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(320px, 80vw);
    height: 100vh;
    height: 100dvh;
    margin: 0;
    background: var(--color-background);
    color: var(--color-text);
    overflow-y: auto;
}

.nav-drawer::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.nav-drawer[open] {
    display: block;
    animation: drawer-slide-in 250ms ease-out forwards;
}

.nav-drawer[open]::backdrop {
    animation: backdrop-fade-in 250ms ease-out forwards;
}

@keyframes drawer-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

@keyframes backdrop-fade-in {
    from { background: rgba(0, 0, 0, 0); }
    to   { background: rgba(0, 0, 0, 0.5); }
}

@media (prefers-reduced-motion: reduce) {
    .nav-drawer[open],
    .nav-drawer[open]::backdrop {
        animation: none;
    }
}

.nav-drawer__content {
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
    min-height: 100%;
}

.nav-drawer__close {
    align-self: flex-end;
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.nav-drawer__close:hover {
    color: var(--color-primary);
}

.nav-drawer__nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.nav-drawer__nav a {
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    padding: var(--space-sm) 0;
    transition: color var(--transition-fast);
}

.nav-drawer__nav a:hover {
    color: var(--color-primary);
}

/* Drawer dropdown (inline expand) */
.nav-drawer__nav .nav-dropdown {
    width: 100%;
}

.nav-drawer__nav .nav-dropdown-toggle {
    width: 100%;
    justify-content: flex-start;
    padding: var(--space-sm) 0;
    font-size: var(--font-size-lg);
}

.nav-drawer__nav .nav-dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: transparent;
}

.nav-drawer__nav .nav-dropdown-toggle[aria-expanded="true"] + .nav-dropdown-menu {
    max-height: 400px;
}

.nav-drawer__nav .nav-dropdown-menu a {
    padding: var(--space-xs) var(--space-md);
    font-size: 20.25px;
}

.nav-drawer__nav .nav-dropdown-item {
    font-size: 20.25px;
    padding: var(--space-xs) var(--space-md);
}

.nav-drawer__utils {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
    padding-top: var(--space-xl);
    margin-top: auto;
    border-top: 1px solid var(--color-border);
}

/* ── Responsive ── */

/* Mobile: slide-down nav, no utility-bar */
@media (max-width: 767px) {
    .nav-row {
        padding: var(--space-md);
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .nav-toggle {
        display: block;
    }

    .site-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
        padding-top: var(--space-md);
        border-top: 1px solid var(--color-border);
        margin-top: var(--space-md);
    }

    .site-nav.is-open {
        display: flex;
    }

    .site-nav .nav-link,
    .site-nav .nav-dropdown-toggle {
        padding: var(--space-sm) 0;
        width: 100%;
    }

    /* Mobile dropdown */
    .site-nav .nav-dropdown {
        width: 100%;
    }

    .site-nav .nav-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background: transparent;
    }

    .site-nav .nav-dropdown-toggle[aria-expanded="true"] + .nav-dropdown-menu {
        max-height: 400px;
    }

    .nav-utils-mobile {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
        padding-top: var(--space-lg);
        width: 100%;
        border-top: 1px solid var(--color-border);
        margin-top: var(--space-sm);
    }
}

/* Tablet: utility-bar visible, hamburger → drawer */
@media (min-width: 768px) {
    .utility-bar {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 18px;
        padding: 0 72px;
        height: 43px;
        font-size: 16.875px;
    }

    .nav-row {
        padding: 0 72px;
        height: 84px;
    }

    .nav-utils-mobile {
        display: none;
    }

    .nav-drawer__utils {
        display: none;
    }
}

/* Tablet only: hamburger → drawer, hide inline nav */
@media (min-width: 768px) and (max-width: 1023px) {
    .nav-toggle {
        display: block;
    }

    .site-nav {
        display: none;
    }
}

/* Desktop: full inline nav */
@media (min-width: 1024px) {
    .nav-row {
        padding: 0 72px;
        height: 84px;
    }

    .nav-toggle {
        display: none;
    }
}


/* ========== TYPOGRAPHY / UTILITIES ========== */

.page-title {
    color: var(--color-primary);
    font-size: xx-large;
    font-weight: 100;
    margin: 0;
    margin-bottom: 50px;
    transition: color 1s;
}

.page-title > small {
    font-size: large;
}

.text-green {
    color: var(--color-success);
}

.text-yellow {
    color: var(--color-warning);
}

.text-red {
    color: var(--color-primary);
}

.text-grey {
    color: var(--color-accent);
}

.text-through {
    text-decoration: line-through;
}

.text-lightgray {
    color: var(--color-text-muted);
}

.pikto {
    color: var(--color-accent);
    font-family: var(--font-piktos);
}

.monospace-font {
    font-family: var(--font-mono);
}

.text-uppercase {
    text-transform: uppercase;
}

.text-bold {
    font-weight: 700;
}

a {
    color: var(--color-text);
    text-decoration: underline;
}

a:hover {
    color: var(--color-primary);
}


/* ========== MAPS (Leaflet overrides) ========== */

.leaflet-popup-content-wrapper {
    border-radius: 0;
}

.leaflet-popup-pane {
    width: auto;
}


/* ========== NOTIFICATIONS ========== */

.notifications-box {
    overflow-y: auto;
}

.notifications-box > p {
    text-align: center;
    opacity: 0.55;
}

.notification {
    width: 100%;
    border-bottom: 1px solid #8b8178; /* unique notification border — keep as-is */
    margin-bottom: 5px;
}

.container.notifications {
    padding-top: 0 !important;
}

.notification.read {
    opacity: 0.3;
    transition: opacity 0.5s;
}

.notification.read:hover {
    opacity: 1;
    transition: opacity 0.5s;
}

.notification h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
}

.notification .n-date {
    color: var(--color-text-muted);
}

.notification p {
    font-size: 15px;
    font-style: italic;
    color: var(--color-text);
}

.notification .mark-read {
    font-family: var(--font-piktos);
    margin-left: 5px;
    float: right;
}


/* ========== WIDGET ========== */

.widget {
    width: 100%;
    border: 1px solid var(--color-border);
    height: 100%;
    transition: background-color 1s, color 1s;
}

.widget > .title {
    display: block;
    width: 100%;
    margin: 0;
    background-color: var(--color-surface);
    color: var(--color-text-muted);
    padding: 10px;
    border-bottom: 1px solid var(--color-border);
    transition: background-color 1s, color 1s;
}

.widget > .container {
    margin: 0;
    padding: 15px;
    width: auto !important;
    max-width: none !important;
    word-wrap: break-word;
}

.widget > .container > pre {
    white-space: pre-wrap;
}


/* ========== BUTTONS / FORMS ========== */

/* ----------------------------------------------------------
 * .btn — Base button class (public-web-5.0 design spec)
 * Opt-in via class; no bare element selectors to prevent bleed.
 * ---------------------------------------------------------- */
.btn {
    display: inline-block;
    padding: var(--space-sm) var(--space-lg);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    font: var(--font-weight-semibold) 1rem var(--font-sans);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all var(--transition-fast);
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

/* Primary — solid red fill */
.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-background);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: var(--color-background);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Secondary — ghost/outline style */
.btn-secondary {
    background-color: transparent;
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-secondary:hover {
    background-color: var(--color-primary);
    color: var(--color-background);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Danger — red (alias for primary since --color-primary is #cc0000) */
.btn-danger {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-background);
}

.btn-danger:hover {
    background-color: var(--color-background);
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Success — green */
.btn-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
    color: var(--color-background);
}

.btn-success:hover {
    background-color: var(--color-background);
    border-color: var(--color-success);
    color: var(--color-success);
}

/* Small — compact uppercase variant */
.btn-sm {
    padding: 5px 10px;
    font-size: 0.875rem;
    font-weight: var(--font-weight-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Icon — icon-only button */
.btn-icon {
    padding: 5px 8px;
    line-height: 1;
}

/* Large — full-width form submit */
.btn-lg {
    width: 100%;
    padding: 15px;
    font-size: 1.125rem;
}

input:not([type=button]):not([type=reset]):not([type=submit]):not([type=image]):not([type=checkbox]):not([type=radio]),
select {
    -ms-box-sizing: content-box;
    -moz-box-sizing: content-box;
    -webkit-box-sizing: content-box;
    box-sizing: border-box;
    text-align: left;
    background-color: var(--color-background);
    background-image: none;
    color: var(--color-text);
    height: 30px;
    width: 100%;
    font-size: 18px;
    border: 1.5px solid var(--color-border);
    padding: 25px 10px;
    margin-bottom: 20px;
    transition: border 0.2s;
    font-family: var(--font-sans);
    transition: background-color 1s, color 1s;
}

input[type=date],
input[type=number],
select {
    line-height: 20px !important;
    padding: 13px 10px !important;
    height: unset !important;
    transition: background-color 1s, color 1s;
}

input:not([type=button]):not([type=reset]):not([type=submit]):not([type=image]):not([type=checkbox]):not([type=radio]):focus,
select:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
    border-color: var(--color-primary);
}

textarea {
    box-sizing: content-box;
    background-color: var(--color-background);
    background-image: none;
    color: var(--color-text);
    font-size: 18px;
    border: 1.5px solid var(--color-border);
    margin: 5px 0 5px 0;
    padding: 1.5%;
    width: 98%;
    max-width: 97%;
    min-width: 97%;
    transition: border 0.2s;
    font-family: var(--font-sans);
}

textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
    border-color: var(--color-primary);
}

.switch-group > label,
.switch-group > p {
    display: inline-block;
    vertical-align: middle;
    padding: 0 !important;
}

.switch {
    position: relative;
    display: inline-block;
    width: 30px;
    height: 16px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc; /* slider unchecked — keep as-is */
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 3px;
    background-color: var(--color-background);
    -webkit-transition: 0.4s;
    transition: 0.4s;
}

input:checked + .slider {
    background-color: #2bd900; /* ACARS/switch live green — keep as-is */
}

input:focus + .slider {
    box-shadow: 0 0 1px #2bd900; /* ACARS/switch live green — keep as-is */
}

input:checked + .slider:before {
    -webkit-transform: translateX(15px);
    -ms-transform: translateX(15px);
    transform: translateX(15px);
}

.slider.round {
    border-radius: 16px;
}

.slider.round:before {
    border-radius: 50%;
}

label {
    color: var(--color-text-muted);
    font-size: smaller;
    font-style: italic;
    display: block;
    padding: 10px;
    padding-left: 0;
}

.time-picker > select {
    position: relative;
    top: 10px;
    display: inline-block;
    width: 49%;
    padding: 4px !important;
    width: 57px;
}

.date-picker {
    position: relative;
    top: 10px;
    display: inline-block;
    width: 49%;
    padding: 4px 10px !important;
    min-width: 135px;
}


/* ========== MISC LAYOUT ========== */

hr {
    color: var(--color-border);
    background-color: var(--color-border);
    height: 1px;
    border: none;
}

.clock {
    display: none;
}

.utility-bar__clock {
    cursor: default;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}


/* ========== FEEDBACK ========== */

#blackoverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #555; /* overlay backdrop — keep as-is */
    opacity: 0.8;
    z-index: 4000;
    text-align: center;
    display: none;
    overflow-y: hidden;
    overflow-x: hidden;
}

#blackoverlay > img {
    display: block;
    margin-top: 15%;
    margin-left: auto;
    margin-right: auto;
}

#blackoverlay > p {
    color: var(--color-background);
    font-size: 25px;
}

.swal2-container {
    z-index: 2000 !important;
}

.feedback-elements {
    display: none;
    z-index: 3500;
}

.feedback-darken {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: #555; /* overlay backdrop — keep as-is */
    opacity: 0.8;
    z-index: 3000;
}

.feedback-window {
    padding: 20px;
    position: fixed;
    width: 50%;
    max-height: 70%;
    padding-bottom: 10px;
    top: 10%;
    left: 30%;
    background-color: var(--color-background);
    border-radius: 1px;
    text-align: center;
    z-index: 3500;
    overflow-y: auto;
}

.feedback-window h1 {
    color: var(--color-primary);
    font-size: 35px;
}

.feedback-window span.inverted {
    width: 40px;
    height: 40px;
    display: inline-block;
    color: var(--color-primary);
    background-color: var(--color-background);
    border-radius: 2px;
    line-height: 40px;
    border: 1px solid var(--color-primary);
    transition: background 0.3s;
}

.askmelater {
    text-decoration: underline;
    text-transform: capitalize;
}

.askmelater:hover {
    color: var(--color-primary);
    cursor: pointer;
}

.feedback-window span:hover {
    background-color: var(--color-background);
    color: var(--color-background);
    cursor: pointer;
    background-color: var(--color-primary);
    transition: background 0.3s;
}

.feedback-window .selected {
    color: var(--color-background) !important;
    background-color: var(--color-primary) !important;
    transition: background 0.3s;
}

.feedback-window .please-give-note {
    display: none;
    color: var(--color-primary);
}

.feedback-window cite {
    color: var(--color-text-muted);
}


/* ========== FORUM / COMMUNITY ========== */

.category {
    color: var(--color-text-muted);
    background-color: var(--color-surface);
    position: relative;
}

.category > .btn-sm {
    position: absolute;
    right: 5px;
    top: 15px;
}

.category > .remove-thread {
    right: 230px;
}

@media (max-width: 768px) {
    .category > .btn-sm {
        position: relative;
        display: inline-block;
        left: 5px;
        top: auto;
    }

    .category > .remove-thread {
        margin-right: 5px;
    }
}

.category > p {
    padding: 10px;
    font-weight: 700;
}

.forum {
    width: 96%;
    margin-left: 2%;
    margin-right: 2%;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.forum > .info {
    width: 40%;
}

.forum .name {
    margin: 0;
    padding: 0;
    color: var(--color-primary);
    text-decoration: none;
}

.forum .name:hover {
    text-decoration: underline;
}

.name > p {
    margin: 0;
}

.description {
    font-style: italic;
    margin: 0;
    font-size: smaller;
}

.forum-head {
    color: var(--color-background);
    background-color: var(--color-primary);
    padding: 1px;
}

.thread {
    width: 98%;
    margin-left: 2%;
    margin-bottom: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--color-border);
}

.thread > .name {
    margin: 0;
    padding: 0;
    color: var(--color-primary);
    text-decoration: none;
}

.thread > .name:hover {
    text-decoration: underline;
}

.forum-description {
    font-weight: 400 !important;
    font-style: italic !important;
}

.date {
    float: right;
    margin: 0;
}

.last-update {
    clear: right;
    float: right;
    margin: 0;
}

.last-thread {
    width: 50%;
    font-size: smaller;
}

.answer {
    border-top: 2px solid var(--color-border);
    border-left: 2px solid var(--color-border);
    padding: 5px;
    margin-bottom: 15px;
}

.signature {
    margin-top: 10px;
    width: 20%;
    border-top: 1px solid var(--color-surface);
    padding: 0;
}


/* ========== DOWNLOADS / DONATIONS ========== */

/* ========== DOWNLOADS ========== */

.dow-hero {
    margin-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-lg);
}

.dow-hero__title {
    font-family: var(--font-sans);
    font-weight: var(--font-weight-light);
    font-size: var(--font-size-4xl);
    color: var(--color-primary);
    line-height: 1.1;
    margin: 0 0 var(--space-sm);
    transition: color 1s;
}

.dow-hero__lead {
    font-size: var(--font-size-lg);
    color: var(--color-text-muted);
    margin: 0;
    font-weight: var(--font-weight-light);
}

.dow-empty {
    color: var(--color-text-muted);
    font-size: var(--font-size-md);
}

/* Tab nav — public-web style: flat, square corners, border-bottom flush */
.dow-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
}

.dow-tab-btn {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom: none;
    padding: 12px 28px;
    margin-right: 8px;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    letter-spacing: 0.01em;
}

.dow-tab-btn:hover {
    color: var(--color-primary);
    background: var(--color-background);
}

.dow-tab-btn.is-active {
    color: var(--color-primary);
    background: var(--color-background);
    border-bottom: 1px solid var(--color-background);
    font-weight: var(--font-weight-bold);
}

/* Panel area — sits flush against the tab bar bottom border */
.dow-tab-panels {
    border: 1px solid var(--color-border);
    border-top: none;
    background: var(--color-background);
    transition: background 1s;
}

.dow-tab-panel {
    display: none;
    padding: var(--space-lg);
}

.dow-tab-panel.is-active {
    display: block;
}

/* Downloads table */
.dow-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

.dow-table thead {
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
    transition: background 1s;
}

.dow-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dow-table__row {
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s;
}

.dow-table__row:last-child {
    border-bottom: none;
}

.dow-table__row:hover {
    background: var(--color-surface);
}

.dow-table__name {
    padding: 18px 16px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    width: 28%;
    vertical-align: top;
}

.dow-table__desc {
    padding: 18px 16px;
    color: var(--color-text-muted);
    line-height: 1.6;
    vertical-align: top;
}

.dow-table__desc a {
    color: var(--color-primary);
    text-decoration: underline;
}

.dow-table__action {
    padding: 18px 16px;
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
    width: 130px;
}

/* Download button — public-web .btn aesthetic: square, red fill */
.dow-dl-btn {
    display: inline-block;
    background: var(--color-primary);
    color: var(--color-background);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 0;
    transition: background 0.2s, transform 0.15s;
}

.dow-dl-btn:hover {
    background: var(--color-primary-hover);
    color: var(--color-background);
    transform: translateY(-1px);
}

/* Column widths */
.dow-table__col-name   { width: 28%; }
.dow-table__col-desc   { width: auto; }
.dow-table__col-action { width: 130px; }

/* Mobile: stack table into readable rows */
@media (max-width: 768px) {
    .dow-tab-btn {
        padding: 10px 16px;
        font-size: var(--font-size-sm);
    }

    .dow-tab-panel {
        padding: var(--space-md);
    }

    .dow-table thead {
        display: none;
    }

    .dow-table__row {
        display: block;
        padding: var(--space-md) 0;
        border-bottom: 1px solid var(--color-border);
    }

    .dow-table__name,
    .dow-table__desc,
    .dow-table__action {
        display: block;
        width: 100%;
        padding: 4px 0;
    }

    .dow-table__action {
        text-align: left;
        padding-top: var(--space-sm);
    }
}

/* ========== PARTNERS ========== */

.partners-list {
    margin-top: var(--space-lg);
}

.partners-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-lg) 0;
}

.partners-row {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.partners-row__logo {
    flex-shrink: 0;
    width: 160px;
    text-align: center;
}

.partners-row__logo img {
    max-width: 140px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(20%);
    transition: filter 0.2s;
}

.partners-row__logo img:hover {
    filter: grayscale(0%);
}

.partners-row__content {
    flex: 1;
}

.partners-row__name {
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin: 0 0 var(--space-xs);
    transition: color 1s;
}

.partners-row__desc {
    color: var(--color-text-muted);
    font-size: var(--font-size-base);
    margin: 0 0 var(--space-sm);
}

@media (max-width: 768px) {
    .partners-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .partners-row__logo {
        width: 100%;
        text-align: left;
    }
}

/* ========== LIVE DOCUMENTATION LIBRARY ========== */

.livdoc-layout {
    display: flex;
    gap: var(--space-xl);
    align-items: flex-start;
}

.livdoc-sidebar {
    flex-shrink: 0;
    width: 220px;
    position: sticky;
    top: 130px;
}

.livdoc-sidebar__section {
    border: 1px solid var(--color-border);
    padding: var(--space-md);
    background: var(--color-surface);
    transition: background 1s;
}

.livdoc-sidebar__heading {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-sm);
}

.livdoc-sidebar__text {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0 0 var(--space-sm);
    line-height: 1.5;
}

.livdoc-sidebar__link {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--font-weight-bold);
    transition: color 0.15s;
}

.livdoc-sidebar__link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.livdoc-main {
    flex: 1;
    min-width: 0;
}

/* Folder tree */
.livdoc-tree {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.livdoc-folder--top {
    border-bottom: 1px solid var(--color-border);
}

.livdoc-folder--top:last-child {
    border-bottom: none;
}

.livdoc-folder__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--color-surface);
    border: none;
    border-bottom: 1px solid transparent;
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 1s;
}

.livdoc-folder__toggle:hover {
    background: var(--color-border);
}

.livdoc-folder__toggle.is-open {
    border-bottom-color: var(--color-border);
}

.livdoc-folder__chevron {
    flex-shrink: 0;
    transition: transform 0.2s;
    color: var(--color-text-muted);
}

.livdoc-folder__toggle.is-open .livdoc-folder__chevron {
    transform: rotate(0deg);
}

.livdoc-folder__toggle:not(.is-open) .livdoc-folder__chevron {
    transform: rotate(-90deg);
}

.livdoc-folder__icon {
    flex-shrink: 0;
    color: var(--color-primary);
}

.livdoc-folder__contents {
    display: none;
    padding: var(--space-xs) 0;
    background: var(--color-background);
    transition: background 1s;
}

.livdoc-folder__contents.is-open {
    display: block;
}

/* Nested folders indent */
.livdoc-folder__contents .livdoc-folder__toggle {
    padding-left: 36px;
    font-weight: var(--font-weight-normal);
    background: var(--color-background);
    font-size: var(--font-size-sm);
}

.livdoc-folder__contents .livdoc-folder__contents .livdoc-folder__toggle {
    padding-left: 56px;
}

.livdoc-folder__contents .livdoc-folder__contents .livdoc-folder__contents .livdoc-folder__toggle {
    padding-left: 76px;
}

/* File rows */
.livdoc-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 9px;
    padding-right: 16px;
    padding-bottom: 9px;
    /* padding-left is set inline per depth level */
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.livdoc-file:hover {
    background: var(--color-surface);
    color: var(--color-primary);
}

.livdoc-file:hover .livdoc-file__icon {
    color: var(--color-primary);
}

.livdoc-file__icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: color 0.15s;
}

.livdoc-file__name {
    flex: 1;
    font-size: var(--font-size-base);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}

.livdoc-file:hover .livdoc-file__name {
    color: var(--color-primary);
}

.livdoc-file__ext {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
}

/* Mobile */
@media (max-width: 768px) {
    .livdoc-layout {
        flex-direction: column;
    }

    .livdoc-sidebar {
        width: 100%;
        position: static;
    }

    .livdoc-file__name {
        white-space: normal;
        overflow: visible;
    }
}

.donation-intro {
    margin-bottom: 2rem;
    color: var(--color-text-muted);
    max-width: 640px;
}

/* 3-column grid; equal-height cards via flexbox column */
.donation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .donation-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
    .donation-grid { grid-template-columns: 1fr; }
    .donation-card--featured { grid-column: span 1; }
}

.donation-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.donation-card--featured {
    grid-column: span 2;
}

.donation-iconplaceholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    margin-bottom: 8px;
}

.donation-iconplaceholder--dual {
    flex-direction: row;
    gap: 12px;
    justify-content: center;
    width: auto;
}

.donation-iconplaceholder--dual .donation-iconfont {
    font-size: 48px;
}

.donation-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.donation-iconfont {
    font-family: var(--font-piktos);
    font-size: 80px;
    line-height: 1;
}

.donation-iconplaceholder-svg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.donation-icon-svg {
    width: 80px;
    height: 80px;
    fill: var(--color-accent);
}

.donation-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 8px 0 6px;
}

.donation-text {
    color: var(--color-text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
    flex: 1;
    margin-bottom: 1rem;
}

.donation-amount-input {
    width: 100%;
    margin-bottom: 0.6rem;
}

.donation-link {
    width: 100%;
    margin-top: auto;
}

.donation-thankyou {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-success);
    border-radius: 6px;
    padding: 14px 20px;
    margin-bottom: 1.5rem;
    color: var(--color-text);
    font-size: 0.92rem;
}

/* Ensure closed dialogs are hidden — some CSS resets override the UA stylesheet default */
dialog:not([open]) { display: none; }

/* Modals */
.donation-modal {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 30px;
    max-width: 680px;
    width: 90vw;
    position: relative;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

/* Stripe Checkout iframe modal — larger, no content padding */

/* Stripe Embedded Checkout modal */
.donation-modal-stripe {
    padding: 0;
    max-width: 540px;
    width: 95vw;
    height: min(92vh, 860px);
    max-height: min(92vh, 860px) !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #eeeeee;
    border-radius: 12px;
}

.donation-modal-stripe #stripe-modal-close {
    position: absolute;
    top: 8px;
    right: 28px; /* 12px button width + ~16px scrollbar clearance */
    z-index: 10;
    background: rgba(0,0,0,0.25);
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.donation-modal-stripe #stripe-modal-close:focus {
    outline: none;
}

.donation-modal-stripe #stripe-modal-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}


.donation-modal::backdrop {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}

.donation-modal h2 {
    color: var(--color-primary);
    margin-bottom: 16px;
    font-size: 1.4rem;
}

.donation-modal p {
    color: var(--color-text);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.donation-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text);
    padding: 0;
}

.donation-modal-close:hover {
    color: var(--color-primary);
}

.donation-qr {
    display: block;
    margin: 0 auto 16px;
    width: 240px;
    height: 240px;
    image-rendering: pixelated;
}

.donation-modal-details {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--color-text);
}


/* ========== ARTICLES / WORLD OF SWISS ========== */

/* Hero header — mirrors dow-hero */
.wos-hero {
    margin-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-lg);
}

.wos-hero__title {
    font-family: var(--font-sans);
    font-weight: var(--font-weight-light);
    font-size: var(--font-size-4xl);
    color: var(--color-primary);
    line-height: 1.1;
    margin: 0 0 var(--space-sm);
    transition: color 1s;
}

.wos-hero__lead {
    font-size: var(--font-size-lg);
    color: var(--color-text-muted);
    margin: 0;
    font-weight: var(--font-weight-light);
}

.wos-empty {
    color: var(--color-text-muted);
    font-size: var(--font-size-md);
}

/* Card list — vertical stack inside each year panel */
.wos-list {
    list-style: none;
    margin: 0;
    padding: var(--space-md) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Landscape card: image left (fixed width), text right (flexible) */
.wos-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    border: 1px solid var(--color-border);
    transition: background 0.15s;
}

.wos-card:hover {
    background: var(--color-surface);
}

.wos-card__img-wrap {
    flex: 0 0 220px;
    overflow: hidden;
    background: var(--color-surface);
}

.wos-card__img {
    width: 100%;
    height: 100%;
    min-height: 140px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.wos-card:hover .wos-card__img {
    transform: scale(1.03);
}

.wos-card__body {
    flex: 1 1 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-xs);
    min-width: 0;
}

.wos-card__date {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0;
    flex-shrink: 0;
}

.wos-card__title {
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin: 0;
    line-height: 1.3;
}

.wos-card__preview {
    font-size: var(--font-size-base);
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.6;
    /* Clamp to 3 lines — keeps cards a consistent height */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wos-card__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-primary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.02em;
    margin-top: var(--space-xs);
    transition: color 0.15s;
    flex-shrink: 0;
}

.wos-card__link:hover {
    color: var(--color-primary-hover);
}

.wos-card__link-icon {
    font-size: 0.8em;
}

/* Mobile: stack image above text */
@media (max-width: 768px) {
    .wos-card {
        flex-direction: column;
    }

    .wos-card__img-wrap {
        flex: 0 0 auto;
        height: 180px;
    }

    .wos-card__img {
        min-height: unset;
        height: 180px;
    }

    .wos-card__body {
        padding: var(--space-md);
    }
}


/* ========== EVENTS ========== */

.evt-section {
    margin-bottom: var(--space-xl);
}

.evt-section__heading {
    font-family: var(--font-sans);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin: 0 0 var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

/* Past event dimming */
.evt-past {
    opacity: 0.45;
    transition: opacity 0.2s;
}

.evt-past:hover {
    opacity: 0.7;
}

.evt-past .wos-card__img {
    filter: grayscale(0.6);
}

.evt-past__link {
    color: var(--color-text-muted) !important;
}

.evt-past__link:hover {
    color: var(--color-text) !important;
}


/* ========== ALERTS ========== */
/* Bootstrap-style alert component — hardcoded colors preserved intentionally */

.alert {
    padding: 8px 35px 8px 14px;
    margin-bottom: 18px;
    color: #c09853;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    background-color: #fcf8e3;
    border: 1px solid #fbeed5;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
}

.alert-heading {
    color: inherit;
}

.alert .close {
    float: right;
    text-decoration: none;
    color: #b94a48;
}

.alert .close:hover {
    color: #ad1a17;
}

.alert-danger,
.alert-error {
    color: #b94a48;
    background-color: #f2dede;
    border-color: #eed3d7;
}

/* Alert dark-mode overrides */
[data-theme="dark"] .alert {
    background-color: #332b00;
    color: #ffd666;
    border-color: #665500;
    text-shadow: none;
}

[data-theme="dark"] .alert-danger,
[data-theme="dark"] .alert-error {
    background-color: #330000;
    color: #ff6666;
    border-color: #660000;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .alert {
        background-color: #332b00;
        color: #ffd666;
        border-color: #665500;
        text-shadow: none;
    }

    :root:not([data-theme]) .alert-danger,
    :root:not([data-theme]) .alert-error {
        background-color: #330000;
        color: #ff6666;
        border-color: #660000;
    }
}


/* ========== SCHEDULE / BOOKINGS ========== */

.divertaction-timepicker {
    max-width: 250px;
}

.divertaction-timepicker > .date-picker {
    width: 100%;
}

.divertaction-timepicker > .time-picker {
    display: flex;
    justify-content: space-between;
}

.divertaction-timepicker > .time-picker > select {
    width: 49%;
}

.routemap {
    width: 100%;
    height: 400px;
    margin-bottom: 10px;
}

.book-table > tbody > tr > td:nth-of-type(even) {
    background-color: var(--color-surface);
}

.book-table > tbody > tr > td {
    vertical-align: top;
}

.schedule-mode-switcher {
    margin-top: 7px;
    margin-bottom: 7px;
    width: 100%;
    color: var(--color-text-muted);
}

.schedule-mode-switcher a:first-child {
    border-right: 2px solid var(--color-border);
}

.schedule-mode-switcher a {
    box-sizing: border-box;
    display: inline-block;
    height: auto;
    min-height: 50px;
    line-height: 50px;
    vertical-align: middle;
    font-weight: 700;
    width: 50%;
    text-decoration: none;
    text-align: center;
    background-color: var(--color-surface);
    transition: background-color 0.3s, color 0.3s;
}

.schedule-mode-switcher a:not(.active):hover {
    background-color: var(--color-border);
    color: var(--color-text);
    transition: background-color 0.3s, color 0.3s;
}

.schedule-mode-switcher .active {
    color: var(--color-primary);
    cursor: default;
    background-color: var(--color-border);
}

.hour-selector {
    text-align: center;
    margin-top: 7px;
    margin-bottom: 7px;
    width: 100%;
}

.hour-selector span {
    color: var(--color-primary);
    display: inline-block;
    border: 1px solid var(--color-primary);
    border-radius: 5px;
    padding: 2px;
    margin: 2px;
}

.hour-selector span.selected {
    background-color: var(--color-primary);
    color: var(--color-background);
}

.hour-selector span:not(.deactivated):hover {
    background-color: var(--color-primary);
    color: var(--color-background);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.hour-selector span.deactivated {
    border: 1px solid var(--color-border);
    color: var(--color-border);
}

/* Route-level suspension warning (schedule list views) — icon inside button */
.btn .icon {
    font-family: swiss-piktos;
}

/* Per-departure suspension (book page) */
.schedule-suspended-flight {
    text-decoration: line-through;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.suspension-reason {
    font-size: 0.82em;
    color: var(--color-primary);
    font-style: italic;
    margin-top: 0;
}

.suspension-reason .icon {
    font-family: swiss-piktos;
}

.box-status {
    float: right;
    padding: 3px;
    font-weight: 400;
    font-size: 23px;
}

.box-status.green {
    color: var(--color-background);
    background-color: var(--color-success);
}

.box-status.yellow {
    color: var(--color-background);
    background-color: var(--color-warning);
}

.box-status.red {
    color: var(--color-background);
    background-color: var(--color-primary);
}

.auto-complete {
    background-color: var(--color-surface);
    width: 100%;
    padding: 5px;
    display: block;
}


/* ========== LOGIN / AUTH ========== */

/* Full-viewport wrapper — intentionally dark in both themes */
.auth-page {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Dark gradient is hardcoded: deliberate — auth page stays dark regardless of theme */
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0d0d0d 100%);
    /* Subtle SWISS red accent via layered gradient */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(204, 0, 0, 0.08) 0%, transparent 60%),
        linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0d0d0d 100%);
    padding: var(--space-md);
    box-sizing: border-box;
}

/* Centred card */
.auth-card {
    background: var(--color-background);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-xl) var(--space-lg);
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
}

/* Logo area */
.auth-card__logo {
    display: block;
    width: 100%;
    margin-bottom: var(--space-lg);
}

.auth-card__logo > img {
    width: 100%;
    height: auto;
    display: block;
}

/* Card heading */
.auth-card__title {
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-md);
    line-height: var(--line-height-tight);
}

/* Form inputs inside the card */
.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"] {
    display: block;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-background);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
    margin-bottom: var(--space-sm);
}

.auth-card input[type="text"]:focus,
.auth-card input[type="password"]:focus,
.auth-card input[type="email"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}

/* Password field + eye toggle wrapper */
.auth-password-wrapper {
    position: relative;
    display: block;
    margin-bottom: var(--space-sm);
}

.auth-password-wrapper input[type="password"],
.auth-password-wrapper input[type="text"] {
    margin-bottom: 0;
    padding-right: calc(var(--space-lg) + var(--space-md));
}

/* Eye toggle button — overlaid on the right side of the password field */
.auth-eye-toggle {
    position: absolute;
    right: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
    line-height: 1;
}

.auth-eye-toggle:hover {
    color: var(--color-text);
}

.auth-eye-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Forgot password link */
.auth-forgot-link {
    display: inline-block;
    margin-bottom: var(--space-md);
    color: var(--color-primary);
    font-size: var(--font-size-sm);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-forgot-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* "or" divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* Future auth method buttons (Passkey, Entra SSO, etc.) */
.auth-method-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    box-sizing: border-box;
    text-align: center;
}

.auth-method-btn:hover:not([disabled]) {
    border-color: var(--color-primary);
    background: var(--color-surface);
}

/* Placeholder state for future auth methods */
.auth-method-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Icon slot inside method buttons */
.auth-method-btn__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Checkbox + label row for reset-password consent */
.auth-consent-group {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

.auth-consent-group input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
}

/* Back to login link */
.auth-back-link {
    display: inline-block;
    margin-top: var(--space-sm);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-back-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .auth-card {
        padding: var(--space-lg) var(--space-md);
        max-width: 90vw;
        width: 90vw;
    }
}

.greeting {
    margin-bottom: 15px;
    color: var(--color-primary);
}


/* ========== PROFILE / COMAIL ========== */

.pilot-profile-link {
    color: var(--color-text-muted);
}

.pilot-info a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.comail-box {
    padding: 20px;
    margin: 50px 0;
    border: 2px solid var(--color-primary);
    background: var(--color-background);
    text-decoration: none;
    color: var(--color-primary);
    width: 100%;
    text-align: center;
    transition: all 0.2s ease-in-out;
    position: relative;
    box-sizing: border-box;
    cursor: pointer;
}

.comail-box a {
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--color-primary);
}

.comail-box:hover > a {
    color: var(--color-background);
}

.comail-box:hover > .comail-message {
    color: var(--color-primary);
}

.comail-box:hover {
    color: var(--color-background);
    background-color: var(--color-primary);
    transition: all 0.5s ease-in-out;
}

.comail-message {
    position: absolute;
    left: -8px;
    top: -8px;
}


/* ========== OPERATIONS / ACARS ========== */

.operations-center {
    width: 100%;
    border-radius: 10px;
    font-weight: 700;
}

.operations-center p {
    line-height: 27px;
}

.operations-center p > small {
    font-weight: 400;
}

.operations-center.offline {
    color: var(--color-primary);
    opacity: 0.6;
}

.dash-map > .header {
    background-color: var(--color-surface);
    height: 50px;
    color: var(--color-text-muted);
    padding-left: 15px;
    padding-right: 15px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.acarsmap-live {
    display: inline-block;
    height: 30px;
    width: 55px;
    text-transform: uppercase;
    background-color: #2bd900; /* ACARS live green — keep as-is */
    color: var(--color-background);
    line-height: 30px;
    text-align: center;
    font-size: smaller;
    border-radius: 4px;
}

/* .acarsmap, .notams-table, .discord-widget rules live in the DASHBOARD section */


/* ========== WEATHER / NEWS / SOCIAL ========== */

.instagram-image {
    width: 100%;
}

.container.instagram {
    padding: 0;
}

.instagram-text {
    padding: 15px;
}

.box-weather {
    display: inline-block;
    width: 50%;
    text-align: center;
    vertical-align: top;
}

.box-weather > .icon {
    color: var(--color-accent);
    font-size: 50px;
}

.box-weather > .main {
    color: var(--color-primary);
}

.box-weather > .main > p {
    color: var(--color-text);
    font-size: 30px;
}

.box-weather > .details {
    font-size: 14px;
    color: var(--color-text-muted);
}

.news > h1 {
    font-size: 20px;
    font-weight: 400;
}

.news > p {
    font-size: 14px;
    color: var(--color-text-muted);
}

.news > p > a {
    color: var(--color-info);
}

/* discord-widget rules live in the DASHBOARD section */


/* ========== FLYPAD ========== */

.flypad-block {
    width: 80vw;
    margin-left: 10vw;
}

.flypad-back {
    font-size: x-large;
    color: var(--color-primary);
    margin-right: 5px;
    transition: color 1s;
}

.flypad-nightmodeblock {
    position: absolute;
    margin-right: 10vw;
    right: 0;
}

@media (max-width: 768px) {
    .flypad-nightmodeblock {
        position: absolute;
        left: 1vw;
        top: 0;
    }
}

.download-loadsheet {
    float: right;
    margin-right: 5px;
}

.flypad-map {
    height: 350px;
}


/* ========== MISC LAYOUT (continued) ========== */

.forum-widget {
    background-color: var(--color-surface);
    position: relative;
}

.forum-bottom {
    position: absolute;
    bottom: 150px;
}

@media (max-width: 768px) {
    .forum-bottom {
        position: relative;
        bottom: auto;
    }
}

.container.md {
    text-align: center;
}

.container.md > cite {
    color: var(--color-text-muted);
}

.container.md > h1 {
    margin-bottom: 0;
}

.container.md > .description {
    margin-top: 20px;
    max-height: 170px;
    overflow-y: auto;
    font-size: 15px;
    text-align: left;
}


/* ========== MESSENGER (from M001) ========== */
/*
 * Duplicated from comail_show.tpl inline <style>.
 * The inline styles remain in comail_show.tpl for now — S04 will remove
 * the inline duplicate once this file is the canonical source.
 */

.conversation-thread {
    margin-top: 16px;
}

.conversation-msg {
    padding: 10px 14px;
    margin-bottom: 12px;
    border-left: 4px solid #555; /* overlay/neutral — keep as-is */
    background: rgba(255, 255, 255, 0.04);
}

.conversation-msg.sent {
    border-left-color: #e74c3c; /* conversation sent border — keep as-is */
}

.conversation-msg.received {
    border-left-color: #2ecc71; /* conversation received border — keep as-is */
}

.conversation-msg .msg-meta {
    font-size: 0.85em;
    margin-bottom: 6px;
}

.conversation-msg .msg-content {
    margin: 0;
}


/* ========== THEME SWITCHER ========== */

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--color-background);
    border: 1.5px solid var(--color-text);
    border-radius: 100vw;
    padding: 2px;
    margin-left: 15px;
    flex-shrink: 0;
}

.theme-switcher__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border: none;
    border-radius: 100vw;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.theme-switcher__btn svg {
    display: block;
    width: 14px;
    height: 14px;
}

.theme-switcher__btn--auto {
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
    line-height: 1;
    padding: 0 5px;
}

.theme-switcher__btn[aria-checked="true"] {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.theme-switcher__btn:hover {
    color: var(--color-text);
}

.theme-switcher__btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Dark mode refinements for theme switcher */
:root[data-theme="dark"] .theme-switcher {
    border: 1px solid rgba(255, 255, 255, 0.35);
}

:root[data-theme="dark"] .theme-switcher__btn {
    color: rgba(255, 255, 255, 0.3);
}

:root[data-theme="dark"] .theme-switcher__btn[aria-checked="true"] {
    background: #2a2a2a;
    color: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-switcher {
        border: 1px solid rgba(255, 255, 255, 0.35);
    }

    :root:not([data-theme]) .theme-switcher__btn {
        color: rgba(255, 255, 255, 0.3);
    }

    :root:not([data-theme]) .theme-switcher__btn[aria-checked="true"] {
        background: #2a2a2a;
        color: #ffffff;
    }
}

/* ========== DASHBOARD ========== */

/*
 * CSS Grid layout for the pilot dashboard (/profile/self).
 * Replaces Bootstrap col-md-* columns with semantic grid cells.
 * Design language mirrors public-web-5.0: cards lift on hover (translateY + shadow-lg),
 * no resting shadow (matches fleet-card / team-card / partner-card pattern),
 * container-wide max-width frames the grid on large viewports.
 * Inspect: DevTools → Elements → .dashboard-grid → Computed tab.
 */

/* Outer wrapper — constrains grid to 1200px like public-web container-wide */
.dashboard-wrapper {
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--space-lg);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    margin-top: var(--space-md);
}

/* Hero cell — greeting, pilot stats, comail, ops-centre (spans 2 of 3 cols) */
.dash-hero {
    grid-column: 1 / 3;
}

.dash-hero > .container {
    padding: var(--space-md);
}

/* Map cell grid-column, flex layout, and .acarsmap live in the card chrome section below */

/* NOTAMs — formerly the notifications slot (auto-flow, one of the 3 equal cells) */
.dash-notams {
    /* auto-flow — no explicit grid-column needed */
}

/* Three equal-width cells: notifications, tutorials, weather — auto-flow */
/* .dash-notifications, .dash-tutorials, .dash-weather — no explicit column needed */

/* Destination of the month — spans the freed 2 columns (placeholder removed) */
.dash-destination {
    grid-column: 2 / 4;
}

/* ---- Card chrome ---- */
/*
 * Matches public-web-5.0 card pattern (fleet-card, team-card, partner-card):
 * - No resting box-shadow (cards sit flush against the page surface)
 * - On hover: translateY(-4px) lift + shadow-lg (same as public site)
 * - transition-base (200ms ease) for snappy feel
 * - overflow:hidden removed from .dash-card — it clips the lifted shadow and
 *   collapses the border on hover. Each card's inner content handles its own
 *   overflow where needed (e.g. acarsmap, iframe).
 *
 * .dash-notams is excluded from hover lift — it's a full-width informational
 * banner, not an interactive card.
 */
.dash-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background-color: var(--color-background);
    transition: background-color var(--transition-slow),
                color var(--transition-slow);
    /* overflow managed per-child — keeps border-radius visible */
}

.dash-card > .title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    background-color: var(--color-surface);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    border-radius: var(--radius-md) var(--radius-md) 0 0; /* clip top corners */
    transition: background-color var(--transition-slow), color var(--transition-slow);
    box-sizing: border-box;
}

/* Homepage alert — rendered as a card above the grid */
.homepage-alert.dash-card {
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Operations Center alert — same pattern as homepage-alert, shown only when active */
.ops-center-alert.dash-card {
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    border-color: var(--color-success);
    color: var(--color-text);
}

/* Map card — full-width (formerly notams slot), flex column so acarsmap fills height */
.dash-map {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius-md);
    position: relative;
}

.flight-info-panel {
    position: absolute;
    top: 60px;
    right: var(--space-sm);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    box-shadow: var(--shadow-md);
    z-index: 800;
    max-width: 280px;
    pointer-events: none;
    font-size: var(--font-size-sm);
}

.fip-route { font-weight: bold; margin-bottom: 2px; }
.fip-pilot { color: var(--color-text-muted); margin-bottom: 4px; }
.fip-aircraft { color: var(--color-text-muted); }
.fip-stats { margin-top: 4px; color: var(--color-text); }

.acarsmap {
    flex: 1;
    width: 100%;
    min-height: 400px;
}

/* Discord card — flex column so iframe fills card edge-to-edge */
.dash-discord {
    grid-column: 1 / 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.discord-widget {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.discord-widget > iframe {
    flex: 1;
    width: 100%;
    min-height: 300px;
    border: 0;
    display: block;
}

/* NOTAMs table — tighten font, remove duplicate td rule */
.notams-table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    font-size: var(--font-size-sm);
}

.notams-table tr:nth-child(2n) {
    background-color: var(--color-surface);
}

.notams-table td {
    padding: var(--space-sm) var(--space-md);
    color: var(--color-text-muted);
}

.notams-table a {
    text-decoration: none;
    color: var(--color-primary);
}

.notams-table a:visited {
    color: var(--color-text-muted);
}

/* YouTube / tutorial iframe — CSS-controlled sizing (no inline style needed) */
.dash-tutorials iframe {
    width: 100%;
    height: 300px;
    border: 0;
}

/* ---- Responsive collapse ---- */
@media (max-width: 768px) {
    .dashboard-wrapper {
        padding-inline: var(--space-md);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dash-hero,
    .dash-map,
    .dash-discord,
    .dash-destination {
        grid-column: auto;
    }
}

/* ========== QR MODAL (FlyPad home) ========== */

.qr-link {
    color: var(--color-text-muted);
    font-size: 11px;
    text-decoration: none;
}

.qr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.qr-modal-box {
    position: relative;
    background: var(--color-surface);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--color-border);
}

.qr-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: var(--color-text-muted);
    font-size: 24px;
    text-decoration: none;
    font-weight: 300;
}

.qr-caption {
    margin-top: 15px;
    color: var(--color-text-muted);
    font-size: 12px;
}
