/* GENERATED by scripts/build-eram-page.js from vendor/eram/eram.css.
   Only the @font-face URL is changed; see vendor/NOTICE. */
@font-face { font-family: 'ERAM'; src: url('vendor/ERAMv110.ttf') format('truetype'); }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #000000; color: #cccc44; font-family: 'ERAM', 'Consolas', 'Courier New', monospace; overflow: hidden; height: 100vh; }

/* ── Layout ── */
#app { position: relative; height: 100vh; }
#sidebar-wrapper { display: flex; position: absolute; top: 0; left: 0; bottom: 0; z-index: 500; }
#sidebar { width: 290px; min-width: 290px; background: #111; border-right: 1px solid #333; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; transition: margin-left 0.2s ease; scrollbar-width: thin; scrollbar-color: #333 #1a1a1a; cursor: default; }
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-track { background: #1a1a1a; }
#sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
#sidebar::-webkit-scrollbar-thumb:hover { background: #444; }
#sidebar.collapsed { margin-left: -290px; }
#sidebar-toggle {
    width: 20px; background: #1a1a1a; border: none; border-right: 1px solid #333;
    color: #666; cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 14px; padding: 0; flex-shrink: 0; z-index: 10;
    transition: color 0.15s, height 0.2s, border-radius 0.2s, margin-top 0.2s;
}
#sidebar-toggle:hover { color: #cccc44; background: #222; }
#sidebar.collapsed ~ #sidebar-toggle {
    height: 36px; align-self: flex-start; margin-top: 8px;
    border-radius: 0 4px 4px 0; border: 1px solid #333; border-left: none;
    opacity: 0.5;
}
#sidebar.collapsed ~ #sidebar-toggle:hover { opacity: 1; }
#map-container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
#map { width: 100%; height: 100%; }

/* ── Sidebar ── */
#sidebar-header { padding: 10px 12px; border-bottom: 1px solid #333; }
#sidebar-header h2 { font-size: 13px; color: #aaa; font-weight: normal; letter-spacing: 1px; }
#connection-status { font-size: 11px; margin-top: 4px; }
.sidebar-home-link {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 8px;
    background: #1a1a1a;
    color: #cccc44;
    border: 1px solid #444;
    font-family: 'Consolas', monospace;
    font-size: 11px;
    text-decoration: none;
    letter-spacing: 1px;
}
.sidebar-home-link:hover { background: #333; border-color: #cccc44; }
#btn-fullscreen {
    background: #222 !important;
    color: #cccc44 !important;
    border: 1px solid #444 !important;
    transition: background-color 0.1s ease, border-color 0.1s ease;
}
#btn-fullscreen:hover {
    background: #333 !important;
    border-color: #cccc44 !important;
}

.panel-section { padding: 10px 12px; border-bottom: 1px solid #222; }
.panel-label { font-size: 10px; color: #666; letter-spacing: 1.5px; margin-bottom: 8px; font-weight: bold; cursor: default; }

.ctrl-row { display: flex; align-items: center; margin-bottom: 6px; font-size: 11px; gap: 12px; }
.ctrl-row label { color: #aaa; min-width: 60px; cursor: default; display: flex; align-items: center; gap: 6px; }
.ctrl-row select {
    flex: 1; background: #1a1a1a; color: #cccc44; border: 1px solid #333;
    padding: 2px 4px; font-family: inherit; font-size: 11px; outline: none;
    scrollbar-width: thin; scrollbar-color: #333 #1a1a1a;
    cursor: pointer;
}
.ctrl-row select::-webkit-scrollbar { width: 6px; }
.ctrl-row select::-webkit-scrollbar-track { background: #1a1a1a; }
.ctrl-row select::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
.ctrl-row select::-webkit-scrollbar-thumb:hover { background: #444; }
.ctrl-row select:hover {
    background: #333;
    border-color: #cccc44;
}
.ctrl-row select:focus { border-color: #cccc44; }
.ctrl-row input[type="number"] {
    flex: 1 !important;
    background: #1a1a1a !important;
    color: #cccc44 !important;
    border: 1px solid #333 !important;
    padding: 2px 4px !important;
    font-family: inherit !important;
    font-size: 11px !important;
    outline: none !important;
    cursor: text;
}
.ctrl-row input[type="number"]::-webkit-outer-spin-button,
.ctrl-row input[type="number"]::-webkit-inner-spin-button {
    background: #1a1a1a !important;
    opacity: 1;
}
.ctrl-row input[type="number"]::-webkit-outer-spin-button {
    filter: invert(0.8);
}
.ctrl-row input[type="number"]::-webkit-inner-spin-button {
    filter: invert(0.8);
}
.ctrl-row input[type="number"]:hover {
    background: #333 !important;
    border-color: #cccc44 !important;
}
.ctrl-row input[type="number"]:focus { border-color: #cccc44 !important; }
.ctrl-row input[type="range"] { flex: 1; cursor: pointer; }
input[type="checkbox"] {
    accent-color: #cccc44;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    background: #333;
    border: 1px solid #555;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    vertical-align: -2px;
    flex-shrink: 0;
}
input[type="checkbox"]:checked {
    background: #cccc44;
    border-color: #cccc44;
}
input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: #000;
    font-size: 12px;
    font-weight: bold;
    left: 0px;
    top: -3px;
    width: 100%;
    text-align: center;
}

#sector-checkboxes {
    max-height: 200px; overflow-y: auto; font-size: 11px; color: #aaa;
    scrollbar-width: thin; scrollbar-color: #444 #1a1a1a;
}
#sector-checkboxes::-webkit-scrollbar { width: 6px; }
#sector-checkboxes::-webkit-scrollbar-track { background: #1a1a1a; }
#sector-checkboxes::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
#sector-checkboxes::-webkit-scrollbar-thumb:hover { background: #666; }
.sec-empty { color: #666; font-size: 10px; }
.sec-actions {
    display: flex; align-items: center; gap: 4px;
    margin-bottom: 4px;
}
.sec-actions .sec-count {
    flex: 1; color: #888; font-size: 10px; font-variant-numeric: tabular-nums;
}
.sec-actions .sec-act {
    background: #1a1a1a; color: #cccc44;
    border: 1px solid #333;
    padding: 1px 6px; font-family: inherit; font-size: 10px;
    cursor: pointer; border-radius: 2px;
}
.sec-actions .sec-act:hover { border-color: #cccc44; background: #222; }
.sec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 3px;
}
.sec-chip {
    background: #1a1a1a;
    color: #777;
    border: 1px solid #2a2a2a;
    padding: 2px 0;
    text-align: center;
    font-family: inherit; font-size: 11px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    border-radius: 2px;
    user-select: none;
    transition: background-color 0.08s, color 0.08s, border-color 0.08s;
}
.sec-chip:hover { border-color: #cccc44; color: #bbb; }
.sec-chip.on {
    background: #2d2d10;
    color: #cccc44;
    border-color: #cccc44;
}

.traffic-row { font-size: 12px; padding: 2px 0; display: flex; justify-content: space-between; }
.traffic-row.own { color: #cccc44; }
.traffic-row.ho { color: #cccc44; }
.traffic-row.other { color: #cccc44; }
.traffic-row.total { color: #aaa; border-top: 1px solid #333; margin-top: 4px; padding-top: 6px; }

#sidebar-footer {
    margin-top: auto; padding: 8px 12px; border-top: 1px solid #333;
    font-size: 11px; color: #666;
}
#cmd-help-btn {
    background: #222; border: 1px solid #444; color: #888; font-family: inherit;
    font-size: 10px; padding: 2px 8px; cursor: pointer; margin-top: 6px; white-space: nowrap;
}
#cmd-help-btn:hover { border-color: #cccc44; color: #cccc44; }
#replay-toggle-btn {
    background: #222; border: 1px solid #444; color: #888; font-family: inherit;
    font-size: 10px; padding: 2px 8px; cursor: pointer; margin-left: 4px; white-space: nowrap;
}
#replay-toggle-btn:hover { border-color: #cccc44; color: #cccc44; }
#cmd-help-popup {
    display: none; position: fixed; z-index: 10000;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #1a1a1a; border: 1px solid #cccc44; padding: 16px 20px;
    font-family: 'ERAM', 'Consolas', monospace; font-size: 11px;
    color: #ccc; max-width: 600px; max-height: 80vh; overflow-y: auto; line-height: 1.6;
    scrollbar-width: thin; scrollbar-color: #333 #1a1a1a;
    cursor: var(--eram-cursor) !important;
}
#cmd-help-popup,
#cmd-help-popup * {
    cursor: var(--eram-cursor) !important;
}
#cmd-help-popup::-webkit-scrollbar { width: 6px; }
#cmd-help-popup::-webkit-scrollbar-track { background: #1a1a1a; }
#cmd-help-popup::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
#cmd-help-popup::-webkit-scrollbar-thumb:hover { background: #444; }
#cmd-help-popup h3 { color: #cccc44; margin: 0 0 10px 0; font-size: 13px; }
#cmd-help-popup h4 { color: #cccc44; margin: 12px 0 4px 0; font-size: 11px; }
#cmd-help-popup .cmd { color: #cccc44; }
#cmd-help-popup .desc { color: #888; }
#cmd-help-popup .close-btn {
    float: right; color: #888; cursor: pointer; font-size: 14px; margin: -4px -4px 0 0;
}
#cmd-help-popup .close-btn:hover { color: #cccc44; }

/* ── Custom crosshair cursor ── */
:root {
    --eram-cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cline x1='16' y1='9' x2='16' y2='12' stroke='white' stroke-width='4.5'/%3E%3Cline x1='16' y1='20' x2='16' y2='23' stroke='white' stroke-width='4.5'/%3E%3Cline x1='9' y1='16' x2='12' y2='16' stroke='white' stroke-width='4.5'/%3E%3Cline x1='20' y1='16' x2='23' y2='16' stroke='white' stroke-width='4.5'/%3E%3Crect x='12' y='12' width='8' height='8' fill='none' stroke='white' stroke-width='1.3'/%3E%3C/svg%3E") 16 16, crosshair;
}

/* ── Map overrides ── */
.leaflet-container {
    background: #000000 !important;
    cursor: var(--eram-cursor) !important;
}
.leaflet-control-zoom a { background: #222 !important; color: #cccc44 !important; border-color: #444 !important; }
.leaflet-control-attribution { display: none !important; }
/* Boundary/overlay lines: lighten blend so brighter line always shows through overlaps */
.bnd-path { mix-blend-mode: lighten; }

/* Apply crosshair cursor to interactive elements */
.ac-db,
.ac-sym-corr-bcn,
.ac-sym-reduced-sep,
.ac-sym-uncorr-bcn,
.ac-sym-uncorr-pri,
.ac-sym-flat-track,
.ac-sym-coast,
.tb-btn,
.tb-btn .tb-content,
.tb-side-bar .tb-arrow-btn,
#po-menu,
.field-menu,
#mca,
#mca-preview,
#mca-feedback,
#ra,
#ra-content {
    cursor: var(--eram-cursor) !important;
}

/* ── Aircraft target group ── */
.ac-group { position: absolute; pointer-events: none; }

/* ── Target symbols (Table 1 — radar return present) ── */
/* Correlated Beacon: \ backslash — transponder on, correlated to flight plan */
.ac-sym-corr-bcn {
    position: absolute; width: 2px; height: 12px;
    background: #cccc44;
    transform: translate(-1px, -6px) rotate(-45deg);
    pointer-events: auto; cursor: inherit;
}
.ac-sym-corr-bcn.emrg { background: #ff4444; }

/* Reduced Separation: • dot — correlated beacon in reduced separation area (at/below FL230) */
.ac-sym-reduced-sep {
    position: absolute;
    font-family: 'ERAM', 'Consolas', monospace;
    font-size: 16px; font-weight: bold; line-height: 1;
    color: #cccc44;
    transform: translate(-50%, -50%);
    pointer-events: auto; cursor: inherit;
}
.ac-sym-reduced-sep.emrg { color: #ff4444; }

/* Uncorrelated Beacon: / forward slash — transponder on, no flight plan */
.ac-sym-uncorr-bcn {
    position: absolute; width: 2px; height: 12px;
    background: #cccc44;
    transform: translate(-1px, -6px) rotate(45deg);
    pointer-events: auto; cursor: inherit;
}

/* Uncorrelated Primary: + plus — transponder off/standby */
.ac-sym-uncorr-pri {
    position: absolute; width: 12px; height: 12px;
    transform: translate(-6px, -6px);
    pointer-events: auto; cursor: inherit;
}
.ac-sym-uncorr-pri::before, .ac-sym-uncorr-pri::after {
    content: ''; position: absolute; background: #cccc44;
}
.ac-sym-uncorr-pri::before { width: 12px; height: 2px; top: 5px; left: 0; }
.ac-sym-uncorr-pri::after { width: 2px; height: 12px; top: 0; left: 5px; }

/* ── Track position symbols (Table 2 — coasting/no target) ── */
/* Flight Plan Aided (Flat) Track: hollow diamond — centered at (0,0) target position */
.ac-sym-flat-track {
    position: absolute;
    box-sizing: border-box;
    width: 8px; height: 8px;
    left: -4px; top: -4px;
    border: 1.5px solid #cccc44; background: transparent;
    transform: rotate(45deg);
    transform-origin: center;
    pointer-events: auto; cursor: inherit;
    z-index: 1;
}
.ac-sym-flat-track.emrg { border-color: #ff4444; }

/* Coast Track: # hash */
.ac-sym-coast {
    position: absolute;
    font-family: 'ERAM', 'Consolas', monospace;
    font-size: 14px; font-weight: bold;
    color: #cccc44;
    transform: translate(-5px, -7px);
    pointer-events: auto; cursor: inherit;
}

/* Handoff flash — handled by JS content changes in formatLine3() */

/* ── Leader line ── */
.ac-leader { position: absolute; top: 0; left: 0; pointer-events: none; }

/* ── Data block ── */
.ac-db {
    position: absolute; white-space: pre; pointer-events: auto; cursor: inherit;
    font-family: 'ERAM', 'Consolas', monospace;
    font-size: 10px; line-height: 12.5px; letter-spacing: 0.5px;
    padding: 1px 2px; color: #cccc44;
    text-shadow: 0 0 3px rgba(0,0,0,0.9), 1px 1px 2px rgba(0,0,0,0.8);
}
.ac-db.emrg { color: #ff4444; }
.dwell-border { position: absolute; pointer-events: none; border: 1px solid #cccc44; }
.emrg .dwell-border { border-color: #ff4444; }
/* Portal fence: top-left corner bracket on FDB lines 1-4 */
/* Portal fence is rendered as an inline SVG — no CSS border needed */
.ac-db.ldb.dwell { outline: 1px solid #cccc44; outline-offset: 1px; }
.ac-db.ldb.dwell.emrg { outline-color: #ff4444; }
/* Hide portal fence when dwell is active (persists through HTML rebuilds) */
.ac-group.dwell-hide-fence .ac-portal-fence { display: none !important; }
/* .ac-db.ho — handoff flash now driven by JS */

/* ── TMU Mode: hide all data blocks and leader lines, show only aircraft icons ── */
body.tmu-mode .ac-db { display: none !important; }
body.tmu-mode .ac-leader { display: none !important; }

/* ── Range Data Block (RDB) — distance to CRR group ── */
.ac-rdb {
    position: absolute; white-space: nowrap; pointer-events: none;
    font-family: 'ERAM', 'Consolas', monospace;
    font-size: 10px; line-height: 12.5px; letter-spacing: 0.5px;
    text-shadow: 0 0 3px rgba(0,0,0,0.9), 1px 1px 2px rgba(0,0,0,0.8);
    color: #FF00FF;
}

/* ── Column 0 (R / VCI) — inline prefix on each data block line ── */
.ac-col0 { color: #cccc44; }
.ac-vci { color: #44cc44; }
/* ── Point-out P/A indicator (line 0) ── */
.ac-po-pending { color: #cccc44; }
.ac-po-accepted { color: #ffffff; }
/* ── Point-out pop-up menu ── */
#po-menu {
    position: absolute; z-index: 1100;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 12px; line-height: 16px; letter-spacing: 0.5px;
    user-select: none; background: #000; border: 1px solid #888;
}

/* ── Checklist menu ── */
#checklist-menu {
    position: absolute; z-index: 1100;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 12px; line-height: 16px; letter-spacing: 0.5px;
    user-select: none; background: #000; border: 1px solid #4A4A4A;
    cursor: var(--eram-cursor) !important;
}
#checklist-menu,
#checklist-menu * {
    cursor: var(--eram-cursor) !important;
}
#checklist-menu.box-dragging { outline: 2px solid #fff; cursor: move; }
#checklist-menu-title {
    display: flex; justify-content: center; align-items: center; position: relative;
    padding: 2px 6px; border-bottom: 1px solid #4A4A4A; background: #000; cursor: move;
}
#checklist-menu-title-text { color: #B1B1B1; }
#checklist-menu-close { position: absolute; right: 6px; color: #B1B1B1; cursor: pointer; padding: 0 4px; font-weight: bold; }
#checklist-menu-close:hover { color: #ff4444; }
#checklist-menu-body { padding: 3px 6px; }
.checklist-item {
    padding: 2px 4px; cursor: pointer; white-space: pre; color: #B1B1B1; background: #000;
    margin: 2px 0; border: 1px solid #444;
}
.checklist-item:hover { border-color: #666; }
.checklist-item.checked { background: #4A4A4A; }
.checklist-separator { height: 1px; background: #444; margin: 2px 0; }
#po-menu.box-dragging { outline: 2px solid #fff; cursor: move; }
#po-menu,
#po-menu * {
    cursor: var(--eram-cursor) !important;
}
#po-menu-title,
.field-menu-title {
    cursor: move !important;
}
#po-menu-callsign { color: #fff; }
.po-menu-divider { width: 1px; align-self: stretch; background: #555; margin: 0 4px; }
#po-menu-close { color: #fff; cursor: pointer; padding: 0 4px; }
#po-menu-close:hover { color: #ff4444; }
#po-menu-body { padding: 3px 6px; }
.po-sector-row { padding: 2px 0; cursor: pointer; white-space: pre; }
.po-sector-box { display: inline-block; padding: 0 3px; border: 1px solid; }
.po-orig-pending { color: #cccc44; border-color: #cccc44; }
.po-recv-pending { color: #00cccc; border-color: #00cccc; }
.po-acked { color: #fff; border-color: transparent; }

/* ── Altimeter Settings Menu ── */
#altim-menu {
    position: absolute; z-index: 1100;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 13px; line-height: 18px; letter-spacing: 0.5px;
    user-select: none; background: #000; border: 1px solid #666;
    min-width: 180px;
}
#altim-menu,
#altim-menu * {
    cursor: var(--eram-cursor) !important;
}
#altim-menu.box-dragging { outline: 2px solid #fff; }
#altim-menu-title {
    display: flex; justify-content: space-between; align-items: center;
    background: #000; padding: 2px 4px; border-bottom: 1px solid #666;
    color: #BBBBBB; cursor: var(--eram-cursor) !important; font-weight: normal;
    padding-left: 8px;
}
#altim-menu-close {
    color: #BBBBBB;
    cursor: var(--eram-cursor) !important;
    padding: 0 6px;
    font-weight: bold;
    user-select: none;
}
#altim-menu-close:hover { color: #FFFFFF; }
#altim-menu-body { padding: 0; max-height: 400px; overflow-y: auto; }
.altim-entry {
    padding: 2px 4px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    white-space: pre;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
    min-width: 180px;
}
.altim-entry:last-child { border-bottom: none; }
.altim-entry:hover { background: #1a1a1a; }
.altim-entry-selected {
    background: #333344;
}
.altim-box {
    display: inline-block;
    width: 12px; height: 12px;
    background: #9FA309;
    margin-right: 6px;
    flex-shrink: 0;
}
.altim-station {
    color: #BBBBBB;
    font-weight: bold;
    min-width: 50px;
}
.altim-time {
    color: #BBBBBB;
    font-size: 11px;
    min-width: 50px;
    text-align: right;
    margin: 0 2px 0 8px;
}
.altim-value {
    color: #BBBBBB;
    margin-left: -8px;
}
.altim-value-digits {
    display: inline-block;
}
.altim-value-digits.below-standard {
    text-decoration: underline;
}
.altim-entry-selected .altim-value {
    visibility: hidden;
}
.altim-delete-btn {
    position: absolute;
    right: 4px;
    top: 2px;
    color: #ff4444;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    white-space: nowrap;
}
.altim-delete-btn:hover { background: #440000; color: #ffff77; }

/* ── Weather Report Menu ── */
#wx-menu {
    position: absolute; z-index: 1100;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 12px; line-height: 16px; letter-spacing: 0.5px;
    user-select: none; background: #000; border: 1px solid #666;
    width: 312px;
}
#wx-menu,
#wx-menu * {
    cursor: var(--eram-cursor) !important;
}
#wx-menu.box-dragging { outline: 2px solid #fff; }
#wx-menu-title {
    display: flex; justify-content: space-between; align-items: center;
    background: #000; padding: 2px 4px; border-bottom: 1px solid #666;
    color: #BBBBBB; cursor: var(--eram-cursor) !important; font-weight: normal;
    padding-left: 8px;
}
#wx-menu-close {
    color: #BBBBBB;
    cursor: var(--eram-cursor) !important;
    padding: 0 6px;
    font-weight: bold;
    user-select: none;
}
#wx-menu-close:hover { color: #FFFFFF; }
#wx-menu-body {
    padding: 0;
    min-height: 40px;
    max-height: 140px;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: none;
    position: relative;
}
#wx-menu-body::-webkit-scrollbar { width: 0; display: none; }
.wx-scroll-track {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: 16px; background: #000; border-left: 1px solid #333;
    display: flex; flex-direction: column;
    z-index: 10;
    pointer-events: none;
}
.wx-scroll-btn {
    flex: 1;
    width: 16px;
    background: #000; border: 1px solid #333; border-left: none;
    color: #BBBBBB; font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; user-select: none;
    pointer-events: auto;
}
.wx-scroll-btn:hover { background: #111; border-color: #555; }
.wx-scroll-btn:active { background: #222; }

/* ── WX Rows Popup ── */
#wx-rows-popup button:hover { background: #444 !important; border-color: #666 !important; }
#wx-rows-popup button:active { background: #555 !important; }

/* ── Beacon Codes Menu ── */
#beacon-menu {
    position: absolute; z-index: 1100;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 12px; line-height: 16px; letter-spacing: 0.5px;
    user-select: none; background: #000; border: 1px solid #666;
    width: 100px;
}
#beacon-menu,
#beacon-menu * {
    cursor: var(--eram-cursor) !important;
}
#beacon-menu.box-dragging { outline: 2px solid #fff; }
#beacon-menu-title {
    display: flex; justify-content: space-between; align-items: center;
    background: #000; padding: 2px 4px; border-bottom: 1px solid #666;
    color: #BBBBBB; cursor: var(--eram-cursor) !important; font-weight: normal;
    padding-left: 8px;
}
#beacon-menu-close {
    color: #BBBBBB;
    cursor: var(--eram-cursor) !important;
    padding: 0 6px;
    font-weight: bold;
    user-select: none;
}
#beacon-menu-close:hover { color: #FFFFFF; }
#beacon-menu-body {
    padding: 0;
    min-height: 40px;
    max-height: 140px;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: none;
    position: relative;
}
#beacon-menu-body::-webkit-scrollbar { width: 0; display: none; }
.beacon-scroll-track {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: 16px; background: #000; border-left: 1px solid #333;
    display: flex; flex-direction: column;
    z-index: 10;
    pointer-events: none;
}
.beacon-scroll-btn {
    flex: 1;
    width: 16px;
    background: #000; border: 1px solid #333; border-left: none;
    color: #BBBBBB; font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; user-select: none;
    pointer-events: auto;
}
.beacon-scroll-btn:hover { background: #111; border-color: #555; }
.beacon-scroll-btn:active { background: #222; }
.beacon-entry {
    padding: 4px 8px;
    border-bottom: 1px solid #333;
    font-size: 12px;
    cursor: default;
    user-select: none;
    color: #BBBBBB;
    min-width: 100px;
}
.beacon-entry:last-child { border-bottom: none; }

/* ── Beacon Rows Popup ── */
#beacon-rows-popup button:hover { background: #444 !important; border-color: #666 !important; }
#beacon-rows-popup button:active { background: #555 !important; }

.wx-entry {
    /* CRC ERAM Fig. 17 layout: yellow box adornment on the left, then
       STA + obs time + METAR on the first line with continuation lines
       hanging-indented under the METAR's first character. */
    padding: 2px 4px;
    border-bottom: 1px solid #333;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
    position: relative;
    min-width: 312px;
    color: #BBBBBB;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.wx-entry:last-child { border-bottom: none; }
.wx-entry:hover { background: #1a1a1a; }
.wx-entry-selected { background: #333344; }
.wx-box {
    display: inline-block;
    width: 12px; height: 12px;
    background: #9FA309;
    flex-shrink: 0;
    margin-top: 1px;        /* nudge to baseline-align with text */
}
.wx-content {
    flex: 1;
    /* Monospace + pre-wrap so the 4-char STA + space + 4-char TIME + space
       prefix consumes exactly 10 chars on line 1; continuation lines indent
       to that boundary via the negative text-indent / padding-left pair. */
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    line-height: 14px;
    white-space: pre-wrap;
    word-break: normal;
    padding-left: 10ch;
    text-indent: -10ch;
    padding-right: 20px;
}
.wx-station { color: #BBBBBB; }            /* per CRC: plain, not bold */
.wx-time    { color: #BBBBBB; }
.wx-time.stale { text-decoration: underline; }
.wx-metar   { color: #BBBBBB; }
.wx-metar.missing { color: #888888; }
.wx-entry-selected .wx-metar { visibility: hidden; }
.wx-delete-btn {
    position: absolute;
    right: 22px;
    top: 2px;
    color: #ff4444;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    white-space: nowrap;
}
.wx-delete-btn:hover { background: #440000; color: #ffff77; }

/* ── CRR Menu ── */
#crr-menu {
    position: absolute; z-index: 1100;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 13px; line-height: 18px; letter-spacing: 0.5px;
    user-select: none; background: #000; border: 1px solid #666;
    min-width: 180px;
}
#crr-menu,
#crr-menu * {
    cursor: var(--eram-cursor) !important;
}
#crr-menu.box-dragging { outline: 2px solid #fff; }
#crr-menu-title {
    display: flex; justify-content: space-between; align-items: center;
    background: #000; padding: 2px 4px; border-bottom: 1px solid #666;
    color: #BBBBBB; cursor: var(--eram-cursor) !important; font-weight: normal;
    padding-left: 8px;
}
#crr-menu-close {
    color: #BBBBBB;
    cursor: var(--eram-cursor) !important;
    padding: 0 6px;
    font-weight: bold;
    user-select: none;
}
#crr-menu-close:hover { color: #FFFFFF; }
#crr-menu-body { padding: 0; max-height: 400px; overflow-y: auto; }
.crr-group {
    padding: 2px 2px 2px 4px;
    border-bottom: 1px solid #333;
    display: block;
    font-size: 12px;
    user-select: none;
    position: relative;
    border: 1px solid transparent;
}
.crr-group:last-child { border-bottom: none; }
.crr-group:hover { border: 1px solid #fff; }
.crr-group-selected {
    background: #333344;
}
.crr-group-label {
    color: #00D000;
    font-weight: bold;
    margin-bottom: 1px;
    padding: 1px 0;
    text-align: center;
}
.crr-group-label-delete {
    color: #ff4444;
    font-weight: bold;
    cursor: pointer;
    margin-left: 4px;
    white-space: nowrap;
}
.crr-group-label-delete:hover { background: #440000; color: #ffff77; }
.crr-aircraft {
    color: #BBBBBB;
    white-space: pre;
    cursor: pointer;
    padding: 0px 2px;
    font-size: 11px;
    line-height: 1.2;
    border: 1px solid transparent;
    margin-top: 4px;
}
.crr-aircraft:hover { border: 1px solid #fff; }

/* ── CRR Group Delete Popup ── */
#crr-group-delete-popup,
#crr-aircraft-delete-popup {
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    color: #BBBBBB;
    cursor: var(--eram-cursor) !important;
}
#crr-group-delete-popup *,
#crr-aircraft-delete-popup * {
    cursor: var(--eram-cursor) !important;
}
.crr-popup-option {
    padding: 3px 8px;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}
.crr-popup-option:last-child { border-bottom: none; }
.crr-popup-option:hover { background: #1a1a1a; }

/* ── Zulu Time View ── */
#time-view {
    position: absolute; z-index: 1050;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 18px; letter-spacing: 2px;
    color: #ffffff; background: rgba(0,0,0,0.6);
    padding: 0px 8px 4px 8px; cursor: move; user-select: none;
    border: 1px solid transparent; white-space: nowrap;
    top: 10px; right: 60px;
}
#time-view:not(.box-dragging) {
    cursor: var(--eram-cursor) !important;
}
#time-view.bordered { border-color: #555; }
#time-view.box-dragging { outline: 2px solid #fff; cursor: var(--eram-cursor) !important; }

/* ── Field menus (altitude, heading, speed, free text) ── */
.field-menu {
    position: absolute; z-index: 1100;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    font-size: 12px; line-height: 16px; letter-spacing: 0.5px;
    user-select: none; background: #000; border: 1px solid #999;
    min-width: 120px;
    cursor: var(--eram-cursor) !important;
}
.field-menu,
.field-menu * {
    cursor: var(--eram-cursor) !important;
}
.field-menu.box-dragging { outline: 2px solid #fff; cursor: move; }
.field-menu-title {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1px 4px; background: #777; cursor: move;
}
.field-menu-cs { color: #fff; }
.field-menu-close { color: #fff; cursor: pointer; padding: 0 2px; margin-left: 8px; }
.field-menu-close:hover { color: #ff4444; }
.field-menu-body { padding: 0; }
.field-menu-row { padding: 1px 4px; cursor: pointer; white-space: pre; color: #fff; line-height: 15px; }
.field-menu-row:hover { background: #333; }
.field-menu-row.current { background: #cd5c5c; color: #fff; }
.field-menu-row.fm-toggle { color: #fff; background: #777; padding: 1px 4px; }
.field-menu-row.fm-toggle:hover { background: #888; }
.field-menu-row.fm-toggle.toggle-active { background: #999; }
.field-menu-footer { padding: 1px 4px; }
.field-menu-values { display: flex; min-height: 112px; }
.field-menu-values-col { flex: 1; padding: 0 2px; }
.field-menu-scrollbar {
    display: flex; flex-direction: column; align-items: center;
    width: 16px; background: #444; border-left: 1px solid #666;
}
.field-menu-scrollbar .sb-arrow {
    cursor: pointer; width: 100%; text-align: center;
    background: #777; color: #fff; font-size: 8px; line-height: 14px;
    border: 1px outset #999;
}
.field-menu-scrollbar .sb-arrow:hover { background: #999; }
.field-menu-scrollbar .sb-arrow:active { background: #555; border-style: inset; }
.field-menu-scrollbar .sb-track {
    flex: 1; width: 10px; background: #333; position: relative;
    border-left: 1px solid #222; border-right: 1px solid #222;
}
.field-menu-scrollbar .sb-thumb {
    position: absolute; width: 100%; background: #999;
    min-height: 10px; border: 1px outset #bbb;
}
.field-menu-hdr { display: flex; gap: 4px; padding: 1px 4px; background: #777; }
.field-menu-hdr span {
    cursor: pointer; color: #fff; padding: 0 3px;
    border: 1px solid transparent; line-height: 15px;
}
.field-menu-hdr span:hover { background: #999; }
.field-menu-hdr span.active { color: #cd5c5c; border: 1px solid #cd5c5c; }
.field-menu-input {
    background: #000; color: #fff; border: 1px solid #555;
    font-family: inherit; font-size: inherit; width: calc(100% - 8px);
    padding: 2px 4px; margin: 2px 4px; outline: none;
}
.field-menu-input:focus { border-color: #fff; }

/* ── Flight detail (sidebar panel) ── */
#flight-detail-section { display: none; }
#flight-detail-section .fd-title { color: #cccc44; font-size: 12px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
#flight-detail-section .fd-row { display: flex; gap: 8px; margin-bottom: 2px; font-size: 11px; }
#flight-detail-section .fd-label { color: #666; min-width: 60px; flex-shrink: 0; }
#flight-detail-section .fd-val { color: #cccc44; word-break: normal; }
#flight-detail-section .fd-close { cursor: pointer; color: #666; font-size: 14px; }
#flight-detail-section .fd-close:hover { color: #ff4444; }

/* ── Target symbols are drawn as inline geometric divs (no font metrics dependency) ── */

/* ── MCA (Message Composition Area) ──
   MCA + RA are independently positioned boxes. They start stacked at the
   bottom-right (RA above MCA) but can be picked up and dropped anywhere
   in the map area. Window resize re-clamps to keep them on-screen. */
#mca {
    position: absolute; z-index: 1000;
    bottom: 30px; right: 30px;
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    user-select: none;
    cursor: var(--eram-cursor) !important;
}
#mca,
#mca * {
    cursor: var(--eram-cursor) !important;
}
#mca.box-dragging,
#ra.box-dragging {
    outline: 2px solid #fff; cursor: move;
}
#mca-preview {
    background: #000000; border: 1px solid #888; color: #ffffff;
    padding: 3px 6px; width: 400px; box-sizing: border-box;
    font-size: 14px; font-weight: normal; line-height: 18px;
    white-space: pre; overflow: hidden; text-overflow: ellipsis;
    min-height: 28px; display: flex; align-items: center;
}
#mca-feedback {
    background: #000000; border: 1px solid #888; border-top: none; color: #ffffff;
    padding: 3px 6px; width: 400px; box-sizing: border-box;
    font-size: 14px; font-weight: normal; line-height: 18px;
    /* Long feedback lines wrap within the fixed-width box so MCA never
       grows horizontally with message length. Vertical growth is OK. */
    white-space: pre-wrap; word-break: break-word; min-height: 68px;
}
#mca-kb-btn {
    position: absolute; top: 0; right: -28px;
    width: 24px; height: 24px; padding: 0;
    background: rgba(50,50,50,0.6); border: 1px solid #555; border-radius: 3px;
    color: #888; font-size: 16px; line-height: 22px; text-align: center;
    cursor: pointer; opacity: 0.5; transition: opacity 0.2s;
    display: none;
}
#mca-kb-btn:hover, #mca-kb-btn:active { opacity: 1; color: #ccc; }
@media (pointer: coarse) { #mca-kb-btn { display: block; } }
#mca.show-kb #mca-kb-btn { display: block; }
#mca-mobile-input {
    position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0;
}
.transp-mca #mca-preview,
.transp-mca #mca-feedback { background: transparent; }
.transp-mca #ra-content { background: transparent; }

/* ── RA (Response Area) ── */
#ra {
    position: absolute; z-index: 1000;
    /* Default: above MCA (which sits at bottom: 30px with ~100px tall).
       Both can be dragged independently; resize clamps both. */
    bottom: 130px; right: 30px;
    max-width: calc(100vw - 60px);
    font-family: 'ERAM', 'Consolas', 'Courier New', monospace;
    user-select: none;
    cursor: var(--eram-cursor) !important;
}
#ra,
#ra * {
    cursor: var(--eram-cursor) !important;
}
#ra-content {
    background: #000000; border: 1px solid #888; color: #ffffff;
    padding: 3px 6px; width: 500px; min-height: 100px;
    max-height: 60vh; overflow-y: auto;
    font-size: 14px; line-height: 18px; white-space: pre-wrap; word-break: normal;
    font-weight: normal;
}

/* ── Master Toolbar System ── */
#tb-tearoff {
    position: absolute; z-index: 960;
    bottom: 12px; left: 12px;
    user-select: none;
}
#tb-tearoff-btn {
    display: flex; align-items: stretch;
    width: 88px; height: 34px;
    background: #00CD00;
    cursor: var(--eram-cursor) !important; font-family: 'ERAM', 'Consolas', monospace;
    font-size: 10px; line-height: 14px; padding: 0;
}
#tb-tearoff-btn .tb-gold-strip {
    width: 13px; background: #FFFFA1; flex-shrink: 0; cursor: var(--eram-cursor) !important;
    border: 1px solid #333;
    border-right: 1px solid #555;
    transition: border-color 0.1s ease;
}
#tb-tearoff-btn .tb-gold-strip:hover {
    border-color: #ffffff !important;
}
#tb-tearoff-btn .tb-tearoff-label {
    color: #ffffff; white-space: nowrap;
    display: flex; align-items: center; justify-content: center; flex: 1;
    border: 1px solid #333;
    border-right: 1px solid #555;
    transition: border-color 0.1s ease;
}
#tb-tearoff-btn .tb-tearoff-label:hover {
    border-color: #ffffff !important;
}

#master-toolbar-container {
    position: absolute; z-index: 960;
    top: 0; left: 0; right: 0;
    user-select: none;
    display: none;
    cursor: var(--eram-cursor) !important;
}
#master-toolbar-container.tb-visible { display: block; }
/* When toolbar is visible, push sidebar below it */
body.tb-active #sidebar-wrapper { top: 70px; }

/* Toolbar panel (master + sub-menus) */
.tb-panel {
    background: transparent;
    font-family: 'ERAM', 'Consolas', monospace;
    font-size: 10px; line-height: 1;
}
.tb-row {
    display: flex;
}

/* Individual toolbar button — CRC: blue bg, white text, uniform size */
.tb-btn {
    display: flex; flex-direction: row; align-items: stretch;
    width: 88px; height: 34px;
    border: 1px solid #333;
    border-right: 1px solid #555;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    background: #0000D4;
    flex-shrink: 0;
    overflow: hidden;
}
.tb-btn:active { background: #0000D4; }

/* Tearoff strip on each button — separate button with borders */
.tb-btn .tb-tear {
    width: 13px; background: #FFFFA1; flex-shrink: 0;
    border: 1px solid #333;
    border-right: 1px solid #555;
    cursor: var(--eram-cursor) !important;
    transition: border-color 0.1s ease;
}
.tb-btn .tb-tear:hover {
    border-color: #ffffff !important;
}
/* Disabled tearoff (grey when active tearoff exists) — color set dynamically in JavaScript */
.tb-btn .tb-tear.tb-tear-disabled {
    background: #C7C7C7 !important;
    cursor: var(--eram-cursor) !important;
}

/* Button content area (label + value) with hover border effect */
.tb-btn .tb-content {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    flex: 1; padding: 2px 3px; position: relative;
    border: 1px solid #333;
    border-right: 1px solid #555;
    transition: border-color 0.1s ease;
}
.tb-btn:has(.tb-content:hover) .tb-content {
    border-color: #ffffff !important;
}

/* Label text — white on blue */
.tb-btn .tb-label {
    color: #ffffff; font-size: 10px; text-align: center;
    line-height: 11px; white-space: pre;
}

/* Value text (for incdec buttons) — white like labels */
.tb-btn .tb-value {
    color: #ffffff; font-size: 9px; text-align: center;
    line-height: 10px; margin-top: 1px;
}

/* Menu indicator triangle */
.tb-btn .tb-menu-ind {
    position: absolute; bottom: 1px; right: 2px;
    color: #6666aa; font-size: 6px; line-height: 6px;
}

/* Momentary toggle indicator triangle (top right) */
.tb-btn .tb-momentary-ind {
    position: absolute; top: 1px; right: 1px;
    font-size: 7px; line-height: 1; font-weight: bold;
    pointer-events: none;
}

/* ── Special button backgrounds ── */
/* Black background (RANGE, ALT LIM) */
.tb-btn.tb-dark { background: #000; }
.tb-btn.tb-dark:hover { background: #000; }

/* Green background (brightness controls) */
.tb-btn.tb-green { background: #00CD00; }
.tb-btn.tb-green:hover { background: #00CD00; }

/* Blue background (MAP BRIGHT, CPDLC) */
.tb-btn.tb-blue { background: #0000D4; }
.tb-btn.tb-blue:hover { background: #0000D4; }

/* Tan background (menu returns/leave submenus) */
.tb-btn.tb-tan { background: #DCA09B; }
.tb-btn.tb-tan:hover { background: #DCA09B; }

/* Teal background (DELETE TEAROFF) */
.tb-btn.tb-teal { background: #00C7D1; }
.tb-btn.tb-teal:hover { background: #00C7D1; }

/* ── Button type states ── */
/* Not simulated — dimmer blue */
.tb-btn.tb-nosim { background: #000066; cursor: var(--eram-cursor) !important; }
.tb-btn.tb-nosim:hover { background: #000066; }
.tb-btn.tb-nosim:active { background: #000066; }
.tb-btn.tb-nosim .tb-label { color: #8888aa; }

/* Toggle ON — same blue, slightly brighter */
.tb-btn.tb-toggle-on { background: #0000D4; }
.tb-btn.tb-toggle-on:hover { background: #0000D4; }

/* Toggle grey (DEST, TYPE, PORTAL FENCE) — off: black, on: light grey */
.tb-btn.tb-toggle-grey { background: #000000; }
.tb-btn.tb-toggle-grey:hover { background: #000000; }
.tb-btn.tb-toggle-grey.tb-toggle-on { background: #C7C7C7; }
.tb-btn.tb-toggle-grey.tb-toggle-on:hover { background: #C7C7C7; }

/* Menu OPEN — pink/clay */
.tb-btn.tb-menu-open { background: #DCA09B; }
.tb-btn.tb-menu-open:hover { background: #DCA09B; }

/* Sub-menu panel — overlays on top of master grid, positioned absolutely */
.tb-submenu {
    position: absolute; top: 0;
    background: transparent;
    font-family: 'ERAM', 'Consolas', monospace;
    font-size: 10px; line-height: 1;
    white-space: nowrap;
    z-index: 2;
}
.tb-submenu {
    scrollbar-width: none;
}
.tb-submenu::-webkit-scrollbar { height: 0px; display: none; }
.tb-submenu::-webkit-scrollbar-thumb { background: #777; border-radius: 2px; }
.tb-submenu::-webkit-scrollbar-track { background: #222; }

/* Floating tearoff — detached button (draggable by tearoff strip) */
.tb-floating-tearoff {
    display: flex;
    position: relative;
}

/* Tearoff marked for deletion */
.tb-floating-tearoff .tb-btn.tb-delete-selected {
    position: relative;
    opacity: 0.7;
}

.tb-floating-tearoff .tb-btn.tb-delete-selected::after {
    content: '✕';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #ff4444;
    font-weight: bold;
}

/* Floating menu — popup menu from floating button */
.tb-floating-menu {
    display: flex;
    flex-direction: column;
    position: absolute;
    background: #0000D4 !important;
    border: 1px solid #FFFFFF !important;
    white-space: nowrap;
    cursor: var(--eram-cursor) !important;
}
.tb-floating-menu,
.tb-floating-menu * {
    cursor: var(--eram-cursor) !important;
}

/* Left/right grey bars flanking the button grid */
.tb-side-bar {
    display: flex; flex-direction: column; justify-content: flex-end;
    min-width: 14px; background: #555; flex-shrink: 0;
}
.tb-side-bar.tb-right { flex: 1; }
.tb-side-bar .tb-arrow-btn {
    width: 14px; height: 34px; background: #555; border: 1px solid #ccc;
    display: flex; align-items: flex-end; justify-content: center;
    cursor: pointer; padding: 0 0 3px 0;
    transition: border-color 0.1s ease;
}
.tb-side-bar .tb-arrow-btn:hover {
    background: #666;
    border-color: #ffffff !important;
}
.tb-side-bar .tb-arrow-btn svg { width: 8px; height: 14px; }
/* Master toolbar layout: [left bar] [button grid] [right bar fills to edge] */
.tb-master-row {
    display: flex; flex-direction: row; width: 100%;
}
.tb-master-grid {
    display: flex; flex-direction: column; flex-shrink: 0;
    position: relative; background: #555;
}
