/* MRW Editor - Modern Professional Design */

:root {
    /* Primary palette - Deep blue/purple gradient theme */
    --bg-primary: #0a0a12;
    --bg-secondary: #12121e;
    --bg-tertiary: #1a1a2e;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.2);

    /* Text */
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* Accent colors */
    --accent-blue: #3b82f6;
    --accent-blue-light: #60a5fa;
    --accent-blue-glow: rgba(59, 130, 246, 0.3);
    --accent-purple: #8b5cf6;
    --accent-purple-light: #a78bfa;
    --accent-cyan: #22d3ee;
    --accent-green: #22c55e;
    --accent-yellow: #eab308;
    --accent-orange: #f97316;
    --accent-red: #ef4444;

    /* Header accent gradient */
    --gradient-header: linear-gradient(90deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));

    /* Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--accent-blue-glow);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ========================================
   LIGHT THEME
   ======================================== */
[data-theme="light"] {
    /* Primary palette - Light backgrounds */
    --bg-primary: #f5f6f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f5;
    --bg-card: rgba(0, 0, 0, 0.03);
    --bg-card-hover: rgba(0, 0, 0, 0.06);

    /* Borders */
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-medium: rgba(0, 0, 0, 0.15);
    --border-strong: rgba(0, 0, 0, 0.25);

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;

    /* Accent colors remain the same but with adjusted glows */
    --accent-blue-glow: rgba(59, 130, 246, 0.2);

    /* Effects - lighter shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-glow: 0 0 20px var(--accent-blue-glow);
}

/* Light theme specific overrides */
[data-theme="light"] .header {
    background: #ffffff;
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .header::before {
    opacity: 0.8;
}

[data-theme="light"] .tree-panel {
    background: #ffffff;
}

[data-theme="light"] .tree-node-content {
    background: #ffffff;
}

[data-theme="light"] .tree-node-content:hover {
    background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .attribute-panel {
    background: #f5f6f8;
}

[data-theme="light"] .connection-panel {
    background: #ffffff;
}

[data-theme="light"] .modal {
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .context-menu {
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .export-menu {
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .toast {
    background: #ffffff;
}

[data-theme="light"] .searchable-dropdown-list {
    background: #ffffff;
}

[data-theme="light"] .tutorial-spotlight {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .tutorial-tooltip {
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}


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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    line-height: 1.5;
}

/* ========================================
   LAYOUT
   ======================================== */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

/* ========================================
   HEADER
   ======================================== */
.header {
    height: 52px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    position: relative;
    z-index: 100;
}

.header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    opacity: 0.5;
}

.header .back-link {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header .back-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.header .logo {
    font-weight: 700;
    font-size: 16px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-right: 16px;
    margin-right: 8px;
    border-right: 1px solid var(--border-subtle);
    letter-spacing: -0.5px;
}

.header-btn {
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.header-btn.primary {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.header-btn.primary:hover {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 2px 8px var(--accent-blue-glow);
}

.header-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.header-right a:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.header-right a.help-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-right a.help-link svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Theme Toggle Button */
.theme-toggle {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
[data-theme="light"] .theme-toggle .sun-icon { display: block; }
[data-theme="light"] .theme-toggle .moon-icon { display: none; }

.filename-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.filename-display .dirty-indicator {
    color: var(--accent-yellow);
    font-size: 14px;
    animation: pulse 2s ease-in-out infinite;
}

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

/* ========================================
   VIEW MODE BAR (3-mode toggle)
   ======================================== */
.view-mode-bar {
    display: flex;
    gap: 4px;
    padding: 0 16px;
    height: 44px;
    align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.view-mode-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-right: 8px;
}

.view-mode-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.view-mode-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.view-mode-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.view-mode-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 2px 8px var(--accent-blue-glow);
}

.view-mode-spacer {
    flex: 1;
}

.view-mode-btn.validate-btn {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.view-mode-btn.validate-btn:hover {
    background: var(--accent-green);
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.view-mode-btn.affinity-btn {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.view-mode-btn.affinity-btn:hover {
    background: var(--accent-purple);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.view-mode-btn.process-btn {
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

.view-mode-btn.process-btn:hover {
    background: var(--accent-orange);
    color: white;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

/* Legacy tab styles - keep for compatibility */
.tab-bar {
    height: 44px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-end;
    padding: 0 16px;
    gap: 4px;
}

.tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent-blue);
    border-radius: 2px 2px 0 0;
    transition: width var(--transition-normal);
}

.tab:hover {
    color: var(--text-secondary);
    background: var(--bg-card);
}

.tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.tab.active::after {
    width: 60%;
}

/* ========================================
   ACTION BAR
   ======================================== */
.action-bar {
    height: 52px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
}

.action-bar label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.action-bar select,
.action-bar input[type="text"] {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: all var(--transition-fast);
}

.action-bar select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    cursor: pointer;
    min-width: 150px;
}

.action-bar select:focus,
.action-bar input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.action-bar .action-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-bar .btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-bar .btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-blue-glow);
}

.action-bar .btn.danger:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.action-bar .btn.primary {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.action-bar .btn.primary:hover {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 2px 8px var(--accent-blue-glow);
}

.action-bar .btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.action-bar .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========================================
   TREE PANEL
   ======================================== */
.tree-panel {
    width: 500px;
    min-width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tree-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
}

.tree-header .toggle-hidden {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.tree-header .toggle-hidden:hover {
    background: var(--bg-card);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}

.tree-header .toggle-hidden.active {
    background: var(--accent-purple);
    color: white;
}

.tree-search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
}

.tree-search-icon {
    position: absolute;
    left: 22px;
    color: var(--text-muted);
    pointer-events: none;
}

.tree-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    transition: all var(--transition-fast);
}

.tree-search input::placeholder {
    color: var(--text-muted);
}

.tree-search input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.tree-search-clear {
    position: absolute;
    right: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.tree-search-clear:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tree-search-clear.hidden {
    display: none;
}

.tree-search-results {
    max-height: 200px;
    overflow-y: auto;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
}

.tree-search-results.hidden {
    display: none;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-subtle);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-card-hover);
}

.search-result-item.selected {
    background: var(--accent-blue);
    color: white;
}

.search-result-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 4px;
    flex-shrink: 0;
}

.search-result-icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--accent-cyan);
}

.search-result-item.selected .search-result-icon {
    background: rgba(255, 255, 255, 0.2);
}

.search-result-item.selected .search-result-icon svg {
    stroke: white;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-name mark {
    background: var(--accent-yellow);
    color: var(--bg-primary);
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-item.selected .search-result-name mark {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.search-result-path {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-item.selected .search-result-path {
    color: rgba(255, 255, 255, 0.7);
}

.search-result-type {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-result-item.selected .search-result-type {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.search-stats {
    padding: 8px 14px;
    font-size: 11px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-stats-count {
    font-weight: 600;
    color: var(--accent-blue-light);
}

.search-nav-hint {
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-nav-hint kbd {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 10px;
    font-family: inherit;
}

.tree-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

/* Virtual scrolling container */
.tree-virtual-container {
    position: relative;
    width: 100%;
}

.tree-virtual-content {
    width: 100%;
}

/* ========================================
   TREE NODE
   ======================================== */
.tree-node {
    user-select: none;
}

.tree-node-content {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 0;
    cursor: pointer;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    transition: background 0.1s ease;
    will-change: background;
    user-select: none;
    -webkit-user-select: none;
}

.tree-node-content:hover {
    background: var(--bg-card);
    border-color: var(--border-subtle);
}

.tree-node-content.selected {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 2px 8px var(--accent-blue-glow);
}

.tree-node-content.selected .tree-node-type {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tree-node-content.selected .tree-expand {
    color: rgba(255, 255, 255, 0.8);
}

.tree-node-content.hidden-target {
    opacity: 0.5;
}

.tree-expand {
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 11px;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 4px;
    margin-right: 8px;
}

.tree-expand:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tree-expand.empty {
    visibility: hidden;
    pointer-events: none;
}

.tree-node-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: var(--bg-card);
    flex-shrink: 0;
}

.tree-node-icon svg {
    width: 12px;
    height: 12px;
    stroke: var(--accent-cyan);
}

.tree-node-content.selected .tree-node-icon {
    background: rgba(255, 255, 255, 0.2);
}

.tree-node-content.selected .tree-node-icon svg {
    stroke: white;
}

/* Highlight animation for found targets */
@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 0 var(--accent-blue); }
    50% { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.tree-node-name {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-node-type {
    font-size: 10px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-weight: 500;
    white-space: nowrap;
}

.tree-children {
    margin-left: 14px;
    padding-left: 14px;
    border-left: 1px dashed var(--border-subtle);
}

.tree-children.collapsed {
    display: none;
}

/* ========================================
   RESIZE HANDLE
   ======================================== */
.resize-handle {
    width: 4px;
    background: transparent;
    cursor: col-resize;
    transition: background var(--transition-fast);
    position: relative;
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 40px;
    background: var(--border-subtle);
    border-radius: 2px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.resize-handle:hover::after,
.resize-handle.dragging::after {
    opacity: 1;
    background: var(--accent-blue);
}

/* ========================================
   RIGHT PANEL CONTAINER
   ======================================== */
.right-panel-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 300px;
}

.resize-handle-horizontal {
    height: 6px;
    background: var(--bg-tertiary);
    cursor: ns-resize;
    flex-shrink: 0;
    position: relative;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.resize-handle-horizontal:hover,
.resize-handle-horizontal.dragging {
    background: var(--accent-blue);
}

.resize-handle-horizontal::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 2px;
    background: var(--border-medium);
    border-radius: 1px;
}

/* ========================================
   ATTRIBUTE PANEL
   ======================================== */
.attribute-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    min-height: 150px;
}

.attribute-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
}

.attribute-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.attribute-header h3::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--accent-blue);
    border-radius: 2px;
}

.attribute-header .filter-input {
    flex: 1;
    max-width: 300px;
    padding: 8px 14px;
    padding-left: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    transition: all var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.attribute-header .filter-input::placeholder {
    color: var(--text-muted);
}

.attribute-header .filter-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.attribute-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ========================================
   ATTRIBUTE GROUPS & TABLE
   ======================================== */
.attribute-group {
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.attribute-group-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-subtle);
}

.attribute-group-header:hover {
    background: var(--bg-card-hover);
}

.attribute-group-header .expand-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.attribute-group-header .group-count {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-muted);
}

.attribute-group-content {
    background: var(--bg-secondary);
}

.attribute-group-content.collapsed {
    display: none;
}

.attribute-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.attribute-table th,
.attribute-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.attribute-table th {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.attribute-table tbody tr {
    transition: background var(--transition-fast);
}

.attribute-table tbody tr:hover {
    background: var(--bg-card);
}

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

.attribute-table .attr-name {
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 12px;
}

.attribute-table .attr-inherited {
    font-size: 9px;
    color: var(--accent-purple-light);
    margin-left: 8px;
    padding: 2px 6px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.attribute-table .attr-type {
    color: var(--text-muted);
    font-size: 11px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.attribute-table input[type="text"],
.attribute-table input[type="number"],
.attribute-table select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: all var(--transition-fast);
}

.attribute-table select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    cursor: pointer;
}

.attribute-table input:focus,
.attribute-table select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.attribute-table input.invalid {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

/* ========================================
   CONNECTION PANEL
   ======================================== */
.connection-panel {
    flex: 1;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    overflow: hidden;
}

.connection-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.connection-header::before {
    content: '';
    width: 4px;
    height: 14px;
    background: var(--accent-cyan);
    border-radius: 2px;
}

.connection-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.connection-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    gap: 14px;
    transition: all var(--transition-fast);
}

.connection-item:hover {
    border-color: var(--accent-cyan);
    background: var(--bg-card-hover);
    box-shadow: 0 2px 12px rgba(34, 211, 238, 0.1);
}

.connection-item .conn-type {
    font-size: 10px;
    color: var(--accent-cyan);
    padding: 4px 10px;
    background: rgba(34, 211, 238, 0.1);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.connection-item .conn-path {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.connection-item .conn-delete {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.connection-item .conn-delete:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    min-width: 440px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* X button in modal header */
.modal-header .modal-close {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.modal-header .modal-close:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

/* Cancel button in modal footer - inherits .btn styles */
.modal-footer .btn.modal-close {
    width: auto;
    height: auto;
    font-size: 13px;
}

.modal-footer .btn.modal-close:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.modal-footer .btn {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-footer .btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-footer .btn.primary {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.modal-footer .btn.primary:hover {
    background: var(--accent-blue);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--accent-blue-glow);
}

.modal-footer .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-footer .btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.modal-footer .btn.danger {
    background: transparent;
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.modal-footer .btn.danger:hover {
    background: var(--accent-red);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Modal sizes */
.modal.modal-sm {
    min-width: 380px;
    max-width: 420px;
}

.modal.modal-lg {
    min-width: 600px;
    max-width: 700px;
}

/* Modal icon in header */
.modal-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-icon.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.modal-icon.primary svg {
    stroke: var(--accent-blue-light);
}

.modal-icon.cyan {
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
}

.modal-icon.cyan svg {
    stroke: var(--accent-cyan);
}

.modal-icon.warning {
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.modal-icon.warning svg {
    stroke: var(--accent-yellow);
}

.modal-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-icon.danger svg {
    stroke: var(--accent-red);
}

.modal-icon.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.modal-icon.success svg {
    stroke: var(--accent-green);
}

/* Confirm/Prompt modal styles */
.confirm-message,
.prompt-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.prompt-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.prompt-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

/* Connection flow visualization */
.connection-flow {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.flow-endpoint {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.flow-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.flow-value {
    font-size: 12px;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    word-break: break-all;
}

.flow-arrow {
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.flow-arrow svg {
    animation: pulseArrow 2s ease-in-out infinite;
}

@keyframes pulseArrow {
    0%, 100% { opacity: 0.5; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(3px); }
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.form-group .readonly-input {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.optional-badge {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-left: 6px;
    font-weight: 500;
    text-transform: lowercase;
}

/* Input with icon */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.input-with-icon input,
.input-with-icon select {
    padding-left: 40px !important;
}

/* Custom checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.checkbox-label:hover {
    border-color: var(--border-medium);
    background: var(--bg-card-hover);
}

.checkbox-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.checkbox-custom::after {
    content: '';
    width: 10px;
    height: 6px;
    border: 2px solid white;
    border-top: none;
    border-right: none;
    transform: rotate(-45deg) scale(0);
    transition: transform var(--transition-fast);
    margin-top: -2px;
}

.checkbox-input:checked + .checkbox-custom {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.checkbox-input:checked + .checkbox-custom::after {
    transform: rotate(-45deg) scale(1);
}

.checkbox-input:focus + .checkbox-custom {
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.checkbox-text {
    font-size: 14px;
    color: var(--text-primary);
}

/* ========================================
   CONTEXT MENU
   ======================================== */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    padding: 6px;
    animation: contextIn 0.15s ease;
}

@keyframes contextIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu.hidden {
    display: none;
}

.context-menu-item {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.context-menu-item:hover {
    background: var(--accent-blue);
    color: white;
}

.context-menu-item.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.context-menu-item.danger {
    color: var(--accent-red);
}

.context-menu-item.danger:hover {
    background: var(--accent-red);
    color: white;
}

.context-menu-item svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 8px;
}

/* ========================================
   EXPORT DROPDOWN
   ======================================== */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    padding: 6px;
    min-width: 200px;
    animation: dropIn 0.2s ease;
}

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

.export-menu.hidden {
    display: none;
}

.export-menu-item {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.export-menu-item:hover {
    background: var(--accent-blue);
    color: white;
}

.export-menu-item svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    padding-left: 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
    min-width: 280px;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.3);
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.1) 0%, var(--bg-secondary) 100%);
}

.toast.success::before {
    background: var(--accent-green);
}

.toast.success .toast-icon {
    color: var(--accent-green);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, var(--bg-secondary) 100%);
}

.toast.error::before {
    background: var(--accent-red);
}

.toast.error .toast-icon {
    color: var(--accent-red);
}

.toast.warning {
    border-color: rgba(234, 179, 8, 0.3);
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.1) 0%, var(--bg-secondary) 100%);
}

.toast.warning::before {
    background: var(--accent-yellow);
}

.toast.warning .toast-icon {
    color: var(--accent-yellow);
}

.toast.info {
    border-color: rgba(59, 130, 246, 0.3);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, var(--bg-secondary) 100%);
}

.toast.info::before {
    background: var(--accent-blue);
}

.toast.info .toast-icon {
    color: var(--accent-blue);
}

.toast span {
    flex: 1;
}

.toast-close {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-left: 8px;
}

.toast-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Loading overlay enhancement */
#loading-overlay {
    background: rgba(10, 10, 18, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#loading-overlay .loading-spinner {
    width: 48px;
    height: 48px;
    border-width: 3px;
    border-color: rgba(59, 130, 246, 0.2);
    border-top-color: var(--accent-blue);
    box-shadow: 0 0 30px var(--accent-blue-glow);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 60px 40px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    border: 1px solid var(--border-subtle);
}

.empty-state-icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--text-muted);
    stroke-width: 1.5;
    fill: none;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.empty-state p {
    font-size: 14px;
    max-width: 320px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   UTILITIES
   ======================================== */
input[type="file"].hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* Global select styling */
select {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
}

select option:hover,
select option:focus,
select option:checked {
    background-color: var(--accent-blue);
    color: white;
}

/* Firefox specific select dropdown fix */
@-moz-document url-prefix() {
    select {
        background-color: var(--bg-card);
        color: var(--text-primary);
    }
    select option {
        background-color: #1a1a2e;
        color: #f0f0f5;
    }
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background: var(--accent-blue);
    color: white;
}

/* ========================================
   SEARCHABLE DROPDOWN
   ======================================== */
.searchable-dropdown {
    position: relative;
    display: inline-block;
}

.searchable-dropdown-input {
    padding: 8px 32px 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: all var(--transition-fast);
    min-width: 220px;
    cursor: text;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.searchable-dropdown-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.searchable-dropdown-input::placeholder {
    color: var(--text-muted);
}

.searchable-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    min-width: 100%;
    width: max-content;
    max-width: 400px;
}

.searchable-dropdown-list.open {
    display: block;
}

.searchable-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.searchable-dropdown-item:hover,
.searchable-dropdown-item.highlighted {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.searchable-dropdown-item.selected {
    background: var(--accent-blue);
    color: white;
}

.searchable-dropdown-item mark {
    background: var(--accent-yellow);
    color: var(--text-primary);
    padding: 0 2px;
    border-radius: 2px;
}

.searchable-dropdown-item.selected mark {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

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

.searchable-dropdown-category {
    padding: 6px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
}

/* Modal variant - wider */
.modal .searchable-dropdown {
    width: 100%;
}

.modal .searchable-dropdown-input {
    width: 100%;
    min-width: unset;
}

/* ========================================
   UPDATE BANNER
   ======================================== */
.update-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-width: 340px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.update-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.update-banner-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.update-banner-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent-blue-light);
}

.update-banner-icon.success {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
}

.update-banner-icon.success svg {
    stroke: var(--accent-green);
}

.update-banner-body {
    flex: 1;
}

.update-banner-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.update-banner-files {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 12px;
}

.update-banner-actions {
    display: flex;
    gap: 8px;
}

.update-banner-btn {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.update-banner-btn.primary {
    background: var(--accent-blue);
    color: white;
}

.update-banner-btn.primary:hover {
    background: var(--accent-blue-light);
}

.update-banner-btn.secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

.update-banner-btn.secondary:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.update-banner-status {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
}

.update-banner-status a {
    color: var(--accent-blue-light);
    text-decoration: none;
}

.update-banner-status a:hover {
    text-decoration: underline;
}

/* ========================================
   VALIDATION RESULTS
   ======================================== */
.validation-summary {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
}

.validation-summary.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.validation-success {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent-green);
    font-weight: 500;
}

.validation-success svg {
    flex-shrink: 0;
}

.validation-stats {
    display: flex;
    gap: 16px;
}

.validation-stats .stat {
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

.validation-stats .stat.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.validation-stats .stat.warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--accent-yellow);
}

.validation-results {
    max-height: 400px;
    overflow-y: auto;
}

.validation-item {
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.validation-item:last-child {
    margin-bottom: 0;
}

.validation-item.error {
    border-left: 3px solid var(--accent-red);
}

.validation-item.warning {
    border-left: 3px solid var(--accent-yellow);
}

.validation-item:hover {
    background: var(--bg-card-hover);
}

.validation-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.validation-type {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.validation-severity {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.validation-severity.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.validation-severity.warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--accent-yellow);
}

.validation-message {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.validation-details {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-top: 8px;
    word-break: break-all;
}

.validation-goto {
    margin-top: 10px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--accent-blue);
    border-radius: var(--radius-sm);
    color: var(--accent-blue);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.validation-goto:hover {
    background: var(--accent-blue);
    color: white;
}

/* Highlight pulse animation for navigation */
.highlight-pulse {
    animation: highlightPulse 0.6s ease-out 3;
}

/* ========================================
   CONNECTION PANEL (Enhanced for 3-mode)
   ======================================== */
.connection-panel {
    flex: 1;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    overflow: hidden;
}

.connection-header {
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.connection-header::before {
    content: '';
    width: 4px;
    height: 14px;
    background: var(--accent-cyan);
    border-radius: 2px;
    margin-right: 10px;
}

.connection-count {
    padding: 3px 10px;
    background: var(--accent-cyan);
    color: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
}

.connection-toolbar {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.connection-search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    transition: all var(--transition-fast);
}

.connection-search-input::placeholder {
    color: var(--text-muted);
}

.connection-search-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

/* ========================================
   AFFINITY RESULTS
   ======================================== */
.affinity-summary {
    margin-bottom: 20px;
}

.affinity-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.affinity-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    min-width: 100px;
}

.affinity-stat .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-purple-light);
    line-height: 1;
}

.affinity-stat .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 6px;
}

.affinity-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.affinity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.affinity-table th {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--border-subtle);
}

.affinity-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.affinity-table tbody tr:hover {
    background: var(--bg-card);
}

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

.affinity-table .target-id {
    font-weight: 500;
    color: var(--text-primary);
}

.affinity-table .target-type {
    font-size: 10px;
    padding: 3px 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: inline-block;
}

.affinity-table .affinity-path,
.affinity-table .phys-path {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 11px;
    color: var(--accent-cyan);
    word-break: break-all;
}

.affinity-table .phys-path {
    color: var(--accent-purple-light);
}

.affinity-table .huid {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 11px;
    color: var(--accent-orange);
}

/* ========================================
   INTERACTIVE TUTORIAL OVERLAY
   ======================================== */

/* Main overlay - covers entire screen */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
}

/* Spotlight effect - highlights target element */
.tutorial-spotlight {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    border-radius: 8px;
    transition: all 0.3s ease;
    pointer-events: none;
}

.tutorial-spotlight::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid var(--accent-blue);
    border-radius: 12px;
    animation: tutorial-spotlight-pulse 1.5s ease-in-out infinite;
}

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

/* Tooltip */
.tutorial-tooltip {
    position: absolute;
    width: 340px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    animation: tutorial-tooltip-appear 0.3s ease;
}

@keyframes tutorial-tooltip-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tooltip header */
.tutorial-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.tutorial-step-indicator {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tutorial-close {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.tutorial-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Tooltip content */
.tutorial-tooltip h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 16px 16px 8px;
}

.tutorial-tooltip p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 16px 16px;
}

/* Progress dots */
.tutorial-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
}

.tutorial-dot {
    width: 8px;
    height: 8px;
    background: var(--bg-card);
    border-radius: 50%;
    transition: all 0.2s;
}

.tutorial-dot.active {
    background: var(--accent-blue);
    transform: scale(1.2);
}

.tutorial-dot.completed {
    background: rgba(59, 130, 246, 0.5);
}

/* Navigation buttons */
.tutorial-nav {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.tutorial-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.tutorial-btn-primary {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    margin-left: auto;
}

.tutorial-btn-primary:hover {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 2px 8px var(--accent-blue-glow);
}

.tutorial-btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.tutorial-btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
}

.tutorial-btn-end {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.3);
    margin-left: auto;
}

.tutorial-btn-end:hover {
    background: rgba(239, 68, 68, 0.2);
}

.tutorial-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========================================
   ATTRIBUTE EDITOR ENHANCEMENTS
   ======================================== */

/* Readonly attribute styling */
.attr-readonly {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-card) !important;
}

.attr-row-readonly {
    opacity: 0.8;
}

.attr-readonly-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: 4px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Invalid input highlight */
.attr-invalid {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

/* Boolean checkbox styling */
.attr-bool-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.attr-bool-input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.attr-bool-input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.attr-bool-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Array attribute display */
.attr-array-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attr-array-preview {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Consolas', 'Monaco', monospace;
    padding: 4px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.attr-array-edit-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-blue-light);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.attr-array-edit-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}

/* Complex attribute field display */
.attr-complex-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attr-complex-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.attr-complex-label {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 80px;
    text-align: right;
    font-weight: 500;
}

.attr-complex-input {
    flex: 1;
    padding: 2px 6px;
    font-size: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
}

.attr-complex-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-glow);
}

/* Array Editor Modal */
.array-editor-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.array-editor-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

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

.array-editor-table th {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-medium);
}

.array-editor-table td {
    padding: 4px 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.array-idx {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    width: 60px;
}

.array-element-input {
    width: 100%;
    padding: 4px 8px;
    font-size: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
}

.array-element-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-glow);
}

/* ========================================
   Errata Viewer
   ======================================== */

.errata-summary {
    margin-bottom: 16px;
}

.errata-stats {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.errata-stat {
    font-size: 13px;
    color: var(--text-secondary);
}

.errata-stat strong {
    color: var(--text-primary);
    margin-right: 4px;
}

.errata-stat.applied strong {
    color: var(--accent-green, #4ade80);
}

.errata-stat.unapplied strong {
    color: var(--accent-amber, #fbbf24);
}

.errata-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.errata-item {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.errata-item.applied {
    border-left: 3px solid var(--accent-green, #4ade80);
}

.errata-item.unapplied {
    border-left: 3px solid var(--accent-amber, #fbbf24);
}

.errata-item.no-match {
    border-left: 3px solid var(--text-dim);
    opacity: 0.7;
}

.errata-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.errata-id {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.errata-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.errata-status.applied {
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent-green, #4ade80);
}

.errata-status.unapplied {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-amber, #fbbf24);
}

.errata-status.no-match {
    background: rgba(128, 128, 128, 0.15);
    color: var(--text-dim);
}

.errata-apply-btn {
    margin-left: auto;
    padding: 2px 10px !important;
    font-size: 11px !important;
}

.errata-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.errata-meta {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--text-dim);
}

.errata-diffs {
    margin-top: 8px;
}

.errata-diff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.errata-diff-table th {
    text-align: left;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-subtle);
}

.errata-diff-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    word-break: break-all;
}

.errata-diff-table .val-current {
    color: var(--accent-red, #f87171);
}

.errata-diff-table .val-errata {
    color: var(--accent-green, #4ade80);
}

/* Small button variant */
.btn-sm {
    padding: 3px 10px !important;
    font-size: 11px !important;
    min-height: auto !important;
}

/* Errata button styling */
.errata-btn {
    color: var(--accent-amber, #fbbf24) !important;
}

/* ============================================
   Compare Tool Styles
   ============================================ */

.compare-files-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.compare-file-input {
    flex: 1;
}

.compare-file-input label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.compare-file-input input[type="file"] {
    width: 100%;
    padding: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

.compare-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    padding-top: 18px;
}

.compare-summary {
    margin-bottom: 16px;
}

.compare-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.compare-stat {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
}

.compare-stat.changed {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-amber, #fbbf24);
}

.compare-stat.added {
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent-green, #4ade80);
}

.compare-stat.removed {
    background: rgba(248, 113, 113, 0.15);
    color: var(--accent-red, #f87171);
}

.compare-files-label {
    font-size: 12px;
    color: var(--text-muted);
}

.compare-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.compare-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.compare-table th {
    padding: 8px 10px;
    text-align: left;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-medium);
}

.compare-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-subtle);
    word-break: break-all;
    max-width: 200px;
}

.diff-row.diff-changed td {
    background: rgba(251, 191, 36, 0.05);
}

.diff-row.diff-added td {
    background: rgba(74, 222, 128, 0.05);
}

.diff-row.diff-removed td {
    background: rgba(248, 113, 113, 0.05);
}

.diff-ref {
    color: var(--accent-red, #f87171);
}

.diff-cmp {
    color: var(--accent-green, #4ade80);
}

.diff-none {
    color: var(--text-muted);
    font-style: italic;
}

.diff-path {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 11px;
}

.diff-attr {
    color: var(--text-primary);
    font-weight: 500;
}

/* Export menu divider */
.export-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}
