
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 400;
  src: url('/fonts/material-symbols.woff2') format('woff2');
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

/* =========================
   LAYOUT
   ========================= */

#app {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    gap: 0;
    position: relative;
}

/* =========================
   SIDEBAR
   ========================= */

#sidebar {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
}

.sidebar-header {
    padding: var(--space-5);
    background: transparent;
    border-bottom: var(--color-border);
    color: var(--color-text-primary);
}

#sidebar h2 {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

#sidebar h2::before {
    content: "memory";
    font-family: 'Material Symbols Outlined';
    font-size: 24px;
    color: var(--color-primary);
}

#component-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.component-item {
    background: var(--color-bg-tertiary);
    border: 1px solid transparent;
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
    border-radius: var(--radius-lg);
    cursor: grab;
    transition: all var(--transition-normal);
    user-select: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    position: relative;
    overflow: hidden;
}

.component-item:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.component-item:active {
    cursor: grabbing;
    transform: scale(0.98);
}

/* Analysis Dashboard Panel */
#analysis-panel {
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 50vh;
}

.analysis-section {
    border-bottom: 1px solid var(--color-border);
}

.analysis-section:last-child {
    border-bottom: none;
}

.analysis-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.analysis-section-header:hover {
    background: var(--color-bg-hover);
}

.analysis-section-header h3 {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    flex: 1;
}

.analysis-icon {
    font-size: 16px;
    color: var(--color-primary);
}

.toggle-icon {
    font-size: 18px;
    color: var(--color-text-tertiary);
    transition: transform 0.2s;
}

.analysis-section.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.analysis-section.collapsed .analysis-section-content {
    display: none;
}

.analysis-section-content {
    padding: 0 var(--space-4) var(--space-3);
}

/* Budget Grid */
.budget-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.budget-card {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.budget-label {
    font-size: 10px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.budget-value {
    font-family: var(--font-family-mono);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    color: var(--color-primary);
}

.budget-loss {
    color: #FF9800;
}

.budget-eff {
    color: #4CAF50;
}

/* Efficiency Bar */
.eff-bar {
    width: 100%;
    height: 4px;
    background: var(--color-bg-primary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.eff-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #F44336 0%, #FF9800 40%, #FFC107 60%, #4CAF50 85%, #00E676 100%);
    transition: width 0.4s ease;
    width: 0%;
}

/* Stages Table */
.stages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.stages-table th {
    color: var(--color-text-tertiary);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: var(--space-1) var(--space-2);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 9px;
    white-space: nowrap;
}

.stages-table td {
    padding: var(--space-1) var(--space-2);
    font-family: var(--font-family-mono);
    color: var(--color-text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    white-space: nowrap;
}

.stages-table tr {
    cursor: pointer;
    transition: background 0.15s;
}

.stages-table tbody tr:hover {
    background: var(--color-bg-hover);
}

.stage-name {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family-sans);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stage-type-badge {
    display: inline-block;
    padding: 0 4px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
}

.stage-type-Source {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
}

.stage-type-LDO {
    background: rgba(255, 193, 7, 0.15);
    color: #FFC107;
}

.stage-type-SMPS {
    background: rgba(156, 39, 176, 0.15);
    color: #CE93D8;
}

.stage-type-Load {
    background: rgba(33, 150, 243, 0.15);
    color: #64B5F6;
}

.stage-type-Resistor {
    background: rgba(139, 69, 19, 0.15);
    color: #A1887F;
}

.stage-type-Diode {
    background: rgba(233, 30, 99, 0.15);
    color: #F06292;
}

.stage-type-Zener {
    background: rgba(233, 30, 99, 0.15);
    color: #F06292;
}

.stage-type-OpAmp {
    background: rgba(255, 87, 34, 0.15);
    color: #FF8A65;
}

.eff-cell {
    font-weight: var(--font-weight-semibold);
}

.eff-good {
    color: #4CAF50;
}

.eff-ok {
    color: #FFC107;
}

.eff-poor {
    color: #FF9800;
}

.eff-bad {
    color: #F44336;
}

/* Warnings */
.warning-count-badge {
    background: #F44336;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.warning-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-2);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-1);
    cursor: pointer;
    transition: background 0.15s;
    font-size: var(--font-size-xs);
}

.warning-item:hover {
    background: var(--color-bg-hover);
}

.warning-item-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.warning-critical .warning-item-icon {
    color: #F44336;
}

.warning-caution .warning-item-icon {
    color: #FF9800;
}

.warning-info .warning-item-icon {
    color: #64B5F6;
}

.warning-item-text {
    flex: 1;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

.warning-item-node {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.analysis-empty {
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-xs);
    padding: var(--space-3) 0;
    margin: 0;
    font-style: italic;
}

/* Warning Badge on Canvas Nodes */
.node-warning-badge {
    pointer-events: none;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}

@keyframes warning-badge-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.node-warning-badge circle {
    animation: warning-badge-pulse 1.5s ease-in-out infinite;
}

/* =========================
   CANVAS AREA
   ========================= */

#canvas-area {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-primary);
    background-image: radial-gradient(circle, rgba(255, 183, 123, 0.07) 1px, transparent 1px);
    background-size: 30px 30px;
    overflow: hidden;
}

#toolbar {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    padding: var(--space-3) var(--space-4);
    border-bottom: var(--glass-border);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    z-index: 20;
}

#toolbar button {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

#toolbar button .material-symbols-outlined {
    font-size: 18px;
}

#toolbar button.toolbar-icon-only {
    padding: var(--space-1);
    min-width: 28px;
    min-height: 28px;
    justify-content: center;
}

#toolbar button:hover {
    background: var(--color-bg-hover);
    color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

#toolbar button:active {
    transform: scale(0.96);
}

#toolbar button.active {
    background: var(--color-primary-dark);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(255, 183, 123, 0.3);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--color-border);
    margin: 0 var(--space-2);
}

/* Knowledge Center toolbar links ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â styled like toolbar buttons */
.toolbar-btn-link {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    text-decoration: none;
    white-space: nowrap;
}
.toolbar-btn-link .material-symbols-outlined {
    font-size: 18px;
}
.toolbar-btn-link:hover {
    background: var(--color-bg-hover);
    color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
.toolbar-btn-link-articles:hover {
    color: #BAC8DA;
    border-color: #BAC8DA;
}
.toolbar-btn-link:active {
    transform: scale(0.96);
}

.toolbar-group {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    position: relative; /* anchor for BOM qty popup */
}

/* BOM Quantity Picker Popup */
.bom-qty-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 2000;
    min-width: 220px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: bomPopupIn 0.15s ease;
}

.bom-qty-popup.hidden {
    display: none;
}

@keyframes bomPopupIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bom-qty-popup-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bom-qty-popup-header .material-symbols-outlined {
    font-size: 14px;
    color: var(--color-primary);
}

.bom-qty-popup-body {
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.bom-qty-popup-body select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    cursor: pointer;
}

.bom-qty-popup-body select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 111, 217, 0.15);
}

.bom-qty-popup-body .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
}

.bom-qty-popup-body .btn-primary .material-symbols-outlined {
    font-size: 16px;
}

#tidy-mode {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

#tidy-mode:hover {
    border-color: var(--color-primary);
}

#tidy-mode:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-surface);
}

/* Toolbar select elements: dark/light-aware option popups */
#toolbar select {
    background-color: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    cursor: pointer;
    color-scheme: dark;
}

#toolbar select option {
    background-color: #1a232c;
    color: #ffffff;
}

#toolbar select:hover {
    border-color: var(--color-primary);
}

#toolbar select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-surface);
}

/* Light theme overrides for toolbar selects */
[data-theme="light"] #toolbar select {
    color-scheme: light;
}

[data-theme="light"] #toolbar select option {
    background-color: #ffffff;
    color: #212121;
}


/* =========================
   NODE COMPONENTS
   ========================= */

.node-group {
    transition: filter var(--transition-normal);
    user-select: none;
    -webkit-user-select: none;
}

/* Prevent SVG text inside nodes from capturing drag/selection events during wiring */
.node-group text {
    pointer-events: none;
}

.node-body {
    fill: var(--color-bg-elevated);
    stroke: var(--color-primary);
    stroke-width: 2px;
    rx: 8px;
    /* Rounded corners */
    filter: drop-shadow(0 0 10px rgba(255, 183, 123, 0.15));
    transition: all var(--transition-normal);
}

.node-group.selected .node-body {
    stroke: var(--color-success);
    stroke-width: 3px;
    filter: drop-shadow(0 0 15px rgba(255, 183, 123, 0.4));
}

.node-label {
    fill: var(--color-text-primary);
    font-family: var(--font-family);
    font-weight: var(--font-weight-bold);
    text-anchor: middle;
}

.node-stats-in,
.node-stats-out,
.node-stats-pd,
.node-part-badge {
    fill: var(--color-text-secondary);
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
}

#canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
    /* Required for flex child to shrink */
}

#canvas {
    width: 100%;
    height: 100%;
    cursor: default;
}

/* =========================
   PROPERTIES PANEL (Floating Overlay)
   ========================= */

#properties {
    position: fixed;
    right: 16px;
    top: 60px;
    width: 300px;
    max-height: calc(100vh - 80px);
    min-width: 220px;
    max-width: 500px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    border: var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    z-index: 500;
    overflow: hidden;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Resize Handle (left edge) --- */
#properties-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.2s;
}

#properties-resize-handle:hover,
#properties-resize-handle.dragging {
    background: var(--color-primary);
}

/* --- Draggable Header --- */
.properties-header {
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    cursor: move;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    user-select: none;
}

#properties h2 {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;
}

#properties h2::before {
    content: "tune";
    font-family: 'Material Symbols Outlined';
    font-size: 18px;
    color: var(--color-accent-light);
}

.properties-controls {
    display: flex;
    gap: var(--space-1);
    flex-shrink: 0;
}

.properties-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.properties-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* --- Content area --- */
#properties-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    font-size: var(--font-size-md);
    max-height: calc(100vh - 160px);
}

/* --- Collapsed state (header-only bar) --- */
#properties.collapsed #properties-content {
    display: none;
}

#properties.collapsed {
    max-height: none;
}

#properties.collapsed .properties-header {
    border-radius: var(--radius-lg);
}

#properties.collapsed #properties-resize-handle {
    display: none;
}

/* --- Hidden state --- */
#properties.panel-hidden {
    display: none;
}

.property-group {
    margin-bottom: var(--space-4);
}

.property-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

.property-group input,
.property-group select {
    width: 100%;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    font-family: var(--font-family-mono);
    transition: all var(--transition-normal);
    box-sizing: border-box;
}

.property-group input:focus,
.property-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-surface);
}

/* Input validation feedback */
.property-group input.input-invalid {
    border-color: #EF5350;
    box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.2);
    animation: input-shake 0.4s ease;
}

@keyframes input-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

.property-group select option {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.property-group input:hover,
.property-group select:hover {
    border-color: var(--color-border-light);
}

/* Property with unit suffix */
.property-input-wrapper {
    position: relative;
}

.property-input-wrapper input {
    padding-right: var(--space-10);
}

.property-unit {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

/* Tolerance UI */
.tolerance-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding-left: var(--space-2);
    border-left: 2px solid var(--color-border);
}

.tolerance-label {
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family-mono);
}

.tolerance-value-input {
    flex: 1;
    min-width: 0;
    padding: var(--space-2) !important;
    font-size: var(--font-size-sm) !important;
}

.tolerance-mode-select {
    width: auto !important;
    padding: var(--space-2) !important;
    font-size: var(--font-size-sm) !important;
    cursor: pointer;
}

.tolerance-range {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    font-family: var(--font-family-mono);
    white-space: nowrap;
    margin-left: auto;
}

/* Empty state for panels */
.empty-state {
    color: var(--color-text-tertiary);
    text-align: center;
    padding: var(--space-8) var(--space-4);
    font-style: italic;
}

/* Component Icons in sidebar */
.component-icon {
    font-size: var(--font-size-xl);
    line-height: 1;
}

.component-icon-svg {
    flex-shrink: 0;
    color: var(--color-text-secondary);
    transition: color var(--transition-normal);
}

.component-item:hover .component-icon-svg {
    color: var(--color-primary);
}

.component-name {
    flex: 1;
}

/* SVG Nodes */
.node-group {
    cursor: move;
    /* Note: No transition on transform - would conflict with JS drag positioning */
}

/* Note: Removed :active scale transform - it conflicts with JS translate and causes jump to 0,0 */

.node-body {
    fill: url(#node-gradient);
    stroke: #4CAF50;
    stroke-width: 2;
    rx: 8;
    ry: 8;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.4));
    transition: all 0.2s ease;
}

.node-group:hover .node-body {
    fill: url(#node-gradient-hover);
    stroke: #66BB6A;
    stroke-width: 2.5;
    filter: drop-shadow(2px 4px 8px rgba(76, 175, 80, 0.3));
}

.node-group.selected .node-body {
    stroke: #FFC107;
    stroke-width: 3;
    filter: drop-shadow(0 0 8px rgba(255, 193, 7, 0.5));
}

/* Thermal warning state */
.node-body.thermal-warning {
    stroke: #FF9800;
    animation: thermal-pulse 1s ease-in-out infinite alternate;
}

.node-body.thermal-danger {
    stroke: #f44336;
    animation: thermal-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes thermal-pulse {
    from {
        filter: drop-shadow(0 0 4px currentColor);
    }

    to {
        filter: drop-shadow(0 0 12px currentColor);
    }
}

.node-label {
    fill: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Directional stats text */
.node-stats-in {
    fill: #8bc9a0;
    font-size: 10px;
    text-anchor: start;
    pointer-events: none;
    font-family: var(--font-family-mono);
}

.node-stats-out {
    fill: #80b4d8;
    font-size: 10px;
    text-anchor: end;
    pointer-events: none;
    font-family: var(--font-family-mono);
}

.node-stats-pd {
    fill: #999;
    font-size: 10px;
    text-anchor: middle;
    pointer-events: none;
    font-family: var(--font-family-mono);
}

.port {
    fill: #4CAF50;
    stroke: #2a2a2a;
    stroke-width: 1;
    transition: all 0.2s ease;
}

.port:hover {
    fill: #66BB6A;
    stroke: #FFF;
    stroke-width: 2;
    filter: drop-shadow(0 0 4px #4CAF50);
}

/* Port highlight when connection is nearby - shows where wire will snap */
.port-highlight {
    fill: #FFC107 !important;
    stroke: #FFF !important;
    stroke-width: 2 !important;
    r: 10 !important;
    filter: drop-shadow(0 0 8px #FFC107) drop-shadow(0 0 16px #FFC107) !important;
    animation: port-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes port-pulse {
    from {
        filter: drop-shadow(0 0 8px #FFC107);
    }

    to {
        filter: drop-shadow(0 0 16px #FFC107);
    }
}

.port-hit {
    cursor: crosshair;
    fill: transparent;
    stroke: none;
}

.port-hit:hover+.port {
    fill: #66BB6A;
    stroke: #FFF;
    stroke-width: 2;
    filter: drop-shadow(0 0 4px #4CAF50);
}

.resize-handle {
    cursor: nwse-resize;
    opacity: 0.3;
}

.resize-handle:hover {
    opacity: 0.8;
}

/* Connections */
.connection-path {
    fill: none;
    stroke: #666;
    stroke-width: 3;
    stroke-linecap: round;
    cursor: pointer;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
    transition: stroke-width 0.2s;
}

/* Animated current flow effect */
/* Animated current flow effect - DISABLED
.connection-path.active {
    stroke-dasharray: 8 4;
    animation: current-flow 0.5s linear infinite;
}

@keyframes current-flow {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: -12;
    }
}
*/

.connection-path:hover {
    stroke-width: 4;
    filter: drop-shadow(0 0 4px var(--wire-color, #666));
}

.connection-path.selected {
    stroke: #2196F3;
    stroke-width: 4;
}

/* Wire grab handles ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â hidden by default, revealed on hover/select */
.wire-handle {
    opacity: 0;
    transition: opacity 0.2s ease, r 0.15s ease;
    pointer-events: all;
}

/* Invisible wide hit-area path that triggers hover on the wire group */
.connection-hit-area {
    fill: none;
    stroke: transparent;
    stroke-width: 18;
    pointer-events: stroke;
    cursor: pointer;
}

/* Reveal handles when hovering anywhere on the connection group */
.connection-group:hover .wire-handle {
    opacity: 0.7;
}

.connection-group:hover .wire-handle:hover {
    opacity: 1;
    r: 8;
}

/* Always show handles when the wire is selected */
.connection-group.selected .wire-handle {
    opacity: 1;
}

/* Heat Map */
.node-warm .node-body {
    stroke: #FFA726;
}

.node-hot .node-body {
    stroke: #F44336;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        stroke-opacity: 1;
    }

    50% {
        stroke-opacity: 0.5;
    }
}

/* Thermal Warning States */
.node-thermal-warning .node-body {
    stroke: #FF9800;
    stroke-width: 3;
    filter: drop-shadow(0 0 8px #FF9800);
}

.node-thermal-critical .node-body {
    stroke: #FF1744;
    stroke-width: 4;
    fill: #3a2020;
    animation: thermal-critical 0.5s infinite;
    filter: drop-shadow(0 0 12px #FF1744);
}

@keyframes thermal-critical {

    0%,
    100% {
        stroke-opacity: 1;
        transform: translateX(0);
    }

    25% {
        transform: translateX(-2px);
    }

    50% {
        stroke-opacity: 0.6;
    }

    75% {
        transform: translateX(2px);
    }
}

/* =========================
   LIGHT THEME ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â Canvas SVG Overrides
   ========================= */

[data-theme="light"] #canvas-area {
    background-image: radial-gradient(circle, rgba(37, 140, 244, 0.12) 1px, transparent 1px);
}

/* Node body ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â light fill, slate border */
[data-theme="light"] .node-body {
    fill: #f8fafc;
    stroke: #334155;
    stroke-width: 1.5;
    filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.10));
}

[data-theme="light"] .node-group:hover .node-body {
    fill: #f1f5f9;
    stroke: #475569;
    stroke-width: 2;
    filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.15));
}

[data-theme="light"] .node-group.selected .node-body {
    stroke: #2563eb;
    stroke-width: 2.5;
    filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.35));
}

/* Node label ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â dark text for light background */
[data-theme="light"] .node-label {
    fill: #0f172a;
    text-shadow: none;
}

/* Stats text ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â legible dark tones */
[data-theme="light"] .node-stats-in {
    fill: #15803d;
}

[data-theme="light"] .node-stats-out {
    fill: #1d4ed8;
}

[data-theme="light"] .node-stats-pd {
    fill: #64748b;
}

[data-theme="light"] .node-part-badge {
    fill: #64748b;
}

/* Ports */
[data-theme="light"] .port {
    fill: #22c55e;
    stroke: #e2e8f0;
    stroke-width: 1;
}

[data-theme="light"] .port:hover {
    fill: #16a34a;
    stroke: #334155;
    stroke-width: 2;
    filter: drop-shadow(0 0 4px #22c55e);
}

[data-theme="light"] .port-hit:hover + .port {
    fill: #16a34a;
    stroke: #334155;
    stroke-width: 2;
    filter: drop-shadow(0 0 4px #22c55e);
}

/* Wires / Connections */
[data-theme="light"] .connection-path {
    stroke: #475569;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

[data-theme="light"] .connection-path:hover {
    filter: drop-shadow(0 0 4px var(--wire-color, #475569));
}

[data-theme="light"] .connection-path.selected {
    stroke: #2563eb;
}

/* Thermal states on light theme */
[data-theme="light"] .node-body.thermal-warning {
    stroke: #ea580c;
}

[data-theme="light"] .node-body.thermal-danger {
    stroke: #dc2626;
}

[data-theme="light"] .node-thermal-warning .node-body {
    stroke: #ea580c;
    filter: drop-shadow(0 0 6px rgba(234, 88, 12, 0.4));
}

[data-theme="light"] .node-thermal-critical .node-body {
    stroke: #dc2626;
    fill: #fef2f2;
    filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.4));
}

[data-theme="light"] .node-warm .node-body {
    stroke: #ea580c;
}

[data-theme="light"] .node-hot .node-body {
    stroke: #dc2626;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* =========================
   MODAL STYLES
   ========================= */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: var(--font-size-lg);
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 1;
}

/* Back button for nested modal navigation */
.modal-back {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.85;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--space-2);
}

.modal-back:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateX(-2px);
}

.modal-back:active {
    transform: translateX(-1px) scale(0.95);
}

.modal-back .material-symbols-outlined {
    font-size: 20px;
}

.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    max-height: 60vh;
}

.shortcut-group {
    margin-bottom: var(--space-5);
}

.shortcut-group h3 {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border);
}

.shortcut {
    display: flex;
    align-items: center;
    padding: var(--space-2) 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

kbd {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-2);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    margin-right: var(--space-2);
    min-width: 24px;
    text-align: center;
}

/* ============================================================
   FIND PARTS MODAL
   ============================================================ */

.find-parts-content {
    max-width: 1400px;
    width: 95vw;
}

.find-parts-requirements {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
}

.req-row {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

.req-row label {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}


.req-row span {
    font-family: var(--font-family-mono);
    color: var(--color-primary);
    font-weight: 600;
    margin-right: var(--space-2);
}

/* Parts Results Table */
#find-parts-results {
    overflow-x: auto;
}

/* Circuit Context Fields (Phase 2) */
.req-context-field {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding-left: var(--space-2);
    border-left: 1px solid var(--color-border);
    margin-left: var(--space-1);
}

.req-context-field label {
    color: var(--color-text-tertiary);
    font-style: italic;
}

.req-context-field span {
    color: #FF9800;
}

/* Filter Tier Badge */
.fp-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: var(--space-3);
    letter-spacing: 0.2px;
}

.fp-badge-strict {
    background: rgba(76, 175, 80, 0.12);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.25);
}

.fp-badge-relaxed {
    background: rgba(255, 152, 0, 0.12);
    color: #FF9800;
    border: 1px solid rgba(255, 152, 0, 0.25);
}

.fp-badge-minimal {
    background: rgba(244, 67, 54, 0.10);
    color: #ef6c00;
    border: 1px solid rgba(244, 67, 54, 0.2);
}

/* Part Filters Panel */
.part-filters {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.part-filters h3 {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-row {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
    min-width: 160px;
}

.filter-group label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.filter-group select {
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.filter-group select:hover {
    border-color: var(--color-primary);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 199, 83, 0.15);
}

.filter-group select option {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

#parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

#parts-table th {
    background: #252525;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

#parts-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    vertical-align: middle;
}

#parts-table tr:hover {
    background: var(--color-bg-secondary);
}

.part-row-assigned {
    background: rgba(76, 175, 80, 0.08) !important;
    border-left: 3px solid #4CAF50;
}

/* Sortable Column Headers */
#parts-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

#parts-table th.sortable:hover {
    color: rgba(255, 255, 255, 0.85);
}

#parts-table th.sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 4px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

#parts-table th.sortable.sort-asc::after {
    border-bottom-color: var(--color-primary);
}

#parts-table th.sortable.sort-desc::after {
    border-bottom: none;
    border-top: 4px solid var(--color-primary);
}

/* Scrollable Results Table */
.fp-table-scroll {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

/* MPN Link */
.mpn-cell a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
}

.mpn-cell a:hover {
    text-decoration: underline;
}

/* Badges */
.pkg-badge {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    font-size: var(--font-size-xs);
    font-family: var(--font-family-mono);
}

.grade-badge {
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.grade-commercial {
    background: rgba(158, 158, 158, 0.15);
    color: #9E9E9E;
}

.grade-industrial {
    background: rgba(33, 150, 243, 0.15);
    color: #2196F3;
}

.grade-automotive {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

.grade-military {
    background: rgba(244, 67, 54, 0.15);
    color: #F44336;
}

.grade-space {
    background: rgba(156, 39, 176, 0.15);
    color: #9C27B0;
}

.stock-badge {
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.stock-in-stock {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
}

.stock-low-stock {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

.stock-lead-time {
    background: rgba(255, 193, 7, 0.15);
    color: #FFC107;
}

.stock-obsolete {
    background: rgba(244, 67, 54, 0.15);
    color: #F44336;
}

/* Apply Part Button */
.btn-apply-part {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-apply-part:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.btn-apply-part:disabled {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    cursor: default;
}

/* ============================================================
   PROPERTIES PANEL ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â FIND PARTS BUTTON & PART BADGE
   ============================================================ */

.find-parts-group {
    margin-top: var(--space-3);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-3);
}

.btn-find-parts {
    width: 100%;
    background: linear-gradient(135deg, var(--color-primary), #1976D2);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-find-parts:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.assigned-part-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: rgba(76, 175, 80, 0.08);
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
}

.part-badge-icon {
    font-size: 16px;
}

.part-badge-mpn {
    font-family: var(--font-family-mono);
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: #4CAF50;
}

.part-badge-mfg {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-left: auto;
}

/* Canvas Part Badge (below node) */
.node-part-badge {
    fill: #4CAF50;
    font-size: 9px;
    font-family: var(--font-family-mono);
    text-anchor: middle;
    font-weight: 600;
    opacity: 0.85;
}

/* ============================================================
   SETTINGS MODAL
   ============================================================ */

.settings-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--space-2);
    line-height: 1.4;
}

.btn-primary {
    width: 100%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--space-4);
    transition: filter 0.15s ease;
}

.btn-primary:hover {
    filter: brightness(1.15);
}

#settings-modal select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

#settings-modal select option,
#document-settings-modal select option,
#doc-settings-modal select option {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

#gemini-api-key {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-family: var(--font-family-mono);
}

/* =========================
   PRINT STYLES
   ========================= */
@media print {

    /* Hide UI Chrome */
    #sidebar,
    #toolbar,
    #properties,
    #sheet-tab-bar,
    .modal,
    #tidy-tools,
    #btn-exit-presentation {
        display: none !important;
    }

    /* Reset Layout for Print */
    #app {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        background: #ffffff !important;
    }

    #canvas-area {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: #ffffff !important;
        background-image: none !important;
        /* Hide dot grid */
    }

    /* Format SVG */
    #canvas {
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh;
        overflow: visible !important;
        display: block;
    }

    /* Print Header / Title Block */
    #canvas-area::after {
        content: "DC Power Architect \\A Generated: " attr(data-date);
        white-space: pre;
        display: block;
        font-family: "Inter", -apple-system, sans-serif;
        font-size: 10pt;
        color: #64748b;
        /* Slate 500 */
        text-align: right;
        padding-top: 20px;
        margin-top: 20px;
        border-top: 1px solid #e2e8f0;
        /* Slate 200 */
    }

    /* Professional Component Styling */
    .node-body {
        stroke: #334155 !important;
        /* Slate 700 */
        stroke-width: 1.5px !important;
        fill: #f8fafc !important;
        /* Slate 50 */
        filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.05)) !important;
        /* Subtle shadow */
        rx: 6px !important;
        /* Rounded corners */
    }

    .node-label {
        fill: #0f172a !important;
        /* Slate 900 */
        font-family: "Inter", -apple-system, sans-serif !important;
        font-weight: 600 !important;
        text-shadow: none !important;
    }

    .node-stats-in,
    .node-stats-out,
    .node-stats-pd,
    .node-part-badge {
        fill: #475569 !important;
        /* Slate 600 */
        font-family: "Inter", -apple-system, sans-serif !important;
    }

    /* Connection Lines */
    .connection-path {
        stroke: #334155 !important;
        /* Slate 700 */
        stroke-width: 1.5px !important;
    }

    .connection-arrow {
        fill: #334155 !important;
        /* Slate 700 */
    }

    /* Hide interactive-only elements from print */
    .port,
    .port-hit,
    .port-arrow,
    .wire-handle,
    .connection-hit-area,
    .resize-handle,
    .node-warning-badge,
    .selection-box {
        display: none !important;
    }

    body {
        background: #ffffff !important;
    }
}

/* =========================
   SHEET TAB BAR
   ========================= */

#sheet-tab-bar {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    min-height: 36px;
    user-select: none;
    overflow-x: auto;
    flex-shrink: 0;
}

#sheet-tabs {
    display: flex;
    gap: var(--space-1);
    align-items: center;
    overflow-x: auto;
    flex: 1;
}

.sheet-tab {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    min-width: 60px;
    justify-content: center;
}

.sheet-tab:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.sheet-tab.active {
    background: var(--color-bg-primary);
    color: var(--color-primary);
    border-color: var(--color-primary);
    font-weight: var(--font-weight-medium);
    box-shadow: 0 -2px 0 var(--color-primary) inset;
}

.sheet-tab-name {
    pointer-events: none;
}

.sheet-tab-rename-input {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-xs);
    padding: 1px 4px;
    font-size: var(--font-size-sm);
    font-family: inherit;
    outline: none;
    width: 80px;
}

#btn-add-sheet {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

#btn-add-sheet:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

#btn-add-sheet .material-symbols-outlined {
    font-size: 18px;
}

/* Sheet Context Menu */
.sheet-context-menu {
    position: fixed;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-1);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    min-width: 140px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
}

.context-menu-item:hover {
    background: var(--color-bg-tertiary);
}

.context-menu-item .material-symbols-outlined {
    font-size: 16px;
    color: var(--color-text-secondary);
}

.context-menu-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.context-menu-danger:hover,
.context-menu-danger:hover .material-symbols-outlined {
    color: var(--color-error);
}

/* =========================
   PRESENTATION MODE
   ========================= */

body.presentation-mode #sidebar,
body.presentation-mode #properties,
body.presentation-mode #toolbar {
    display: none !important;
}

body.presentation-mode .port,
body.presentation-mode .port-hit,
body.presentation-mode .port-arrow,
body.presentation-mode .wire-handle,
body.presentation-mode .connection-hit-area,
body.presentation-mode .resize-handle {
    display: none !important;
}

body.presentation-mode #app {
    grid-template-columns: 1fr;
}

#btn-exit-presentation {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-full);
    background: var(--color-primary-dark);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
}

#btn-exit-presentation:hover {
    background: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 199, 83, 0.4);
}

#btn-exit-presentation.hidden {
    display: none !important;
}

/* =========================
   ADVERTISEMENTS (PROTOTYPE MVP)
   ========================= */

.ad-container {
    background-color: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    margin: 0.5rem 0.75rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    max-height: 80px;
}

.ad-container:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.ad-container.empty {
    border-style: dashed;
    opacity: 0.6;
}

.ad-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.ad-label {
    position: absolute;
    top: 2px;
    right: 6px;
    font-size: 0.55rem;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ad-image {
    max-width: 100%;
    max-height: 60px;
    object-fit: contain;
}

.ad-text {
    font-size: 0.75rem;
    color: var(--color-text-primary);
    font-weight: 500;
}

.ad-cta {
    font-size: 0.65rem;
    color: var(--color-primary);
    font-weight: 600;
    margin-top: 0.15rem;
}

/* ============================================================
   SIGN-IN MODAL (Multi-Provider)
   ============================================================ */

.btn-sign-in {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    border: none;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-sign-in:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 199, 83, 0.35);
}

.sign-in-modal-content {
    max-width: 420px;
    width: 90vw;
}

.sign-in-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-5);
    line-height: 1.5;
}

/* --- Provider Buttons --- */

.sign-in-providers {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.btn-auth-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--color-border);
    font-family: var(--font-family-base);
}

.btn-auth-provider:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-auth-provider:active {
    transform: translateY(0);
}

/* Google */
.btn-auth-google {
    background: #ffffff;
    color: #3c4043;
    border-color: #dadce0;
}

.btn-auth-google:hover {
    background: #f8f9fa;
    border-color: #c6c9cd;
}

/* Apple */
.btn-auth-apple {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
}

.btn-auth-apple:hover {
    background: #1a1a1a;
}

/* Facebook */
.btn-auth-facebook {
    background: #1877F2;
    color: #ffffff;
    border-color: #1877F2;
}

.btn-auth-facebook:hover {
    background: #166FE5;
}

/* Light theme overrides */
[data-theme="light"] .btn-auth-google {
    background: #ffffff;
    color: #3c4043;
    border-color: #dadce0;
}

[data-theme="light"] .btn-auth-apple {
    background: #000000;
    color: #ffffff;
}

/* --- Divider --- */

.sign-in-divider {
    display: flex;
    align-items: center;
    margin: var(--space-4) 0;
}

.sign-in-divider::before,
.sign-in-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.sign-in-divider span {
    padding: 0 var(--space-3);
    color: var(--color-text-tertiary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* --- Email Form --- */

.sign-in-email-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.sign-in-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-family: var(--font-family-base);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.sign-in-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 199, 83, 0.12);
}

.sign-in-input::placeholder {
    color: var(--color-text-tertiary);
}

.sign-in-error {
    color: #ef4444;
    font-size: var(--font-size-xs);
    margin: 0;
    min-height: 16px;
    text-align: center;
}

.btn-auth-email-submit {
    width: 100%;
    padding: 12px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family-base);
}

.btn-auth-email-submit:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.btn-auth-email-toggle {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
    cursor: pointer;
    text-align: center;
    padding: var(--space-2);
    transition: color 0.15s ease;
    font-family: var(--font-family-base);
}

.btn-auth-email-toggle:hover {
    color: var(--color-primary);
}

/* =========================
   TOAST NOTIFICATIONS
   ========================= */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-2);
    pointer-events: none;
    max-width: 420px;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xl), 0 0 20px rgba(0, 0, 0, 0.2);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    pointer-events: auto;
    animation: toast-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    min-width: 280px;
}

.toast .material-symbols-outlined {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    flex-shrink: 0;
    line-height: 1;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}

/* Type-specific styling */
.toast-info {
    border-left: 3px solid #42A5F5;
}

.toast-info .material-symbols-outlined {
    color: #42A5F5;
}

.toast-success {
    border-left: 3px solid #66BB6A;
}

.toast-success .material-symbols-outlined {
    color: #66BB6A;
}

.toast-warning {
    border-left: 3px solid #FFA726;
}

.toast-warning .material-symbols-outlined {
    color: #FFA726;
}

.toast-error {
    border-left: 3px solid #EF5350;
}

.toast-error .material-symbols-outlined {
    color: #EF5350;
}

/* Animations */
@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast-fade-out {
    animation: toast-fade-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
}

/* =========================
   ACCOUNT SETTINGS ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Å“ Logout & Support Buttons
   ========================= */

/* Logout Button ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â red danger styling, clearly readable */
.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(239, 83, 80, 0.12);
    color: #EF5350;
    border: 1px solid rgba(239, 83, 80, 0.3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-logout:hover {
    background: rgba(239, 83, 80, 0.22);
    border-color: #EF5350;
    box-shadow: 0 0 12px rgba(239, 83, 80, 0.15);
    transform: translateY(-1px);
}

.btn-logout:active {
    transform: scale(0.98);
}

.btn-logout .material-symbols-outlined {
    font-size: 20px;
}

/* Customer Support Button ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â styled outline */
.btn-support {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(37, 140, 244, 0.08);
    color: var(--color-primary);
    border: 1px solid rgba(37, 140, 244, 0.25);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-support:hover {
    background: rgba(37, 140, 244, 0.16);
    border-color: var(--color-primary);
    box-shadow: 0 0 12px rgba(37, 140, 244, 0.15);
    transform: translateY(-1px);
}

.btn-support:active {
    transform: scale(0.98);
}

.btn-support .material-symbols-outlined {
    font-size: 20px;
}

/* =========================
   CUSTOMER SUPPORT MODAL
   ========================= */

.support-action-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.support-action-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: left;
    font-family: var(--font-family);
}

.support-action-item:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.support-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.support-action-icon .material-symbols-outlined {
    font-size: 22px;
}

.support-action-icon.icon-manage {
    background: rgba(37, 140, 244, 0.12);
    color: var(--color-primary);
}

.support-action-icon.icon-contact {
    background: rgba(0, 230, 118, 0.12);
    color: var(--color-success);
}

.support-action-icon.icon-faq {
    background: rgba(255, 171, 0, 0.12);
    color: var(--color-warning);
}

.support-action-icon.icon-delete {
    background: rgba(239, 83, 80, 0.12);
    color: #EF5350;
}

.support-action-text {
    flex: 1;
    min-width: 0;
}

.support-action-label {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.support-action-desc {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    line-height: 1.3;
}

.support-action-arrow {
    color: var(--color-text-tertiary);
    font-size: 18px;
    flex-shrink: 0;
    transition: transform var(--transition-normal);
}

.support-action-item:hover .support-action-arrow {
    transform: translateX(3px);
    color: var(--color-primary);
}

/* Contact support overlay */
.contact-support-overlay {
    background: rgba(59, 111, 217, 0.06);
    border: 1px solid rgba(59, 111, 217, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-top: var(--space-3);
    display: none;
}

.contact-support-overlay.visible {
    display: block;
    animation: slideDown 0.2s ease;
}

.contact-support-overlay h4 {
    color: var(--color-primary);
    font-size: var(--font-size-md);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.contact-support-overlay p {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
    line-height: 1.5;
}

.contact-email-box {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.contact-email-text {
    flex: 1;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-semibold);
    user-select: all;
}

.btn-copy-email {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-xs);
    font-family: var(--font-family);
    transition: all var(--transition-normal);
}

.btn-copy-email:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-copy-email.copied {
    background: rgba(76, 175, 80, 0.15);
    border-color: #4CAF50;
    color: #4CAF50;
}

.contact-support-actions {
    display: flex;
    gap: var(--space-2);
}

.btn-contact-cancel {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-contact-cancel:hover {
    background: var(--color-bg-hover);
}

/* Delete account confirmation overlay */
.delete-confirm-overlay {
    background: rgba(239, 83, 80, 0.06);
    border: 1px solid rgba(239, 83, 80, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-top: var(--space-3);
    display: none;
}

.delete-confirm-overlay.visible {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.delete-confirm-overlay h4 {
    color: #EF5350;
    font-size: var(--font-size-md);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.delete-confirm-overlay p {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
    line-height: 1.5;
}

.delete-confirm-overlay input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family-mono);
    margin-bottom: var(--space-3);
}

.delete-confirm-overlay input:focus {
    outline: none;
    border-color: #EF5350;
    box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.15);
}

.delete-confirm-actions {
    display: flex;
    gap: var(--space-2);
}

.btn-delete-confirm {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: #EF5350;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
    opacity: 0.5;
    pointer-events: none;
}

.btn-delete-confirm.enabled {
    opacity: 1;
    pointer-events: auto;
}

.btn-delete-confirm.enabled:hover {
    background: #D32F2F;
    box-shadow: 0 0 12px rgba(239, 83, 80, 0.3);
}

.btn-delete-cancel {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-delete-cancel:hover {
    background: var(--color-bg-hover);
}

/* =========================
   FAQ & HELP CENTER
   ========================= */

.faq-modal-content {
    max-width: 700px;
    width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.faq-body {
    padding: var(--space-4) var(--space-5) !important;
    max-height: none !important;
    flex: 1;
    overflow-y: auto;
}

.faq-intro {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

/* Accordion sections */
.faq-section {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.faq-section:hover {
    box-shadow: 0 0 0 1px rgba(59, 111, 217, 0.15);
}

.faq-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    background: var(--color-bg-tertiary);
    transition: background 0.15s ease;
    user-select: none;
}

.faq-section-header:hover {
    background: var(--color-bg-hover);
}

.faq-section-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: white;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.faq-section-header h3 {
    margin: 0;
    font-size: var(--font-size-md);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-semibold);
}

.faq-section-subtitle {
    margin: 2px 0 0;
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
}

.faq-chevron {
    margin-left: auto;
    font-size: 20px;
    color: var(--color-text-tertiary);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.faq-section.expanded .faq-chevron {
    transform: rotate(180deg);
}

/* Section body (hidden by default) */
.faq-section-body {
    display: none;
    padding: var(--space-3) var(--space-4) var(--space-4);
    border-top: 1px solid var(--color-border);
    animation: faqFadeIn 0.2s ease;
}

.faq-section.expanded .faq-section-body {
    display: block;
}

@keyframes faqFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.faq-section-body p {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-3);
}

.faq-section-body ul,
.faq-section-body ol {
    padding-left: var(--space-4);
    margin-bottom: var(--space-3);
}

.faq-section-body li {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-2);
}

.faq-section-body li strong {
    color: var(--color-text-primary);
}

/* Tutorial illustrations */
.faq-illustration {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    margin-bottom: var(--space-3);
    box-shadow: var(--shadow-md);
}

/* Tip callout */
.faq-tip {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: rgba(255, 193, 7, 0.06);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: var(--radius-md);
    margin-top: var(--space-2);
}

.faq-tip .material-symbols-outlined {
    color: #FFC107;
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.faq-tip span:last-child {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.faq-tip kbd {
    font-size: 10px;
    padding: 1px 4px;
}

/* Component reference table */
.faq-component-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-3);
}

.faq-component-table th {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-2) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.faq-component-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.faq-component-table td strong {
    color: var(--color-text-primary);
}

.faq-component-table tr:hover {
    background: var(--color-bg-secondary);
}

/* Keyboard shortcut table */
.faq-shortcut-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.faq-shortcut-table th {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-2) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.faq-shortcut-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.faq-shortcut-table tr:hover {
    background: var(--color-bg-secondary);
}

/* =========================
   AI INSIGHTS (Sprint 7)
   ========================= */

/* --- AI Panel Modal Sub-elements --- */
.ai-insights-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* --- AI Toolbar Buttons --- */
.btn-ai-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(75, 43, 238, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(75, 43, 238, 0.25);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ai-toolbar:hover {
    background: rgba(75, 43, 238, 0.22);
    border-color: #7c3aed;
    box-shadow: 0 0 12px rgba(75, 43, 238, 0.2);
    transform: translateY(-1px);
}

.btn-ai-toolbar:active { transform: scale(0.98); }
.btn-ai-toolbar:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ai-toolbar .material-symbols-outlined {
    font-size: 16px;
}

/* --- Summary Card --- */
.ai-summary-card {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
}

.ai-summary-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    color: #7c3aed;
}

.ai-summary-label .material-symbols-outlined {
    font-size: 16px;
}

.ai-summary-label span:last-child {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-primary);
}

.ai-summary-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* --- Suggestion Cards --- */
.ai-suggestions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
}

.ai-suggestions-header h4 {
    margin: 0;
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-tertiary);
}

.ai-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.ai-suggestion-card {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.ai-suggestion-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Severity-specific card borders */
.ai-suggestion-card[data-severity="info"] {
    border-left: 3px solid #42A5F5;
}
.ai-suggestion-card[data-severity="warning"] {
    border-left: 3px solid #FFA726;
}
.ai-suggestion-card[data-severity="critical"] {
    border-left: 3px solid #EF5350;
}

.ai-suggestion-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.ai-suggestion-type {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-suggestion-type .material-symbols-outlined {
    font-size: 14px;
}

.ai-suggestion-type span:last-child {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Severity icons + text colors */
.ai-suggestion-card[data-severity="info"] .ai-suggestion-type { color: #42A5F5; }
.ai-suggestion-card[data-severity="warning"] .ai-suggestion-type { color: #FFA726; }
.ai-suggestion-card[data-severity="critical"] .ai-suggestion-type { color: #EF5350; }

/* Severity badge backgrounds */
.ai-suggestion-card[data-severity="info"] .ai-suggestion-card-header {
    background: rgba(66, 165, 245, 0.08);
}
.ai-suggestion-card[data-severity="warning"] .ai-suggestion-card-header {
    background: rgba(255, 167, 38, 0.08);
}
.ai-suggestion-card[data-severity="critical"] .ai-suggestion-card-header {
    background: rgba(239, 83, 80, 0.08);
}

.ai-suggestion-dismiss {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    display: flex;
}

.ai-suggestion-dismiss:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.ai-suggestion-dismiss .material-symbols-outlined {
    font-size: 16px;
}

.ai-suggestion-card-body {
    padding: var(--space-3);
}

.ai-suggestion-component {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.ai-suggestion-confidence {
    font-size: 10px;
    font-family: var(--font-family-mono);
    color: var(--color-text-tertiary);
    background: var(--color-bg-secondary);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    margin-left: var(--space-2);
}

.ai-suggestion-reason {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* --- Loading Spinner --- */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) 0;
}

.ai-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(75, 43, 238, 0.15);
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-loading-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    animation: ai-pulse 1.5s ease-in-out infinite;
}

@keyframes ai-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- Error State --- */
.ai-error-card {
    background: rgba(239, 83, 80, 0.06);
    border: 1px solid rgba(239, 83, 80, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.ai-error-card .material-symbols-outlined {
    color: #EF5350;
    font-size: 20px;
    flex-shrink: 0;
}

.ai-error-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    flex: 1;
}

.btn-ai-retry {
    background: rgba(239, 83, 80, 0.12);
    color: #EF5350;
    border: 1px solid rgba(239, 83, 80, 0.3);
    border-radius: var(--radius-md);
    padding: 4px 12px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-ai-retry:hover {
    background: rgba(239, 83, 80, 0.22);
    border-color: #EF5350;
}

/* --- Privacy Footer --- */
.ai-privacy-footer {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3);
    border-top: 1px solid var(--color-border);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.ai-privacy-footer .material-symbols-outlined {
    color: var(--color-text-tertiary);
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.ai-privacy-text {
    font-size: 10px;
    color: var(--color-text-tertiary);
    line-height: 1.4;
}

.ai-privacy-text a {
    color: #7c3aed;
    font-weight: var(--font-weight-bold);
    text-decoration: none;
}

/* --- Suggest Architecture Overlay --- */
.ai-suggest-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ai-overlay-in 0.2s ease;
}

@keyframes ai-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-suggest-panel {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl), 0 0 60px rgba(75, 43, 238, 0.1);
    animation: ai-panel-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ai-panel-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.ai-suggest-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.ai-suggest-panel-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.ai-suggest-panel-header h3 .material-symbols-outlined {
    color: #7c3aed;
    font-size: 22px;
}

.ai-suggest-close {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.ai-suggest-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-primary);
}

.ai-suggest-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* --- Upgrade Modal --- */
.ai-upgrade-card {
    background: linear-gradient(135deg, rgba(75, 43, 238, 0.08), rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(75, 43, 238, 0.25);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-align: center;
}

.ai-upgrade-card .material-symbols-outlined {
    font-size: 32px;
    color: #7c3aed;
    margin-bottom: var(--space-2);
}

.ai-upgrade-card h4 {
    margin: 0 0 var(--space-2);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.ai-upgrade-card p {
    margin: 0 0 var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.btn-ai-upgrade {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #4b2bee, #6366f1);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(75, 43, 238, 0.25);
}

.btn-ai-upgrade:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* --- Utility: hide AI elements when disabled --- */
.ai-hidden {
    display: none !important;
}

/* =========================
   TEXTBOX ANNOTATIONS (Sprint 8A)
   ========================= */

.textbox-node-group {
    cursor: move;
}

.textbox-node-body {
    fill: rgba(30, 30, 30, 0.6);
    stroke: var(--color-border);
    stroke-width: 1.5;
    rx: 6;
    ry: 6;
    transition: fill 0.15s ease, stroke 0.15s ease;
}

.textbox-node-group.selected .textbox-node-body {
    stroke: var(--color-primary);
    stroke-width: 2;
    stroke-dasharray: 6 3;
}

.textbox-name-label {
    fill: var(--color-text-tertiary);
    font-size: 9px;
    font-family: var(--font-family-mono);
    pointer-events: none;
}

.textbox-content {
    padding: 8px 10px;
    color: var(--color-text-primary);
    font-family: var(--font-family);
    line-height: 1.4;
    word-wrap: break-word;
    overflow: hidden;
    box-sizing: border-box;
    pointer-events: none;
    user-select: none;
}

.textbox-editing {
    width: 100%;
    height: 100%;
    padding: 8px 10px;
    color: var(--color-text-primary);
    background: rgba(20, 20, 20, 0.85);
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    font-family: var(--font-family);
    line-height: 1.4;
    resize: none;
    outline: none;
    box-sizing: border-box;
    box-shadow: 0 0 0 3px rgba(59, 111, 217, 0.2);
}

.textbox-node-group .resize-handle {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.textbox-node-group:hover .resize-handle,
.textbox-node-group.selected .resize-handle {
    opacity: 0.3;
}

/* Light theme overrides */
[data-theme="light"] .textbox-node-body {
    fill: rgba(255, 255, 255, 0.85);
    stroke: #ccc;
}

[data-theme="light"] .textbox-editing {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
}

/* =========================
   SPRINT 8B: SHARING & EDIT LOCKS
   ========================= */

/* Cloud Designs Tab Navigation */
.cloud-designs-tabs {
    display: flex;
    gap: 0;
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
}

.cloud-tab {
    padding: var(--space-2) var(--space-4);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cloud-tab:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.cloud-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
}

/* Share Modal */
.share-input-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.share-email-input {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
}

.share-email-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 111, 217, 0.15);
}

.share-permissions-select {
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    cursor: pointer;
}

.share-send-btn {
    padding: var(--space-2) var(--space-4) !important;
    margin: 0 !important;
    white-space: nowrap;
}

.share-error {
    color: #EF5350;
    font-size: var(--font-size-xs);
    margin: var(--space-2) 0 0;
    display: none;
}

.share-error.visible {
    display: block;
}

.share-success {
    color: #66BB6A;
    font-size: var(--font-size-xs);
    margin: var(--space-2) 0 0;
    display: none;
}

.share-success.visible {
    display: block;
}

.share-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-3) 0;
}

.share-list-heading {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-2);
    font-weight: var(--font-weight-semibold);
}

.share-existing-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.share-empty {
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
    padding: var(--space-3);
}

.share-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.share-item-info {
    flex: 1;
    min-width: 0;
}

.share-item-name {
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-item-email {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Permission badge */
.perm-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.perm-badge-view {
    background: rgba(66, 165, 245, 0.12);
    color: #42A5F5;
}

.perm-badge-edit {
    background: rgba(102, 187, 106, 0.12);
    color: #66BB6A;
}

.perm-badge-clone {
    background: rgba(255, 167, 38, 0.12);
    color: #FFA726;
}

.share-item-revoke {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.share-item-revoke:hover {
    color: #EF5350;
    background: rgba(239, 83, 80, 0.1);
}

.share-item-revoke .material-symbols-outlined {
    font-size: 16px;
}

/* Cloud designs share button */
.btn-share-design {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.btn-share-design:hover {
    color: var(--color-primary);
    background: rgba(59, 111, 217, 0.1);
}

.btn-share-design .material-symbols-outlined {
    font-size: 16px;
}

/* Shared design card extras */
.shared-owner-badge {
    font-size: 10px;
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.shared-owner-badge .material-symbols-outlined {
    font-size: 12px;
}

/* Read-Only Indicator (inline toolbar chip) */
.readonly-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px 3px 6px;
    margin-left: var(--space-2);
    background: rgba(255, 152, 0, 0.12);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 16px;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: #FFA726;
    white-space: nowrap;
    animation: readonlyFadeIn 0.25s ease;
    transition: all 0.2s ease;
}

.readonly-indicator.hidden {
    display: none;
}

@keyframes readonlyFadeIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.readonly-indicator-icon {
    font-size: 14px;
    color: #FFA726;
}

.readonly-indicator-text {
    font-size: 11px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Editing state overrides */
.readonly-indicator.editing-active {
    background: rgba(102, 187, 106, 0.12);
    border-color: rgba(102, 187, 106, 0.3);
    color: #66BB6A;
}

.readonly-indicator.editing-active .readonly-indicator-icon {
    color: #66BB6A;
}

/* Inline edit lock buttons */
.btn-request-edit-inline,
.btn-release-edit-inline {
    padding: 2px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    font-size: 10px;
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 4px;
}

.btn-request-edit-inline:hover {
    background: rgba(255, 152, 0, 0.25);
    border-color: rgba(255, 152, 0, 0.5);
}

.btn-release-edit-inline {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
    color: #66BB6A;
}

.btn-release-edit-inline:hover {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

/* Read-only canvas overlay hint */
.canvas-readonly-overlay {
    pointer-events: none;
    opacity: 0.7;
}

/* =========================
   SPRINT 8C: TEAM WORKSPACES
   ========================= */

.team-section {
    margin-bottom: var(--space-3);
}

.team-section h4 {
    margin: 0;
}

#team-workspace-selector {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4) 0;
    background: var(--color-bg-secondary);
}

#team-workspace-select {
    flex: 1;
    appearance: auto;
}

#team-workspace-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* =========================
   LIGHT THEME ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â App Editor UI
   Comprehensive overrides for sidebar, toolbar, panels, modals
   ========================= */

/* Scrollbars */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: #f3f4f6;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #d1d5db;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Sidebar */
[data-theme="light"] #sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid #e5e7eb;
}

[data-theme="light"] .sidebar-header {
    border-bottom-color: #e5e7eb;
}

[data-theme="light"] .component-item {
    background: #f3f4f6;
}

[data-theme="light"] .component-item:hover {
    background: #e5e7eb;
    border-color: #3B82F6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}

/* Toolbar */
[data-theme="light"] #toolbar {
    background: #ffffff;
    border-bottom-color: #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] #toolbar button {
    color: #374151;
}

[data-theme="light"] #toolbar button:hover {
    background: #f3f4f6;
    color: #1f2937;
}

[data-theme="light"] #toolbar button:active,
[data-theme="light"] #toolbar button.active {
    background: rgba(59, 130, 246, 0.1);
    color: #3B82F6;
}

[data-theme="light"] .toolbar-divider {
    background: #e5e7eb;
}

[data-theme="light"] .toolbar-btn-link {
    color: #374151;
}

[data-theme="light"] .toolbar-btn-link:hover {
    color: #3B82F6;
    background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .btn-ai-toolbar {
    color: #374151;
}

[data-theme="light"] .btn-ai-toolbar:hover {
    background: rgba(59, 130, 246, 0.08);
    color: #3B82F6;
}

/* Canvas container */
[data-theme="light"] #canvas-container {
    background: #f9fafb;
}

[data-theme="light"] .canvas-background {
    fill: #f1f5f9;
}

/* Properties panel */
[data-theme="light"] #properties {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .properties-header {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: white;
}

[data-theme="light"] .properties-header h2 {
    color: white;
}

[data-theme="light"] .properties-btn {
    color: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .properties-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] #properties-content input,
[data-theme="light"] #properties-content select {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] #properties-content input:focus,
[data-theme="light"] #properties-content select:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

[data-theme="light"] #properties-content label {
    color: #374151;
}

[data-theme="light"] .property-unit {
    color: #6b7280;
}

/* Analysis panel */
[data-theme="light"] #analysis-panel {
    border-top-color: #e5e7eb;
}

[data-theme="light"] .analysis-section {
    border-bottom-color: #e5e7eb;
}

[data-theme="light"] .analysis-section-header {
    color: #374151;
}

[data-theme="light"] .analysis-section-header:hover {
    background: #f3f4f6;
}

[data-theme="light"] .budget-card {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

[data-theme="light"] .budget-label {
    color: #6b7280;
}

[data-theme="light"] .budget-value {
    color: #1f2937;
}

[data-theme="light"] .stages-table th {
    background: #f3f4f6;
    color: #6b7280;
    border-bottom-color: #e5e7eb;
}

[data-theme="light"] .stages-table td {
    border-bottom-color: #f3f4f6;
    color: #374151;
}

[data-theme="light"] .stages-table tr:hover {
    background: #f9fafb;
}

/* Modals */
[data-theme="light"] .modal {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .modal-content {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-header {
    background: linear-gradient(135deg, #2563EB, #3B82F6);
}

[data-theme="light"] .modal-body {
    color: #374151;
}

[data-theme="light"] kbd {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #1f2937;
}

/* Parts table */
[data-theme="light"] #parts-table th {
    background: #f3f4f6;
    color: #6b7280;
    border-bottom-color: #e5e7eb;
}

[data-theme="light"] #parts-table td {
    border-bottom-color: #f3f4f6;
    color: #374151;
}

[data-theme="light"] #parts-table tr:hover {
    background: #f9fafb;
}

/* Sheet tab bar */
[data-theme="light"] #sheet-tab-bar {
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

[data-theme="light"] .sheet-tab {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
}

[data-theme="light"] .sheet-tab:hover {
    background: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .sheet-tab.active {
    background: #ffffff;
    color: #3B82F6;
    border-bottom-color: #3B82F6;
}

/* Ad container */
[data-theme="light"] .ad-container-horizontal {
    background: #f9fafb !important;
    border-bottom-color: #e5e7eb !important;
}

/* Toast notifications */
[data-theme="light"] .toast {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Sign-in button */
[data-theme="light"] .btn-sign-in {
    background: #3B82F6;
    color: white;
    border-color: #3B82F6;
}

[data-theme="light"] .btn-sign-in:hover {
    background: #2563EB;
}

/* Trade space sliders */
[data-theme="light"] .trade-space-sliders {
    background: #f9fafb;
    border-color: #e5e7eb;
}

[data-theme="light"] .slider-row input[type="range"] {
    background: #e5e7eb;
}

[data-theme="light"] .slider-row input[type="range"]::-webkit-slider-thumb {
    background: #3B82F6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* AI Suggest panel */
[data-theme="light"] .ai-suggest-panel {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .ai-suggest-panel-header {
    background: linear-gradient(135deg, #2563EB, #3B82F6);
    color: white;
}

[data-theme="light"] .ai-summary-card {
    background: #f9fafb;
    border-color: #e5e7eb;
}

/* Warning items */
[data-theme="light"] .warning-item {
    background: #f9fafb;
    border-color: #e5e7eb;
}

/* BOM popup */
[data-theme="light"] .bom-qty-popup {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Tolerance row */
[data-theme="light"] .tolerance-row {
    border-left-color: #d1d5db;
}

/* Selection box */
[data-theme="light"] .selection-box {
    border-color: #3B82F6;
    background: rgba(59, 130, 246, 0.08);
}

/* SVG Grid pattern in light mode */
[data-theme="light"] #grid path {
    stroke: #e5e7eb;
}

/* Node gradients ÃƒÂ¢Ã¢â€šÂ¬Ã¢â‚¬Â light mode uses flat fills via the existing overrides above */

/* Assigned part badge */
[data-theme="light"] .assigned-part-badge {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

/* Find parts requirements */
[data-theme="light"] .find-parts-requirements {
    background: #f9fafb;
    border-color: #e5e7eb;
}

/* Read-only indicator */
[data-theme="light"] .readonly-indicator {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
    color: #3B82F6;
}
