/* Operator detail page — uses global site-theme tokens */

.op-page {
    --op-accent: var(--link);
    --op-hero-bg: var(--white);
}

.op-toolbar {
    margin-bottom: 16px;
}

.op-hero {
    margin-bottom: 20px;
    overflow: hidden;
}

.op-hero-top {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 24px;
    padding: 22px 24px;
    background: var(--op-hero-bg);
}

.op-hero-left {
    flex: 1 1 320px;
    min-width: 0;
}

.op-hero-brand-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.op-hero-icon-wrap {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.op-hero-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.op-hero-icon--light,
.op-banner--light { display: block; }
.op-hero-icon--dark,
.op-banner--dark { display: none; }
html[data-theme="dark"] .op-hero-icon--light,
html[data-theme="dark"] .op-banner--light { display: none; }
html[data-theme="dark"] .op-hero-icon--dark,
html[data-theme="dark"] .op-banner--dark { display: block; }

.op-hero-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--heading);
    line-height: 1.2;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}

.op-code-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.op-code-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--white);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.op-code-lbl {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.op-code-val {
    font-size: 13px;
    font-weight: 800;
    font-family: ui-monospace, monospace;
    color: var(--heading);
}

.op-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px 20px;
    margin: 0;
}

.op-meta-item {
    margin: 0;
}

.op-meta-item--wide {
    grid-column: 1 / -1;
}

.op-meta-item dt {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.op-meta-item dd {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--heading);
    line-height: 1.35;
}

.op-hero-banner {
    flex: 0 1 380px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 12px 18px;
    border-left: 1px solid var(--border);
    min-height: 132px;
}

.op-hero-tail {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.op-hero-tail img {
    max-height: 96px;
    max-width: 96px;
    width: auto;
    object-fit: contain;
}

.op-hero-banner-logos {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.op-banner {
    max-width: 100%;
    max-height: 108px;
    width: auto;
    object-fit: contain;
}

.op-hero-about {
    padding: 14px 22px 18px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
    border-top: 1px solid var(--border);
}

.op-hero-about p {
    margin: 0 0 10px;
}

.op-hero-about p:last-child {
    margin-bottom: 0;
}

.op-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.op-kpi {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px 14px;
    text-align: center;
}

.op-kpi-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--heading);
    font-family: ui-monospace, monospace;
}

.op-kpi-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 700;
}

.op-map-section {
    margin-bottom: 20px;
    overflow: hidden;
}

.op-map-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.op-map-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.op-map-toggle input {
    accent-color: var(--link);
}

.op-map-frame {
    background: #f4f6f9;
    padding: 0;
    overflow: hidden;
    line-height: 0;
}

html[data-theme="dark"] .op-map-frame {
    background: #1a2030;
}

.op-map-frame--hero .op-map {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    object-position: center top;
    margin: 0;
    vertical-align: top;
}

.op-brand-section {
    margin-bottom: 20px;
    overflow: hidden;
}

.op-brand-inner {
    padding: 18px 14px 22px;
}

.op-livery-marquee-wrap {
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}

.op-livery-marquee {
    overflow: hidden;
    --op-marquee-duration: calc(max(var(--op-livery-count, 6), 4) * 5s);
}

.op-livery-track {
    display: flex;
    gap: 28px;
    width: max-content;
    animation: op-livery-scroll var(--op-marquee-duration) linear infinite;
}

.op-livery-marquee:hover .op-livery-track {
    animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
    .op-livery-marquee-wrap {
        mask-image: none;
    }
    .op-livery-track {
        animation: none;
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }
    .op-livery-slide {
        flex: 1 1 min(440px, 100%);
    }
}

@keyframes op-livery-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.op-livery-slide {
    flex: 0 0 auto;
    width: min(440px, 58vw);
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--stripe);
    padding: 16px 20px 12px;
    cursor: zoom-in;
    text-align: center;
    transition: border-color 0.15s;
}

.op-livery-slide:hover {
    border-color: var(--link);
}

.op-livery-slide img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: contain;
}

.op-livery-label {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    color: var(--heading);
}

.op-section {
    margin-bottom: 24px;
}

.op-section > .panel-heading {
    margin-bottom: 0;
    border-radius: 4px 4px 0 0;
}

.op-matrix-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    background: var(--white);
}

.op-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.op-table-panel .panel-heading {
    border-radius: 4px 4px 0 0;
}

.op-table-panel .panel-body {
    padding: 0;
}

.op-table-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background: var(--panel-head);
}

.op-table-search input[type="search"] {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    background: var(--white);
    color: var(--text);
}

/* Fleet matrix (scoped) */
.op-page .fleet_matrix_container {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: none;
}

.op-matrix-compact .fleet_matrix th,
.op-matrix-compact .fleet_matrix td {
    padding: 8px 12px;
}

.op-matrix-compact .fleet_matrix thead th {
    font-size: 10px;
}

.op-page .fleet_matrix th.type {
    width: auto;
}

.op-page h2.headline-spacer {
    display: none;
}

.op-page .pg-bar {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 4px 4px;
}

/* Livery lightbox */
.op-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(15, 18, 24, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.op-lightbox[hidden] {
    display: none !important;
}

.op-lightbox img {
    max-width: min(960px, 100%);
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    background: #fff;
}

.op-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

@media (max-width: 900px) {
    .op-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .op-split {
        grid-template-columns: 1fr;
    }
    .op-hero-banner {
        border-left: none;
        border-top: 1px solid var(--border);
        flex: 1 1 100%;
    }
}

@media (max-width: 600px) {
    .op-hero-top {
        padding: 16px;
    }
    .op-hero-title {
        font-size: 22px;
    }
    .op-meta-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Tables (fleet matrix, fleet list, callsigns) */
.op-page .fleet_matrix {
    width: 100%;
    border-collapse: collapse;
}
.op-page .fleet_matrix th,
.op-page .fleet_matrix td {
    border: 1px solid var(--border);
    padding: 10px 12px;
    text-align: center;
}
.op-page .fleet_matrix thead th {
    background: var(--panel-head);
    font-weight: 700;
    color: var(--heading);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.op-page .fleet_matrix th.type {
    text-align: left;
    background: var(--white);
    color: var(--heading);
    font-size: 13px;
    font-weight: 700;
}
.op-page .fleet_matrix td.data {
    font-family: monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--link);
}
.op-page .fleet_matrix td.date {
    font-size: 12px;
    color: var(--text-muted);
}
.op-page .fleet_matrix td.engine-cell {
    font-size: 11px;
    color: var(--text);
    line-height: 1.6;
    text-align: left;
    white-space: nowrap;
}

.op-page .dt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.op-page .dt-table thead th {
    background: var(--panel-head);
    border-bottom: 2px solid var(--border-dark);
    padding: 8px 12px;
    font-weight: 700;
    color: var(--heading);
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.op-page .dt-table tbody {
    transition: opacity 0.2s ease;
}
.op-page .dt-table tbody tr {
    border-bottom: 1px solid var(--border);
}
.op-page .dt-table tbody tr:nth-child(even) {
    background: var(--stripe);
}
.op-page .dt-table td {
    padding: 9px 12px;
    vertical-align: middle;
}
.op-page .reg {
    font-weight: 700;
    color: var(--link);
    font-family: monospace;
    font-size: 13px;
    display: block;
}
.op-page .cs {
    font-weight: 700;
    color: var(--heading);
    font-family: monospace;
    font-size: 13px;
}
.op-page .route-code {
    font-weight: 700;
    color: var(--heading);
    font-size: 12px;
}
.op-page .route-arrow {
    color: var(--border-dark);
    margin: 0 4px;
    font-size: 11px;
}
.op-page .ac-model {
    font-weight: 600;
    color: var(--heading);
}
.op-page .ac-mfr {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.op-page .badge-sightings {
    display: inline-block;
    background: #e8eef7;
    color: var(--btn-primary);
    font-weight: 700;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
}
html[data-theme="dark"] .op-page .badge-sightings {
    background: rgba(42, 109, 181, 0.25);
}

.op-page .pg-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--panel-head);
    border-top: 1px solid var(--panel-head-b);
    font-size: 11px;
    color: var(--text-muted);
}
.op-page .pg-controls {
    display: flex;
    gap: 5px;
}
.op-page .btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 600px) {
    .op-page .fleet_matrix_container {
        -webkit-overflow-scrolling: touch;
    }
    .op-page .fleet_matrix {
        min-width: 640px;
    }
    .op-page .fleet_matrix th,
    .op-page .fleet_matrix td {
        padding: 8px;
        font-size: 11px;
    }
    .op-page .fleet_matrix td.engine-cell {
        white-space: normal;
    }
    .op-page .dt-table thead {
        display: none;
    }
    .op-page .dt-table,
    .op-page .dt-table tbody,
    .op-page .dt-table tr,
    .op-page .dt-table td {
        display: block;
        width: 100%;
    }
    .op-page .dt-table tbody tr {
        border: 1px solid var(--border);
        border-radius: 4px;
        margin-bottom: 8px;
        padding: 6px 0;
    }
    .op-page .dt-table tbody tr:nth-child(even) {
        background: var(--white);
    }
    .op-page .dt-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 7px 12px;
        text-align: right;
        border-bottom: 1px dashed var(--border);
    }
    .op-page .dt-table td:last-child {
        border-bottom: none;
    }
    .op-page .dt-table td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--text-muted);
        text-align: left;
        flex-shrink: 0;
    }
    .op-page .dt-table td[data-label="Registration"],
    .op-page .dt-table td[data-label="Aircraft"] {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .op-page .pg-bar {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
        text-align: center;
    }
    .op-page .pg-controls {
        justify-content: center;
    }
}

html[data-theme="dark"] .op-page {
    --op-hero-bg: var(--white);
}
html[data-theme="dark"] .op-page .op-hero-top[style*="gradient"] {
    background: var(--white);
}
