:root {
    --bg-window: #09090b;
    --bg-panel: #09090b;
    --bg-toolbar: #141e18;
    --bg-toolbar-hover: #1f2e24;
    --bg-card: #101914;
    --bg-card-hover: #16261d;
    --bg-card-selected: #102e20;
    --border-dark: #1c2e24;
    --border-green: #2e4a38;
    --accent-green: #10b981;
    --accent-light: #34d399;
    --accent-fail: #ef4444;
    --accent-fail-bg: #2e1414;
    --text-primary: #f4f4f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: var(--font-family);
    background-color: var(--bg-window);
    color: var(--text-primary);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* App Container */
.circuitflow-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background-color: var(--bg-window);
}

/* Window Titlebar (macOS style) */
.macos-titlebar {
    height: 36px;
    background-color: #070709;
    border-bottom: 1px solid #18181b;
    display: flex;
    align-items: center;
    padding: 0 14px;
    position: relative;
    flex-shrink: 0;
}

.traffic-lights {
    display: flex;
    gap: 8px;
    align-items: center;
}

.traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.traffic-light.close { background-color: #ff5f56; border: 1px solid #e0443e; }
.traffic-light.minimize { background-color: #ffbd2e; border: 1px solid #dea123; }
.traffic-light.maximize { background-color: #27c93f; border: 1px solid #1aab29; }

.titlebar-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

/* Main 3-Column Workspace */
.circuitflow-workspace {
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Left Sidebar (260px) */
.circuitflow-sidebar {
    width: 260px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px 24px 14px;
    gap: 16px;
}

.sidebar-heading {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-green);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.category-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-green);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 4px;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.component-tile {
    height: 64px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-green);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.component-tile:hover {
    border-color: var(--accent-green);
    background-color: var(--bg-card-hover);
    transform: translateY(-1px);
}

.component-tile.active {
    border-color: var(--accent-green);
    border-width: 1.5px;
    background-color: var(--bg-card-selected);
}

.component-preview-img {
    width: 44px;
    height: 32px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    pointer-events: none;
}

.component-preview-container {
    width: 46px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    margin: 0 auto;
}

.component-preview-svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    margin: auto;
    filter: drop-shadow(0 0 1px rgba(16, 185, 129, 0.4));
}

.component-glyph {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-green);
    line-height: 1;
}

.component-name {
    font-size: 8.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sidebar Action Buttons */
.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-sidebar {
    height: 40px;
    background-color: #1a241e;
    border: 1px solid var(--accent-green);
    border-radius: 8px;
    color: var(--accent-green);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-sidebar:hover {
    background-color: #22382c;
    border-color: #34d399;
    color: #34d399;
}

.btn-sidebar.btn-save {
    background-color: #16382b;
}

.btn-sidebar.btn-subtle {
    height: 38px;
    background-color: #141e18;
    border-color: var(--border-green);
    color: var(--accent-light);
}

.btn-sidebar.btn-subtle:hover {
    background-color: #1a2920;
    border-color: var(--accent-green);
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* DRC Status Card */
.drc-card {
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-green);
    background-color: #141e18;
    color: #d1d5db;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.drc-card.pass {
    border-color: var(--accent-green);
    background-color: #102e20;
    color: var(--accent-green);
}

.drc-card.fail {
    border-color: var(--accent-fail);
    background-color: var(--accent-fail-bg);
    color: var(--accent-fail);
}

.drc-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drc-errors-dashboard {
    margin-top: 8px;
    background-color: #1a1012;
    border: 1px solid #7f1d1d;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 11px;
}

.drc-errors-count {
    color: #f87171;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.drc-errors-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 140px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drc-error-item {
    color: #fca5a5;
    background-color: rgba(239, 68, 68, 0.12);
    border-left: 2px solid #ef4444;
    padding: 4px 6px;
    border-radius: 3px;
    line-height: 1.3;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10.5px;
}

.drc-pass-msg {
    margin-top: 6px;
    color: #10b981;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-refresh {
    background: transparent;
    border: none;
    color: var(--accent-green);
    font-size: 15px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.btn-refresh:hover {
    background: #1f2e24;
}

/* Center Canvas Container */
.circuitflow-canvas-container {
    position: relative;
    flex: 1;
    background-color: #050505;
    overflow: hidden;
}

.canvas-input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.canvas-svg {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.pcb-component-node {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    transition: filter 0.15s ease;
}

.pcb-component-node:active {
    cursor: grabbing;
}

.pcb-pin-node {
    cursor: crosshair;
}

.pcb-pin-node:hover circle {
    filter: drop-shadow(0 0 1px #34d399);
}

/* Floating Pill Toolbar */
.floating-toolbar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background-color: #141e18;
    border: 1px solid var(--border-green);
    border-radius: 16px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
}

.toolbar-btn {
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.toolbar-btn:hover:not(:disabled) {
    background-color: var(--bg-toolbar-hover);
    color: var(--accent-green);
}

.toolbar-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.toolbar-separator {
    width: 1px;
    height: 22px;
    background-color: var(--border-green);
    margin: 0 4px;
}

.toolbar-zoom-group {
    display: flex;
    align-items: center;
    background-color: #141e18;
    border: 1px solid var(--border-green);
    border-radius: 8px;
    padding: 0 2px;
    height: 30px;
}

.zoom-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background-color: var(--bg-toolbar-hover);
    color: var(--accent-green);
}

.zoom-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-green);
    width: 46px;
    text-align: center;
}

.toolbar-drc-btn {
    height: 30px;
    padding: 0 12px;
    background-color: #141e18;
    border: 1px solid var(--border-green);
    border-radius: 8px;
    color: var(--accent-light);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.toolbar-drc-btn:hover {
    background-color: #1c2e24;
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* Right Inspector (260px) */
.circuitflow-inspector {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    background-color: var(--bg-panel);
    border-left: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    gap: 16px;
    overflow-y: auto;
    overflow-x: hidden;
}

.inspector-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 70%;
    gap: 16px;
    color: var(--text-muted);
}

.inspector-empty-icon {
    font-size: 42px;
    opacity: 0.5;
}

.inspector-empty-text {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-green);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
}

.prop-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.prop-label {
    font-size: 11px;
    font-weight: 700;
    color: #e5e7eb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prop-input {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ffffff;
    font-size: 12px;
    height: 30px;
    padding: 0 8px;
    width: 140px;
    text-align: right;
    outline: none;
    font-family: inherit;
}

.prop-input:focus {
    border-color: var(--accent-green);
    background-color: rgba(255, 255, 255, 0.12);
}

.prop-input:read-only {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
}

/* Bottom Status Bar */
.circuitflow-statusbar {
    height: 40px;
    background-color: #000000;
    border-top: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    flex-shrink: 0;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.platform-badge {
    font-size: 14px;
}

.status-mode-pill {
    background-color: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-text {
    font-size: 11px;
    color: var(--text-secondary);
}

.status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-counter {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-green);
}

.status-drc-pill {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-drc-pill.idle { background-color: #141e18; color: #a1a1aa; border: 1px solid var(--border-green); }
.status-drc-pill.pass { background-color: #102e20; color: var(--accent-green); border: 1px solid var(--accent-green); }
.status-drc-pill.fail { background-color: var(--accent-fail-bg); color: var(--accent-fail); border: 1px solid var(--accent-fail); }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #111418;
    border: 1px solid var(--border-green);
    border-radius: 12px;
    width: 500px;
    max-width: 90vw;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-green);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--accent-green);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
}

.modal-body {
    padding: 18px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 13px;
    color: var(--text-primary);
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-green);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Drag-and-drop enhancements */
.library-item[draggable="true"] {
    cursor: grab;
}
.library-item[draggable="true"]:active {
    cursor: grabbing;
}
.circuitflow-canvas-container.drag-over {
    outline: 2px dashed #10b981;
    outline-offset: -4px;
}
.circuitflow-canvas-container.placement-mode {
    cursor: crosshair;
}
.circuitflow-canvas-container.panning,
.circuitflow-canvas-container.panning * {
    cursor: grabbing !important;
}
.circuitflow-canvas-container.placement-mode .pcb-component-node,
.circuitflow-canvas-container.placement-mode path,
.circuitflow-canvas-container.drag-over .pcb-component-node,
.circuitflow-canvas-container.drag-over path {
    pointer-events: none;
}
.pcb-placement-ghost {
    pointer-events: none;
}

/* Component Definition Header Card */
.comp-def-card {
    background-color: #111827;
    border: 1px solid #1d2d21;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.comp-def-label {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent-green);
    text-transform: uppercase;
}
.comp-def-id {
    font-size: 13px;
    font-weight: 800;
    color: #34d399;
}

/* Rotation Preset Buttons (0°, 90°, 180°, 270°) */
.rotation-presets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 4px;
}
.btn-rot,
.btn-rot-preset {
    height: 28px;
    background-color: #1a241e;
    border: 1px solid #10b981;
    border-radius: 6px;
    color: #10b981;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.btn-rot:hover,
.btn-rot-preset:hover {
    background-color: #22382c;
    border-color: #34d399;
    color: #34d399;
}
.btn-rot.active,
.btn-rot-preset.active {
    background-color: #10b981;
    color: #000000;
    border-color: #10b981;
}

/* Color Swatch Palette */
.color-palette-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.color-swatch-tile {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.15s ease;
}
.color-swatch-tile:hover {
    transform: scale(1.1);
}
.color-swatch-tile.selected {
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #27272a;
    transition: 0.2s;
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.2s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: #10b981;
}
input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Interactive Component Editor Modal */
.modal-component-editor {
    width: 95vw;
    max-width: 1280px;
    height: 90vh;
    max-height: 920px;
    background-color: #050c07;
    border: 1px solid #1a4a23;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
}

.comp-editor-header {
    height: 52px;
    background-color: #0a1a0f;
    border-bottom: 1px solid #1a4a23;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.comp-editor-title {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
}

.comp-editor-status {
    font-size: 11px;
    color: #10b981;
    margin-left: 12px;
}

.comp-editor-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 64px 1fr 300px;
    overflow: hidden;
}

.comp-editor-tools {
    background-color: #0a1a0f;
    border-right: 1px solid #1a4a23;
    padding: 8px 4px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.comp-editor-section-label {
    font-size: 8px;
    font-weight: 800;
    color: #065f46;
    text-transform: uppercase;
    margin-top: 8px;
    margin-bottom: 2px;
}

.comp-editor-tool-btn {
    width: 46px;
    height: 42px;
    background-color: #111b15;
    border: 1px solid #293b30;
    border-radius: 7px;
    color: #a1a1aa;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.comp-editor-tool-btn:hover {
    border-color: #6fbf91;
    color: #f3fff7;
    background-color: #172a1e;
}

.comp-editor-tool-btn.active {
    background-color: #2d6a4f;
    border-color: #6fbf91;
    color: #f3fff7;
    box-shadow: 0 0 8px rgba(111, 191, 145, 0.4);
}

.comp-editor-canvas-container {
    background-color: #050c07;
    position: relative;
    overflow: hidden;
}

.comp-editor-canvas-svg {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.comp-editor-panel {
    background-color: #0a1a0f;
    border-left: 1px solid #1a4a23;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comp-editor-panel-heading {
    font-size: 11px;
    font-weight: 800;
    color: #10b981;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid #1a4a23;
    padding-bottom: 6px;
}

.comp-editor-shapes-list {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background-color: #08120b;
    border: 1px solid #142e1b;
    border-radius: 6px;
    padding: 6px;
}

.comp-editor-shape-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #e5e7eb;
    cursor: pointer;
    background-color: #0f2115;
    border: 1px solid transparent;
}

.comp-editor-shape-item:hover {
    border-color: #10b981;
}

.comp-editor-shape-item.selected {
    border-color: #34d399;
    background-color: #163622;
}

/* Multi-Selection Stack & Inspector Details */
.selection-stack-header {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 78, 59, 0.25));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selection-stack-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.selection-stack-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #34d399;
    text-transform: uppercase;
}

.selection-count-badge {
    background-color: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.bulk-trace-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.selection-stack-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    padding-right: 2px;
}

.selection-stack-item-card {
    display: flex;
    align-items: stretch;
    background: #0f1c14;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    overflow: hidden;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.selection-stack-item-card:hover {
    border-color: rgba(16, 185, 129, 0.45);
    background: #13241a;
}

.selection-item-colorbar {
    width: 4px;
    flex-shrink: 0;
}

.selection-item-content {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.selection-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.selection-item-name {
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selection-item-type {
    font-size: 9px;
    font-weight: 700;
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 4px;
    padding: 1px 5px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.selection-item-desc {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selection-item-details {
    font-size: 10px;
    color: #6b7280;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    line-height: 1.3;
}

.selection-item-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4px 6px;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-item-action {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    padding: 0;
}

.btn-item-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.btn-item-action.delete:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #fca5a5;
}

.btn-item-action.isolate:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
    color: #6ee7b7;
}

/* Status Bar (bottom overlay matching MAUI) */
.circuitflow-statusbar {
    height: 34px;
    background-color: #070709;
    border-top: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-secondary);
    user-select: none;
    z-index: 20;
}

.statusbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.statusbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.os-platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    background: rgba(92, 46, 144, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 6px;
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: default;
    transition: all 0.2s ease;
}

.os-platform-badge:hover {
    background: rgba(92, 46, 144, 0.35);
    border-color: rgba(167, 139, 250, 0.55);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.25);
}

.os-platform-badge .os-icon.blazor-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    flex-shrink: 0;
}

.statusbar-metric {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.statusbar-metric-highlight {
    color: var(--accent-green);
    font-weight: 700;
}

.statusbar-left {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.statusbar-divider {
    width: 1px;
    height: 16px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.14), transparent);
    flex-shrink: 0;
}

/* Mode / message indicator */
.statusbar-mode {
    --mode-color: #6b7280;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    padding: 3px 10px 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--mode-color) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--mode-color) 28%, transparent);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.statusbar-mode.mode-ready { --mode-color: #10b981; background: transparent; border-color: transparent; }
.statusbar-mode.mode-place { --mode-color: #34d399; }
.statusbar-mode.mode-route { --mode-color: #f59e0b; }

.statusbar-mode-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mode-color);
    box-shadow: 0 0 6px var(--mode-color);
    flex-shrink: 0;
}

.statusbar-mode.mode-place .statusbar-mode-dot,
.statusbar-mode.mode-route .statusbar-mode-dot {
    animation: statusbar-pulse 1.4s ease-in-out infinite;
}

.statusbar-mode-label {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: var(--mode-color);
}

.statusbar-mode-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #d4d4d8;
    font-weight: 500;
}

/* Metric chips */
.statusbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 9px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #a1a1aa;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.statusbar-chip:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    color: #d4d4d8;
}

.statusbar-chip-icon {
    color: #71717a;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.statusbar-chip:hover .statusbar-chip-icon {
    color: var(--accent-green);
}

.statusbar-chip-value {
    font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: #e4e4e7;
}

/* Mouse coordinates chip */
.statusbar-mouse {
    min-width: 168px;
    font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

.statusbar-mouse .statusbar-chip-icon {
    color: #60a5fa;
}

.statusbar-coord {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    min-width: 58px;
    color: #e4e4e7;
    font-weight: 600;
}

.statusbar-coord-axis {
    font-size: 9px;
    font-weight: 800;
    color: #60a5fa;
}

.statusbar-coord-unit,
.statusbar-coord-empty {
    font-size: 9.5px;
    color: #71717a;
}

/* DRC pill */
.statusbar-drc-pill {
    --drc-color: #9ca3af;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--drc-color);
    background: color-mix(in srgb, var(--drc-color) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--drc-color) 45%, transparent);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.statusbar-drc-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 10px color-mix(in srgb, var(--drc-color) 35%, transparent);
    background: color-mix(in srgb, var(--drc-color) 22%, transparent);
}

.statusbar-drc-pill:active { transform: translateY(0); }

.statusbar-drc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--drc-color);
    box-shadow: 0 0 6px var(--drc-color);
}

.statusbar-drc-pill.pass { --drc-color: #34d399; }
.statusbar-drc-pill.fail { --drc-color: #f87171; }
.statusbar-drc-pill.idle { --drc-color: #9ca3af; }
.statusbar-drc-pill.checking { --drc-color: #fbbf24; }

.statusbar-drc-pill.checking .statusbar-drc-dot,
.statusbar-drc-pill.fail .statusbar-drc-dot {
    animation: statusbar-pulse 1.1s ease-in-out infinite;
}

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

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pcb-trace.hovered .trace-line {
    stroke: #34D399 !important;
    stroke-opacity: 1 !important;
    filter: drop-shadow(0 0 2px rgba(52, 211, 153, 0.85));
}

/* Tactile Keyboard Keycaps & OS Detection Badge */
.keycap-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}
.keycap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    background: linear-gradient(180deg, #1f3629 0%, #15261d 100%);
    border: 1px solid #2e523a;
    border-bottom: 2px solid #1a3825;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    color: #34d399;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    user-select: none;
}
.key-op {
    color: #10b981;
    font-weight: bold;
    font-size: 11px;
    margin: 0 1px;
}
.key-text {
    color: #d1d5db;
    font-size: 11px;
}
.os-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #102e20;
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 4px 10px;
}
.os-badge-title {
    color: #10b981;
    font-size: 11px;
    font-weight: bold;
}
.os-badge-sub {
    color: #34d399;
    font-size: 9px;
    font-weight: bold;
}

/* Shortcuts Modal & Modal Body Scrollbar */
.shortcuts-scroll-container,
.modal-body {
    scrollbar-width: thin;
    scrollbar-color: #10b981 #07140b;
}

.shortcuts-scroll-container::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    display: block !important;
}

.shortcuts-scroll-container::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: #07140b;
    border-radius: 4px;
}

.shortcuts-scroll-container::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #1c3b28;
    border: 1px solid #2e523a;
    border-radius: 4px;
    min-height: 40px;
}

.shortcuts-scroll-container::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #10b981;
}


