/* CEREBRUM — Your SAGE Brain */
:root {
    --bg-deep: #0a0e17;
    --bg-surface: #111827;
    --bg-elevated: #1a2332;
    --bg-hover: #1f2d3f;
    --primary: #06b6d4;
    --primary-dim: rgba(6, 182, 212, 0.15);
    --secondary: #8b5cf6;
    --secondary-dim: rgba(139, 92, 246, 0.15);
    --accent: #10b981;
    --accent-dim: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #e5e7eb;
    --text-dim: #9ca3af;
    --text-muted: #6b7280;
    --border: #1e293b;
    --border-light: #334155;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

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

#app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 64px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
    color: white;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.sidebar-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    position: relative;
}
.sidebar-btn:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-btn.active { background: var(--primary-dim); color: var(--primary); }
.sidebar-btn svg { width: 22px; height: 22px; }

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Top bar */
.top-bar {
    height: 52px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
    z-index: 50;
}

.top-bar h1 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.3px;
}

.top-bar .spacer { flex: 1; }

.connection-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-elevated);
}
.connection-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}
.connection-dot.disconnected { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* Text Size Toggle */
.lock-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 8px;
}
.lock-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(6, 182, 212, 0.1);
}

.text-size-toggle {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 2px;
    margin-right: 4px;
}
.text-size-btn {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 12px;
    padding: 2px 8px;
    font-weight: 600;
    transition: all 0.15s;
    line-height: 1;
}
.text-size-btn:hover { color: var(--text); }
.text-size-btn.active { background: var(--primary-dim); color: var(--primary); }
.text-size-btn.sz-s { font-size: 10px; }
.text-size-btn.sz-m { font-size: 12px; }
.text-size-btn.sz-l { font-size: 14px; }

/* Zoom levels applied to main content */
.main-content.zoom-small { zoom: 0.9; }
.main-content.zoom-medium { zoom: 1; }
.main-content.zoom-large { zoom: 1.15; }

/* Tooltip tags */
.tooltip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.tooltip-tag {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    letter-spacing: 0.3px;
}

/* Tooltip click hint */
.tooltip-hint {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 6px;
    text-align: center;
    letter-spacing: 0.3px;
}

/* Health Status Bar */
.health-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
    flex-shrink: 0;
}
.health-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.health-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.health-dot.ok { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.health-dot.err { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.health-num { font-weight: 700; color: var(--primary); }
.health-sep { width: 1px; height: 12px; background: var(--border-light); }

/* Brain canvas */
.brain-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.brain-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Navigation pad — compass-style d-pad with zoom */
.nav-pad {
    position: absolute;
    bottom: 48px;
    right: 20px;
    display: grid;
    grid-template-columns: 30px 30px 30px;
    grid-template-rows: 30px 30px 30px;
    gap: 3px;
    z-index: 10;
    background: rgba(15, 10, 30, 0.6);
    border-radius: 12px;
    padding: 6px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
}

.nav-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}

.nav-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.35);
    color: rgba(255,255,255,0.9);
}

.nav-btn:active { transform: scale(0.9); }

.nav-up     { grid-column: 2; grid-row: 1; }
.nav-left   { grid-column: 1; grid-row: 2; }
.nav-center { grid-column: 2; grid-row: 2; background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.2); }
.nav-right  { grid-column: 3; grid-row: 2; }
.nav-down   { grid-column: 2; grid-row: 3; }
.nav-zin    { grid-column: 1; grid-row: 3; }
.nav-zout   { grid-column: 3; grid-row: 3; }

/* Domain filter bar */
.domain-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.domain-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.domain-pill:hover { border-color: var(--text-muted); }
.domain-pill.active { border-color: currentColor; background: var(--bg-elevated); }

/* Graph search toggle */
.graph-search {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0;
}
.graph-search-toggle {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}
.graph-search-toggle:hover { border-color: var(--primary); color: var(--primary); }
.graph-search.has-filter .graph-search-toggle { border-color: var(--primary); color: var(--primary); }
.search-badge {
    position: absolute; top: 4px; right: 4px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--primary);
}
.graph-search.open .graph-search-toggle {
    border-radius: 20px 0 0 20px;
    border-right: none;
}
.graph-search-input {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-left: none;
    border-radius: 0 20px 20px 0;
    padding: 7px 32px 7px 8px;
    color: var(--text);
    font-size: 13px;
    width: 280px;
    outline: none;
    transition: all 0.2s;
}
.graph-search-input:focus { border-color: var(--primary); }
.graph-search-input::placeholder { color: var(--text-muted); }
.graph-search-clear {
    position: absolute; right: 8px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    font-size: 16px; padding: 2px 6px;
    border-radius: 50%;
}
.graph-search-clear:hover { color: var(--text); background: var(--bg-elevated); }

/* Stats panel */
.stats-panel {
    position: absolute;
    bottom: 60px;
    left: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    z-index: 30;
    min-width: 260px;
    width: 300px;
    max-height: 60vh;
    overflow-y: auto;
    resize: horizontal;
    box-shadow: var(--shadow);
}

.stats-panel h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 13px;
}

.stat-label { color: var(--text-dim); }
.stat-value { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.stat-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.stat-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.stat-bar-label {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
}

/* Timeline bar */
.timeline-bar {
    height: 52px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 40;
}

.timeline-label {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 32px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.timeline-track {
    flex: 1;
    height: 28px;
    background: var(--bg-elevated);
    border-radius: 4px;
    position: relative;
    overflow: visible;
    cursor: crosshair;
    border-bottom: 1px solid var(--border-light);
}

.timeline-bucket-bar {
    position: absolute;
    bottom: 0;
    background: var(--primary);
    opacity: 0.6;
    border-radius: 2px 2px 0 0;
    min-width: 2px;
    transition: opacity 0.2s, background 0.2s;
}
.timeline-bucket-bar:hover {
    opacity: 1;
    background: #22d3ee;
}

/* Timeline tooltip */
.timeline-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 6px 10px;
    pointer-events: none;
    z-index: 310;
    white-space: nowrap;
    font-size: 11px;
    color: var(--text-dim);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.15s;
}
.timeline-bucket-bar:hover .timeline-tooltip {
    opacity: 1;
}
.timeline-tooltip-count {
    font-weight: 700;
    color: var(--primary);
    margin-right: 4px;
}
.timeline-tooltip-time {
    color: var(--text-muted);
}

/* Interactive timeline */
.timeline-bucket-bar {
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s;
}
.timeline-bucket-bar.selected {
    opacity: 1 !important;
    background: #22d3ee !important;
    box-shadow: 0 0 6px rgba(34, 211, 238, 0.4);
}
.timeline-clear-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 8px;
    white-space: nowrap;
}
.timeline-clear-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

/* Focus indicator */
.focus-indicator {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    box-shadow: var(--shadow);
}
.focus-exit-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.focus-exit-btn:hover {
    color: var(--text);
    border-color: var(--text-muted);
}
.focus-hint {
    font-size: 11px;
    color: var(--text-muted);
}
.focus-selection-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(16, 185, 129, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
}
.focus-action-btn {
    background: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.focus-action-btn:hover {
    background: var(--primary);
    color: var(--bg-deep);
}
.focus-action-btn.deselect {
    border-color: var(--text-muted);
    color: var(--text-muted);
}
.focus-action-btn.deselect:hover {
    background: var(--text-muted);
    color: var(--bg-deep);
}
.focus-action-btn.select-all {
    border-color: var(--text-dim);
    color: var(--text-dim);
}
.focus-action-btn.select-all:hover {
    background: var(--text-dim);
    color: var(--bg-deep);
}

/* Draggable stats panel */
.stats-drag-handle {
    cursor: grab;
    user-select: none;
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.stats-drag-handle:active {
    cursor: grabbing;
}
.stats-drag-handle::before {
    content: '⠿';
    margin-right: 6px;
    opacity: 0.4;
    font-size: 14px;
    vertical-align: middle;
}
.stats-dragged {
    position: fixed !important;
    bottom: auto !important;
}
.stats-reset-btn {
    float: right;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}
.stats-reset-btn:hover {
    color: var(--text);
}

/* Chain Activity Log */
.chain-activity {
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    z-index: 50;
}
.chain-activity-resize-handle {
    height: 20px;
    cursor: ns-resize;
    background: transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
    z-index: 10;
    border-top: 1px solid var(--border);
}
.chain-activity-resize-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 4px;
    border-radius: 3px;
    background: var(--border-light);
    transition: background 0.15s, width 0.15s, height 0.15s;
}
.chain-activity-resize-handle:hover::after {
    background: var(--primary);
    width: 80px;
    height: 5px;
}
.chain-activity-resize-handle:active::after {
    background: var(--primary);
    width: 100px;
    height: 5px;
}
.chain-activity-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.chain-activity-toggle:hover {
    color: var(--text);
    background: var(--bg-elevated);
}
.chain-activity-count {
    background: var(--primary);
    color: var(--bg);
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 700;
}
.chain-activity-latest {
    margin-left: auto;
    font-size: 10px;
    opacity: 0.7;
}
.chain-activity-log {
    max-height: 200px;
    overflow-y: auto;
    padding: 0 8px 8px;
}
.chain-activity-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}
.chain-event {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    flex-wrap: wrap;
}
.chain-event:hover {
    background: var(--bg-elevated);
}
.chain-event-expand {
    width: 100%;
    padding: 8px 8px 8px 34px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    animation: slideDown 0.15s ease-out;
}
@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}
.chain-event-expand-content {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 6px;
    border-left: 2px solid var(--primary);
    padding-left: 10px;
}
.chain-event-expand-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}
.chain-event-retrieved {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}
.chain-event-retrieved-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 4px 8px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 11px;
}
.chain-event-retrieved-item code {
    font-size: 9px;
    background: var(--bg-elevated);
    padding: 1px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}
.chain-event-retrieved-item .retrieved-content {
    color: var(--text-dim);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.chain-event-chevron {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.15s;
    flex-shrink: 0;
}
.chain-event-chevron.open {
    transform: rotate(90deg);
}
.chain-event-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}
.chain-event-time {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 10px;
    min-width: 70px;
}
.chain-event-type {
    font-weight: 600;
    min-width: 110px;
}
.chain-event-detail {
    color: var(--text-muted);
    font-size: 11px;
    display: flex;
    gap: 6px;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chain-event-detail code {
    background: var(--bg-elevated);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
}
.chain-event-domain {
    background: var(--bg-elevated);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.chain-event-content {
    opacity: 0.6;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Memory detail panel */
.detail-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0,0,0,0.5);
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
}
.detail-overlay.open { transform: translateX(0); }

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

.detail-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
}

.detail-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.detail-close:hover { background: var(--bg-hover); color: var(--text); }

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.detail-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.detail-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-meta-item label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.detail-meta-item .value {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

/* Domain badge */
.domain-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Confidence bar */
.confidence-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.confidence-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.confidence-value {
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 40px;
}

/* Action buttons */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-light);
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled):not(.btn-disabled) { background: rgba(239,68,68,0.15); }
.btn:disabled, .btn.btn-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    border-color: var(--border);
    color: var(--text-muted);
}

/* Search page */
.search-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px;
}

.search-page-input {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    color: var(--text);
    font-size: 15px;
    width: 100%;
    outline: none;
    margin-bottom: 20px;
}
.search-page-input:focus { border-color: var(--primary); }
.search-page-input::placeholder { color: var(--text-muted); }

.memory-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Memory card */
.memory-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.15s;
}
.memory-card:hover { border-color: var(--primary); background: var(--bg-elevated); }

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

.memory-card-content {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.memory-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Settings page */
.settings-page {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.settings-tab {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 16px;
    background: none; border: none;
    color: var(--text-muted);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.settings-tab svg { opacity: 0.7; }
.settings-tab.active svg { opacity: 1; }
.settings-tab .update-badge {
    width: 8px; height: 8px;
    background: var(--accent, #f59e0b);
    border-radius: 50%;
    display: inline-block;
    margin-left: 2px;
    animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.settings-tab-content { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.settings-grid .settings-section.full-width {
    grid-column: 1 / -1;
}
@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.settings-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
}
.settings-row .label { color: var(--text-dim); }
.settings-row .value { color: var(--text); font-weight: 500; }

/* Chain Health Section */
.chain-health-section {
    border-color: rgba(6, 182, 212, 0.3);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), var(--bg-surface));
}
.chain-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.chain-stat-card {
    background: rgba(6, 182, 212, 0.06);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: var(--radius);
    padding: 14px 12px 10px;
    text-align: center;
    position: relative;
}
.chain-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}
.chain-stat-value.block-height {
    color: #10b981;
}
.chain-stat-value.countdown-value {
    color: #f59e0b;
    font-size: 20px;
}
.chain-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 4px;
}
.countdown-bar {
    height: 3px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}
.countdown-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    border-radius: 2px;
    transition: width 0.1s linear;
}
.chain-details {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
/* Peers Section */
.peer-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
}
.peer-card:last-child { margin-bottom: 0; }
.peer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.peer-moniker {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}
.peer-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--primary-dim);
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.peer-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 12px;
    font-size: 11px;
}
.peer-meta-label { color: var(--text-muted); }
.peer-meta-value { color: var(--text-dim); font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; }
.peer-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 16px;
}

.chain-id-value {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px !important;
    color: var(--primary) !important;
}
.chain-offline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Status indicator dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.status-dot.active {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}
.status-dot.inactive {
    background: #6b7280;
}

@media (max-width: 500px) {
    .chain-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 16px;
    pointer-events: none;
    z-index: 300;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    backdrop-filter: blur(8px);
}

.tooltip-domain {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    margin-bottom: 6px;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
}

.tooltip-content {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 8px;
    word-break: break-word;
    border-left: 2px solid var(--border-light);
    padding-left: 8px;
}

.tooltip-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}
.tooltip-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tooltip-meta-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
}

/* Help overlay */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease-out;
}
.help-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 720px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
    padding: 32px;
}
.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.help-modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.guide-modal { max-width: 900px; }
.guide-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.guide-tabs::-webkit-scrollbar { display: none; }
.guide-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
}
.guide-tab:hover { color: var(--text); background: var(--bg-elevated); }
.guide-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.guide-tab-icon { display: flex; color: inherit; }
.guide-tab-icon svg { width: 14px; height: 14px; }
.guide-tab-label { }
@media (max-width: 700px) {
    .guide-tab-label { display: none; }
    .guide-tab { padding: 10px 12px; }
    .guide-tab-icon svg { width: 18px; height: 18px; }
}
.guide-tab-content {
    padding: 20px 4px;
    overflow-y: auto;
    height: 55vh;
    margin-bottom: 16px;
}
.guide-section-content {
    padding: 0 4px;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.7;
    transition: opacity 0.2s ease;
    opacity: 1;
}
.guide-section-content.guide-anim-out {
    opacity: 0;
}
.guide-section-content.guide-anim-in {
    animation: guide-fade-in 0.25s ease-out forwards;
}
@keyframes guide-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.guide-section-content p { margin: 0 0 14px 0; }
.guide-section-content code {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 12px;
    color: var(--accent);
}
.guide-steps { display: flex; flex-direction: column; gap: 12px; }
.guide-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.guide-step-num {
    width: 24px; height: 24px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}
.guide-step div { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.guide-step strong { color: var(--text); }
.guide-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .guide-detail-grid { grid-template-columns: 1fr; } }
.guide-detail-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}
.guide-detail-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-detail-label::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}
.guide-detail-desc { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.guide-detail-desc strong { color: var(--text); }
.guide-callout {
    margin-top: 14px;
    padding: 12px 16px;
    background: rgba(139, 92, 246, 0.08);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
}
.guide-callout strong { color: var(--text); }

/* Contextual help tooltips (toggleable via settings) */
.help-tip {
    position: relative;
    display: inline-flex;
}
.help-tip-trigger {
    width: 15px; height: 15px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    margin-left: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(139, 92, 246, 0.25);
    transition: background 0.2s, border-color 0.2s;
    line-height: 1;
}
.help-tip-trigger:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--primary);
}
.page-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    vertical-align: middle;
    margin-left: 8px;
}
.page-help-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--primary);
    transform: scale(1.1);
}
.help-tip-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
    max-width: 260px;
    min-width: 180px;
    white-space: normal;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 400;
    pointer-events: none;
    animation: fade-in 0.15s ease-out;
}
.help-tip-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-light);
}
/* Right-aligned variant for elements near the right edge */
.help-tip-popup.align-right {
    left: auto;
    right: -8px;
    transform: none;
}
.help-tip-popup.align-right::after {
    left: auto;
    right: 12px;
    transform: none;
}
/* Left-aligned variant */
.help-tip-popup.align-left {
    left: -8px;
    transform: none;
}
.help-tip-popup.align-left::after {
    left: 12px;
    transform: none;
}
.help-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.help-dismiss-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
}
.help-dismiss-check input[type="checkbox"] {
    accent-color: var(--primary);
}

/* ─── Import Page ─── */
.import-page {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
    max-width: 840px;
}

.import-header {
    margin-bottom: 28px;
}

.import-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.import-subtitle {
    font-size: 14px;
    color: var(--text-dim);
}

/* Provider cards grid */
.provider-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

@media (max-width: 700px) {
    .provider-cards {
        grid-template-columns: 1fr;
    }
}

.provider-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 18px;
    cursor: default;
}

.provider-icon {
    margin-bottom: 12px;
    color: var(--primary);
}

.provider-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.provider-card p {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 10px;
}

.provider-card strong {
    color: var(--text);
    font-weight: 600;
}

.provider-file-type {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary-dim);
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    background: transparent;
}

.drop-zone:hover {
    border-color: var(--text-muted);
    background: var(--bg-surface);
}

.drop-zone-active {
    border-color: var(--primary);
    background: var(--primary-dim);
}

.drop-zone-has-file {
    border-style: solid;
    border-color: var(--accent);
    background: var(--accent-dim);
    padding: 24px;
}
.drop-zone-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.drop-zone-text {
    font-size: 14px;
    color: var(--text-dim);
}

.drop-zone-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.drop-zone-file {
    display: flex;
    align-items: center;
    gap: 14px;
}

.drop-zone-filename {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.drop-zone-filesize {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Import actions */
.import-actions {
    margin-bottom: 20px;
}

.import-btn {
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.import-btn:hover:not(:disabled) {
    background: #0891b2;
}

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

.import-btn.importing {
    opacity: 0.8;
}

.import-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Import error */
/* Tag editor */
.tag-editor {
    margin-top: 8px;
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.tag-chip-remove {
    cursor: pointer;
    opacity: 0.5;
    font-size: 10px;
    margin-left: 2px;
}

.tag-chip-remove:hover {
    opacity: 1;
    color: var(--danger);
}

.tag-input-row {
    display: flex;
    gap: 6px;
}

.tag-input {
    flex: 1;
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
}

.tag-input:focus {
    border-color: var(--accent);
}

.tag-add-btn {
    padding: 4px 10px;
    font-size: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
}

.tag-add-btn:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tag-add-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.import-progress {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.import-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}
.import-progress-count { color: var(--primary); font-variant-numeric: tabular-nums; }
.import-progress-bar-track {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}
.import-progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.import-progress-detail {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
}
.import-progress-hint {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-dim);
    opacity: 0.7;
    font-style: italic;
}

/* Import preview card */
.import-preview-card {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
}
.import-preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.import-preview-samples {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    max-height: 280px;
    overflow-y: auto;
}
.import-preview-sample {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
}
.import-preview-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--bg);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
}
.import-preview-domain {
    flex-shrink: 0;
    padding: 2px 6px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.import-preview-text {
    color: var(--text-dim);
    word-break: break-word;
}
.import-preview-more {
    text-align: center;
    font-size: 11px;
    color: var(--text-dim);
    font-style: italic;
    padding: 4px;
}
.import-preview-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.btn-secondary {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.btn-secondary:hover {
    border-color: var(--text-dim);
    color: var(--text);
}

.import-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 16px;
}

/* Import suggestion (unstructured doc warning) */
.import-suggestion {
    background: var(--bg-surface);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}

.import-suggestion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: rgb(234, 179, 8);
}

.import-suggestion-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.import-suggestion-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.import-suggestion-example {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px 16px;
    line-height: 1.6;
}

.import-suggestion-example code {
    background: rgba(var(--accent-rgb, 99, 102, 241), 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* Import results */
.import-results {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.import-results-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.import-results-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.import-results-stats {
    margin-bottom: 20px;
}

.import-stat {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0;
}

.import-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.import-stat-dim {
    color: var(--text-muted);
    font-size: 18px;
}

.import-stat-warn {
    color: var(--warning);
    font-size: 18px;
}

.import-stat-label {
    font-size: 14px;
    color: var(--text-dim);
}

.import-error-list {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    max-height: 120px;
    overflow-y: auto;
}

.import-error-item {
    font-size: 12px;
    color: var(--danger);
    padding: 3px 0;
    font-family: monospace;
}

.import-view-btn {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.import-view-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Animations */
@keyframes pulse-glow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

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

.fade-in {
    animation: fade-in 0.2s ease-out;
}

/* ─── Login Screen ─── */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
    background: var(--bg-deep);
}
.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow);
}
.login-icon {
    text-align: center;
    margin-bottom: 20px;
}
.login-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.login-subtitle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.5;
}
.login-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--bg-deep);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.login-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.login-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 8px;
    text-align: center;
}
.login-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius);
    border: none;
    background: var(--secondary);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.login-btn:hover:not(:disabled) {
    background: #7c3aed;
}
.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.login-recover-link {
    display: block;
    margin: 16px auto 0;
    background: none;
    border: none;
    color: var(--text-muted, #888);
    font-size: 0.85em;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.login-recover-link:hover {
    color: var(--accent, #a78bfa);
}
.login-success {
    color: #22c55e;
    font-size: 0.9em;
    text-align: center;
    margin-top: 8px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    transition: all 0.3s ease;
}
.toggle-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-dim);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background: var(--accent);
}

/* Cleanup Settings */
.cleanup-section {
    border-color: rgba(245, 158, 11, 0.2);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.03), var(--bg-surface));
}

/* Synaptic Ledger */
.ledger-section {
    border-color: rgba(139, 92, 246, 0.25);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.04), var(--bg-surface));
}
.ledger-section h3 { color: #a78bfa; }
.ledger-status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.ledger-status-badge.enabled { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.ledger-status-badge.disabled { background: rgba(107, 114, 128, 0.15); color: #6b7280; }
.ledger-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ledger-recovery {
    margin-top: 12px; padding: 12px; border-radius: 8px;
    background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.2);
}
.ledger-recovery-key {
    font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px;
    word-break: break-all; padding: 8px; margin: 8px 0;
    background: var(--bg-primary); border-radius: 4px; border: 1px solid var(--border);
    color: var(--text-primary);
}
.ledger-recovery-warning {
    font-size: 12px; color: #f59e0b; line-height: 1.5; margin-bottom: 8px;
}
.setting-help {
    margin-top: 4px;
    line-height: 1.4;
}
.setting-detail {
    padding-left: 8px;
    border-left: 2px solid var(--border);
    margin-left: 4px;
}

/* Range slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border-light);
    border-radius: 4px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 4px rgba(6, 182, 212, 0.4);
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-surface);
}

/* Button variants */
.btn-primary {
    background: var(--accent) !important;
    color: #fff !important;
}
.btn-primary:hover:not(:disabled) {
    background: #059669 !important;
}
.btn-danger {
    background: transparent !important;
    color: var(--danger) !important;
    border: 1px solid var(--danger) !important;
}
.btn-danger:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* ─── Network Page ─── */
.network-page {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.network-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.network-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}
.network-header-sub {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* External clients section (Connect ChatGPT / Cursor / Cline / Claude Desktop) — v6.7.3 */
.ext-clients-section {
    margin: 18px 0 24px 0;
    padding: 16px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.ext-clients-header h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: var(--text);
}
.ext-clients-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 720px) {
    .ext-clients-grid { grid-template-columns: 1fr; }
}
.ext-client-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.ext-client-card:hover, .ext-client-card:focus {
    border-color: var(--accent);
    outline: none;
    transform: translateY(-1px);
}
.ext-client-icon { font-size: 28px; line-height: 1; }
.ext-client-info { flex: 1; min-width: 0; }
.ext-client-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.ext-client-desc {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.45;
}
.ext-client-cta {
    font-size: 12px;
    color: var(--accent);
    white-space: nowrap;
    font-weight: 500;
}

/* Agent list (vertical accordion) */
.agent-list { display: flex; flex-direction: column; gap: 12px; }

/* Collapsed card row */
.agent-card-row {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px 20px;
    cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; gap: 16px; position: relative;
}
.agent-card-row:hover { border-color: var(--primary); background: var(--bg-elevated); }
.agent-card-row.expanded {
    border-color: var(--primary); border-bottom-left-radius: 0;
    border-bottom-right-radius: 0; border-bottom-color: transparent;
    background: var(--bg-elevated);
}
.agent-row-identity { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.agent-row-meta {
    display: flex; align-items: center; gap: 20px; flex: 1;
    font-size: 12px; color: var(--text-dim);
}
.agent-row-chevron {
    width: 20px; height: 20px; color: var(--text-muted);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); flex-shrink: 0;
}
.agent-card-row.expanded .agent-row-chevron { transform: rotate(180deg); }

/* Shared agent elements */
.agent-avatar {
    width: 40px; height: 40px; border-radius: var(--radius);
    background: var(--bg-elevated); display: flex; align-items: center;
    justify-content: center; font-size: 20px; border: 1px solid var(--border); flex-shrink: 0;
}
.agent-name { font-size: 14px; font-weight: 600; color: var(--text); }
.agent-role-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.agent-role-badge.admin { background: var(--secondary-dim); color: var(--secondary); }
.agent-role-badge.member { background: var(--primary-dim); color: var(--primary); }
.agent-role-badge.observer { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.on-chain-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
    background: rgba(16, 185, 129, 0.15); color: #10b981;
}
.agent-detail-link {
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 8px; border-radius: 6px; transition: background 0.2s;
}
.agent-detail-link:hover {
    background: var(--primary-dim);
}
.agent-status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block;
}
.agent-status-dot.active { background: var(--accent); box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.agent-status-dot.pending { background: var(--warning); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.agent-status-dot.offline { background: var(--text-muted); }
.agent-status-dot.removed { background: var(--danger); }

/* Expanded accordion */
.agent-expanded {
    background: var(--bg-surface); border: 1px solid var(--primary);
    border-top: none; border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
.agent-expanded.open { max-height: 900px; opacity: 1; }
.agent-expanded::before {
    content: ''; display: block; height: 1px; margin: 0 20px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0; transition: opacity 0.3s ease 0.1s;
}
.agent-expanded.open::before { opacity: 1; }
.agent-expanded-inner { padding: 0 20px 20px; }

/* Tab bar */
.agent-tab-bar {
    display: flex; gap: 0; border-bottom: 1px solid var(--border);
    margin: 0 -20px 20px; padding: 0 20px;
}
.agent-tab {
    padding: 12px 20px; font-size: 13px; font-weight: 500;
    color: var(--text-muted); cursor: pointer;
    border: none; border-bottom: 2px solid transparent;
    background: none; transition: all 0.2s;
}
.agent-tab:hover { color: var(--text-dim); }
.agent-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Overview tab */
.agent-overview-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.agent-info-block { display: flex; flex-direction: column; gap: 4px; }
.agent-info-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted);
}
.agent-info-value { font-size: 14px; color: var(--text); font-weight: 500; }
.agent-info-value.mono {
    font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px;
    color: var(--text-dim); word-break: break-all;
}
.agent-bio-block {
    grid-column: 1 / -1; font-size: 13px; color: var(--text-dim); line-height: 1.6;
    padding: 12px 16px; background: var(--bg-elevated);
    border-radius: var(--radius); border: 1px solid var(--border);
}

/* Access control tab */
.access-section-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted); margin-bottom: 10px; margin-top: 20px;
}
.access-section-title:first-child { margin-top: 0; }
.role-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.role-card {
    padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius);
    cursor: pointer; transition: all 0.2s; background: var(--bg-elevated); text-align: left;
}
.role-card:hover { border-color: var(--text-muted); }
.role-card.selected { border-color: var(--primary); background: var(--primary-dim); }
.role-card.selected.admin { border-color: var(--secondary); background: var(--secondary-dim); }
.role-card.selected.observer { border-color: var(--warning); background: rgba(245, 158, 11, 0.08); }
.role-card-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.role-card-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* Domain access matrix */
.domain-matrix { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.domain-matrix-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--bg-deep); border-bottom: 1px solid var(--border);
}
.domain-matrix-search {
    padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border-light);
    background: var(--bg-surface); color: var(--text); font-size: 12px; outline: none;
    width: 200px; transition: border-color 0.2s;
}
.domain-matrix-search:focus { border-color: var(--primary); }
.domain-matrix-bulk { display: flex; gap: 6px; }
.domain-matrix-bulk button {
    padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border-light);
    background: var(--bg-elevated); color: var(--text-dim); cursor: pointer;
    font-size: 11px; transition: all 0.15s;
}
.domain-matrix-bulk button:hover { border-color: var(--primary); color: var(--primary); }
.domain-matrix-add {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; background: var(--bg-deep); border-bottom: 1px solid var(--border);
}
.domain-matrix-add input { flex: 1; }
.domain-add-btn {
    padding: 5px 12px; border-radius: 4px; border: 1px solid var(--primary);
    background: var(--primary-dim); color: var(--primary); cursor: pointer;
    font-size: 11px; font-weight: 600; white-space: nowrap; transition: all 0.15s;
}
.domain-add-btn:hover { background: var(--primary); color: var(--bg); }
.domain-add-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.domain-matrix-row.custom { background: rgba(6, 182, 212, 0.04); }
.domain-matrix-columns {
    display: grid; grid-template-columns: 1fr 70px 70px; padding: 8px 16px;
    background: var(--bg-deep); border-bottom: 1px solid var(--border);
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted); font-weight: 600;
}
.domain-matrix-body {
    max-height: 300px; overflow-y: auto; scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}
.domain-matrix-body::-webkit-scrollbar { width: 6px; }
.domain-matrix-body::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.domain-matrix-row {
    display: grid; grid-template-columns: 1fr 70px 70px; padding: 10px 16px;
    align-items: center; border-bottom: 1px solid var(--border); transition: background 0.15s;
}
.domain-matrix-row:last-child { border-bottom: none; }
.domain-matrix-row:hover { background: var(--bg-elevated); }
.domain-matrix-domain { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text); }
.domain-matrix-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.domain-matrix-toggle { display: flex; justify-content: center; }
.domain-matrix-empty, .domain-matrix-no-results {
    padding: 20px; text-align: center; color: var(--text-muted); font-size: 12px;
}
.access-save-bar {
    display: flex; justify-content: flex-end; align-items: center; gap: 12px;
    padding-top: 16px; border-top: 1px solid var(--border); margin-top: 20px;
}
.access-dirty { font-size: 11px; color: var(--warning); font-weight: 500; }
.access-saved { font-size: 11px; color: var(--accent); transition: opacity 0.3s; }

/* Activity tab */
.activity-tab { display: flex; flex-direction: column; gap: 16px; }
.activity-stats-row { display: flex; gap: 16px; }
.activity-stat-card {
    flex: 1; background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; text-align: center;
}
.activity-stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.activity-stat-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); margin-top: 4px;
}
.activity-memory-list {
    display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto;
}
.activity-memory-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 13px; transition: background 0.15s;
}
.activity-memory-item:hover { background: var(--bg-deep); }
.activity-memory-domain {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
    font-weight: 600; padding: 2px 8px; border-radius: 4px; flex-shrink: 0; white-space: nowrap;
}
.activity-memory-content {
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim);
}
.activity-memory-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.activity-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

/* Action bar (bottom of expanded card) */
.agent-action-bar {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 16px 0 0; border-top: 1px solid var(--border); margin-top: 20px;
}

/* Add agent row */
.agent-card-add {
    border: 2px dashed var(--border-light); background: transparent;
    border-radius: var(--radius-lg); padding: 16px 20px;
    display: flex; align-items: center; justify-content: center;
    gap: 12px; cursor: pointer; color: var(--text-muted);
    transition: all 0.2s; min-height: 56px;
}
.agent-card-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dim); }
.agent-card-add-icon {
    width: 32px; height: 32px; border-radius: 50%; background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
    border: 1px solid var(--border-light); transition: all 0.2s;
}
.agent-card-add:hover .agent-card-add-icon { background: var(--primary-dim); border-color: var(--primary); }
.agent-card-add-label { font-size: 13px; font-weight: 600; }

/* Unregistered agents */
.unregistered-section { margin-top: 24px; padding: 16px 20px; background: var(--bg-elevated); border-radius: 12px; border: 1px dashed var(--border); }
.unregistered-list { display: flex; flex-direction: column; gap: 8px; }
.unregistered-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--bg-surface); border-radius: 8px;
    border: 1px dashed var(--border);
}
.unregistered-info { display: flex; flex-direction: column; gap: 2px; }
.merge-btn {
    padding: 6px 14px; font-size: 12px; font-weight: 600;
    background: var(--primary-dim); color: var(--primary); border: 1px solid var(--primary);
    border-radius: 6px; cursor: pointer; transition: all 0.15s;
}
.merge-btn:hover { background: var(--primary); color: var(--bg); }
.merge-target-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; color: var(--text); font-size: 13px;
    transition: all 0.15s; text-align: left;
}
.merge-target-btn:hover { border-color: var(--primary); background: var(--primary-dim); }
.merge-target-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Clearance visual */
.clearance-row { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.clearance-row input[type="range"] { flex: 1; }
.clearance-label { font-size: 13px; font-weight: 600; color: var(--text); min-width: 100px; text-align: right; }

@media (max-width: 900px) {
    .agent-row-meta { flex-wrap: wrap; gap: 8px 16px; }
    .role-selector { grid-template-columns: 1fr; }
    .agent-overview-grid { grid-template-columns: 1fr; }
    .domain-matrix-header { flex-direction: column; gap: 8px; }
    .domain-matrix-search { width: 100%; }
    .activity-stats-row { flex-wrap: wrap; }
}

/* Wizard overlay */
.wizard-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease-out;
}
.wizard-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.wizard-header {
    padding: 24px 28px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wizard-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.wizard-body {
    padding: 24px 28px;
}
.wizard-footer {
    padding: 16px 28px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

/* Wizard stepper */
.wizard-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
}
.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}
.wizard-step.active {
    background: var(--primary-dim);
    color: var(--primary);
}
.wizard-step.completed {
    color: var(--accent);
}
.wizard-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}
.wizard-step.active .wizard-step-num {
    border-color: var(--primary);
    background: var(--primary-dim);
}
.wizard-step.completed .wizard-step-num {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.wizard-step-line {
    width: 24px;
    height: 2px;
    background: var(--border-light);
}

/* Wizard form elements */
.wizard-field {
    margin-bottom: 18px;
}
.wizard-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wizard-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--bg-deep);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.wizard-input:focus {
    border-color: var(--primary);
}
.wizard-textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--bg-deep);
    color: var(--text);
    font-size: 13px;
    outline: none;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
}
.wizard-textarea:focus {
    border-color: var(--primary);
}
.wizard-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--bg-deep);
    color: var(--text);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.wizard-select:focus {
    border-color: var(--primary);
}

/* Clearance slider */
.clearance-slider {
    display: flex;
    align-items: center;
    gap: 12px;
}
.clearance-slider input[type="range"] {
    flex: 1;
}
.clearance-label {
    font-size: 12px;
    font-weight: 600;
    min-width: 100px;
    text-align: right;
}

/* Emoji picker grid */
.emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.emoji-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.emoji-btn:hover {
    border-color: var(--primary);
    background: var(--primary-dim);
}
.emoji-btn.selected {
    border-color: var(--primary);
    background: var(--primary-dim);
    box-shadow: 0 0 0 2px var(--primary);
}

/* Connect method cards */
.connect-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.connect-card {
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.connect-card:hover {
    border-color: var(--primary);
}
.connect-card.selected {
    border-color: var(--primary);
    background: var(--primary-dim);
}
.connect-card-icon {
    font-size: 32px;
    margin-bottom: 10px;
}
.connect-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.connect-card p {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Boot instructions textarea */
.boot-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}
.boot-textarea:focus {
    border-color: var(--primary);
}
.boot-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Software Update section */
.update-section { margin-top: 16px; }
.update-status { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.update-version-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid var(--border);
}
.update-version-row .label { color: var(--text-muted); font-size: 13px; }
.update-version-row .value.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.update-highlight { color: var(--primary); font-weight: 600; }
.update-current {
    color: var(--accent); font-size: 13px; padding: 8px 12px;
    background: rgba(16, 185, 129, 0.08); border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.update-available {
    padding: 12px; background: var(--bg-elevated); border-radius: 8px;
    border: 1px solid var(--primary-dim); margin-bottom: 12px;
}
.update-release-name { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.update-size { font-size: 12px; color: var(--text-muted); margin-right: 12px; }
.update-notes-link {
    font-size: 12px; color: var(--primary); text-decoration: none;
}
.update-notes-link:hover { text-decoration: underline; }
.update-error {
    color: var(--danger); font-size: 13px; padding: 8px 12px;
    background: rgba(239, 68, 68, 0.08); border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2); margin-bottom: 8px;
}
.update-progress {
    color: var(--primary); font-size: 13px; padding: 8px 0;
}
.update-steps {
    display: flex; flex-direction: column; gap: 6px;
    padding: 12px; background: var(--bg-elevated); border-radius: 8px;
    border: 1px solid var(--border); margin-bottom: 12px;
}
.update-step {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-muted);
    transition: color 0.2s;
}
.update-step.active { color: var(--text); }
.update-step.done { color: var(--text-dim); }
.update-step.error { color: var(--danger); }
.update-step-icon { width: 16px; text-align: center; flex-shrink: 0; }
.update-step-label { font-weight: 500; min-width: 110px; }
.update-step-msg { color: var(--text-muted); font-size: 12px; }
.update-step.active .update-step-msg { color: var(--primary); }
.update-step.done .update-step-label { color: var(--accent-green, var(--accent)); }
.update-actions { display: flex; gap: 8px; margin-top: 8px; }
.update-restart-btn { animation: pulse-glow 2s infinite; }
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 4px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 16px rgba(99, 102, 241, 0.6); }
}
.spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.6s linear infinite;
    vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pairing code display */
.pairing-code-display {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 8px;
    color: var(--primary);
    font-family: monospace;
    padding: 20px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin: 16px 0;
    text-align: center;
    user-select: all;
}

/* Deploy progress */
.deploy-progress {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 16px;
}
.deploy-phase {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
.deploy-phase.completed {
    color: var(--accent);
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.15);
}
.deploy-phase.in-progress {
    color: var(--primary);
    background: var(--primary-dim);
    border-color: rgba(6, 182, 212, 0.25);
    animation: deploy-pulse 1.5s ease-in-out infinite;
}
.deploy-phase.failed {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}
.deploy-phase-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.deploy-phase-label {
    flex: 1;
    font-weight: 500;
}
.deploy-check {
    color: var(--accent);
    font-weight: 700;
    font-size: 15px;
}
.deploy-fail {
    color: var(--danger);
    font-weight: 700;
    font-size: 15px;
}
.deploy-pending {
    color: var(--text-muted);
    font-size: 12px;
}
.deploy-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--danger);
}
.deploy-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(6, 182, 212, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.deploy-timer {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; margin-bottom: 8px;
    background: var(--primary-dim); border-radius: var(--radius);
    border: 1px solid rgba(6, 182, 212, 0.15);
}
@keyframes deploy-pulse {
    0%, 100% { opacity: 1; border-color: rgba(6, 182, 212, 0.25); }
    50% { opacity: 0.75; border-color: rgba(6, 182, 212, 0.5); }
}

/* Summary card */
.summary-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}
.summary-row .label { color: var(--text-muted); }
.summary-row .value { color: var(--text); font-weight: 500; }

/* Warning banner */
.warning-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--warning);
    margin-top: 12px;
}

/* Redeploy banner */
.redeploy-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    color: var(--warning);
    flex-shrink: 0;
    margin-bottom: 16px;
    animation: pulse-border 2s ease-in-out infinite;
}
@keyframes pulse-border {
    0%, 100% { border-color: rgba(245, 158, 11, 0.25); }
    50% { border-color: rgba(245, 158, 11, 0.5); }
}

/* Agent filter dropdown on search */
.search-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-select {
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    color: var(--text);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
.filter-select:focus {
    border-color: var(--primary);
}

/* Remove confirmation modal */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.15s ease-out;
}
.confirm-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.confirm-modal h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}
.confirm-modal p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 16px;
}
.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ─── Kanban / Tasks Page ─── */
.tasks-page {
    padding: 24px;
    height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}
.tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-shrink: 0;
}
.tasks-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.tasks-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    flex: 1;
    min-height: 0;
}
@media (max-width: 1000px) {
    .kanban-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .kanban-board { grid-template-columns: 1fr; }
}
.kanban-column {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 200px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.kanban-column.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}
.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}
.kanban-column-icon {
    font-size: 14px;
}
.kanban-column-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.kanban-column-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-deep);
    padding: 2px 8px;
    border-radius: 10px;
}
.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kanban-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
    position: relative;
}
.kanban-card:hover {
    border-color: var(--border-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.kanban-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}
.kanban-card:active {
    cursor: grabbing;
}
.kanban-card-content {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.kanban-card-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.kanban-action {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 12px;
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.1s;
}
.kanban-action:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.kanban-action-drop:hover {
    background: var(--danger);
    border-color: var(--danger);
}
.kanban-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 24px 8px;
}

/* ─── Task Add Form ─── */
.task-add-form {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    align-items: center;
    flex-wrap: wrap;
}
.task-add-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}
.task-add-input:focus { border-color: var(--accent); outline: none; }
.task-add-domain {
    width: 140px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}
.task-add-domain:focus { border-color: var(--accent); outline: none; }
.task-add-submit { font-weight: 600; }
.tasks-old-done-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* ─── Agent Tabs (Brain View) ─── */
.agent-tab-bar {
    display: flex;
    gap: 6px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 6px 20px;
    margin: 0;
    flex-wrap: wrap;
}
.agent-tab {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    white-space: nowrap;
}
.agent-tab:hover {
    background: var(--bg-elevated);
    color: var(--text);
}
.agent-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.agent-tab-avatar {
    font-size: 14px;
}
.agent-tab.unregistered {
    border-style: dashed;
    border-color: var(--text-muted);
    opacity: 0.7;
}
.agent-tab.unregistered.active {
    opacity: 1;
    border-style: solid;
}
.agent-role-badge {
    font-size: 9px;
    line-height: 1;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 700;
}
.agent-role-badge.admin {
    color: var(--warning, #f5a623);
}
.agent-role-badge.unknown {
    color: var(--text-muted);
    font-size: 10px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    max-width: 420px;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: toast-in 0.3s ease-out;
    border: 1px solid var(--border);
}

.toast.removing {
    animation: toast-out 0.25s ease-in forwards;
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

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

.toast-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 0 0 0 8px;
    opacity: 0.5;
    flex-shrink: 0;
}

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

.toast.success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.toast.info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.toast.warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

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

/* ─── Governance Section ─── */
.gov-section {
    margin-bottom: 24px;
}
.gov-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.gov-section-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}
.gov-proposal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color 0.2s;
}
.gov-proposal-card.active {
    border-color: var(--primary);
}
.gov-proposal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}
.gov-proposal-op {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.gov-proposal-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.gov-proposal-reason {
    font-size: 13px;
    color: var(--text-dim);
    font-style: italic;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}
.gov-vote-tally {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}
.gov-vote-accept { color: #22c55e; }
.gov-vote-reject { color: #ef4444; }
.gov-vote-abstain { color: #6b7280; }
.gov-quorum-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.gov-quorum-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: visible;
    position: relative;
}
.gov-quorum-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
    min-width: 0;
}
.gov-quorum-threshold {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background: var(--warning);
    border-radius: 1px;
    z-index: 1;
}
.gov-quorum-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}
.gov-expiry {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.gov-vote-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.gov-vote-btn {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.gov-vote-btn:hover:not(:disabled) { opacity: 0.85; transform: translateY(-1px); }
.gov-vote-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.gov-vote-btn.accept { background: #22c55e; color: white; }
.gov-vote-btn.reject { background: #ef4444; color: white; }
.gov-vote-btn.abstain { background: #6b7280; color: white; }
.gov-vote-btn.cancel { background: transparent; border: 1px solid var(--border-light); color: var(--text-muted); }
.gov-vote-btn.cancel:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.gov-voted-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-dim);
}

/* Proposal history */
.gov-history-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}
.gov-history-toggle:hover { color: var(--text-dim); }
.gov-history-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}
.gov-history-toggle.open svg { transform: rotate(180deg); }
.gov-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.gov-history-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}
.gov-history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gov-history-op {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
}
.gov-history-detail {
    color: var(--text-muted);
}
.gov-history-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.gov-history-votes {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}
.gov-status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.gov-status-executed { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.gov-status-rejected { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.gov-status-expired { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.gov-status-cancelled { background: rgba(107, 114, 128, 0.15); color: #9ca3af; }
.gov-status-voting { background: rgba(6, 182, 212, 0.15); color: var(--primary); }

/* New proposal button */
.gov-new-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px dashed var(--border-light);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.gov-new-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-dim);
}

/* Empty state */
.gov-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}
.gov-empty-icon {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}
