/*
  The Windows editor's look (Themes/Light.xaml and Dark.xaml), as CSS. The theme is set on <html data-theme>.
  WPF colours are #AARRGGBB; CSS wants #RRGGBBAA, so the see-through ones are turned round here.
*/
:root, [data-theme=light] {
    --window: #EEF0F4;
    --panel: #FFFFFF;
    --panel-alt: #F2F4F7;
    --header-band: #E3E7EF;
    --stroke: #D5DAE3;
    --text: #1D212F;
    --muted: #5F6677;
    --section-label: #8A90A0;
    --accent: #6E7D0E;
    --accent-hover: #5C690A;
    --on-accent: #FFFFFF;
    --accent-soft: #EEF3CF;
    --active-nav: #E4EBB8;
    --error: #C62828;
    --warning: #9A7B00;
    --success: #2E7D32;

    --canvas: #E6E9EF;
    --sheet: #FFFFFF;
    --ink: #1D212F;
    --faint-ink: #A3AAB7;
    --frame: #C3C9D3;
    --selection: #8A9C12;
    --front-gear: #3B82C466;
    --rear-gear: #D08A3C66;
    --strip: #7A8796;
    --rack-void: #C9CED7;
    --rail: linear-gradient(to right, #A9B0BA 0%, #E3E7EC 45%, #9CA3AE 100%);
    --rail-hole: #4A505B;
    --post: linear-gradient(to right, #596071 0%, #7C8496 50%, #596071 100%);
    --cap: linear-gradient(to bottom, #7C8496, #596071);
    --foot: #2E333D;
    --faceplate: linear-gradient(to bottom, #FBFCFD 0%, #EDEFF3 50%, #DFE3E9 100%);
    --faceplate-edge: #8E96A4;
    --screw: radial-gradient(circle at 35% 30%, #FFFFFF, #8C93A0);

    /* Plan drawing layers, matching the AutoCAD colours where they read on a light sheet. */
    --l-frame: #1d2330;
    --l-rail: #8a8f98;
    --l-units: #a0a6b0;
    --l-equip: #0e7490;
    --l-hidden: #9aa1ab;
    --l-text: #9a6700;
    --l-label: #15803d;
    --l-door: #a21caf;
    --l-dim: #dc2626;

    color-scheme: light;
}

[data-theme=dark] {
    --window: #13161E;
    --panel: #1D212F;
    --panel-alt: #282D3E;
    --header-band: #323954;
    --stroke: #373D51;
    --text: #E5E8EF;
    --muted: #868C9D;
    --section-label: #636979;
    --accent: #C4D43B;
    --accent-hover: #D4E255;
    --on-accent: #13161E;
    --accent-soft: #3C4323;
    --active-nav: #3C4323;
    --error: #FF6B6B;
    --warning: #E0C341;
    --success: #7FC97A;

    --canvas: #13161E;
    --sheet: #1D212F;
    --ink: #E5E8EF;
    --faint-ink: #4D5468;
    --frame: #3A4052;
    --selection: #C4D43B;
    --front-gear: #4A6FA566;
    --rear-gear: #A5673B66;
    --strip: #8C96A3;
    --rack-void: #0E1016;
    --rail: linear-gradient(to right, #5A606C 0%, #8E95A2 45%, #4C525D 100%);
    --rail-hole: #0B0D12;
    --post: linear-gradient(to right, #232837 0%, #3A4154 50%, #232837 100%);
    --cap: linear-gradient(to bottom, #454C61, #2A3040);
    --foot: #0B0D12;
    --faceplate: linear-gradient(to bottom, #343A4C 0%, #262B3A 50%, #1F2331 100%);
    --faceplate-edge: #5C6479;
    --screw: radial-gradient(circle at 35% 30%, #D7DBE2, #7D8492);

    --l-frame: #e6e8eb;
    --l-rail: #8a8f98;
    --l-units: #5d6470;
    --l-equip: #22d3ee;
    --l-hidden: #6b7280;
    --l-text: #facc15;
    --l-label: #4ade80;
    --l-door: #e879f9;
    --l-dim: #f87171;

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--window);
    color: var(--text);
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 12px;
}

#app { height: 100%; }
.loading { padding: 24px; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.strong { font-weight: 600; margin-top: 8px; }
.spaced { margin-top: 8px; }
.pre { white-space: pre-line; }
.success { color: var(--success); }
.error-text { color: var(--error); margin-top: 6px; }

/* ===== Controls ===== */

button, .button {
    font: inherit;
    min-height: 26px;
    padding: 3px 10px;
    border: 1px solid var(--stroke);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
button:hover:not(:disabled), .button:hover { background: var(--panel-alt); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled), .button.primary:hover { background: var(--accent-hover); }
button.link { border: none; background: none; color: var(--accent); padding: 0; min-height: 0; }
.button input[type=file] { display: none; }

input, select {
    font: inherit;
    width: 100%;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid var(--stroke);
    border-radius: 4px;
    background: var(--panel);
    color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input[type=range] { padding: 0; border: none; background: none; accent-color: var(--accent); min-height: 0; }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--accent); }

.segments {
    display: inline-flex;
    padding: 2px;
    gap: 2px;
    border-radius: 5px;
    background: var(--panel-alt);
    border: 1px solid var(--stroke);
    flex-wrap: wrap;
}
.segment { border: none; background: transparent; min-height: 22px; padding: 2px 9px; }
.segment.on, .segment.on:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); font-weight: 600; }

.section-header { font-size: 10.5px; font-weight: 600; color: var(--section-label); margin-bottom: 8px; letter-spacing: 0.02em; }
.tla-badge {
    display: inline-block;
    padding: 0 5px;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
}
.button-row { display: flex; flex-wrap: wrap; gap: 6px; }
.button-row.centred { justify-content: center; }

/* ===== Layout ===== */

.app { display: flex; flex-direction: column; height: 100%; }

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--panel);
    border-bottom: 2px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 300; letter-spacing: 0.02em; }
.brand .ink { fill: var(--text); }
.brand .accent { fill: var(--accent); }
.header-right { text-align: right; }
.header-title { font-size: 16px; font-weight: 600; }
.header-sub { font-size: 11px; color: var(--muted); }

.command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: var(--window);
    border-bottom: 1px solid var(--stroke);
}
.commands { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.commands.right { flex-wrap: nowrap; }
.tool { border-color: transparent; background: transparent; }
.tool:hover:not(:disabled) { background: var(--panel); border-color: var(--stroke); }
.tool.glyph { font-size: 15px; padding: 0 8px; }
.divider { width: 1px; height: 20px; background: var(--stroke); margin: 0 6px; }
.zoom { width: 110px; }

.tabs {
    display: flex;
    gap: 2px;
    padding: 4px 8px 0;
    background: var(--window);
    border-bottom: 1px solid var(--stroke);
    overflow-x: auto;
}
.tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 6px 6px 12px;
    border-radius: 4px 4px 0 0;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}
.tab:hover { background: var(--panel-alt); }
.tab.selected { background: var(--active-nav); border-bottom-color: var(--accent); }
.tab-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.dirty { color: var(--accent); font-size: 9px; }
.tab-close { border: none; background: transparent; font-size: 10px; padding: 0 4px; min-height: 18px; margin-left: 4px; }

.workspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 340px;
    gap: 10px;
    padding-right: 10px;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 14px;
    background: var(--panel);
    border-top: 1px solid var(--stroke);
    color: var(--muted);
}
.status-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.busy { width: 80px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent-soft), var(--accent), var(--accent-soft)); background-size: 200% 100%; animation: busy 1.2s linear infinite; }
@keyframes busy { from { background-position: 200% 0; } to { background-position: 0 0; } }

/* ===== Library ===== */

.library {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 14px 12px 12px;
    background: var(--panel);
    border-right: 1px solid var(--stroke);
}
.search { margin-bottom: 8px; }
.library-list { flex: 1; min-height: 0; overflow-y: auto; }
.library-group { font-weight: 600; color: var(--accent); margin: 12px 0 4px 4px; height: 28px; display: flex; align-items: flex-end; }
.library-item { height: 40px; padding: 3px 6px; border-radius: 4px; cursor: grab; margin-bottom: 4px; overflow: hidden; }
.library-item:hover { background: var(--panel-alt); }
.library-item.selected { background: var(--active-nav); }
.library-name { display: flex; align-items: center; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-name > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.library-summary { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-foot { margin-top: 10px; }
.library-foot p { margin: 0 0 10px; }

/* ===== Lineup ===== */

.lineup {
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: 10px 0;
    background: var(--canvas);
    border: 1px solid var(--stroke);
    border-radius: 5px;
    overflow: hidden;
}
.empty-state { margin: auto; text-align: center; padding: 24px; }
.empty-state h2 { font-size: 22px; font-weight: 600; margin: 0 0 6px; }
.empty-state > p { margin: 0 0 18px; }
.empty-state .small { margin-top: 14px; }

.header-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    padding: 7px 14px;
    background: var(--header-band);
    border-bottom: 1px solid var(--stroke);
}
.lineup-name { font-size: 14px; font-weight: 600; }
.pill { background: var(--accent-soft); color: var(--accent); font-weight: 600; padding: 2px 9px; border-radius: 10px; }

.elevation-scroll, .plan-scroll { flex: 1; min-height: 0; overflow: auto; }
.elevation-scroll { padding: 18px; }
.elevation-content { width: max-content; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.lineup-row { margin-bottom: 24px; }
.row-title { color: var(--muted); font-weight: 600; margin: 0 0 8px 4px; }
.row-racks { display: flex; align-items: flex-end; }

.plan-scroll { background: var(--sheet); }
.plan-sheet { min-width: 100%; }
.plan-sheet svg { display: block; width: 100%; height: auto; }

.view3d { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view3d-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 6px 10px;
    background: var(--panel);
    border-bottom: 1px solid var(--stroke);
}
.view3d-bar .check { margin-top: 0; }
.view3d-sep { width: 1px; align-self: stretch; background: var(--stroke); }
.view3d-host { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; }
.view3d-host canvas { display: block; position: absolute; inset: 0; cursor: grab; outline: none; }
.view3d-host canvas:active { cursor: grabbing; }
.view3d-help, .view3d-notes { position: absolute; left: 10px; bottom: 8px; pointer-events: none; padding: 2px 8px; border-radius: 4px; background: var(--panel); opacity: 0.85; }
.view3d-notes { bottom: auto; top: 52px; }

/* ===== One rack ===== */

.rack {
    padding: 10px 12px 12px;
    margin-right: 4px;
    border: 1px solid transparent;
    border-radius: 5px;
}
.rack.active { border-color: var(--accent); background: var(--panel); }
.rack-head { display: flex; gap: 6px; margin-bottom: 8px; }
.rack-titles { flex: 1; min-width: 0; }
.rack-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rack-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rack-model { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rack-buttons { display: flex; align-items: flex-start; gap: 2px; }
.icon { border-color: transparent; background: transparent; padding: 0 6px; min-height: 22px; color: var(--muted); }
.rack-totals {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.rack-body { display: grid; width: max-content; }
.rack-cap { background: var(--cap); border-top: 1px solid var(--faceplate-edge); border-radius: 2px 2px 0 0; }
.rack-plinth {
    background: var(--cap);
    border-top: 1px solid var(--faceplate-edge);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: center;
    padding: 0 22px;
}
.rack-plinth span { height: 3px; margin: 0 3px; border-radius: 1.5px; background: var(--rail-hole); }
.rack-feet { display: flex; justify-content: space-between; padding: 0 4px; height: 7px; }
.rack-feet span { width: 26px; background: var(--foot); border-radius: 0 0 3px 3px; }
.rack-post { background: var(--post); z-index: 1; }
.rack-post.left { border-radius: 2px 0 0 0; }
.rack-post.right { border-radius: 0 2px 0 0; }

.unit-numbers div {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--muted);
    position: relative;
}
.unit-numbers div::after { content: ""; position: absolute; bottom: 0; width: 6px; height: 1px; background: var(--faint-ink); }
.unit-numbers.left div::after { right: 0; }
.unit-numbers.right div::after { left: 0; }

.rail { display: block; background: var(--rail); }
.rail .hole { fill: var(--rail-hole); }
.rail .hole.faint { opacity: 0.35; }

.strip-column { position: relative; background: var(--rack-void); }
.strip {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 6px 0;
    background: var(--strip);
    border: 1px solid var(--ink);
    border-radius: 3px;
    cursor: move;
}
.strip i { width: 5px; height: 5px; border-radius: 50%; background: var(--sheet); }

.panel { position: relative; overflow: hidden; background: var(--rack-void); }
.empty-unit { position: absolute; left: 4px; right: 4px; border: 1px solid var(--faint-ink); border-radius: 2px; pointer-events: none; }
.other-face { position: absolute; border: 1px dashed var(--ink); opacity: 0.35; pointer-events: none; }
.frame-back { position: absolute; background: var(--rack-void); border: 1px solid var(--faceplate-edge); pointer-events: none; }
.frame-slot {
    position: absolute;
    top: 0;
    border-left: 0.5px solid var(--faint-ink);
    border-right: 0.5px solid var(--faint-ink);
    color: var(--muted);
    text-align: center;
    padding-top: 1px;
    line-height: 1;
}

.gear {
    position: absolute;
    background: var(--faceplate);
    border: 1px solid var(--faceplate-edge);
    cursor: move;
    color: var(--ink);
    overflow: hidden;
}
.gear.loose { background: var(--front-gear); border-radius: 3px; }
.gear.card { border-radius: 1px; }
.gear.shelf { background: transparent; border-color: transparent; }
.gear.error, .strip.error { border: 2px solid var(--error); }
.gear.selected, .strip.selected { border: 2px solid var(--selection); }

.shelf-opening { position: absolute; border: 1px dashed var(--faceplate-edge); pointer-events: none; }
.shelf-label { position: absolute; left: 4px; top: 2px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.shelf-ear { position: absolute; top: 0; bottom: 0; background: var(--faceplate); border: 1px solid var(--faceplate-edge); pointer-events: none; }
.shelf-lip { position: absolute; left: 0; right: 0; bottom: 0; background: var(--faceplate); border: 1px solid var(--faceplate-edge); pointer-events: none; }

.screw {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 0.8px solid var(--rail-hole);
    background: var(--screw);
    pointer-events: none;
}

.face-text { position: absolute; overflow: hidden; pointer-events: none; line-height: 1.15; }
.face-text > span { position: absolute; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.face-text .maker { left: 0; top: 0; }
.face-text .model { left: 0; bottom: 0; }
.face-text .corner { right: 0; top: 0; display: flex; flex-direction: column; align-items: flex-end; text-overflow: clip; }
.face-text .centre {
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    color: var(--text);
    line-height: 1.05;
}
.face-text .centre > * { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.face-text .centre b { font-weight: 600; }
.face-text .panel-text { font-weight: 700; }

.drop-preview { position: absolute; border: 2px solid var(--error); background: #FF525233; border-radius: 2px; pointer-events: none; }
.drop-preview.valid { border-color: var(--success); background: #5CC07A33; }
.lasso { position: absolute; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 25%, transparent); pointer-events: none; }
.drop-message {
    margin: 8px auto 0;
    height: 30px;
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    overflow: hidden;
}

.section { margin-left: 18px; display: grid; grid-template-rows: 10px auto 14px auto; }
.section-cap { background: var(--frame); }
.section-cap.top { border-radius: 3px 3px 0 0; }
.section-cap.bottom { border-radius: 0 0 3px 3px; }
.section-sheet { position: relative; overflow: hidden; background: var(--sheet); border-left: 3px solid var(--frame); border-right: 3px solid var(--frame); }
.section-rail { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--faint-ink); pointer-events: none; }
.section-label { position: absolute; top: 2px; font-size: 9px; color: var(--faint-ink); pointer-events: none; }
.section-label.front { left: 6px; }
.section-label.rear { right: 6px; }
.section-item {
    position: absolute;
    border-style: solid;
    border-color: var(--ink);
    background: var(--front-gear);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 10px;
    padding: 0 3px;
    white-space: nowrap;
}
.section-item.rear { background: var(--rear-gear); }
.section-item.error { border-color: var(--error); }
.section-item.selected { border-color: var(--selection); }
.section-item span { overflow: hidden; text-overflow: ellipsis; }
.section-depth { font-size: 10px; color: var(--muted); text-align: center; margin: 6px auto 0; }

/* ===== Details ===== */

.details { overflow-y: auto; padding: 10px 0; min-height: 0; }
.card {
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 5px;
    padding: 12px;
    margin-bottom: 10px;
}
.card p { margin: 6px 0 0; }
.field { display: block; margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.field input, .field select { margin-top: 3px; font-size: 12px; }
.field i { font-style: italic; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-pair.narrow-first { grid-template-columns: 100px 1fr; }
.field-triple { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.totals { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.uuid { font-size: 10px; color: var(--muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slider-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.slider-row input { flex: 1; }
.swing { width: 40px; text-align: right; }
.card .segments { margin-top: 3px; }
.issue { display: flex; gap: 8px; margin-bottom: 6px; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; }
.dot.error { background: var(--error); }
.dot.warning { background: var(--warning); }

/* ===== Menus and dialogs ===== */

.menu-shield { position: fixed; inset: 0; z-index: 20; }
.menu {
    position: fixed;
    z-index: 21;
    min-width: 200px;
    padding: 4px;
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 5px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.menu-item { display: flex; justify-content: space-between; gap: 24px; width: 100%; border: none; background: transparent; text-align: left; }
.menu-item .gesture { color: var(--muted); }
.menu-separator { height: 1px; background: var(--stroke); margin: 4px 0; }

.dialog-shield {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 12, 18, 0.45);
    padding: 16px;
}
.dialog {
    width: 420px;
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.dialog.wide { width: 640px; }
.dialog.widest { width: 860px; }
.dialog-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.dialog-text { margin: 0 0 12px; line-height: 1.45; white-space: pre-line; }
.dialog-form .field:first-child { margin-top: 0; }
.dialog .segments { margin: 3px 8px 8px 0; }
.dialog-buttons { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 6px; margin-top: 14px; }
.dialog-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--stroke); border-radius: 4px; }
.problem { color: var(--error); margin: 8px 0 0; }
.check { display: flex; align-items: center; gap: 6px; margin-top: 4px; }

.lineups { width: 100%; border-collapse: collapse; }
.lineups th, .lineups td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--stroke); }
.lineups th { font-size: 11px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
.clickable { cursor: pointer; }
.clickable:hover, .pick:hover { background: var(--panel-alt); }

.pick { padding: 5px 8px; cursor: pointer; border-bottom: 1px solid var(--stroke); }
.pick.selected { background: var(--active-nav); }
.pick-name { font-weight: 600; }
.pick-size { float: right; color: var(--muted); }

.receptacles { display: grid; grid-template-columns: 1fr 300px; gap: 12px; }
.receptacle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; align-content: start; max-height: 55vh; overflow-y: auto; }
.receptacle { flex-direction: column; align-items: flex-start; height: auto; padding: 6px; white-space: normal; text-align: left; }
.receptacle span { font-size: 11px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.receptacle.used { background: var(--accent-soft); }
.receptacle.selected { border: 2px solid var(--selection); }
.receptacle-gear { max-height: 55vh; overflow-y: auto; }

/* ===== Plan drawing linework (from the same drawings as the DWG) ===== */

.drawing * { fill: none; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.drawing .text { stroke: none; font-family: Arial, Helvetica, sans-serif; white-space: pre; }
.drawing .fill { stroke: none; }
.l-rack-frame, .l-rack-title { stroke: var(--l-frame); }
.l-rack-rail { stroke: var(--l-rail); }
.l-rack-units { stroke: var(--l-units); }
.l-rack-equip { stroke: var(--l-equip); }
.l-rack-hidden { stroke: var(--l-hidden); stroke-dasharray: 6 4; }
.l-rack-door { stroke: var(--l-door); }
.l-rack-dim { stroke: var(--l-dim); }
.l-rack-label { stroke: var(--l-label); }
.l-rack-text { stroke: var(--l-text); }
.drawing .text.l-rack-frame, .drawing .fill.l-rack-frame, .drawing .text.l-rack-title { fill: var(--l-frame); }
.drawing .text.l-rack-rail, .drawing .fill.l-rack-rail { fill: var(--l-rail); }
.drawing .text.l-rack-units, .drawing .fill.l-rack-units { fill: var(--l-units); }
.drawing .text.l-rack-equip, .drawing .fill.l-rack-equip { fill: var(--l-equip); }
.drawing .text.l-rack-hidden, .drawing .fill.l-rack-hidden { fill: var(--l-hidden); }
.drawing .text.l-rack-door, .drawing .fill.l-rack-door { fill: var(--l-door); }
.drawing .text.l-rack-dim, .drawing .fill.l-rack-dim { fill: var(--l-dim); }
.drawing .text.l-rack-label, .drawing .fill.l-rack-label { fill: var(--l-label); }
.drawing .text.l-rack-text, .drawing .fill.l-rack-text { fill: var(--l-text); }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding: 10px 16px;
    background: var(--error);
    color: #fff;
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss { margin-left: 12px; cursor: pointer; color: inherit; }

/* The editor is made for a desktop; on a narrow screen the side columns fold away under the lineup. */
@media (max-width: 1000px) {
    .workspace { grid-template-columns: 1fr; grid-auto-rows: minmax(300px, auto); overflow-y: auto; padding: 0 10px; }
    .library, .details { border-right: none; }
}
