/* ═══════════════════════════════════════════════════════════════════════════
   Shared page components (account, community, onboarding)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --layout-max: 1140px;
    --panel-head:   #f8f9fa;
    --panel-head-b: #dde1e7;
    --stripe:       #f8f9fb;
    --btn-primary:  #2a6db5;
    --btn-primary-h:#1a4f8a;
    --btn-default:  #f8f9fa;
    --btn-default-b:#c4c9d1;
    --btn-danger:   #c0392b;
    --btn-danger-h: #a5311f;
    --green:        #2e7d32;
    --green-bg:     #e8f5e9;
    --amber:        #e65100;
    --amber-bg:     #fff3e0;
    --red:          #c0392b;
    --red-bg:       #fdf2f2;
    --overlay-scrim: rgba(240, 242, 245, 0.88);
}

html {
    height: 100%;
}
::selection {
    background: #c8e6c9;
    color: inherit;
}
::-moz-selection {
    background: #c8e6c9;
    color: inherit;
}
html[data-theme="dark"] ::selection,
html[data-theme="dark"] ::-moz-selection {
    background: #a5d6a7;
    color: inherit;
}
body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
#main-content {
    flex: 1 0 auto;
}
#site-footer {
    margin-top: auto;
    flex-shrink: 0;
}
body:has(#fir-root) #site-footer,
body:has(#stream-root) #site-footer,
body:has(#tracked-root) #site-footer,
body:has(#kiosk-page[style*="block"]) #site-footer {
    display: none !important;
}

.page-wrap {
    width: 100%;
    max-width: var(--layout-max);
    margin: 0 auto;
    padding: 20px 15px 50px;
    box-sizing: border-box;
}

h2.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 18px;
}

.header-actions { margin-bottom: 20px; }

.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.panel-heading {
    background: var(--panel-head);
    border-bottom: 1px solid var(--panel-head-b);
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 700;
    color: var(--heading);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.panel-heading .sub {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-muted);
}

.panel-body { padding: 15px; }

.panel-footer {
    background: var(--panel-head);
    border-top: 1px solid var(--panel-head-b);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 12px;
    font-family: var(--font, 'Open Sans', Arial, sans-serif);
    font-weight: 600;
    border-radius: 3px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    background: none;
}

.btn-primary {
    background: var(--btn-primary);
    border-color: var(--btn-primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--btn-primary-h);
    border-color: var(--btn-primary-h);
    color: #fff;
    text-decoration: none;
}

.btn-default {
    background: var(--btn-default);
    border-color: var(--btn-default-b);
    color: var(--text);
}
.btn-default:hover {
    background: #e9ecef;
    color: var(--text);
    text-decoration: none;
}

.btn-danger {
    background: var(--white);
    border-color: #e8b4b4;
    color: var(--btn-danger);
}
.btn-danger:hover {
    background: var(--red-bg);
    border-color: var(--btn-danger);
    color: var(--btn-danger-h);
    text-decoration: none;
}

.btn-sm { padding: 4px 10px; font-size: 11px; }
.pull-right { margin-left: auto; }

.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-success { background: var(--green-bg); color: var(--green); border: 1px solid #a5d6a7; }
.badge-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid #ffcc80; }
.badge-danger  { background: var(--red-bg); color: var(--red); border: 1px solid #e8b4b4; }
.badge-neutral { background: var(--btn-default); color: var(--text-muted); border: 1px solid var(--border-dark); }

.alert {
    padding: 10px 15px;
    border-radius: 4px;
    border: 1px solid transparent;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success { background: var(--green-bg); border-color: #a5d6a7; color: var(--green); }
.alert-error   { background: var(--red-bg); border-color: #e8b4b4; color: var(--red); }
.alert-info    { background: #e8eef7; border-color: #c5d6ee; color: var(--link); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.stat-cell {
    background: var(--white);
    padding: 12px 10px;
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--heading);
    line-height: 1.2;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 4px;
}

.dt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.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;
    white-space: nowrap;
}

.dt-table tbody tr { border-bottom: 1px solid var(--border); }
.dt-table tbody tr:nth-child(even) { background: var(--stripe); }
.dt-table tbody tr:hover { background: #e8eef7; }
.dt-table td { padding: 9px 12px; vertical-align: middle; color: var(--text); }

.mono { font-family: monospace; }
.text-muted { color: var(--text-muted); }
.ts { font-size: 11px; color: var(--text-muted); }

.empty-state {
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    font-style: italic;
}

.form-row { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.form-input {
    width: 100%;
    max-width: 360px;
    padding: 7px 10px;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    font-size: 13px;
    font-family: var(--font, 'Open Sans', Arial, sans-serif);
    color: var(--text);
    outline: none;
    background: var(--white);
}

.form-input:focus {
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 2px rgba(42, 109, 181, 0.12);
}

.tz-picker {
    position: relative;
    width: 100%;
    max-width: 360px;
}

.tz-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    max-width: none;
    text-align: left;
    cursor: pointer;
    background: var(--white);
}

.tz-picker-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tz-picker-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 11px;
}

.tz-picker-menu {
    position: absolute;
    z-index: 200;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

/* Timezone menu overlaps panel-footer; footer follows body in DOM and wins without z-index */
.panel:has(.tz-picker) {
    overflow: visible;
}

.panel:has(.tz-picker) .panel-body {
    position: relative;
    z-index: 2;
    overflow: visible;
}

.panel:has(.tz-picker) .panel-footer {
    position: relative;
    z-index: 1;
}

.tz-picker-search-wrap {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-head);
}

.tz-picker-search {
    max-width: none;
    width: 100%;
    margin: 0;
}

.tz-picker-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 240px;
    overflow-y: auto;
}

.tz-picker-option {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
}

.tz-picker-option:hover,
.tz-picker-option.is-focused {
    background: rgba(42, 109, 181, 0.08);
}

.tz-picker-option.is-selected {
    background: rgba(42, 109, 181, 0.14);
    font-weight: 600;
}

.tz-picker-option.is-preferred {
    font-weight: 500;
}

.tz-picker-divider {
    padding: 6px 12px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    pointer-events: none;
}

.tz-picker-empty {
    padding: 12px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.tz-picker-trigger[aria-expanded="true"] {
    border-color: var(--btn-primary);
    box-shadow: 0 0 0 2px rgba(42, 109, 181, 0.12);
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 13px;
}

.detail-table tr:last-child td { border-bottom: none; }

.detail-table .dl {
    width: 160px;
    background: var(--panel-head);
    border-right: 1px solid var(--border);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-table .dv {
    color: var(--heading);
    font-family: monospace;
    font-size: 13px;
    font-weight: 600;
}

.detail-table .dv.plain { font-family: var(--font, 'Open Sans', Arial, sans-serif); }

.pref-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.pref-row:last-child { border-bottom: none; padding-bottom: 0; }
.pref-row:first-child { padding-top: 0; }

.pref-info { flex: 1; min-width: 0; }
.pref-title { font-weight: 700; font-size: 13px; color: var(--heading); margin-bottom: 3px; }
.pref-desc  { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.pref-control { flex-shrink: 0; padding-top: 1px; }

.pref-select {
    padding: 5px 8px;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    font-size: 12px;
    font-family: var(--font, 'Open Sans', Arial, sans-serif);
    color: var(--text);
    background: var(--white);
    outline: none;
    cursor: pointer;
    min-width: 90px;
}

.coord-inputs {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.coord-inputs .form-row {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

.panel-locked { position: relative; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

@media (max-width: 700px) {
    .page-wrap { padding: 14px 10px 40px; }
    h2.page-title { font-size: 18px; }
    .stat-grid { grid-template-columns: 1fr; }
    .community-feed { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .pref-row { flex-direction: column; gap: 8px; }
    .detail-table .dl { width: 120px; font-size: 10px; }
    .coord-inputs { flex-direction: column; }
    .form-input { max-width: 100%; font-size: 16px; }
    .pref-select { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Site-wide dark theme: loaded from header; overrides page-level :root tokens
   ═══════════════════════════════════════════════════════════════════════════ */

html[data-theme="dark"] {
    color-scheme: dark;

    --nav-bg:       #0a0d12;
    --nav-border:   #1e2430;
    --nav-text:     #8b95a5;
    --nav-hover:    #eef1f5;
    --nav-active:   #ffffff;
    --nav-accent:   #4a90d9;

    --body-bg:      #0f1218;
    --white:        #1a1f28;
    --border:       #2d3544;
    --border-dark:  #3d4656;
    --text:         #dce1e9;
    --text-muted:   #8b95a5;
    --heading:      #eef1f5;
    --link:         #5a9fd4;
    --link-hover:   #7ab8e8;

    --btn-primary:  #3d7fc4;
    --btn-primary-h:#2a6db5;
    --btn-default:  #252b36;
    --btn-default-b:#3d4656;
    --btn-danger:   #e05545;
    --btn-danger-h: #c0392b;

    --panel-head:   #1e2430;
    --panel-head-b: #2d3544;
    --stripe:       #161b24;

    --green:        #66bb6a;
    --green-bg:     #1a2e1c;
    --amber:        #ffb74d;
    --amber-bg:     #2e2418;
    --red:          #ef5350;
    --red-bg:       #2e1a1a;

    --info-bg:      #1a2744;
    --info-border:  #2d4a6e;
    --info-text:    #dce1e9;
    --warning-bg:   #2e2818;
    --warning-border:#6d5a20;
    --warning-text: #e8d48a;
    --purple:       #b39ddb;
    --purple-bg:    #2a1f3d;
    --purple-border:#5c4a8a;
    --amber-border: #6d5a20;
    --green-border: #2e5c32;
    --red-border:   #5c2e2e;
}

/* ── Anti-FOUC: ensure dark background before full CSS cascade ─────────────── */
html[data-theme="dark"],
html[data-theme="dark"] body {
    background-color: #0f1218 !important;
    color: #dce1e9;
}

/* ── Shared interactive states (hardcoded light colours in page CSS) ─────── */
html[data-theme="dark"] .btn-default:hover,
html[data-theme="dark"] .pg-btn:hover:not(:disabled):not(.pg-active),
html[data-theme="dark"] .view-toggle-btn:hover:not(.active),
html[data-theme="dark"] .mob-auth-signin:hover {
    background: #2d3544 !important;
    color: var(--heading) !important;
    border-color: var(--border-dark) !important;
}

html[data-theme="dark"] .dt-table tbody tr:hover,
html[data-theme="dark"] .runway-table tbody tr:hover,
html[data-theme="dark"] .search-result-row:hover,
html[data-theme="dark"] .cs-result-row:hover,
html[data-theme="dark"] .action-menu-item:hover,
html[data-theme="dark"] .group-card:hover,
html[data-theme="dark"] .group-card.highlighted,
html[data-theme="dark"] .map-legend .legend-item.legend-btn:hover,
html[data-theme="dark"] .range-cal-day.in-range {
    background: #1e2430 !important;
}

html[data-theme="dark"] .guest-notice,
html[data-theme="dark"] .scanner-notice,
html[data-theme="dark"] .alert-info,
html[data-theme="dark"] .upgrade-notice {
    background: #1a2744 !important;
    border-color: #2d4a6e !important;
    color: var(--text) !important;
}

html[data-theme="dark"] .alert-success {
    background: var(--green-bg) !important;
    border-color: #2e5c32 !important;
    color: var(--green) !important;
}

html[data-theme="dark"] .alert-error,
html[data-theme="dark"] .alert-danger {
    background: var(--red-bg) !important;
    border-color: #5c2e2e !important;
    color: var(--red) !important;
}

html[data-theme="dark"] .seen-badge,
html[data-theme="dark"] .badge-airline,
html[data-theme="dark"] .badge-tier,
html[data-theme="dark"] .badge-sightings,
html[data-theme="dark"] .indexed-airline-badge,
html[data-theme="dark"] .feature-badge,
html[data-theme="dark"] .process-tag,
html[data-theme="dark"] .tour-access.free,
html[data-theme="dark"] .access-tag.free,
html[data-theme="dark"] .type-badge,
html[data-theme="dark"] .cl-latest,
html[data-theme="dark"] .stat-icon,
html[data-theme="dark"] .process-icon {
    background: #1a2744 !important;
    color: #7ab8e8 !important;
    border-color: #2d4a6e !important;
}

html[data-theme="dark"] .badge-none {
    background: #252b36 !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}

html[data-theme="dark"] .new-key-box,
html[data-theme="dark"] .no-tier-notice {
    background: #2e2818 !important;
    border-color: #6d5a20 !important;
    color: #e0c870 !important;
}
html[data-theme="dark"] .new-key-box strong { color: #e0c870 !important; }
html[data-theme="dark"] .new-key-value {
    background: #1a1f28 !important;
    border-color: #6d5a20 !important;
    color: var(--heading) !important;
}
html[data-theme="dark"] .new-key-warn { color: #c9a227 !important; }

html[data-theme="dark"] .tier-card.tier-active {
    background: #1a2744 !important;
    border-color: #2d4a6e !important;
}

html[data-theme="dark"] .account-dropdown {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .mob-nav li a.nav-active {
    background: #1a2744 !important;
}

html[data-theme="dark"] #site-theme-toggle {
    background: var(--white);
    border-color: var(--border-dark);
    color: var(--heading);
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.35);
}

/* ── Countries page ──────────────────────────────────────────────────────── */
html[data-theme="dark"] .letter-link {
    background: var(--stripe);
    border-color: var(--border);
    color: var(--link);
}
html[data-theme="dark"] .letter-link:hover {
    background: var(--btn-primary) !important;
    border-color: var(--btn-primary) !important;
    color: #fff !important;
}
html[data-theme="dark"] .letter-link.disabled {
    color: var(--border-dark) !important;
    background: transparent !important;
}
html[data-theme="dark"] .toolbar-wrapper {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* ── FIR map page ────────────────────────────────────────────────────────── */
html[data-theme="dark"] #map,
html[data-theme="dark"] #fir-map-wrap,
html[data-theme="dark"] #zone-map,
html[data-theme="dark"] #ft-map,
html[data-theme="dark"] #stream-map,
html[data-theme="dark"] #tracked-map-shell,
html[data-theme="dark"] #tracked-map-shell .tracked-map-inner,
html[data-theme="dark"] #track-map,
html[data-theme="dark"] #route-map,
html[data-theme="dark"] #cs-map,
html[data-theme="dark"] #global-route-map,
html[data-theme="dark"] .cs-indexed-map {
    background: #12151a !important;
}

html[data-theme="dark"] .map-overlay,
html[data-theme="dark"] .search-type-filters,
html[data-theme="dark"] .map-hud {
    background: rgba(26, 31, 40, 0.94) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="dark"] .stream-map-col {
    background: #12151a;
}

html[data-theme="dark"] .ap-marker-label,
html[data-theme="dark"] .runway-label-icon {
    background: rgba(26, 31, 40, 0.94) !important;
    border-color: var(--border-dark) !important;
    color: var(--heading) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .fir-center-label {
    color: rgba(122, 184, 232, 0.65) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
}

html[data-theme="dark"] .ap-marker-dot {
    border-color: #1a1f28 !important;
}

html[data-theme="dark"] .cl-close-btn:hover {
    background: #3d2020 !important;
    border-color: #8b4040 !important;
    color: #ef5350 !important;
}

html[data-theme="dark"] .cl-overlay {
    background: rgba(0, 0, 0, 0.65) !important;
}

/* ── Leaflet controls ────────────────────────────────────────────────────── */
html[data-theme="dark"] .leaflet-control-zoom,
html[data-theme="dark"] .leaflet-bar {
    border-color: var(--border-dark) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .leaflet-control-zoom a,
html[data-theme="dark"] .leaflet-bar a {
    background: var(--white) !important;
    color: var(--heading) !important;
    border-bottom-color: var(--border) !important;
}

html[data-theme="dark"] .leaflet-control-zoom a:hover,
html[data-theme="dark"] .leaflet-bar a:hover {
    background: var(--stripe) !important;
}

html[data-theme="dark"] .leaflet-popup-content-wrapper,
html[data-theme="dark"] .leaflet-popup-tip {
    background: var(--white) !important;
    color: var(--text) !important;
}

html[data-theme="dark"] .leaflet-tooltip {
    background: var(--white) !important;
    color: var(--heading) !important;
    border-color: var(--border-dark) !important;
}

/* ── Active stream page ──────────────────────────────────────────────────── */
html[data-theme="dark"] .stream-flight-card:hover {
    border-color: #3d5a7a;
    background: #1e2430;
}
html[data-theme="dark"] .stream-flight-card.row-selected {
    border-color: var(--btn-primary);
    background: #1a2744;
}

html[data-theme="dark"] .sfc-thumb,
html[data-theme="dark"] .ac-thumb {
    background: #252b36;
}

html[data-theme="dark"] .seen-badge {
    background: #1a2744;
    color: #7ab8e8;
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .infobox,
html[data-theme="dark"] .upgrade-panel,
html[data-theme="dark"] .shortcut-card:hover,
html[data-theme="dark"] .stat-card:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #252b36;
    color: var(--text);
    border-color: var(--border-dark);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted);
}

html[data-theme="dark"] code,
html[data-theme="dark"] pre {
    background: #252b36;
    color: var(--text);
}

html[data-theme="dark"] .dt-table tr.row-selected {
    background: #1a2744 !important;
}

html[data-theme="dark"] .filter-btn:hover {
    background: var(--stripe);
    border-color: var(--link);
    color: var(--link);
}

html[data-theme="dark"] .filter-btn.active {
    color: #fff;
}

html[data-theme="dark"] .search-dropdown-item:hover {
    background: var(--stripe);
}

html[data-theme="dark"] .stream-flight-card:hover {
    background: #1e2430;
}

html[data-theme="dark"] .seg-control button.active,
html[data-theme="dark"] .settings-tab-btn.active {
    color: #fff;
}

/* ── Active page: kiosk entry button ─────────────────────────────────────── */
html[data-theme="dark"] .btn-kiosk {
    background: var(--btn-primary) !important;
    border-color: var(--btn-primary) !important;
    color: #fff !important;
}
html[data-theme="dark"] .btn-kiosk:hover {
    background: var(--btn-primary-h) !important;
    border-color: var(--btn-primary-h) !important;
}

/* ── Index: aircraft photo placeholder ───────────────────────────────────── */
html[data-theme="dark"] .indexed-thumb,
html[data-theme="dark"] .ac-thumb,
html[data-theme="dark"] .cs-indexed-map {
    background: #252b36 !important;
}
html[data-theme="dark"] .indexed-thumb .placeholder,
html[data-theme="dark"] .indexed-airline-badge + .placeholder {
    color: var(--text-muted) !important;
}

/* ── API docs: callouts & semantic colours ───────────────────────────────── */
html[data-theme="dark"] .callout {
    background: var(--info-bg) !important;
    color: var(--text) !important;
}
html[data-theme="dark"] .callout.info {
    background: var(--purple-bg) !important;
    border-left-color: var(--purple) !important;
}
html[data-theme="dark"] .callout.warn {
    background: var(--amber-bg) !important;
    border-left-color: var(--amber) !important;
}
html[data-theme="dark"] .callout.success {
    background: var(--green-bg) !important;
    border-left-color: var(--green) !important;
}
html[data-theme="dark"] .callout strong {
    color: var(--heading) !important;
}

/* ── Admin notice ────────────────────────────────────────────────────────── */
html[data-theme="dark"] .admin-notice {
    background: #2a1f3d !important;
    border-color: #5c4a8a !important;
    border-left-color: #b39ddb !important;
    color: var(--text) !important;
}
html[data-theme="dark"] .admin-notice-icon {
    color: #b39ddb !important;
}

/* ── Tracking zones: map overlays & sidebar ──────────────────────────────── */
html[data-theme="dark"] .map-legend,
html[data-theme="dark"] .stat-pill,
html[data-theme="dark"] .refresh-btn {
    background: rgba(26, 31, 40, 0.96) !important;
    border-color: var(--border-dark) !important;
    color: var(--text) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
}
html[data-theme="dark"] .refresh-btn:hover {
    background: #2d3544 !important;
    border-color: var(--link) !important;
    color: var(--link) !important;
}
html[data-theme="dark"] .zone-label,
html[data-theme="dark"] .user-label {
    background: rgba(26, 31, 40, 0.94) !important;
    border-color: var(--border-dark) !important;
    color: var(--heading) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35) !important;
}
html[data-theme="dark"] .group-badge.is-group {
    background: #1a2744 !important;
    color: #7ab8e8 !important;
    border-color: #2d4a6e !important;
}

/* ── Privacy page ────────────────────────────────────────────────────────── */
html[data-theme="dark"] .data-fields tr:nth-child(even) td {
    background: var(--stripe) !important;
}
html[data-theme="dark"] .field-name {
    color: #7ab8e8 !important;
}
html[data-theme="dark"] .privacy-notice {
    background: #2e2818 !important;
    border-color: #6d5a20 !important;
    border-left-color: #c9a227 !important;
    color: #e8d48a !important;
}
html[data-theme="dark"] .privacy-notice-icon {
    color: #c9a227 !important;
}
html[data-theme="dark"] .privacy-notice strong {
    color: #f0d060 !important;
}
html[data-theme="dark"] .info-notice {
    background: #1a2744 !important;
    border-color: #2d4a6e !important;
    border-left-color: var(--link) !important;
    color: var(--text) !important;
}
html[data-theme="dark"] .info-notice-icon {
    color: var(--link) !important;
}
html[data-theme="dark"] .info-notice strong {
    color: var(--heading) !important;
}

/* ── About page screenshots ──────────────────────────────────────────────── */
html[data-theme="dark"] .screenshot-placeholder {
    background: var(--white);
}
html[data-theme="dark"] .screenshot-placeholder img {
    background: #252b36 !important;
    border: 1px solid var(--border);
}

.panel-lock-overlay {
    position: absolute;
    inset: 0;
    background: var(--overlay-scrim);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 4px;
    text-align: center;
    padding: 20px;
}
.lock-title { font-size: 14px; font-weight: 700; color: var(--heading); }
.lock-desc  { font-size: 12px; color: var(--text-muted); max-width: 280px; }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 24px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    color: var(--text);
}
.modal h3 { font-size: 16px; color: var(--heading); margin-bottom: 12px; }
.modal p  { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

html[data-theme="dark"] .panel-lock-overlay {
    background: var(--overlay-scrim) !important;
}
html[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.65);
}
html[data-theme="dark"] .modal {
    background: var(--white);
    border-color: var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

/* ── Login / auth page ───────────────────────────────────────────────────── */
html[data-theme="dark"] {
    --overlay-scrim: rgba(15, 18, 24, 0.88);
    --surface:      #1a1f28;
    --bg:           #0f1218;
    --accent-soft:  #1a2744;
    --accent:       #5a9fd4;
    --accent-dark:  #3d7fc4;
    --border-focus: #5a9fd4;
    --success-bg:   #1a2e1c;
    --success-bd:   #2e5c32;
    --success-tx:   #66bb6a;
    --error-bg:     #2e1a1a;
    --error-bd:     #5c2e2e;
    --error-tx:     #ef5350;
}

html[data-theme="dark"] .card {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
    background: var(--panel-head) !important;
    border-color: var(--border) !important;
}

html[data-theme="dark"] .form-control {
    background: #252b36 !important;
    border-color: var(--border-dark) !important;
    color: var(--text) !important;
}

html[data-theme="dark"] .form-control:focus {
    box-shadow: 0 0 0 3px rgba(90, 159, 212, 0.2) !important;
}

html[data-theme="dark"] .alert-error {
    background: var(--error-bg) !important;
    border-color: var(--error-bd) !important;
    color: var(--error-tx) !important;
}

html[data-theme="dark"] .alert-success {
    background: var(--success-bg) !important;
    border-color: var(--success-bd) !important;
    color: var(--success-tx) !important;
}

html[data-theme="dark"] .footer-link-row a {
    color: var(--link) !important;
}

html[data-theme="dark"] .db-lock-overlay {
    background: rgba(15, 18, 24, 0.88) !important;
}

/* ── Sightings page (stats.php) ── */
html[data-theme="dark"] .kpi-card {
    background: var(--white) !important;
}

html[data-theme="dark"] .panel-heading .badge-count {
    background: #2a3140 !important;
    border-color: var(--border-dark) !important;
    color: var(--link) !important;
}

html[data-theme="dark"] .dt-table tbody tr.row-clickable:hover,
html[data-theme="dark"] .dt-table tbody tr.row-clickable:active {
    background: #1e2430 !important;
}

html[data-theme="dark"] .badge-airline,
html[data-theme="dark"] .airport-chip {
    background: #2a3140 !important;
    border-color: var(--border-dark) !important;
    color: var(--link) !important;
}

html[data-theme="dark"] .coming-soon-banner,
html[data-theme="dark"] .btn-cta-disabled {
    background: #2a2410 !important;
    border-color: #5a4a00 !important;
    color: var(--text) !important;
}
html[data-theme="dark"] .coming-soon-banner strong {
    color: var(--heading) !important;
}

html[data-theme="dark"] .alert-info-track {
    background: #1a2438 !important;
    border-color: #2a4060 !important;
    color: var(--text) !important;
}
html[data-theme="dark"] .alert-info-track a {
    color: var(--link) !important;
}

html[data-theme="dark"] .mob-menu,
html[data-theme="dark"] .mob-search {
    background: var(--white) !important;
    color: var(--text) !important;
}

html[data-theme="dark"] .access-tag.guest {
    background: #2a3140 !important;
    color: var(--text-muted) !important;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--btn-primary, #2a6db5);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}
.skip-link:focus {
    left: 8px;
    top: 8px;
}

/* ── Account tabs, onboarding, community ── */
.account-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--border);
}
.account-tab {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 4px 4px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
}
.account-tab:hover {
    color: var(--link);
    text-decoration: none;
    background: var(--panel-head, #f8f9fa);
}
.account-tab.active {
    color: var(--link);
    background: var(--white);
    border-color: var(--border);
    border-bottom-color: var(--white);
}
.account-page .panel { margin-bottom: 16px; }

.account-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 18px 16px;
}
.account-avatar-big {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--link);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.02em;
}
.account-summary-info {
    flex: 1 1 180px;
    min-width: 0;
}
.account-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--heading);
    line-height: 1.25;
    margin-bottom: 2px;
}
.account-email {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
    word-break: break-all;
}
.account-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-left: auto;
}
.meta-block {
    min-width: 88px;
}
.meta-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.meta-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--heading);
}

.upgrade-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: var(--amber-bg);
    border: 1px solid #ffcc80;
    border-radius: 4px;
    font-size: 12.5px;
    line-height: 1.5;
}
.upgrade-notice strong {
    display: block;
    color: var(--heading);
    margin-bottom: 2px;
}
.upgrade-notice span { color: var(--text-muted); }
.upgrade-notice .upgrade-icon { font-size: 22px; line-height: 1; }

.account-status-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 4px;
    font-size: 12.5px;
    line-height: 1.5;
}
.account-status-active {
    background: var(--green-bg, #e8f5e9);
    border: 1px solid #a5d6a7;
}
.account-status-verified {
    background: var(--amber-bg);
    border: 1px solid #ffcc80;
}
.account-status-pill { flex-shrink: 0; }
.location-setup-banner,
.tracking-live-banner {
    margin-bottom: 16px;
}
.header-status-pill {
    font-size: 9px;
    padding: 2px 6px;
    vertical-align: middle;
    margin-left: 4px;
}
.account-toggle .header-status-pill { display: inline-block; }

.new-key-box {
    padding: 14px 16px;
    margin-bottom: 16px;
    background: #fffde7;
    border: 1px solid #f9a825;
    border-radius: 4px;
    font-size: 13px;
}
.new-key-value {
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
    background: var(--white);
    border: 1px solid var(--border);
    padding: 8px 10px;
    margin: 8px 0;
    border-radius: 3px;
}
.new-key-warn { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

#track-map {
    width: 100%;
    height: 360px;
    border-radius: 4px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    background: #e2e6eb;
    z-index: 1;
    position: relative;
}
.track-form-area { margin-top: 4px; }
.coord-hint { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.watchlist-box {
    width: 100%;
    min-height: 100px;
    padding: 10px 12px;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.6;
    resize: vertical;
    background: var(--white);
    color: var(--text);
}
.watchlist-box:focus {
    outline: none;
    border-color: var(--link);
    box-shadow: 0 0 0 2px rgba(42, 109, 181, 0.12);
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

@media (max-width: 700px) {
    .account-summary { flex-direction: column; align-items: flex-start; }
    .account-summary-meta { margin-left: 0; width: 100%; }
    #track-map { height: 280px; }
}

.export-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.export-preset-form { display: inline; }
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 8px;
    cursor: pointer;
}
.form-check input { margin-top: 3px; }
.form-static { font-family: monospace; font-size: 13px; }
.account-advanced summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--link);
    font-size: 13px;
}
/* ── Onboarding (index-style layout) ── */
.onboarding-page .onboarding-progress {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.onboarding-dot.done { background: var(--link); opacity: 0.45; }

.onboarding-dot.current {
    opacity: 1;
    background: var(--link);
    box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--link);
}

.onboarding-step-table .onboarding-step-current .dv {
    font-weight: 700;
    color: var(--heading);
}

.onboarding-step-table .onboarding-step-done .dl,
.onboarding-step-table .onboarding-step-done .dv {
    opacity: 0.75;
}

.onboarding-map {
    width: 100%;
    height: 320px;
    border-radius: 4px;
    border: 1px solid var(--border);
    margin-bottom: 4px;
}

html[data-theme="dark"] .onboarding-dot.current {
    box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--link);
}

@media (max-width: 700px) {
    .onboarding-page .panel-heading {
        flex-direction: column;
        align-items: flex-start;
    }
    .onboarding-page .onboarding-progress.pull-right {
        margin-left: 0;
        margin-top: 6px;
    }
    .onboarding-map { height: 240px; }
}

.community-stats.stat-grid {
    border: none;
    border-radius: 0;
    margin: 0;
    gap: 10px;
    padding: 12px;
    background: transparent;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.community-stats.stat-grid .stat-cell {
    border: 1px solid var(--border);
    border-radius: 4px;
}

.community-page .community-hourly-panel {
    margin-bottom: 20px;
}

.community-page .community-hourly-panel .panel-body {
    padding: 16px 18px 18px;
}

.community-page .chart-canvas-wrap.community-hourly-chart {
    position: relative;
    width: 100%;
    height: 300px;
}

@media (min-width: 900px) {
    .community-page .chart-canvas-wrap.community-hourly-chart {
        height: 340px;
    }
}

@media (max-width: 700px) {
    .community-page .chart-canvas-wrap.community-hourly-chart {
        height: 240px;
    }
}

.community-page .chart-empty {
    padding: 48px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.community-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--green-bg, #e8f5e9);
    border: 1px solid #a5d6a7;
    color: var(--green, #2e7d32);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.community-live-badge.is-pulse {
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.22);
    transform: scale(1.03);
}

.community-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green, #2e7d32);
    animation: community-live-pulse 1.4s ease-in-out infinite;
}

@keyframes community-live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
    .community-live-dot,
    .community-card.is-new,
    .community-hero-panel.is-highlight,
    .community-hero-content,
    .community-stat-bump,
    .community-chart-panel.is-pulse {
        animation: none !important;
        transition: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .community-hero-panel.is-highlight {
        box-shadow: none !important;
    }
}

.community-live-updated {
    display: inline-block;
    margin-left: 6px;
    transition: opacity 0.35s ease;
}

.community-hero-panel.panel {
    margin-bottom: 20px;
}

.community-hero-panel.js-community-card {
    cursor: pointer;
}

.community-hero-panel.js-community-card:focus-visible {
    outline: 2px solid var(--btn-primary);
    outline-offset: 2px;
}

.community-hero-panel .panel-heading {
    gap: 8px;
}

.community-hero-body {
    padding: 16px 18px;
}

.community-hero-content {
    transition: opacity 0.25s ease;
}

.community-hero-panel.is-highlight {
    animation: community-hero-flash 0.65s ease-out;
}

@keyframes community-hero-flash {
    0% { box-shadow: inset 0 0 0 0 rgba(42, 109, 181, 0); }
    35% { box-shadow: inset 0 0 0 2px rgba(42, 109, 181, 0.35); }
    100% { box-shadow: inset 0 0 0 0 rgba(42, 109, 181, 0); }
}

.community-hero-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 132px;
    gap: 14px 16px;
    align-items: start;
}

.community-hero-copy {
    min-width: 0;
}

.community-hero-reg-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    margin-bottom: 6px;
}

.community-hero-reg {
    font-family: monospace;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--heading);
    text-decoration: none;
}

.community-hero-reg:hover {
    color: var(--link);
}

.community-hero-reg.muted {
    color: var(--text-muted);
}

.community-hero-cs {
    font-family: monospace;
    font-size: 13px;
    color: var(--link);
    text-decoration: none;
}

.community-hero-cs:hover {
    text-decoration: underline;
}

.community-hero-type {
    font-size: 14px;
    font-weight: 600;
    color: var(--heading);
    line-height: 1.35;
}

.community-hero-op {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.community-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.community-hero-route {
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--heading);
}

.community-hero-when {
    display: block;
    margin-top: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    transition: opacity 0.3s ease;
}

.community-hero-thumb {
    position: relative;
    width: 132px;
    height: 88px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--stripe, #e2e6eb);
    border: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.community-hero-thumb .placeholder {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    padding: 4px;
}

.community-hero-thumb .img-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-top-color: var(--link);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.community-hero-thumb img {
    display: none;
}

.community-hero-thumb.ac-photo-loaded img,
.community-hero-thumb.ac-photo-loaded .ac-photo-link img {
    display: block;
}

.community-hero-thumb.community-card-thumb--empty {
    opacity: 0.55;
}

.community-hero-thumb.community-card-thumb--empty .placeholder {
    font-size: 8px;
}

.js-community-thumb {
    position: relative;
    overflow: hidden;
}

.community-hero-thumb .ac-photo-credit,
.community-card-thumb .ac-photo-credit,
.js-community-thumb .ac-photo-credit,
#community-cards .ac-photo-credit,
#community-hero .ac-photo-credit {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.community-hero-thumb img,
.community-hero-thumb .ac-photo-link,
.community-hero-thumb .ac-photo-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.35s ease;
}

@media (max-width: 720px) {
    .community-hero-main {
        grid-template-columns: 1fr;
    }

    .community-hero-thumb {
        width: 100%;
        height: 160px;
    }

    .community-hero-when {
        text-align: left;
    }
}

.community-card.is-new {
    animation: community-card-in 0.55s ease-out both;
}

@keyframes community-card-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.community-cards {
    overflow-anchor: auto;
}

.community-stat-bump {
    animation: community-stat-bump 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes community-stat-bump {
    0% { transform: scale(1); color: var(--heading); }
    35% { transform: scale(1.06); color: var(--link); }
    100% { transform: scale(1); color: var(--heading); }
}

.community-chart-panel.is-pulse .panel-body {
    animation: community-chart-pulse 0.7s ease;
}

@keyframes community-chart-pulse {
    0% { background: transparent; }
    30% { background: rgba(42, 109, 181, 0.06); }
    100% { background: transparent; }
}

html[data-theme="dark"] .community-live-badge {
    background: rgba(46, 125, 50, 0.18);
    border-color: rgba(129, 199, 132, 0.45);
    color: #81c784;
}

html[data-theme="dark"] .community-chart-panel.is-pulse .panel-body {
    animation-name: community-chart-pulse-dark;
}

@keyframes community-chart-pulse-dark {
    0% { background: transparent; }
    30% { background: rgba(90, 159, 212, 0.1); }
    100% { background: transparent; }
}

html[data-theme="dark"] .stat-cell {
    background: var(--white) !important;
}

html[data-theme="dark"] .dt-table tbody tr:hover {
    background: #1e2430 !important;
}

html[data-theme="dark"] .dt-table tbody tr:nth-child(even) {
    background: var(--stripe) !important;
}

html[data-theme="dark"] .form-input,
html[data-theme="dark"] .pref-select {
    background: var(--panel-bg);
    border-color: var(--border-dark);
    color: var(--text);
}

html[data-theme="dark"] .tz-picker-trigger,
html[data-theme="dark"] .tz-picker-menu {
    background: var(--panel-bg);
    border-color: var(--border-dark);
}

html[data-theme="dark"] .tz-picker-search-wrap {
    background: var(--panel-head);
}

html[data-theme="dark"] h2.page-title {
    color: var(--heading);
}

.community-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.community-feed-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.community-search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.community-search-input {
    min-width: 220px;
    padding: 6px 10px;
    font-size: 12px;
}
.community-cards-wrap {
    padding: 14px 16px 18px;
}
.community-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.community-day-heading {
    grid-column: 1 / -1;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 10px 2px 4px;
    margin-top: 2px;
}
.community-day-heading:first-child {
    margin-top: 0;
    padding-top: 0;
}
.community-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.community-card.js-community-card {
    cursor: pointer;
}
.community-card.js-community-card:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
}
.community-card:hover {
    border-color: var(--link);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.community-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 42%);
    grid-template-rows: auto minmax(92px, 1fr);
    grid-template-areas:
        "head head"
        "copy thumb";
    gap: 6px 12px;
    padding: 12px 14px;
    min-height: 132px;
    min-width: 0;
    align-items: stretch;
}
.community-card-top {
    grid-area: head;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.community-card-copy {
    grid-area: copy;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    align-self: start;
}
.community-card-body:not(:has(.community-card-thumb)) {
    grid-template-columns: 1fr;
    grid-template-areas:
        "head"
        "copy";
}
.community-card-reg {
    font-size: 15px;
    font-weight: 700;
    color: var(--heading);
    font-family: monospace;
    text-decoration: none;
}
.community-card-reg:hover { color: var(--link); }
.community-card-reg.muted { color: var(--text-muted); font-weight: 600; }
.community-card-cs {
    display: block;
    font-size: 11px;
    font-family: monospace;
    color: var(--link);
    margin-top: 2px;
    text-decoration: none;
}
.community-card-cs:hover {
    text-decoration: underline;
}
.community-card-when {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.community-card-type {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}
.community-card-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.community-tag {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--panel-head);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 6px;
}
.community-card-op {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}
.community-card-route {
    font-size: 11px;
    font-weight: 600;
    color: var(--link);
    font-family: monospace;
}
.community-card-footer {
    margin-top: auto;
    padding-top: 6px;
}
.community-card-thumb {
    position: relative;
    grid-area: thumb;
    align-self: stretch;
    width: 100%;
    min-height: 92px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--stripe, #e2e6eb);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.community-card-thumb img,
.community-card-thumb .ac-photo-link,
.community-card-thumb .ac-photo-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.community-card-thumb img {
    display: none;
}
.community-card-thumb.ac-photo-loaded img,
.community-card-thumb.ac-photo-loaded .ac-photo-link img {
    display: block;
}
.community-card-thumb .placeholder {
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    padding: 2px;
}
.community-card-thumb .img-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-top-color: var(--link);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.community-card-thumb.community-card-thumb--empty {
    opacity: 0.35;
}
.community-card-thumb.community-card-thumb--empty .placeholder {
    font-size: 6px;
}
.community-drawer-photo {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 14px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #101318;
    position: relative;
    line-height: 0;
}
.community-drawer-photo img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 260px;
    vertical-align: top;
}
.community-drawer-photo-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 10px 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.35) 65%, transparent 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    pointer-events: none;
}
.community-drawer-photo-credit {
    position: static;
    font-size: 10px;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.95);
    background: none;
    padding: 0;
}
.community-drawer-photo-link {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
    pointer-events: auto;
}
.community-drawer-photo-link:hover {
    color: #fff;
    opacity: 0.9;
}
html[data-theme="dark"] .community-card {
    background: var(--white);
}
@media (max-width: 640px) {
    .community-cards {
        grid-template-columns: 1fr;
    }
    .community-search-input {
        min-width: 0;
        width: 100%;
    }
    .community-card-body {
        grid-template-columns: minmax(0, 1fr) minmax(104px, 40%);
        min-height: 124px;
    }
    .community-card-thumb {
        min-height: 86px;
    }
}

.community-feed .mono { font-family: monospace; }

/* ── Site drawer (community, shared) ───────────────────────────────────── */
.site-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.site-drawer-backdrop.visible { opacity: 1; }

.site-drawer {
    position: fixed;
    top: 0;
    right: -100vw;
    width: 440px;
    max-width: 100vw;
    height: 100%;
    background: var(--bg, var(--white));
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}
.site-drawer.open { right: 0; }

.site-drawer-header {
    position: relative;
    background: var(--panel-head);
    border-bottom: 1px solid var(--panel-head-b, var(--border));
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.site-drawer-kicker {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0;
}
.site-drawer-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--heading);
    font-family: monospace;
    line-height: 1.2;
}
.site-drawer-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
}
.site-drawer-close:hover {
    color: var(--heading);
    background: var(--border);
}
.site-drawer-body {
    padding: 16px 18px 24px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    min-width: 0;
}
.site-drawer-body .panel,
.site-drawer-body .detail-table,
.site-drawer-body .stat-grid {
    max-width: 100%;
}
.site-drawer-body .detail-table {
    table-layout: fixed;
    width: 100%;
}
.site-drawer-body .detail-table .dv {
    word-break: break-word;
}
.site-drawer-hero {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.site-drawer-reg {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--heading);
    font-family: monospace;
    text-decoration: none;
}
.site-drawer-reg:hover {
    color: var(--link);
    text-decoration: none;
}
.site-drawer-cs {
    display: block;
    font-size: 12px;
    font-family: monospace;
    color: var(--link);
    margin-top: 2px;
    text-decoration: none;
}
.site-drawer-cs:hover {
    text-decoration: underline;
}
.site-drawer-type {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-top: 6px;
}
.site-drawer-op {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.community-drawer-stats {
    grid-template-columns: repeat(2, 1fr);
    min-width: 0;
}
.community-drawer-note {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0;
}
.community-drawer-lock {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.spinner-inline {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(42, 109, 181, 0.2);
    border-top-color: var(--link);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

html[data-theme="dark"] .site-drawer {
    background: var(--bg);
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .site-drawer-backdrop {
    background: rgba(0, 0, 0, 0.65);
}

@media (max-width: 700px) {
    .site-drawer {
        top: auto;
        bottom: -100vh;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 82vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        transition: bottom 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    .site-drawer.open { bottom: 0; right: 0; }
    .site-drawer-header::before {
        content: '';
        display: block;
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--border-dark, var(--border));
        border-radius: 2px;
    }
}

html[data-theme="dark"] .account-tab.active {
    background: var(--white);
    border-bottom-color: var(--white);
}
html[data-theme="dark"] .account-tab:hover {
    background: #1e2430;
}
