/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* All CSS custom properties now live in design-system.css */

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Skip-to-content link (accessibility) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 100000;
    padding: 8px 16px;
    background: var(--accent-primary);
    color: var(--white);
    border-radius: 0 0 6px 6px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    z-index: var(--z-sticky);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: var(--header-shadow, none);
}

/* Living gradient line under header */
.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), var(--accent-secondary), transparent);
    background-size: 200% 100%;
    animation: gradient-flow 4s ease infinite;
    pointer-events: none;
}

.header-left {
    flex: 0 0 var(--sidebar-width);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 0;
    overflow: visible;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--accent-primary);
    min-width: 0;
    overflow: hidden;
    transition: width 0.2s ease, opacity 0.15s ease, gap 0.2s ease;
}

/* =========================================================
   COSMION icon — 32x32 SVG favicon used in header
   ========================================================= */
.ld-logo-img {
    flex-shrink: 0;
    height: 32px;
    width: 32px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(212, 101, 74, 0.3));
    transition: filter 0.3s ease, transform 0.3s ease;
}

.ld-logo-img:hover {
    filter: drop-shadow(0 0 10px rgba(212, 101, 74, 0.55));
    transform: scale(1.06);
}

/* =========================================================
   COSMION wordmark — SVG text logo
   ========================================================= */
.logo-wordmark-wrap {
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s ease, max-width 0.3s ease;
    overflow: hidden;
    max-width: 200px;
}

.ld-wordmark-img {
    height: 22px;
    width: auto;
    object-fit: contain;
    /* SVG wordmark is already #e5e5e5 — no filter needed in dark mode */
    filter: none;
    transition: filter 0.3s ease, opacity 0.3s ease;
    display: block;
}

.ld-wordmark-img:hover {
    filter: brightness(1.15) drop-shadow(0 0 6px rgba(229, 229, 229, 0.2));
}

/* Light theme: darken the #e5e5e5 wordmark text for contrast on light bg */
[data-theme="light"] .ld-wordmark-img {
    filter: brightness(0.35) saturate(0.8);
}

[data-theme="light"] .ld-wordmark-img:hover {
    filter: brightness(0.3) saturate(0.9) drop-shadow(0 0 3px rgba(30, 30, 30, 0.25));
}

/* Legacy text fallback (backward compat) */
.logo-text {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 2.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    transition: opacity 0.2s ease, max-width 0.3s ease;
    display: none; /* hidden when wordmark is present */
}


/* Legacy fallback (keep for backward compat) */
.logo-ly {
    font-weight: 700;
    background: linear-gradient(135deg, var(--ld-400), var(--ld-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.logo-dian {
    color: rgba(255, 255, 255, 0.88);
    font-weight: 400;
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    min-width: 0;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    min-width: 0;
}

.breadcrumb-root {
    color: var(--text-tertiary);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.breadcrumb-root:hover {
    color: var(--accent-primary);
}

.breadcrumb-sep {
    color: var(--text-tertiary);
    opacity: 0.4;
    font-size: 14px;
    user-select: none;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Command palette trigger — search bar style */
.cmd-palette-trigger {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    min-width: 180px;
    background: var(--glass-hover);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 13px;
    transition: all 0.2s ease;
}

.cmd-palette-trigger:hover {
    background: rgba(212, 101, 74, 0.08);
    border-color: rgba(212, 101, 74, 0.25);
    color: var(--text-secondary);
}

.cmd-palette-label {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kbd-hint {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 5px;
    background: var(--glass-hover);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    color: var(--text-tertiary);
    line-height: 1;
    margin-left: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--glass-hover);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.connection-status:has(.status-indicator.connected) {
    border-color: rgba(212, 101, 74, 0.2);
    color: var(--text-secondary);
}

.status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
}

.status-indicator.connected {
    background: var(--green-500);
    box-shadow: 0 0 6px rgba(20, 184, 166, 0.6);
    animation: pulse-connected 2s ease-in-out infinite;
}

.status-indicator.connecting {
    background: var(--warning);
    animation: pulse-connecting 1s ease-in-out infinite;
}

.status-indicator.disconnected {
    background: var(--error);
}

@keyframes pulse-connected {
    0%, 100% { box-shadow: 0 0 6px rgba(20, 184, 166, 0.6); }
    50% { box-shadow: 0 0 10px rgba(20, 184, 166, 0.3); }
}

@keyframes pulse-connecting {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.icon-btn {
    width: 44px;
    height: 44px;
    background: var(--glass-hover);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-tertiary);
}

.icon-btn:hover {
    background: rgba(212, 101, 74, 0.1);
    border-color: rgba(212, 101, 74, 0.3);
    color: var(--accent-primary);
    transform: translateY(-1px);
}

/* ── Voice Trigger Button (Headless — no popup, icon states only) ── */
.voice-trigger {
    position: relative;
    transition: color 200ms ease, border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
}
.voice-trigger.active {
    color: var(--accent-primary);
    border-color: rgba(212, 101, 74, 0.4);
    background: rgba(212, 101, 74, 0.12);
}
.voice-trigger.recording {
    color: var(--red-500);
    border-color: rgba(233, 116, 81, 0.6);
    background: rgba(233, 116, 81, 0.15);
    box-shadow: 0 0 12px rgba(233, 116, 81, 0.3);
    animation: voice-btn-record 0.9s ease-in-out infinite;
}
.voice-trigger.processing {
    color: var(--blue-500);
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.12);
    animation: voice-btn-process 1.2s linear infinite;
}
.voice-trigger.speaking {
    color: var(--color-success, var(--green-500));
    border-color: rgba(20, 184, 166, 0.5);
    background: rgba(20, 184, 166, 0.12);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.2);
    animation: voice-btn-speak 1.5s ease-in-out infinite;
}

@keyframes voice-btn-record {
    0%, 100% { box-shadow: 0 0 12px rgba(233, 116, 81, 0.3); }
    50%       { box-shadow: 0 0 20px rgba(233, 116, 81, 0.6); }
}
@keyframes voice-btn-process {
    0%   { border-color: rgba(59, 130, 246, 0.5); }
    50%  { border-color: rgba(59, 130, 246, 0.2); }
    100% { border-color: rgba(59, 130, 246, 0.5); }
}
@keyframes voice-btn-speak {
    0%, 100% { box-shadow: 0 0 10px rgba(20, 184, 166, 0.2); }
    50%       { box-shadow: 0 0 18px rgba(20, 184, 166, 0.4); }
}

/* Voice status dot on header icon */
.voice-status-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    pointer-events: none;
}
.voice-status-dot.connected {
    background: var(--color-success, var(--green-500));
    box-shadow: 0 0 6px rgba(20, 184, 166, 0.5);
}
.voice-status-dot.recording {
    background: var(--red-500);
    box-shadow: 0 0 8px rgba(233, 116, 81, 0.6);
    animation: voice-dot-pulse 0.8s ease-in-out infinite;
}
.voice-status-dot.processing {
    background: var(--blue-500);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
    animation: voice-dot-spin 1s linear infinite;
}
.voice-status-dot.speaking {
    background: var(--color-success, var(--green-500));
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.6);
    animation: voice-dot-speak 1.2s ease-in-out infinite;
}
.voice-status-dot.error {
    background: var(--red-500);
    box-shadow: 0 0 6px rgba(233, 116, 81, 0.5);
}
.voice-status-dot.connecting {
    background: var(--yellow-500);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
    animation: voice-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes voice-dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
@keyframes voice-dot-spin {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes voice-dot-speak {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

/* ── Command Palette Overlay ── */
.cmd-palette {
    position: fixed;
    inset: 0;
    z-index: var(--z-command-palette);
    display: none;
}

.cmd-palette.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: min(20vh, 120px);
}

.cmd-palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.cmd-palette-dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-elevated);
    overflow: hidden;
}

.cmd-palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.cmd-palette-input-wrap svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.cmd-palette-input-wrap input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.cmd-palette-input-wrap input::placeholder {
    color: var(--text-tertiary);
}

.cmd-palette-results {
    max-height: 420px;
    overflow-y: auto;
    padding: 6px;
}

.cmd-palette-empty {
    padding: 16px 12px;
    color: var(--text-tertiary);
    text-align: center;
    font-size: 13px;
}

.cmd-palette-kbd {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-medium);
    color: var(--text-tertiary);
    font-family: inherit;
    flex-shrink: 0;
}

.cmd-palette-group-label {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.cmd-palette-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: background 0.1s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cmd-palette-item:hover,
.cmd-palette-item.active {
    background: rgba(212, 101, 74, 0.12);
    color: var(--text-primary);
}

.cmd-palette-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.cmd-palette-item .cmd-palette-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Match Highlighting ── */
.cmd-match {
    background: rgba(212, 101, 74, 0.18);
    color: var(--accent-primary);
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 600;
}

/* ── Result Count Badge ── */
.cmd-result-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--glass-hover);
    border-radius: 10px;
    padding: 2px 8px;
    min-width: 20px;
    text-align: center;
    line-height: 1.2;
}
.cmd-result-count:empty { display: none; }

/* ── Category Filter Chips ── */
.cmd-palette-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-subtle);
}
.cmd-filter-chip {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.cmd-filter-chip:hover {
    border-color: rgba(212, 101, 74, 0.3);
    color: var(--text-secondary);
    background: rgba(212, 101, 74, 0.06);
}
.cmd-filter-chip.active {
    background: rgba(212, 101, 74, 0.14);
    border-color: rgba(212, 101, 74, 0.4);
    color: var(--accent-primary);
    font-weight: 600;
}

/* ── Recent Searches ── */
.cmd-palette-recent {
    padding: 6px 14px 2px;
}
.cmd-recent-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}
.cmd-recent-item {
    display: inline-block;
    padding: 3px 10px;
    margin: 2px 4px 2px 0;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--glass-hover);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cmd-recent-item:hover {
    border-color: rgba(212, 101, 74, 0.3);
    background: rgba(212, 101, 74, 0.08);
    color: var(--text-primary);
}

/* ── Page Description & Category Tag ── */
.cmd-palette-desc {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    flex-shrink: 1;
}
.cmd-palette-cat-tag {
    font-size: 10px;
    font-weight: 500;
    color: var(--accent-primary);
    background: rgba(212, 101, 74, 0.08);
    border-radius: 8px;
    padding: 2px 7px;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.8;
}

/* Main Container */
.main-container {
    margin-top: var(--header-height);
    margin-bottom: var(--footer-height);
    display: flex;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.sidebar-nav {
    padding: var(--spacing-sm) 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--spacing-lg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-left: 3px solid transparent;
    font-size: 13.5px;
    font-weight: 450;
    position: relative;
}

.nav-item:hover {
    background: rgba(212, 101, 74, 0.07);
    color: var(--text-primary);
    border-left-color: rgba(212, 101, 74, 0.3);
    padding-left: calc(var(--spacing-lg) + 3px);
}

.nav-item.active {
    background: rgba(212, 101, 74, 0.1);
    color: var(--text-primary);
    border-left-color: var(--accent-primary);
    font-weight: 550;
    box-shadow: inset 3px 0 12px rgba(212, 101, 74, 0.1);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 3px;
    background: var(--accent-primary);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px rgba(212, 101, 74, 0.6), 0 0 20px rgba(212, 101, 74, 0.3);
    animation: active-glow 2s ease-in-out infinite;
}

@keyframes active-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(212, 101, 74, 0.6), 0 0 20px rgba(212, 101, 74, 0.3); }
    50% { box-shadow: 0 0 15px rgba(212, 101, 74, 0.8), 0 0 30px rgba(212, 101, 74, 0.4); }
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.nav-item:hover svg,
.nav-item.active svg {
    opacity: 1;
}

.nav-item-small {
    font-size: var(--font-size-sm);
    padding: 6px var(--spacing-lg) 6px calc(var(--spacing-lg) + var(--spacing-md));
    font-weight: 400;
    color: var(--text-muted);
}

.nav-item-small:hover {
    color: var(--text-secondary);
}

.nav-item-toggle {
    background: transparent;
    border: none;
    width: 100%;
    justify-content: space-between;
    font-family: inherit;
    font-size: inherit;
}

.nav-section-title {
    padding: 20px var(--spacing-lg) 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-tertiary);
    position: relative;
}

.nav-section-title::before {
    content: '';
    position: absolute;
    top: 10px;
    left: var(--spacing-lg);
    right: var(--spacing-lg);
    height: 1px;
    background: linear-gradient(90deg, var(--border-subtle), transparent);
}

.domain-list.collapsed {
    display: none;
}

.domain-list.expanded {
    display: block;
}

#toggle-domains-icon {
    transition: transform 0.2s ease;
}

.domain-list.expanded ~ .nav-item-toggle #toggle-domains-icon {
    transform: rotate(180deg);
}

/* ── Nav Groups (grouped sidebar navigation) ── */
.nav-group {
    margin-bottom: 2px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px var(--spacing-lg) 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    position: relative;
}

.nav-group-header::before {
    content: '';
    position: absolute;
    top: 4px;
    left: var(--spacing-lg);
    right: var(--spacing-lg);
    height: 1px;
    background: linear-gradient(90deg, rgba(212, 101, 74, 0.06), transparent);
}

.nav-group:first-child .nav-group-header::before {
    display: none;
}

.nav-group-header:hover {
    color: var(--text-secondary);
}

.nav-group-header .group-indicator {
    width: 3px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-group-header:hover .group-indicator {
    opacity: 1;
    box-shadow: 0 0 8px currentColor;
}

.nav-group-header .group-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-group-header:hover .group-icon {
    opacity: 1;
}

.nav-group-header .group-label {
    flex: 1;
}

.nav-group-header .group-chevron {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

.nav-group-header:hover .group-chevron {
    opacity: 0.8;
}

.nav-group.collapsed .group-chevron {
    transform: rotate(-90deg);
}

.nav-group-items {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 1;
}

/* Intelligence group (70+ items): scrollable when expanded */
.nav-group-items--scroll {
    max-height: 340px !important;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 101, 74,0.3) transparent;
}
.nav-group-items--scroll::-webkit-scrollbar { width: 3px; }
.nav-group-items--scroll::-webkit-scrollbar-thumb { background: rgba(212, 101, 74,0.3); border-radius: 2px; }

.nav-group.collapsed .nav-group-items {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
}

/* Nav icon wrapper */
.nav-item .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Active nav item uses domain color for left border */
.nav-item.active[data-domain] {
    border-left-color: currentColor;
}

/* ── Sidebar Collapsed State (Desktop) ── */
.sidebar--collapsed {
    width: var(--sidebar-width-collapsed);
}

.sidebar--collapsed .nav-item .nav-label,
.sidebar--collapsed .nav-item-toggle span,
.sidebar--collapsed .nav-section-title,
.sidebar--collapsed .domain-list,
.sidebar--collapsed .nav-item-toggle,
.sidebar--collapsed .nav-group-header {
    display: none;
}

.sidebar--collapsed .nav-group.collapsed .nav-group-items {
    max-height: 600px;
    opacity: 1;
}

.sidebar--collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
    border-left: 3px solid transparent;
    gap: 0;
}

.sidebar--collapsed .nav-item svg {
    margin: 0 auto;
}

.sidebar--collapsed .nav-item-small {
    display: none;
}

/* Sidebar collapse transition */
.sidebar {
    transition: width var(--sidebar-transition, 0.2s ease);
}

/* Header-left tracks sidebar width */
.header-left {
    transition: flex-basis var(--sidebar-transition, 0.2s ease);
}

body.sidebar-collapsed .header-left {
    flex: 0 0 var(--sidebar-width-collapsed);
}

body.sidebar-collapsed .logo {
    gap: 0;
    transition: gap 0.2s ease;
}

body.sidebar-collapsed .ld-logo-img {
    height: 28px;
    width: 28px;
    transition: height 0.2s ease, width 0.2s ease, filter 0.3s ease;
}

body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .logo-wordmark-wrap {
    max-width: 0;
    opacity: 0;
    margin: 0;
    overflow: hidden;
    transition: max-width 0.2s ease, opacity 0.15s ease;
}

/* Tooltip for collapsed sidebar nav items */
.sidebar--collapsed .nav-item[data-tooltip] {
    position: relative;
}

.sidebar--collapsed .nav-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 10, 10, 0.95);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 300;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar--collapsed .nav-item[data-tooltip]:hover::after {
    opacity: 1;
}

/* Collapse toggle — hamburger morphs to chevron */
.sidebar-toggle {
    display: none;
    position: relative;
    z-index: var(--z-sticky, 200);
    flex-shrink: 0;
    padding: 0;
}

.sidebar-toggle .hamburger-line {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease;
    transform-origin: center;
}

body.sidebar-collapsed .sidebar-toggle .line-top {
    transform: translate(2px, 3px) rotate(-30deg) scaleX(0.65);
}

body.sidebar-collapsed .sidebar-toggle .line-mid {
    opacity: 0;
    transform: scaleX(0);
}

body.sidebar-collapsed .sidebar-toggle .line-bot {
    transform: translate(2px, -3px) rotate(30deg) scaleX(0.65);
}

/* Content Area — global Cosmion grid background (matches CI page aesthetic) */
.content {
    flex: 1;
    padding: var(--spacing-xl);
    overflow-y: auto;
    overflow-x: hidden;
    container-type: inline-size;
    container-name: content;
    min-width: 0;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(212, 101, 74, 0.05) 0%, transparent 55%),
        linear-gradient(rgba(212, 101, 74, 0.038) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 101, 74, 0.038) 1px, transparent 1px);
    background-size: 100% 100%, 32px 32px, 32px 32px;
    background-attachment: local, local, local;
}

/* Light mode: darker grid lines for visibility */
[data-theme="light"] .content {
    background-image:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(212, 101, 74, 0.06) 0%, transparent 55%),
        linear-gradient(rgba(212, 101, 74, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(212, 101, 74, 0.08) 1px, transparent 1px);
    background-size: 100% 100%, 32px 32px, 32px 32px;
}

/* Cards — base .card defined in design-system.css */

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

/* Metric Cards */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: var(--spacing-xl);
}

.metric-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.metric-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.metric-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.5px;
}

.metric-change {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.metric-change.positive {
    color: var(--green-500);
}

.metric-change.negative {
    color: var(--red-500);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.01);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(255, 255, 255, 0.03);
}

th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(212, 101, 74, 0.04);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.badge.success {
    background: rgba(20, 184, 166, 0.1);
    color: var(--green-500);
    border-color: rgba(20, 184, 166, 0.15);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--yellow-500);
    border-color: rgba(245, 158, 11, 0.15);
}

.badge.error {
    background: rgba(233, 116, 81, 0.1);
    color: var(--red-500);
    border-color: rgba(233, 116, 81, 0.15);
}

.badge.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--blue-500);
    border-color: rgba(59, 130, 246, 0.15);
}

/* Buttons */
.btn {
    padding: 8px 18px;
    background: var(--accent-primary);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.2px;
}

.btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212, 101, 74, 0.3);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: rgba(212, 101, 74, 0.08);
    border-color: rgba(212, 101, 74, 0.25);
    color: var(--text-primary);
    box-shadow: none;
}

/* Event Feed */
.event-feed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.event-item {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border-left: 2px solid var(--accent-primary);
    transition: all 0.15s ease;
}

.event-item:hover {
    background: rgba(212, 101, 74, 0.05);
    border-left-color: rgba(212, 101, 74, 0.8);
}

.event-time {
    flex-shrink: 0;
    font-size: 10.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.event-content {
    flex: 1;
    min-width: 0;
}

.event-type {
    font-size: 10px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
    font-weight: 600;
}

.event-message {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Domain Grid */
.domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.domain-tile {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.domain-tile:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.domain-tile.healthy {
    border-color: rgba(20, 184, 166, 0.25);
}

.domain-tile.healthy:hover {
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.1);
}

.domain-tile.warning {
    border-color: rgba(245, 158, 11, 0.25);
}

.domain-tile.critical {
    border-color: rgba(233, 116, 81, 0.25);
}

.domain-tile.unknown {
    border-color: rgba(255, 255, 255, 0.06);
}

.domain-tile-name {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

.domain-tile-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: box-shadow 0.3s ease;
}

.domain-tile.healthy .domain-tile-status {
    background: var(--green-500);
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.4);
}

.domain-tile.warning .domain-tile-status {
    background: var(--yellow-500);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.domain-tile.critical .domain-tile-status {
    background: var(--red-500);
    box-shadow: 0 0 8px rgba(233, 116, 81, 0.4);
}

/* JSON Display */
.json-display {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 14px;
    overflow-x: auto;
    font-family: var(--font-mono, 'JetBrains Mono', 'Monaco', 'Menlo', monospace);
    font-size: 12px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.json-key {
    color: #79c0ff;
}

.json-string {
    color: #a5d6ff;
}

.json-number {
    color: #79c0ff;
}

.json-boolean {
    color: #ffa657;
}

.json-null {
    color: #ff7b72;
}

/* Page Headers (used by view components) */
.page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.page-header .text-muted {
    color: var(--text-muted);
}

/* Loading Spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Skeleton loading placeholders */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer-skeleton 1.5s ease infinite;
    border-radius: 8px;
}

@keyframes shimmer-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--spacing-md));
    right: var(--spacing-md);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
}

.toast {
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 300px;
    pointer-events: all;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

.toast.info {
    border-left: 3px solid var(--info);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

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

.modal {
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: var(--spacing-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

.modal-body {
    margin-bottom: var(--spacing-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-lg);
}

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

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input::placeholder {
    color: var(--text-tertiary);
    font-size: 13px;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: rgba(212, 101, 74, 0.5);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(212, 101, 74, 0.08);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-height);
    background: var(--bg-footer);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    z-index: var(--z-dropdown);
    gap: var(--spacing-xl);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Subtle gradient line on top of footer */
.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 101, 74, 0.2), transparent);
    pointer-events: none;
}

.footer-section {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.footer-label {
    color: var(--text-muted);
    font-weight: 400;
}

.footer-value {
    color: var(--text-secondary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Only show scrollbar on hover for sidebar & content */
.sidebar::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
    background: transparent;
}

.sidebar:hover::-webkit-scrollbar-thumb,
.content:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
}

/* Utility Classes */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-tertiary); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* ── Bento KPI Row ── */
.bento-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: var(--spacing-lg);
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.kpi-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-card--agents .kpi-icon { background: rgba(212, 101, 74, 0.12); color: var(--accent-primary); }
.kpi-card--health .kpi-icon { background: rgba(20, 184, 166, 0.12); color: var(--green-500); }
.kpi-card--events .kpi-icon { background: rgba(212, 101, 74, 0.12); color: var(--accent-primary); }
.kpi-card--uptime .kpi-icon { background: rgba(59, 130, 246, 0.12); color: var(--blue-500); }

.kpi-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.kpi-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.3px;
}

.kpi-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.kpi-badge--info    { background: rgba(212, 101, 74, 0.15); color: var(--accent-primary); }
.kpi-badge--success { background: rgba(20, 184, 166, 0.15);  color: var(--green-400); }
.kpi-badge--warning { background: rgba(234, 179, 8, 0.15);  color: #facc15; }
.kpi-badge--danger  { background: rgba(233, 116, 81, 0.15);  color: var(--red-400); }
.kpi-badge--muted   { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* ── Overview Pulse Layout ── */
.overview-pulse {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg, 20px);
    padding: var(--spacing-lg, 20px);
}

.pulse-strip {
    display: flex;
    gap: 1px;
    background: rgba(255,255,255,0.04);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
}

.pulse-kpi {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    background: rgba(10, 10, 10, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    gap: 4px;
    min-width: 0;
    transition: background 0.2s;
}

.pulse-kpi:hover {
    background: rgba(10, 10, 10, 0.7);
}

.pulse-kpi--wide {
    flex: 2;
    padding: 4px 12px;
}

.pk-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.pk-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    font-weight: 500;
}

.pulse-row-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg, 20px);
}

.pulse-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: var(--spacing-lg, 20px);
}

.pulse-row-4 {
    display: grid;
    grid-template-columns: 1fr;
}

/* RENAISSANCE: Engine Health Grid + Causality Stream + Office Widget */
.pulse-row-5 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--spacing-lg, 20px);
}

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

.pulse-activity-card .activity-feed {
    max-height: 320px;
    overflow-y: auto;
}

/* Live indicator badge */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-success, var(--green-500));
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(20, 184, 166, 0.1);
}

.live-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success, var(--green-500));
    animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* KPI value flash on update */
.pk-val.updating {
    animation: kpi-flash 0.4s ease;
}

@keyframes kpi-flash {
    0% { opacity: 1; }
    30% { opacity: 0.5; color: var(--accent-primary); }
    100% { opacity: 1; }
}

/* Activity feed item animations */
.activity-item {
    animation: activity-slide-in 0.3s ease backwards;
}

.activity-item:nth-child(1) { animation-delay: 0ms; }
.activity-item:nth-child(2) { animation-delay: 30ms; }
.activity-item:nth-child(3) { animation-delay: 60ms; }
.activity-item:nth-child(4) { animation-delay: 90ms; }
.activity-item:nth-child(5) { animation-delay: 120ms; }

@keyframes activity-slide-in {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

.activity-item:hover {
    background: rgba(212, 101, 74, 0.05);
    border-radius: 8px;
}

/* Overview responsive */
@media (max-width: 1024px) {
    .pulse-row-2 { grid-template-columns: 1fr; }
    .pulse-row-3 { grid-template-columns: 1fr 1fr; }
    .pulse-activity-card { grid-column: 1 / -1; }
    .pulse-row-5 { grid-template-columns: 1fr 1fr; }
    .pulse-row-5 > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
    .pulse-strip { flex-wrap: wrap; }
    .pulse-kpi--wide { flex-basis: 100%; }
    .pulse-row-3 { grid-template-columns: 1fr; }
    .pulse-row-5 { grid-template-columns: 1fr; }
    .pk-val { font-size: 15px; }
}

/* ── Universal Domain View ── */
.domain-view {
    padding: var(--spacing-lg, 20px);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg, 20px);
}

.dv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md, 12px);
}

.dv-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dv-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dv-icon svg {
    width: 28px;
    height: 28px;
}

.dv-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.dv-group {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dv-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* KPI Row */
.dv-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.dv-kpi {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-left: 3px solid var(--dv-color, var(--accent-primary));
    border-radius: 10px;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}

.dv-kpi:hover {
    background: rgba(255,255,255,0.04);
    transform: translateY(-1px);
}

.dv-kpi-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
}

.dv-kpi-lbl {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.dv-kpi-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1rem;
    font-size: 13px;
}

/* Body Grid */
.dv-body {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--spacing-lg, 20px);
}

/* Health Gauge */
.dv-health-grid {
    display: flex;
    gap: var(--spacing-lg, 20px);
    align-items: flex-start;
}

.dv-gauge {
    flex-shrink: 0;
}

.dv-health-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dv-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.dv-detail-key {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.dv-detail-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Stats Table */
.dv-stats-table {
    display: flex;
    flex-direction: column;
    max-height: 500px;
    overflow-y: auto;
}

.dv-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.15s;
}

.dv-stat-row:hover {
    background: rgba(255,255,255,0.02);
}

.dv-stat-key {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 450;
}

.dv-stat-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    text-align: right;
}

@media (max-width: 768px) {
    .dv-body { grid-template-columns: 1fr; }
    .dv-health-grid { flex-direction: column; align-items: center; }
}

/* ── Bento Grid (legacy) ── */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: var(--spacing-lg);
}

.bento-grid .bento-wide {
    grid-column: span 2;
}

/* ── Bento Bottom ── */
.bento-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: var(--spacing-lg);
}

/* ── Responsive / Mobile ── */

/* Sidebar toggle (hamburger) — visible on all viewports */
.sidebar-toggle {
    display: flex;
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(212, 101, 74, 0.06);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 299;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease-out;
}

/* Wide desktop — ≤1440px: slightly tighter spacing */
@media (max-width: 1440px) {
    .content {
        padding: var(--spacing-lg);
    }

    .bento-kpi-row {
        gap: 14px;
    }
}

/* Tablet — ≤1024px */
@media (max-width: 1024px) {
    .breadcrumb-root {
        display: none;
    }

    .breadcrumb-sep:first-of-type {
        display: none;
    }

    .breadcrumb-domain-parent {
        display: none;
    }

    .kbd-hint {
        display: none;
    }

    .cmd-palette-label {
        display: none;
    }

    .cmd-palette-trigger {
        min-width: unset;
        padding: 6px 10px;
    }

    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-grid .bento-wide {
        grid-column: span 2;
    }

    .footer-section:nth-child(n+4) {
        display: none;
    }
}

/* Mobile — ≤768px */
@media (max-width: 768px) {
    /* On mobile, ignore desktop collapse — always use slide-in overlay */
    .sidebar,
    .sidebar.sidebar--collapsed {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: var(--footer-height);
        z-index: var(--z-overlay);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 260px;
    }

    .sidebar.open,
    .sidebar.sidebar--collapsed.open {
        transform: translateX(0);
    }

    /* Reset collapsed styles on mobile */
    .sidebar--collapsed .nav-item .nav-label,
    .sidebar--collapsed .nav-section-title,
    .sidebar--collapsed .nav-item-toggle,
    .sidebar--collapsed .nav-group-header {
        display: revert;
    }

    .sidebar--collapsed .nav-item {
        justify-content: flex-start;
        padding: 10px var(--spacing-lg);
        gap: 12px;
    }

    /* Hide collapse tooltips on mobile */
    .sidebar--collapsed .nav-item[data-tooltip]::after {
        display: none;
    }

    /* Show sidebar toggle on mobile */
    .sidebar-toggle {
        display: flex;
    }

    /* Don't rotate hamburger icon on mobile */
    body.sidebar-collapsed .sidebar-toggle svg {
        transform: none;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .main-container {
        flex-direction: column;
    }

    .content {
        padding: var(--spacing-md);
    }

    .header {
        padding: 0 var(--spacing-md);
    }

    .header-left {
        flex: 0 0 auto;
    }

    .logo-text {
        font-size: var(--font-size-base);
    }

    .logo-subtitle {
        display: none !important;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .footer {
        padding: 0 var(--spacing-md);
        gap: var(--spacing-md);
    }

    .footer-section:nth-child(n+3) {
        display: none;
    }

    .header-center {
        display: none;
    }

    .cmd-palette-trigger svg {
        width: 16px;
        height: 16px;
    }

    .cmd-palette-dialog {
        margin: 0 12px;
    }

    .bento-kpi-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Force all inline grid 3-panel layouts to single column on mobile */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Force flex 3-panel layouts to column stack */
    div[style*="display:flex"][style*="overflow:hidden"] {
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    /* Canvas containers fluid */
    canvas {
        max-width: 100% !important;
    }

    .kpi-card {
        padding: 12px 14px;
        gap: 10px;
    }

    .kpi-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .kpi-icon svg {
        width: 16px;
        height: 16px;
    }

    .kpi-value {
        font-size: 18px;
    }

    .kpi-badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-grid .bento-wide {
        grid-column: span 1;
    }

    .bento-bottom {
        grid-template-columns: 1fr;
    }

    .connection-status .status-text {
        display: none;
    }

    .engine-pulse-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 8px;
    }

    .engine-dot {
        width: 28px;
        height: 28px;
        font-size: 8px;
    }
}

/* Small phone — ≤480px */
@media (max-width: 480px) {
    .content {
        padding: var(--spacing-sm);
    }

    .bento-kpi-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .kpi-card {
        padding: 10px 12px;
    }

    .kpi-value {
        font-size: 16px;
    }

    .card-title {
        font-size: 13px;
    }

    .header {
        padding: 0 var(--spacing-sm);
    }

    .engine-pulse-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }

    .engine-dot {
        width: 24px;
        height: 24px;
        font-size: 7px;
    }
}

/* Container queries for self-adapting cards */
.card,
.kpi-card,
.bento-grid > * {
    container-type: inline-size;
}

@container (max-width: 280px) {
    .card-title {
        font-size: 13px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Engine Health Pulse Grid
   ============================================ */
.engine-pulse-grid {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    gap: 8px;
    padding: 14px;
}

.engine-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.engine-dot::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: inherit;
    opacity: 0;
    z-index: -1;
    animation: engine-pulse 2.5s ease-in-out infinite;
}

.engine-dot.healthy::before {
    opacity: 0.3;
}

.engine-dot:hover {
    transform: scale(1.3);
    z-index: 2;
    box-shadow: 0 0 16px currentColor;
}

.engine-dot[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 10, 0.95);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 10;
    letter-spacing: 0.3px;
}

@keyframes engine-pulse {
    0%, 100% { transform: scale(1); opacity: 0; }
    50% { transform: scale(1.6); opacity: 0.25; }
}

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

/* Toast improvements */
.toast-item {
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(10, 10, 10, 0.95);
    color: var(--text-primary, var(--gray-100));
    font-size: 13px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 360px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast-item.toast-success { border-left: 3px solid var(--green-500); }
.toast-item.toast-error   { border-left: 3px solid var(--red-500); }
.toast-item.toast-warning { border-left: 3px solid var(--yellow-500); }
.toast-item.toast-info    { border-left: 3px solid var(--color-consciousness, var(--cyan-300)); }

.toast-item:hover {
    transform: translateX(-4px);
    border-color: rgba(255, 255, 255, 0.1);
}

.toast-item.toast-exit {
    animation: toastSlideOut 0.3s ease-in forwards;
}

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

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

/* View transitions — enter/exit for route changes */
.view-enter {
    animation: viewEnter 0.18s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.view-exit {
    animation: viewExit 0.12s ease-in both;
}

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

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

/* Card alive pulse — subtle breathing glow on active cards */
.card--alive {
    animation: card-breathe 3s ease-in-out infinite;
}

@keyframes card-breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 101, 74, 0); }
    50% { box-shadow: 0 0 12px 2px rgba(212, 101, 74, 0.08); }
}

/* Reduced motion: disable ALL non-essential animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Keep essential loading indicators visible (static) */
    .spinner { animation: none !important; }
    .skeleton { animation: none !important; background-size: 100% !important; }
    .engine-dot::before { animation: none !important; opacity: 0 !important; }
    .card--alive { animation: none !important; }
}

/* ─── Orchestrator view ─── */
.orchestrator-view { display: flex; flex-direction: column; gap: 1.5rem; }

.orc-tabs {
    display: flex; gap: .5rem; padding: .25rem;
    background: rgba(255,255,255,0.03); border-radius: 10px;
}
.orc-tab {
    flex: 1; padding: .6rem 1rem; border: none; border-radius: 8px;
    background: transparent; color: var(--text-secondary);
    font-size: .85rem; font-weight: 500; cursor: pointer; transition: all .2s;
}
.orc-tab:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.orc-tab.active { background: rgba(var(--primary-rgb), .15); color: var(--primary); }

.orc-body { min-height: 300px; }

.orc-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.orc-table th { text-align: left; padding: .6rem .75rem; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.06); }
.orc-table td { padding: .55rem .75rem; border-bottom: 1px solid rgba(255,255,255,0.04); }
.orc-table tr:hover td { background: rgba(255,255,255,0.02); }

.orc-input {
    width: 100%; padding: .55rem .75rem; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04);
    color: var(--text-primary); font-size: .85rem;
}
.orc-input:focus { outline: none; border-color: var(--primary); }
select.orc-input { cursor: pointer; }

.orc-form-group { margin-bottom: 1rem; }
.orc-form-group label { display: block; margin-bottom: .35rem; font-size: .8rem; color: var(--text-secondary); font-weight: 500; }

.orc-result { margin-top: 1rem; }
.orc-pre {
    background: rgba(0,0,0,0.3); border-radius: 8px; padding: 1rem;
    font-size: .8rem; overflow-x: auto; color: var(--text-secondary);
    max-height: 400px; overflow-y: auto;
}
.orc-error { color: var(--error, #ff5252); padding: .75rem; background: rgba(255,82,82,0.08); border-radius: 8px; font-size: .85rem; }
.orc-offline { text-align: center; padding: 3rem; color: var(--text-muted); font-size: .95rem; }

/* ─── Orchestrator offline panel (with retry) ─── */
.orc-offline-panel {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1rem; padding: 3.5rem 2rem; text-align: center;
}
.orc-offline-icon {
    color: var(--text-muted); opacity: .45;
}
.orc-offline-title {
    font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin: 0;
}
.orc-offline-endpoint {
    font-size: .78rem; color: var(--text-muted); margin: 0;
}
.orc-offline-endpoint code {
    background: rgba(255,255,255,0.06); border-radius: 4px;
    padding: .15rem .4rem; font-family: monospace;
}
.orc-retry-btn {
    margin-top: .5rem;
}
.orc-source-badge {
    font-size: .68rem; vertical-align: middle; margin-left: .4rem;
}

.orc-cat-row { display: flex; align-items: center; justify-content: space-between; padding: .4rem 0; }
.orc-cat-name { font-size: .85rem; color: var(--text-primary); }

/* Orchestrator status card (overview page) */
.orc-status-card {
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.orc-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.orc-status-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Pulse dot — status indicator */
.pulse-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.pulse-dot--active {
    background: var(--color-success, #4caf50);
    box-shadow: 0 0 0 0 rgba(76,175,80,0.5);
    animation: pulseDot 1.8s infinite;
}
.pulse-dot--danger {
    background: var(--error, #ff5252);
    box-shadow: 0 0 0 0 rgba(255,82,82,0.5);
    animation: pulseDot 1.8s infinite;
}
@keyframes pulseDot {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.35); }
    70%  { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

/* ─── Orchestrator mobile ─── */
@media (max-width: 768px) {
    .orc-tabs {
        flex-wrap: wrap;
        gap: .35rem;
    }
    .orc-tab {
        flex: 0 0 auto;
        padding: .5rem .75rem;
        font-size: .78rem;
    }
    .orc-table {
        font-size: .78rem;
    }
    .orc-table th,
    .orc-table td {
        padding: .45rem .5rem;
    }
    /* Hide capabilities column on mobile */
    .orc-table th:nth-child(4),
    .orc-table td:nth-child(4) {
        display: none;
    }
    .orc-input {
        font-size: .82rem;
    }
    .orc-pre {
        font-size: .72rem;
        max-height: 300px;
        padding: .75rem;
    }
    .orc-offline {
        padding: 2rem;
        font-size: .85rem;
    }
}

@media (max-width: 480px) {
    .orc-tabs {
        gap: .25rem;
    }
    .orc-tab {
        padding: .4rem .6rem;
        font-size: .72rem;
        border-radius: 6px;
    }
    .orc-table th,
    .orc-table td {
        padding: .35rem .4rem;
        font-size: .72rem;
    }
    /* Also hide type column on very small screens */
    .orc-table th:nth-child(3),
    .orc-table td:nth-child(3) {
        display: none;
    }
    .orc-pre {
        max-height: 200px;
        font-size: .68rem;
    }
}

/* Keyboard shortcut hint */
.kbd-hint {
    display: inline-block;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 10px;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    color: var(--text-muted);
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}


/* ════════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES
   Converts all hardcoded dark-theme rgba values to light-mode
   equivalents. Uses design-system.css tokens where available.
   ════════════════════════════════════════════════════════════ */

/* ── Header ──────────────────────────────────── */
[data-theme="light"] .header {
    background: var(--bg-header, rgba(255, 255, 255, 0.92));
    border-bottom-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}
/* Logo — darker text for light backgrounds */
[data-theme="light"] .header .logo-dian {
    color: rgba(5, 5, 5, 0.82);
}
[data-theme="light"] .header .logo svg {
    color: var(--accent-primary);
}

/* Toggle button */
[data-theme="light"] .sidebar-toggle {
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
}
[data-theme="light"] .sidebar-toggle:hover {
    background: rgba(212, 101, 74, 0.06);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* ── Command Palette Trigger ─────────────────── */
[data-theme="light"] .cmd-palette-trigger {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
}
[data-theme="light"] .cmd-palette-trigger:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.12);
}

/* ── Kbd Hint ────────────────────────────────── */
[data-theme="light"] .kbd-hint {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ── Connection Status ───────────────────────── */
[data-theme="light"] .connection-status {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .connection-status .status-text {
    color: var(--text-secondary);
}

/* ── Sidebar ─────────────────────────────────── */
[data-theme="light"] .sidebar {
    background: var(--bg-sidebar);
    border-right-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .sidebar::before {
    background: linear-gradient(180deg, rgba(212, 101, 74, 0.03) 0%, transparent 100%);
}
[data-theme="light"] .sidebar .sidebar-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .sidebar .sidebar-footer {
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* ── Nav Items ───────────────────────────────── */
[data-theme="light"] .nav-item {
    color: var(--text-secondary);
}
[data-theme="light"] .nav-item:hover {
    background: rgba(212, 101, 74, 0.05);
    color: var(--text-primary);
}
[data-theme="light"] .nav-item.active {
    background: rgba(212, 101, 74, 0.07);
    color: var(--accent-primary);
}
[data-theme="light"] .nav-item.active::after {
    background: var(--accent-primary);
    box-shadow: 0 0 6px rgba(212, 101, 74, 0.4);
}
[data-theme="light"] .nav-section-title {
    color: var(--text-muted);
}
[data-theme="light"] .nav-section-title::before {
    background: rgba(0, 0, 0, 0.06);
}

/* ── Group indicators ───────────────────────── */
[data-theme="light"] .nav-group-header .group-label {
    color: var(--text-secondary);
}
[data-theme="light"] .nav-group-header:hover .group-label {
    color: var(--text-primary);
}

/* ── Collapsed Sidebar Tooltip ────────────────── */
[data-theme="light"] .sidebar--collapsed .nav-item .tooltip-text {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary, var(--gray-750));
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ── Content Area ────────────────────────────── */
[data-theme="light"] .content {
    background: var(--bg-primary, #f8f8fc);
}

/* ── Page Title ──────────────────────────────── */
[data-theme="light"] .page-title {
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .page-subtitle {
    color: var(--text-secondary, var(--gray-600));
}

/* ── Metric Cards ────────────────────────────── */
[data-theme="light"] .metric-card {
    background: var(--bg-card, rgba(255, 255, 255, 1));
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: var(--shadow-card, 0 2px 12px rgba(0, 0, 0, 0.06));
}
[data-theme="light"] .metric-card:hover {
    background: var(--bg-card, var(--white));
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .metric-card .metric-label {
    color: var(--text-secondary, var(--gray-600));
}
[data-theme="light"] .metric-card .metric-value {
    color: var(--text-primary, var(--gray-750));
}

/* ── Tables ──────────────────────────────────── */
[data-theme="light"] .table-container {
    background: var(--bg-card, var(--white));
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .table-container thead {
    background: rgba(0, 0, 0, 0.02);
}
[data-theme="light"] .table-container th {
    border-bottom-color: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary, var(--gray-600));
}
[data-theme="light"] .table-container td {
    border-bottom-color: rgba(0, 0, 0, 0.04);
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .table-container tbody tr:hover {
    background: rgba(212, 101, 74, 0.03);
}

/* ── Buttons ─────────────────────────────────── */
[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
}

/* ── Event Feed ──────────────────────────────── */
[data-theme="light"] .event-feed {
    background: var(--bg-card, var(--white));
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .event-item {
    background: rgba(0, 0, 0, 0.015);
    border-bottom-color: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .event-item:hover {
    background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .event-item .event-time {
    color: var(--text-muted, #7a7a7a);
}
[data-theme="light"] .event-item .event-text {
    color: var(--text-primary, var(--gray-750));
}

/* ── Domain Tiles ────────────────────────────── */
[data-theme="light"] .domain-tile {
    background: var(--bg-card, var(--white));
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .domain-tile:hover {
    background: var(--bg-card, var(--white));
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .domain-tile .domain-name {
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .domain-tile .domain-status {
    color: var(--text-secondary, var(--gray-600));
}

/* ── JSON Display / Code Blocks ──────────────── */
[data-theme="light"] .json-display {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-primary, var(--gray-750));
}

/* ── Spinner & Skeleton ──────────────────────── */
[data-theme="light"] .spinner {
    border-color: rgba(0, 0, 0, 0.06);
    border-top-color: var(--accent-primary, var(--ld-400));
}
[data-theme="light"] .skeleton {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.04) 25%,
        rgba(0, 0, 0, 0.07) 50%,
        rgba(0, 0, 0, 0.04) 75%
    );
}

/* ── Toasts ──────────────────────────────────── */
[data-theme="light"] .toast,
[data-theme="light"] .toast-item {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-primary, var(--gray-750));
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* ── Modal ───────────────────────────────────── */
[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .modal {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .modal-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .modal-title {
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .modal-close:hover {
    background: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .modal-footer {
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* ── Form Inputs ─────────────────────────────── */
[data-theme="light"] .form-input,
[data-theme="light"] .form-select {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus {
    background: rgba(0, 0, 0, 0.01);
    border-color: var(--accent-primary, var(--ld-400));
    box-shadow: 0 0 0 3px rgba(212, 101, 74, 0.15);
}
[data-theme="light"] .form-input::placeholder {
    color: var(--text-muted, #7a7a7a);
}
[data-theme="light"] .form-label {
    color: var(--text-secondary, var(--gray-600));
}

/* ── Footer ──────────────────────────────────── */
[data-theme="light"] .footer {
    background: var(--bg-footer, rgba(255, 255, 255, 0.92));
    border-top-color: rgba(0, 0, 0, 0.06);
    color: var(--text-muted, #7a7a7a);
}

/* ── Engine Dot Tooltip ───────────────────────── */
[data-theme="light"] .engine-dot .tooltip,
[data-theme="light"] .engine-dot-tooltip {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary, var(--gray-750));
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ── Orchestrator Panel ───────────────────────── */
[data-theme="light"] .orc-tabs {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .orc-tab {
    color: var(--text-secondary, var(--gray-600));
}
[data-theme="light"] .orc-tab:hover {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .orc-tab.active {
    background: var(--bg-card, var(--white));
    color: var(--accent-primary, var(--ld-400));
    border-bottom-color: var(--accent-primary, var(--ld-400));
}
[data-theme="light"] .orc-table,
[data-theme="light"] .orc-table th,
[data-theme="light"] .orc-table td {
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .orc-table thead {
    background: rgba(0, 0, 0, 0.02);
}
[data-theme="light"] .orc-table td {
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .orc-input {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .orc-input:focus {
    border-color: var(--accent-primary, var(--ld-400));
}
[data-theme="light"] .orc-pre {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    color: var(--text-primary, var(--gray-750));
}

/* ── Scrollbars ──────────────────────────────── */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, rgba(0, 0, 0, 0.12));
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ── Sidebar Overlay (Mobile) ────────────────── */
[data-theme="light"] .sidebar-overlay {
    background: rgba(0, 0, 0, 0.2);
}

/* ── Status Badges ───────────────────────────── */
[data-theme="light"] .badge {
    border-color: rgba(0, 0, 0, 0.06);
}

/* ── Section Headers ─────────────────────────── */
[data-theme="light"] .section-title {
    color: var(--text-primary, var(--gray-750));
}
[data-theme="light"] .section-subtitle {
    color: var(--text-secondary, var(--gray-600));
}

/* ── Dividers / Separators ────────────────────── */
[data-theme="light"] hr,
[data-theme="light"] .divider {
    border-color: rgba(0, 0, 0, 0.06);
}

/* ── Tab Panels ──────────────────────────────── */
[data-theme="light"] .tab-content {
    background: var(--bg-card, var(--white));
    border-color: rgba(0, 0, 0, 0.06);
}

/* ── Command Palette Dialog ───────────────────── */
[data-theme="light"] .cmd-palette-backdrop {
    background: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .cmd-palette-dialog {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .cmd-palette-input-wrap {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .cmd-palette-kbd {
    border-color: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .cmd-palette-item:hover,
[data-theme="light"] .cmd-palette-item.active {
    background: rgba(212, 101, 74, 0.08);
}

/* ── Header Icon Buttons (light theme) ──────── */
[data-theme="light"] .icon-btn {
    color: var(--text-secondary, var(--gray-600));
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .icon-btn:hover {
    color: var(--accent-primary);
    border-color: rgba(212, 101, 74, 0.25);
    background: rgba(212, 101, 74, 0.06);
}

/* ── Header Separator (light theme) ─────────── */
[data-theme="light"] .header-vsep {
    background: rgba(0, 0, 0, 0.1);
}

/* ── GA / CI / Studio Header Buttons (light) ── */
[data-theme="light"] .ga-header-btn {
    background: rgba(212, 101, 74, 0.06);
    border-color: rgba(212, 101, 74, 0.2);
    color: var(--ld-500);
}
[data-theme="light"] .ga-header-btn:hover {
    background: rgba(212, 101, 74, 0.12);
    border-color: rgba(212, 101, 74, 0.4);
    color: var(--ld-600);
}
[data-theme="light"] .ci-header-btn {
    background: rgba(212, 101, 74, 0.05);
    border-color: rgba(212, 101, 74, 0.18);
    color: var(--ld-500);
}
[data-theme="light"] .ci-header-btn:hover {
    background: rgba(212, 101, 74, 0.1);
    border-color: rgba(212, 101, 74, 0.35);
    color: var(--ld-600);
}
[data-theme="light"] .studio-header-btn {
    background: rgba(212, 101, 74, 0.05);
    border-color: rgba(212, 101, 74, 0.18);
    color: var(--ld-500);
}
[data-theme="light"] .studio-header-btn:hover {
    background: rgba(212, 101, 74, 0.1);
    border-color: rgba(212, 101, 74, 0.35);
    color: var(--ld-600);
}
[data-theme="light"] .studio-hbtn-cursor {
    background: var(--ld-400);
}

/* ── Lydian Monitor Button (light theme) ─────── */
[data-theme="light"] .lydian-header-btn {
    border-color: rgba(0, 0, 0, 0.1) !important;
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--text-secondary, var(--gray-600)) !important;
}
[data-theme="light"] .lydian-header-btn[data-risk="low"] {
    border-color: rgba(212, 101, 74, 0.25) !important;
    background: rgba(212, 101, 74, 0.05) !important;
    color: var(--ld-500) !important;
}
[data-theme="light"] .lydian-header-btn[data-risk="medium"] {
    border-color: rgba(202, 138, 4, 0.3) !important;
    background: rgba(202, 138, 4, 0.06) !important;
    color: #a16207 !important;
}
[data-theme="light"] .lydian-header-btn[data-risk="high"] {
    border-color: rgba(233, 116, 81, 0.35) !important;
    background: rgba(233, 116, 81, 0.06) !important;
    color: #c2410c !important;
    box-shadow: none !important;
}
[data-theme="light"] .lydian-header-btn[data-risk="critical"] {
    border-color: rgba(212, 101, 74, 0.4) !important;
    background: rgba(212, 101, 74, 0.06) !important;
    color: #C95A37 !important;
}
[data-theme="light"] .lydian-hbtn-pulse {
    background: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .lydian-header-btn[data-risk="low"] .lydian-hbtn-pulse {
    background: var(--ld-400);
}

/* ── Notification Bell (light theme) ──────────── */
[data-theme="light"] .notif-bell-btn {
    color: var(--text-secondary, var(--gray-600));
}
[data-theme="light"] .notif-bell-btn:hover {
    color: var(--accent-primary);
}

/* ── GA Neuron/Synapse (light theme) ──────────── */
[data-theme="light"] .ga-neuron {
    stroke: var(--ld-500);
}
[data-theme="light"] .ga-core {
    fill: rgba(212, 101, 74, 0.25);
    stroke: var(--ld-500);
}
[data-theme="light"] .ga-synapse {
    stroke: rgba(160, 24, 48, 0.5);
}

/* ════════════════════════════════════════════════════════════
   SYSTEM THEME — mirrors [data-theme="light"] when OS prefers light
   ════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: light) {

    /* ── Header ──────────────────────────────── */
    [data-theme="system"] .header {
        background: var(--bg-header, rgba(255, 255, 255, 0.92));
        border-bottom-color: rgba(0, 0, 0, 0.06);
        box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
    }
    /* Logo — darker text for light mode (system prefers-color-scheme: light) */
    [data-theme="system"] .header .logo-dian {
        color: rgba(5, 5, 5, 0.82);
    }
    [data-theme="system"] .header .logo svg { color: var(--accent-primary); }
    [data-theme="system"] .sidebar-toggle { border-color: rgba(0, 0, 0, 0.1); color: var(--text-secondary); }
    [data-theme="system"] .sidebar-toggle:hover { background: rgba(212, 101, 74, 0.06); color: var(--accent-primary); border-color: var(--accent-primary); }

    /* ── Command Palette Trigger ─────────────── */
    [data-theme="system"] .cmd-palette-trigger {
        background: rgba(0, 0, 0, 0.03);
        border-color: rgba(0, 0, 0, 0.08);
        color: var(--text-secondary);
    }
    [data-theme="system"] .cmd-palette-trigger:hover {
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.12);
    }

    /* ── Kbd Hint ────────────────────────────── */
    [data-theme="system"] .kbd-hint {
        background: rgba(0, 0, 0, 0.04);
        border-color: rgba(0, 0, 0, 0.1);
        color: var(--text-muted);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    /* ── Connection Status ───────────────────── */
    [data-theme="system"] .connection-status {
        background: rgba(0, 0, 0, 0.03);
        border-color: rgba(0, 0, 0, 0.06);
    }

    /* ── Sidebar ─────────────────────────────── */
    [data-theme="system"] .sidebar {
        background: var(--bg-sidebar);
        border-right-color: rgba(0, 0, 0, 0.06);
    }
    [data-theme="system"] .sidebar::before {
        background: linear-gradient(180deg, rgba(212, 101, 74, 0.03) 0%, transparent 100%);
    }
    [data-theme="system"] .sidebar .sidebar-header { border-bottom-color: rgba(0, 0, 0, 0.06); }
    [data-theme="system"] .sidebar .sidebar-footer { border-top-color: rgba(0, 0, 0, 0.06); }

    /* ── Nav Items ───────────────────────────── */
    [data-theme="system"] .nav-item { color: var(--text-secondary); }
    [data-theme="system"] .nav-item:hover { background: rgba(212, 101, 74, 0.05); color: var(--text-primary); }
    [data-theme="system"] .nav-item.active { background: rgba(212, 101, 74, 0.07); color: var(--accent-primary); }
    [data-theme="system"] .nav-item.active::after { background: var(--accent-primary); box-shadow: 0 0 6px rgba(212, 101, 74, 0.4); }
    [data-theme="system"] .nav-section-title { color: var(--text-muted, #7a7a7a); }
    [data-theme="system"] .nav-section-title::before { background: rgba(0, 0, 0, 0.06); }

    /* ── Collapsed Sidebar Tooltip ────────────── */
    [data-theme="system"] .sidebar--collapsed .nav-item .tooltip-text {
        background: rgba(255, 255, 255, 0.95);
        border-color: rgba(0, 0, 0, 0.1);
        color: var(--text-primary, var(--gray-750));
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    }

    /* ── Content Area ────────────────────────── */
    [data-theme="system"] .content { background: var(--bg-primary, #f8f8fc); }

    /* ── Metric Cards ────────────────────────── */
    [data-theme="system"] .metric-card {
        background: var(--bg-card, var(--white));
        border-color: rgba(0, 0, 0, 0.06);
        box-shadow: var(--shadow-card, 0 2px 12px rgba(0, 0, 0, 0.06));
    }
    [data-theme="system"] .metric-card:hover {
        background: var(--bg-card, var(--white));
        border-color: rgba(0, 0, 0, 0.1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }
    [data-theme="system"] .metric-card .metric-label { color: var(--text-secondary, var(--gray-600)); }
    [data-theme="system"] .metric-card .metric-value { color: var(--text-primary, var(--gray-750)); }

    /* ── Tables ──────────────────────────────── */
    [data-theme="system"] .table-container {
        background: var(--bg-card, var(--white));
        border-color: rgba(0, 0, 0, 0.06);
    }
    [data-theme="system"] .table-container thead { background: rgba(0, 0, 0, 0.02); }
    [data-theme="system"] .table-container th { border-bottom-color: rgba(0, 0, 0, 0.08); color: var(--text-secondary, var(--gray-600)); }
    [data-theme="system"] .table-container td { border-bottom-color: rgba(0, 0, 0, 0.04); color: var(--text-primary, var(--gray-750)); }
    [data-theme="system"] .table-container tbody tr:hover { background: rgba(212, 101, 74, 0.03); }

    /* ── Buttons ─────────────────────────────── */
    [data-theme="system"] .btn-secondary {
        background: rgba(0, 0, 0, 0.03);
        border-color: rgba(0, 0, 0, 0.08);
        color: var(--text-primary, var(--gray-750));
    }
    [data-theme="system"] .btn-secondary:hover { background: rgba(0, 0, 0, 0.06); border-color: rgba(0, 0, 0, 0.12); }

    /* ── Event Feed ──────────────────────────── */
    [data-theme="system"] .event-feed { background: var(--bg-card, var(--white)); border-color: rgba(0, 0, 0, 0.06); }
    [data-theme="system"] .event-item { background: rgba(0, 0, 0, 0.015); border-bottom-color: rgba(0, 0, 0, 0.04); }
    [data-theme="system"] .event-item:hover { background: rgba(0, 0, 0, 0.03); }

    /* ── Domain Tiles ────────────────────────── */
    [data-theme="system"] .domain-tile {
        background: var(--bg-card, var(--white));
        border-color: rgba(0, 0, 0, 0.06);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }
    [data-theme="system"] .domain-tile:hover {
        border-color: rgba(0, 0, 0, 0.1);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }
    [data-theme="system"] .domain-tile .domain-name { color: var(--text-primary, var(--gray-750)); }

    /* ── JSON Display ────────────────────────── */
    [data-theme="system"] .json-display {
        background: rgba(0, 0, 0, 0.03);
        border-color: rgba(0, 0, 0, 0.08);
        color: var(--text-primary, var(--gray-750));
    }

    /* ── Spinner & Skeleton ──────────────────── */
    [data-theme="system"] .spinner { border-color: rgba(0, 0, 0, 0.06); border-top-color: var(--accent-primary, var(--ld-400)); }
    [data-theme="system"] .skeleton {
        background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.07) 50%, rgba(0,0,0,0.04) 75%);
    }

    /* ── Toasts ──────────────────────────────── */
    [data-theme="system"] .toast,
    [data-theme="system"] .toast-item {
        background: rgba(255, 255, 255, 0.97);
        border-color: rgba(0, 0, 0, 0.08);
        color: var(--text-primary, var(--gray-750));
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    }

    /* ── Modal ───────────────────────────────── */
    [data-theme="system"] .modal-overlay { background: rgba(0, 0, 0, 0.3); }
    [data-theme="system"] .modal {
        background: rgba(255, 255, 255, 0.98);
        border-color: rgba(0, 0, 0, 0.1);
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
        color: var(--text-primary, var(--gray-750));
    }
    [data-theme="system"] .modal-header { border-bottom-color: rgba(0, 0, 0, 0.06); }
    [data-theme="system"] .modal-title { color: var(--text-primary, var(--gray-750)); }
    [data-theme="system"] .modal-close:hover { background: rgba(0, 0, 0, 0.06); }
    [data-theme="system"] .modal-footer { border-top-color: rgba(0, 0, 0, 0.06); }

    /* ── Form Inputs ─────────────────────────── */
    [data-theme="system"] .form-input,
    [data-theme="system"] .form-select {
        background: rgba(0, 0, 0, 0.02);
        border-color: rgba(0, 0, 0, 0.1);
        color: var(--text-primary, var(--gray-750));
    }
    [data-theme="system"] .form-input:focus,
    [data-theme="system"] .form-select:focus {
        background: rgba(0, 0, 0, 0.01);
        border-color: var(--accent-primary, var(--ld-400));
        box-shadow: 0 0 0 3px rgba(212, 101, 74, 0.15);
    }
    [data-theme="system"] .form-input::placeholder { color: var(--text-muted, #7a7a7a); }

    /* ── Footer ──────────────────────────────── */
    [data-theme="system"] .footer {
        background: var(--bg-footer, rgba(255, 255, 255, 0.92));
        border-top-color: rgba(0, 0, 0, 0.06);
        color: var(--text-muted, #7a7a7a);
    }

    /* ── Engine Dot Tooltip ───────────────────── */
    [data-theme="system"] .engine-dot .tooltip,
    [data-theme="system"] .engine-dot-tooltip {
        background: rgba(255, 255, 255, 0.97);
        border-color: rgba(0, 0, 0, 0.1);
        color: var(--text-primary, var(--gray-750));
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    }

    /* ── Orchestrator Panel ───────────────────── */
    [data-theme="system"] .orc-tabs { background: rgba(0, 0, 0, 0.02); border-color: rgba(0, 0, 0, 0.06); }
    [data-theme="system"] .orc-tab { color: var(--text-secondary, var(--gray-600)); }
    [data-theme="system"] .orc-tab:hover { background: rgba(0, 0, 0, 0.04); }
    [data-theme="system"] .orc-tab.active { background: var(--bg-card, var(--white)); color: var(--accent-primary, var(--ld-400)); }
    [data-theme="system"] .orc-table,
    [data-theme="system"] .orc-table th,
    [data-theme="system"] .orc-table td { border-color: rgba(0, 0, 0, 0.06); }
    [data-theme="system"] .orc-table thead { background: rgba(0, 0, 0, 0.02); }
    [data-theme="system"] .orc-input { background: rgba(0, 0, 0, 0.02); border-color: rgba(0, 0, 0, 0.1); color: var(--text-primary, var(--gray-750)); }
    [data-theme="system"] .orc-pre { background: rgba(0, 0, 0, 0.03); border-color: rgba(0, 0, 0, 0.06); color: var(--text-primary, var(--gray-750)); }

    /* ── Scrollbars ──────────────────────────── */
    [data-theme="system"] ::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.02); }
    [data-theme="system"] ::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb, rgba(0, 0, 0, 0.12)); }
    [data-theme="system"] ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

    /* ── Sidebar Overlay ─────────────────────── */
    [data-theme="system"] .sidebar-overlay { background: rgba(0, 0, 0, 0.2); }

    /* ── Misc ────────────────────────────────── */
    [data-theme="system"] hr,
    [data-theme="system"] .divider { border-color: rgba(0, 0, 0, 0.06); }
    [data-theme="system"] .tab-content { background: var(--bg-card, var(--white)); border-color: rgba(0, 0, 0, 0.06); }

    /* ── Command Palette Dialog ─────────────── */
    [data-theme="system"] .cmd-palette-backdrop { background: rgba(0, 0, 0, 0.25); }
    [data-theme="system"] .cmd-palette-dialog { background: rgba(255, 255, 255, 0.98); border-color: rgba(0, 0, 0, 0.1); box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15); }
    [data-theme="system"] .cmd-palette-input-wrap { border-bottom-color: rgba(0, 0, 0, 0.08); }
    [data-theme="system"] .cmd-palette-kbd { border-color: rgba(0, 0, 0, 0.15); }
    [data-theme="system"] .cmd-palette-item:hover,
    [data-theme="system"] .cmd-palette-item.active { background: rgba(212, 101, 74, 0.06); }

    /* ── Icon Buttons (system light) ─────────── */
    [data-theme="system"] .icon-btn {
        color: var(--text-secondary, var(--gray-600));
        border-color: rgba(0, 0, 0, 0.08);
        background: rgba(0, 0, 0, 0.03);
    }
    [data-theme="system"] .icon-btn:hover {
        color: var(--accent-primary);
        border-color: rgba(212, 101, 74, 0.25);
        background: rgba(212, 101, 74, 0.06);
    }
    [data-theme="system"] .header-vsep { background: rgba(0, 0, 0, 0.1); }

    /* ── Header Buttons (system light) ────────── */
    [data-theme="system"] .ga-header-btn { background: rgba(212, 101, 74, 0.06); border-color: rgba(212, 101, 74, 0.2); color: var(--ld-500); }
    [data-theme="system"] .ga-header-btn:hover { background: rgba(212, 101, 74, 0.12); border-color: rgba(212, 101, 74, 0.4); color: var(--ld-600); }
    [data-theme="system"] .ci-header-btn { background: rgba(212, 101, 74, 0.05); border-color: rgba(212, 101, 74, 0.18); color: var(--ld-500); }
    [data-theme="system"] .ci-header-btn:hover { background: rgba(212, 101, 74, 0.1); border-color: rgba(212, 101, 74, 0.35); color: var(--ld-600); }
    [data-theme="system"] .studio-header-btn { background: rgba(212, 101, 74, 0.05); border-color: rgba(212, 101, 74, 0.18); color: var(--ld-500); }
    [data-theme="system"] .studio-header-btn:hover { background: rgba(212, 101, 74, 0.1); border-color: rgba(212, 101, 74, 0.35); color: var(--ld-600); }
    [data-theme="system"] .lydian-header-btn { border-color: rgba(0, 0, 0, 0.1) !important; background: rgba(0, 0, 0, 0.04) !important; color: var(--text-secondary) !important; }
    [data-theme="system"] .lydian-header-btn[data-risk="low"] { border-color: rgba(212, 101, 74, 0.25) !important; background: rgba(212, 101, 74, 0.05) !important; color: var(--ld-500) !important; }
    [data-theme="system"] .ga-neuron { stroke: var(--ld-500); }
    [data-theme="system"] .ga-core { fill: rgba(212, 101, 74, 0.25); stroke: var(--ld-500); }
    [data-theme="system"] .ga-synapse { stroke: rgba(160, 24, 48, 0.5); }
    [data-theme="system"] .notif-bell-btn { color: var(--text-secondary, var(--gray-600)); }
}

/* ── Workflow Builder Wrapper ────────────────── */
.workflow-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-workflow, var(--gray-900));
}

.workflow-iframe {
    width: 100%;
    height: calc(100vh - 60px);
    border: none;
    display: block;
    background: var(--bg-workflow, var(--gray-900));
}

[data-theme="light"] .workflow-wrapper,
[data-theme="light"] .workflow-iframe {
    background: var(--bg-workflow, var(--gray-50));
}

/* Adjust header height for workflow view */
body.workflow-view .header {
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Ensure sidebar is hidden when in workflow view for more space */
body.workflow-view .sidebar {
    display: none;
}

body.workflow-view .main-container {
    padding-left: 0;
}

/* =========================================================================
   RESPONSIVE LAYOUT PATTERNS (P0-P3 Dashboard Components)
   5 reusable patterns that all new views share
   ========================================================================= */

/* ---------- PATTERN 1: Dashboard Layout ----------
   KPI strip + content grid + feed
   Collapses to single column at 768px */
.dash-layout { display: flex; flex-direction: column; gap: 24px; }
.dash-kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.dash-kpi-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(20px);
    transition: background 0.2s;
}
.dash-kpi-card:hover { background: rgba(255,255,255,0.06); }
.dash-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
    line-height: 1.2;
}
.dash-kpi-label {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
}
.dash-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 768px) {
    .dash-kpi-strip { grid-template-columns: 1fr 1fr; }
    .dash-content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .dash-kpi-strip { grid-template-columns: 1fr; }
}

/* ---------- PATTERN 2: List / Table ----------
   Responsive table that becomes card layout on mobile.
   Use data-label attributes on <td> for mobile column headers. */
.resp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.resp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.resp-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.45);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}
.resp-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.85);
    vertical-align: middle;
}
.resp-table tbody tr { transition: background 0.15s; }
.resp-table tbody tr:hover { background: rgba(255,255,255,0.04); }

@media (max-width: 768px) {
    .resp-table--cards thead { display: none; }
    .resp-table--cards tbody tr {
        display: block;
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 12px 16px;
    }
    .resp-table--cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border: none;
    }
    .resp-table--cards td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.72rem;
        text-transform: uppercase;
        color: rgba(255,255,255,0.45);
        margin-right: 12px;
        flex-shrink: 0;
    }
}

/* ---------- PATTERN 3: Chat Layout ----------
   3-panel → single panel with fixed bottom input on mobile */
.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr 260px;
    height: calc(100vh - 120px);
    gap: 0;
}
.chat-sidebar {
    border-right: 1px solid rgba(255,255,255,0.06);
    overflow-y: auto;
    padding: 16px;
}
.chat-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.chat-input-bar {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.3);
}
.chat-context {
    border-left: 1px solid rgba(255,255,255,0.06);
    overflow-y: auto;
    padding: 16px;
}

@media (max-width: 1024px) {
    .chat-layout { grid-template-columns: 1fr; }
    .chat-sidebar,
    .chat-context { display: none; }
    .chat-sidebar.open,
    .chat-context.open {
        display: block;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        z-index: 200;
        background: var(--bg-primary, var(--gray-900));
    }
    .chat-input-bar {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 100;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    .chat-messages { padding-bottom: 80px; }
}

/* ---------- PATTERN 4: Form Layout ----------
   2-col → 1-col on mobile, full-width inputs */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid--full { grid-template-columns: 1fr; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field--span { grid-column: 1 / -1; }
.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.92);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--ld-400);
    box-shadow: 0 0 0 2px rgba(212, 101, 74,0.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; appearance: none; }
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 12px;
}

@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ---------- PATTERN 5: Marketplace / Card Grid ----------
   auto-fill → 1-col on mobile */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.card-grid-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(20px);
    transition: background 0.2s, transform 0.15s;
    cursor: pointer;
}
.card-grid-item:hover {
    background: rgba(255,255,255,0.06);
    transform: translateY(-2px);
}

@media (max-width: 480px) {
    .card-grid { grid-template-columns: 1fr; }
    .card-grid-item { padding: 16px; }
}

/* ---------- Bottom Sheet (mobile overlays) ---------- */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.bottom-sheet-overlay.open { opacity: 1; pointer-events: auto; }
.bottom-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 301;
    background: var(--bg-card, rgba(20,20,20,0.98));
    border-top: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.2);
    margin: 12px auto 8px;
}

/* ---------- Common UI Elements ---------- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.status-badge--success { background: rgba(13,148,136,0.15); color: #0d9488; }
.status-badge--warning { background: rgba(245,158,11,0.15); color: var(--yellow-500); }
.status-badge--error   { background: rgba(233,116,81,0.15);  color: var(--red-500); }
.status-badge--info    { background: rgba(59,130,246,0.15);  color: var(--blue-500); }
.status-badge--muted   { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.45); }

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot--online  { background: #0d9488; box-shadow: 0 0 6px rgba(13,148,136,0.4); }
.status-dot--offline { background: rgba(255,255,255,0.25); }
.status-dot--warning { background: var(--yellow-500); box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.status-dot--error   { background: var(--red-500); box-shadow: 0 0 6px rgba(233,116,81,0.4); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    min-height: 44px; /* touch target */
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
    background: var(--ld-400);
    color: var(--gray-950);
}
.btn--primary:hover { background: var(--ld-500); }
.btn--secondary {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
}
.btn--secondary:hover { background: rgba(255,255,255,0.12); }
.btn--danger {
    background: rgba(233,116,81,0.15);
    color: var(--red-500);
}
.btn--danger:hover { background: rgba(233,116,81,0.25); }
.btn--ghost {
    background: transparent;
    color: rgba(255,255,255,0.6);
}
.btn--ghost:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.btn--sm { padding: 5px 12px; font-size: 0.75rem; min-height: 32px; }
.btn .loading-spin {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text--short { width: 60%; }
.skeleton-card {
    height: 120px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    backdrop-filter: blur(20px);
    pointer-events: auto;
    animation: toast-in 0.3s ease-out;
    max-width: 380px;
}
.toast--success { background: rgba(13,148,136,0.2); color: #0d9488; border: 1px solid rgba(13,148,136,0.2); }
.toast--error   { background: rgba(233,116,81,0.2);  color: var(--red-500); border: 1px solid rgba(233,116,81,0.2); }
.toast--warning { background: rgba(245,158,11,0.2); color: var(--yellow-500); border: 1px solid rgba(245,158,11,0.2); }
.toast--info    { background: rgba(59,130,246,0.2);  color: var(--blue-500); border: 1px solid rgba(59,130,246,0.2); }

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

/* Tabs */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
    padding: 12px 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
    min-height: 44px;
}
.tab-btn:hover { color: rgba(255,255,255,0.75); }
.tab-btn.active {
    color: var(--ld-400);
    border-bottom-color: var(--ld-400);
}

/* Modal / Drawer overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-panel {
    background: rgba(20,20,20,0.98);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    max-width: 600px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
    transform: scale(0.95);
    transition: transform 0.2s;
}
.modal-overlay.open .modal-panel { transform: scale(1); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
}
.modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.1); }

/* Drawer (slide-in panel from right) */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 420px;
    max-width: 90vw;
    background: rgba(15,15,15,0.98);
    border-left: 1px solid rgba(255,255,255,0.08);
    z-index: 251;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
    padding: 24px;
}
.drawer-overlay.open .drawer-panel { transform: translateX(0); }

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    gap: 12px;
}
.empty-state-icon {
    font-size: 2.5rem;
    color: rgba(255,255,255,0.15);
    margin-bottom: 8px;
}
.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
}
.empty-state-desc {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.3);
    max-width: 360px;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--ld-400);
    color: var(--gray-950);
    padding: 8px 16px;
    z-index: 1000;
    transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* Spin animation (used across components) */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Pulse animation (scanning, connecting) */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* ── RENAISSANCE: Office Fullscreen Mode ── */

/* Sol sidebar: position:fixed → document flow'dan çıkar → canvas 100vw alır */
body.office-fullscreen .sidebar,
body.office-fullscreen #sidebar {
    position: fixed !important;
    left: -280px !important;
    top: var(--header-height, 56px);
    width: 260px !important;
    min-width: 0 !important;
    height: calc(100vh - var(--header-height, 56px));
    z-index: 400;
    overflow-y: auto;
    overflow-x: hidden;
    transition: left 0.3s ease !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
}
/* Sidebar açık hali */
body.office-fullscreen .sidebar.office-sidebar-open,
body.office-fullscreen #sidebar.office-sidebar-open {
    display: block !important;
    left: 0 !important;
}

body.office-fullscreen .header-left {
    flex: 0 0 0 !important;
    min-width: 0 !important;
    overflow: hidden;
}
/* Engine canvas'ı tam viewport yüksekliğine kilitle */
body.office-fullscreen .main-container {
    height: calc(100vh - var(--header-height));
    min-height: 0;
    overflow: hidden;
    margin-bottom: 0;
}
/* Ana içerik: sidebar artık fixed, bu tam 100vw alır */
body.office-fullscreen .main-content,
body.office-fullscreen #main-content {
    margin-left: 0 !important;
    width: 100vw !important;
    padding: 0 !important;
    height: 100%;
    overflow: hidden;
}
/* Sağ istatistik paneli: varsayılan gizli, overlay açıkken görünür */
body.office-fullscreen aside,
body.office-fullscreen [role="complementary"],
body.office-fullscreen .sidebar-right,
body.office-fullscreen .stats-panel {
    display: none !important;
}
/* Sağ panel overlay açık hali */
body.office-fullscreen aside.office-stats-open,
body.office-fullscreen [role="complementary"].office-stats-open {
    display: block !important;
    position: fixed !important;
    right: 0 !important;
    top: var(--header-height, 56px) !important;
    height: calc(100vh - var(--header-height, 56px)) !important;
    width: 280px !important;
    z-index: 400;
    overflow-y: auto;
    background: var(--bg-card, #262626) !important;
    border-left: 1px solid var(--border-subtle, #1e2535) !important;
    box-shadow: -4px 0 24px rgba(0,0,0,0.6);
}

/* ── RENAISSANCE: Engine Detail Drawer ── */
.engine-detail-drawer {
    position: fixed;
    top: 64px;
    right: 0;
    width: 360px;
    height: calc(100vh - 64px);
    background: rgba(13, 17, 23, 0.97);
    border-left: 1px solid var(--border-subtle, #1e2535);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    overflow-y: auto;
}
.engine-detail-drawer.open {
    transform: translateX(0);
}
.engine-detail-drawer .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-subtle, #1e2535);
    flex-shrink: 0;
}
.engine-detail-drawer .drawer-engine-name {
    font-size: 15px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary, var(--slate-200));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.engine-detail-drawer .drawer-close {
    width: 28px; height: 28px;
    border: 1px solid var(--border-subtle, #1e2535);
    background: transparent;
    color: var(--text-muted, #475569);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
}
.engine-detail-drawer .drawer-close:hover { color: var(--text-primary); background: var(--bg-card, #262626); }
.engine-detail-drawer .drawer-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.engine-detail-drawer .drawer-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #475569);
    margin-bottom: 8px;
}
.engine-detail-drawer .drawer-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.engine-detail-drawer .drawer-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid transparent;
}
.engine-detail-drawer .drawer-status-badge.healthy {
    background: #2dd4bf22;
    border-color: #2dd4bf66;
    color: var(--green-400);
}
.engine-detail-drawer .drawer-status-badge.degraded {
    background: #E9745122;
    border-color: #E9745166;
    color: var(--red-500);
}
.engine-detail-drawer .drawer-latency {
    font-size: 11px;
    color: var(--text-secondary, var(--slate-400));
    font-family: 'JetBrains Mono', monospace;
}
.engine-detail-drawer .drawer-role-btns {
    display: flex;
    gap: 6px;
}
.engine-detail-drawer .drawer-role-btn {
    flex: 1;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-subtle, #1e2535);
    background: var(--bg-base, #202020);
    color: var(--text-secondary, var(--slate-400));
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'JetBrains Mono', monospace;
}
.engine-detail-drawer .drawer-role-btn:hover,
.engine-detail-drawer .drawer-role-btn.active {
    background: var(--bg-card, #262626);
    color: var(--text-primary, var(--slate-200));
    border-color: var(--accent-primary, var(--green-500));
}
.engine-detail-drawer .drawer-cap-input-row {
    display: flex;
    gap: 6px;
}
.engine-detail-drawer .drawer-cap-input {
    flex: 1;
    background: var(--bg-base, #202020);
    border: 1px solid var(--border-subtle, #1e2535);
    color: var(--text-primary, var(--slate-200));
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}
.engine-detail-drawer .drawer-cap-input:focus { border-color: var(--accent-primary, var(--green-500)); }
.engine-detail-drawer .drawer-run-btn {
    padding: 6px 14px;
    background: var(--accent-primary, var(--green-500));
    color: var(--gray-950);
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    transition: opacity 0.15s;
}
.engine-detail-drawer .drawer-run-btn:hover { opacity: 0.85; }
.engine-detail-drawer .drawer-result {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary, var(--slate-400));
    background: var(--bg-base, #202020);
    border: 1px solid var(--border-subtle, #1e2535);
    border-radius: 4px;
    padding: 8px 10px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
    display: none;
}
.engine-detail-drawer .drawer-activity-item {
    font-size: 11px;
    color: var(--text-secondary, var(--slate-400));
    font-family: 'JetBrains Mono', monospace;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-subtle, #1e2535);
}
.engine-detail-drawer .drawer-activity-item:last-child { border-bottom: none; }
@keyframes drawer-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

/* ── Cosmion AI Assistant Header Button ─────────────────── */
.ga-header-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 8px;
    border-radius: 10px;
    border: 1px solid rgba(212, 101, 74, 0.4);
    background: linear-gradient(135deg, rgba(212, 101, 74,0.12) 0%, rgba(96,165,250,0.06) 100%);
    color: var(--ld-300);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
}
.ga-header-btn:hover {
    border-color: rgba(212, 101, 74, 0.7);
    background: linear-gradient(135deg, rgba(212, 101, 74,0.2) 0%, rgba(96,165,250,0.1) 100%);
    color: var(--ld-gold-300);
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(212, 101, 74, 0.3), 0 0 6px rgba(212, 101, 74,0.15) inset;
}
.ga-header-btn:hover .ga-synapse { stroke: var(--ld-400); stroke-dashoffset: 0; }
.ga-header-btn:hover .ga-core { fill: rgba(212, 101, 74,0.6); }
.ga-header-btn:active {
    transform: translateY(0);
}
.ga-hbtn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Noron animasyonlari */
.ga-neuron {
    animation: ga-neuron-glow 3s ease-in-out infinite;
}
.ga-n1 { animation-delay: 0s; }
.ga-n2 { animation-delay: 0.6s; }
.ga-n3 { animation-delay: 1.2s; }
.ga-n4 { animation-delay: 1.8s; }
@keyframes ga-neuron-glow {
    0%, 100% { fill: transparent; stroke-opacity: 0.7; }
    50%      { fill: rgba(212, 101, 74,0.15); stroke-opacity: 1; }
}
/* Sinaps baglanti animasyonu — akis efekti */
.ga-synapse {
    stroke-dasharray: 6 3;
    animation: ga-synapse-flow 2s linear infinite;
    transition: stroke 0.3s;
}
@keyframes ga-synapse-flow {
    0% { stroke-dashoffset: 18; }
    100% { stroke-dashoffset: 0; }
}
/* Cekirdek animasyonu */
.ga-core {
    animation: ga-core-pulse 2.5s ease-in-out infinite;
    transition: fill 0.3s;
}
@keyframes ga-core-pulse {
    0%, 100% { r: 1.5; fill: rgba(212, 101, 74,0.3); }
    50%      { r: 2; fill: rgba(212, 101, 74,0.5); }
}
.ga-hbtn-pulse {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ld-400);
    animation: ga-hbtn-pulse 2s ease-in-out infinite;
}
@keyframes ga-hbtn-pulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(212, 101, 74,0.5); }
    50%      { opacity: 0.4; transform: scale(0.6); box-shadow: 0 0 0 5px rgba(212, 101, 74,0); }
}
.ga-hbtn-label {
    font-size: 10.5px;
    font-weight: 700;
    color: inherit;
    letter-spacing: 0.05em;
}

/* ── Competitive Intelligence Header Button ─────────────── */
.ci-header-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px 5px 8px;
    border-radius: 8px;
    border: 1px solid rgba(212, 101, 74, 0.28);
    background: rgba(212, 101, 74, 0.07);
    color: var(--ld-300);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.25s ease;
    overflow: hidden;
}
.ci-header-btn:hover {
    border-color: rgba(212, 101, 74, 0.55);
    background: rgba(212, 101, 74, 0.14);
    color: var(--ld-gold-300);
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(212, 101, 74, 0.2);
}
.ci-header-btn:active {
    transform: translateY(0);
}
.ci-hbtn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ci-hbtn-spin 6s linear infinite;
}
@keyframes ci-hbtn-spin {
    0%   { transform: rotate(0deg); }
    20%  { transform: rotate(0deg); }
    30%  { transform: rotate(60deg); }
    50%  { transform: rotate(60deg); }
    60%  { transform: rotate(120deg); }
    80%  { transform: rotate(120deg); }
    90%  { transform: rotate(180deg); }
    100% { transform: rotate(180deg); }
}
.ci-hbtn-pulse {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ld-400);
    animation: ci-hbtn-pulse 2.5s ease-in-out infinite;
}
@keyframes ci-hbtn-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.7); }
}
.ci-hbtn-label {
    font-size: 10px;
    font-weight: 700;
    color: inherit;
    letter-spacing: 0.06em;
}

/* ── Code Studio Header Button — Cosmion Green ──────────── */
.studio-header-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px 5px 8px;
    border-radius: 8px;
    border: 1px solid rgba(212, 101, 74, 0.3);
    background: rgba(212, 101, 74, 0.07);
    color: var(--ld-300);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.2s ease;
    overflow: hidden;
}
.studio-header-btn:hover {
    border-color: rgba(212, 101, 74, 0.55);
    background: rgba(212, 101, 74, 0.13);
    color: var(--ld-gold-300);
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(212, 101, 74, 0.18);
}
.studio-header-btn:active { transform: translateY(0); }
.studio-hbtn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: studio-hbtn-type 2s ease-in-out infinite;
}
@keyframes studio-hbtn-type {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.65; transform: scale(0.9); }
}
.studio-hbtn-cursor {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 2px;
    height: 9px;
    border-radius: 1px;
    background: var(--ld-400);
    animation: studio-hbtn-blink 1s step-end infinite;
}
@keyframes studio-hbtn-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}
.studio-hbtn-label {
    font-size: 10px;
    font-weight: 700;
    color: inherit;
    letter-spacing: 0.06em;
}

/* ── SA-46: Lydian Monitor Header Button — Dinamik Risk Rengi ── */
.lydian-header-btn {
    position: relative;
    display: flex !important;
    align-items: center;
    gap: 5px;
    padding: 5px 10px 5px 8px;
    height: 30px;
    box-sizing: border-box;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: color .35s ease, border-color .35s ease, background .35s ease, box-shadow .35s ease;
    overflow: hidden;
    pointer-events: auto !important;
    z-index: 10;
    /* default / unknown — bağlantı bekleniyor */
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    background: rgba(20, 20, 20, 0.60) !important;
    color: rgba(255, 255, 255, 0.32) !important;
}
/* ── Risk durumu renkleri (data-risk attribute) ── */
.lydian-header-btn[data-risk="low"] {
    border-color: rgba(212, 101, 74, 0.28) !important;
    background:   rgba( 10,  20, 10, 0.65) !important;
    color:        var(--ld-400) !important;
}
.lydian-header-btn[data-risk="medium"] {
    border-color: rgba(234, 179,  8, 0.38) !important;
    background:   rgba( 20,  18,  5, 0.65) !important;
    color:        #eab308 !important;
}
.lydian-header-btn[data-risk="high"] {
    border-color: rgba(249, 115, 22, 0.45) !important;
    background:   rgba( 22,  12,  5, 0.70) !important;
    color:        #f97316 !important;
    box-shadow:   0 0 8px rgba(249, 115, 22, 0.15) !important;
}
.lydian-header-btn[data-risk="critical"] {
    border-color: rgba(239,  68, 68, 0.55) !important;
    background:   rgba( 22,   5,  5, 0.75) !important;
    color:        var(--red-500) !important;
    animation:    lyd-crit-border 1.6s ease-in-out infinite;
}
@keyframes lyd-crit-border {
    0%, 100% { box-shadow: 0 0  0   0   rgba(233, 116, 81, .30); }
    50%       { box-shadow: 0 0 16px 4px rgba(233, 116, 81, .15); }
}
/* ── Hover: renk korunur, hafif parlar ── */
.lydian-header-btn:hover {
    filter: brightness(1.22);
    transform: translateY(-1px);
}
.lydian-header-btn:active { transform: translateY(0); filter: none; }
/* ── İkon — risk seviyesine göre dönüş hızı ── */
.lydian-hbtn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lydian-hbtn-spin 5s linear infinite;
}
.lydian-header-btn[data-risk="high"]     .lydian-hbtn-icon { animation-duration: 2s; }
.lydian-header-btn[data-risk="critical"] .lydian-hbtn-icon { animation-duration: 0.9s; }
@keyframes lydian-hbtn-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ── Pulse dot — risk rengini CSS ile alır ── */
.lydian-hbtn-pulse {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    transition: background .35s ease, box-shadow .35s ease;
    animation: lydian-hbtn-pulse-anim 2s ease-in-out infinite;
}
.lydian-header-btn[data-risk="low"]      .lydian-hbtn-pulse { background: var(--ld-400); }
.lydian-header-btn[data-risk="medium"]   .lydian-hbtn-pulse { background: #eab308; }
.lydian-header-btn[data-risk="high"]     .lydian-hbtn-pulse { background: #f97316; }
.lydian-header-btn[data-risk="critical"] .lydian-hbtn-pulse {
    background: var(--red-500);
    box-shadow: 0 0 6px var(--red-500);
    animation-duration: 0.8s;
}
@keyframes lydian-hbtn-pulse-anim {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.22; transform: scale(0.42); }
}
/* ── Label ── */
.lydian-hbtn-label {
    font-size: 10px;
    font-weight: 700;
    color: inherit;
    letter-spacing: 0.06em;
}
/* ── Risk badge pill ── */
.lydian-hbtn-risk {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 1px 5px;
    border-radius: 5px;
    border: 1px solid currentColor;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    white-space: nowrap;
    opacity: 0.88;
    transition: opacity .3s;
}
.lydian-hbtn-risk:empty { display: none; }

/* ── Header Premium Layout ───────────────────────────────── */
/* Separator between header groups */
.header-vsep {
    width: 1px;
    height: 20px;
    background: rgba(212, 101, 74, 0.18);
    flex-shrink: 0;
}

/* Premium search bar */
.cmd-palette-trigger {
    min-width: 160px !important;
    border-color: rgba(212, 101, 74, 0.2) !important;
    background: rgba(212, 101, 74, 0.04) !important;
}
.cmd-palette-trigger:hover {
    border-color: rgba(212, 101, 74, 0.35) !important;
    background: rgba(212, 101, 74, 0.09) !important;
}

/* Icon buttons (voice, theme) — smaller, cleaner */
.icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}
.icon-btn:hover {
    border-color: rgba(212, 101, 74, 0.25);
    background: rgba(212, 101, 74, 0.07);
    color: var(--ld-300);
}

/* Uniform action button height */
.ga-header-btn,
.ci-header-btn,
.studio-header-btn {
    height: 30px;
    box-sizing: border-box;
}

/* Tighter header-right spacing */
.header-right {
    gap: 6px !important;
}

/* Connection status pill — minimal */
.connection-status {
    padding: 4px 10px !important;
    font-size: 10px !important;
    letter-spacing: 0.2px !important;
    border-color: rgba(212, 101, 74, 0.2) !important;
    background: rgba(212, 101, 74, 0.04) !important;
}
.connection-status:has(.status-indicator.connected) {
    border-color: rgba(212, 101, 74, 0.3) !important;
    color: var(--ld-300) !important;
}

/* ── Notification Bell Badge ── */
.notif-bell-btn {
    position: relative;
}
.notif-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 14px;
    height: 14px;
    background: var(--red-500);
    color: var(--white);
    border-radius: 7px;
    font-size: 8px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    padding: 0 3px;
    display: none;
    border: 1px solid var(--bg-header, var(--gray-900));
    animation: notif-pulse 2s ease-in-out infinite;
}
@keyframes notif-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.85; }
}

/* ── SA-46: Lydian Arka Plan Durum Çubuğu ────────────────── */
.ovw-lydian-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin: 8px 0 4px;
    border-radius: 8px;
    border: 1px solid rgba(212, 101, 74, 0.12);
    background: rgba(212, 101, 74, 0.03);
    min-height: 28px;
}
.ovw-lydian-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ld-400);
    box-shadow: 0 0 6px var(--ld-400);
    flex-shrink: 0;
    animation: lydian-dot-beat 3s ease-in-out infinite;
}
@keyframes lydian-dot-beat {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.45; transform: scale(0.7); }
}
.ovw-lydian-risk-pill {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 1px 7px;
    border-radius: 20px;
    border: 1px solid rgba(212, 101, 74, 0.3);
    background: rgba(212, 101, 74, 0.1);
    color: var(--ld-400);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   Light Theme Overrides — dashboard.css component level
   Supplements design-system.css token remapping
   ══════════════════════════════════════════════════════════════ */

/* Sidebar */
[data-theme="light"] .sidebar {
    background: rgba(250, 250, 252, 0.97);
    border-right-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .nav-item {
    color: rgba(15, 17, 23, 0.65);
}

[data-theme="light"] .nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(15, 17, 23, 0.85);
}

[data-theme="light"] .nav-item.active {
    background: rgba(212, 101, 74, 0.08);
    color: #C45A3A;
    border-left-color: #C45A3A;
}

/* Content area */
[data-theme="light"] .content,
[data-theme="light"] .content-area,
[data-theme="light"] .main-content {
    background: #f7f8fa;
    color: #0f1117;
}

/* Cards */
[data-theme="light"] .card,
[data-theme="light"] .widget-card {
    background: var(--white);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Stat values */
[data-theme="light"] .stat-value {
    color: #0f1117;
}

[data-theme="light"] .stat-label {
    color: rgba(15, 17, 23, 0.5);
}

/* Inputs */
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #f3f4f6;
    border-color: rgba(0, 0, 0, 0.1);
    color: #0f1117;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: rgba(15, 17, 23, 0.35);
}

/* Modal / drawer */
[data-theme="light"] .modal,
[data-theme="light"] .drawer {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .cmd-palette-backdrop {
    background: rgba(0, 0, 0, 0.2);
}

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.14);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.22);
}

[data-theme="light"] ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
}

/* ══ RESPONSIVE LAYOUT UTILITIES (Container Query Aware) ══════════════════ */

/* ── Overflow Prevention ── */
.content > * {
    max-width: 100%;
    box-sizing: border-box;
}

/* ── Responsive Table Wrapper ── */
.content table:not(.resp-table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* ── 3-Panel Layout (sidebar + center + sidebar) ── */
.layout-3panel {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 14px;
    min-height: 0;
    overflow: hidden;
}

@container content (max-width: 1100px) {
    .layout-3panel {
        grid-template-columns: 240px 1fr;
    }
    .layout-3panel > :last-child {
        grid-column: 1 / -1;
    }
}

@container content (max-width: 750px) {
    .layout-3panel {
        grid-template-columns: 1fr;
    }
}

/* ── 2-Panel Layout (sidebar + main) ── */
.layout-2panel {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--space-lg);
}

@container content (max-width: 700px) {
    .layout-2panel {
        grid-template-columns: 1fr;
    }
}

/* ── Auto-Responsive 3-Panel Grids (catch inline grid-template-columns) ── */
/* Override inline 3-column px grids when content area narrows */
@container content (max-width: 1000px) {
    .content > div[style*="grid-template-columns"],
    .content div[style*="grid-template-columns"] {
        grid-template-columns: 1fr 1fr !important;
    }
}

@container content (max-width: 650px) {
    .content > div[style*="grid-template-columns"],
    .content div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* Also target common CSS class patterns for 3-panel engine layouts */
@container content (max-width: 1000px) {
    [class*="-body"][style*="grid"],
    [class*="-layout"][style*="grid"] {
        grid-template-columns: 1fr 1fr !important;
    }
}

@container content (max-width: 650px) {
    [class*="-body"][style*="grid"],
    [class*="-layout"][style*="grid"] {
        grid-template-columns: 1fr !important;
    }
}

/* ── Touch Target Minimum (mobile) ── */
@media (pointer: coarse) {
    button:not(.sidebar-toggle),
    a.nav-item,
    .tab-btn,
    [role="button"],
    select {
        min-height: 44px;
        min-width: 44px;
    }

    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
}

/* ── Safe Area Insets (notched devices) ── */
@supports (padding: max(0px)) {
    .footer {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* ── Auth Full-Page Mode ─────────────────────────────────────────────────── */
/* When body has .auth-fullpage, hide sidebar/header and make main-content full viewport */
body.auth-fullpage .sidebar,
body.auth-fullpage .header,
body.auth-fullpage .breadcrumb,
body.auth-fullpage .command-bar {
    display: none !important;
}

body.auth-fullpage .main-content,
body.auth-fullpage #main-content {
    margin-left: 0 !important;
    margin-top: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    min-height: 100vh !important;
}

/* ═══════════════════════════════════════════════════════════════
   Luminous Language Grid — Son Teknoloji Dil Seçici Bileşeni
   LyDian Ekosistemi | Animated Gradient Border + Grid Tiles
   ═══════════════════════════════════════════════════════════════ */

@property --lang-border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes lang-border-rotate {
    0%   { --lang-border-angle: 0deg; }
    100% { --lang-border-angle: 360deg; }
}

@keyframes lang-tile-enter {
    from { opacity: 0; transform: scale(0.82) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes lang-panel-spring-in {
    0%   { opacity: 0; transform: scale(0.88) translateY(-12px); }
    50%  { opacity: 1; transform: scale(1.03) translateY(2px); }
    75%  { transform: scale(0.99) translateY(-1px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes lang-active-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(212, 101, 74, 0.25), inset 0 0 0 1px rgba(212, 101, 74, 0.35); }
    50%      { box-shadow: 0 0 18px rgba(212, 101, 74, 0.5), inset 0 0 0 1px rgba(212, 101, 74, 0.6); }
}

@keyframes lang-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ── Wrapper ── */
.lang-switcher {
    position: relative;
    display: inline-flex;
}

/* ── Trigger Button ── */
.lang-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    height: 32px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    color: var(--text-tertiary, var(--text-secondary));
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.lang-trigger::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    background: linear-gradient(135deg, rgba(212,101,74,0.1), rgba(212,168,83,0.06));
    transition: opacity 0.25s ease;
}

.lang-trigger:hover::before { opacity: 1; }
.lang-trigger.open::before { opacity: 1; }

.lang-trigger:hover {
    border-color: rgba(212, 101, 74, 0.3);
    color: var(--text-primary);
    box-shadow: 0 0 12px rgba(212, 101, 74, 0.1);
}

.lang-trigger.open {
    border-color: rgba(212, 101, 74, 0.45);
    color: var(--text-bright, var(--white));
    box-shadow: 0 0 16px rgba(212, 101, 74, 0.15);
}

.lang-trigger-flag {
    font-size: 15px;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.lang-trigger-code {
    position: relative;
    z-index: 1;
}

.lang-trigger-chevron {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0.5;
    position: relative;
    z-index: 1;
}

.lang-trigger.open .lang-trigger-chevron {
    transform: rotate(180deg);
    opacity: 0.9;
}

/* ── Panel ── */
.lang-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 400px;
    z-index: 9998;
    border-radius: 16px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.88) translateY(-12px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.lang-panel.open {
    pointer-events: auto;
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: lang-panel-spring-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.lang-panel.closing {
    opacity: 0;
    transform: scale(0.92) translateY(-8px);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.4, 0, 1, 1);
    pointer-events: none;
}

/* ── Animated Gradient Border ── */
.lang-panel-border {
    position: relative;
    padding: 1.5px;
    border-radius: 16px;
    background: conic-gradient(
        from var(--lang-border-angle, 0deg),
        var(--ld-400),
        var(--ld-gold-400),
        var(--green-500),
        var(--cyan-500),
        var(--ld-400)
    );
    animation: lang-border-rotate 3s linear infinite;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(212, 101, 74, 0.08);
}

/* ── Inner Glass ── */
.lang-panel-inner {
    background: rgba(10, 10, 10, 0.94);
    backdrop-filter: blur(28px) saturate(200%);
    -webkit-backdrop-filter: blur(28px) saturate(200%);
    border-radius: 14.5px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

/* ── Mouse Spotlight ── */
.lang-spotlight {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 14.5px;
}

.lang-panel.open .lang-spotlight { opacity: 1; }

/* ── Panel Header ── */
.lang-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}

.lang-panel-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted, var(--gray-500));
    position: relative;
    z-index: 1;
}

.lang-panel-count {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted, var(--gray-500));
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 8px;
    border-radius: 10px;
    position: relative;
    z-index: 1;
}

/* ── Search ── */
.lang-search-wrap {
    position: relative;
    margin-bottom: 14px;
    z-index: 1;
}

.lang-search {
    width: 100%;
    padding: 9px 12px 9px 34px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    color: var(--text-primary, var(--gray-100));
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.lang-search:focus {
    border-color: rgba(212, 101, 74, 0.35);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(212, 101, 74, 0.08);
}

.lang-search::placeholder {
    color: var(--text-muted, var(--gray-500));
    font-size: 12px;
}

.lang-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, var(--gray-500));
    pointer-events: none;
    transition: color 0.2s ease;
}

.lang-search:focus ~ .lang-search-icon,
.lang-search-wrap:focus-within .lang-search-icon {
    color: var(--accent-primary, var(--ld-400));
}

/* ── Grid ── */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    position: relative;
    z-index: 1;
}

/* ── Tile ── */
.lang-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 14px 4px 11px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.015);
    cursor: pointer;
    transition:
        transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.25s ease;
    position: relative;
    opacity: 0;
    animation: lang-tile-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.lang-tile:hover {
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.lang-tile:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.08s;
}

/* Active tile */
.lang-tile.active {
    background: rgba(212, 101, 74, 0.1);
    border-color: rgba(212, 101, 74, 0.3);
    animation: lang-tile-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               lang-active-glow 2.5s ease-in-out infinite;
}

.lang-tile.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 22%;
    right: 22%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary, var(--ld-400)), transparent);
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(212, 101, 74, 0.5);
}

.lang-tile.hidden {
    display: none;
}

/* Tile flag */
.lang-tile-flag {
    font-size: 26px;
    line-height: 1;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.lang-tile:hover .lang-tile-flag {
    transform: scale(1.18);
}

/* Tile name */
.lang-tile-name {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary, #999);
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.lang-tile:hover .lang-tile-name { color: var(--text-primary, var(--gray-100)); }
.lang-tile.active .lang-tile-name { color: var(--text-bright, var(--white)); font-weight: 600; }

/* Tile code */
.lang-tile-code {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted, var(--gray-500));
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-mono, monospace);
    opacity: 0.6;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.lang-tile:hover .lang-tile-code { opacity: 0.9; }
.lang-tile.active .lang-tile-code { color: var(--accent-primary, var(--ld-400)); opacity: 1; }

/* ── No Results ── */
.lang-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted, var(--gray-500));
    font-size: 12px;
    font-style: italic;
    position: relative;
    z-index: 1;
}

/* ══════ Light Theme ══════ */
[data-theme="light"] .lang-trigger {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .lang-trigger:hover {
    background: rgba(212, 101, 74, 0.05);
    border-color: rgba(212, 101, 74, 0.2);
}

[data-theme="light"] .lang-trigger.open {
    background: rgba(212, 101, 74, 0.07);
    border-color: rgba(212, 101, 74, 0.3);
}

[data-theme="light"] .lang-panel-border {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12), 0 0 20px rgba(212, 101, 74, 0.05);
}

[data-theme="light"] .lang-panel-inner {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
}

[data-theme="light"] .lang-search {
    background: rgba(0, 0, 0, 0.025);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

[data-theme="light"] .lang-search:focus {
    border-color: rgba(212, 101, 74, 0.25);
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .lang-tile {
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="light"] .lang-tile:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .lang-tile.active {
    background: rgba(212, 101, 74, 0.06);
    border-color: rgba(212, 101, 74, 0.18);
}

[data-theme="light"] .lang-tile-flag {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.08));
}

/* ══════ System Theme (prefers light) ══════ */
@media (prefers-color-scheme: light) {
    [data-theme="system"] .lang-trigger {
        background: rgba(0, 0, 0, 0.02);
        border-color: rgba(0, 0, 0, 0.08);
    }
    [data-theme="system"] .lang-trigger:hover {
        background: rgba(212, 101, 74, 0.05);
        border-color: rgba(212, 101, 74, 0.2);
    }
    [data-theme="system"] .lang-panel-inner {
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(24px) saturate(120%);
        -webkit-backdrop-filter: blur(24px) saturate(120%);
    }
    [data-theme="system"] .lang-tile {
        background: rgba(0, 0, 0, 0.015);
    }
    [data-theme="system"] .lang-tile:hover {
        background: rgba(0, 0, 0, 0.04);
        border-color: rgba(0, 0, 0, 0.08);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    }
    [data-theme="system"] .lang-tile.active {
        background: rgba(212, 101, 74, 0.06);
        border-color: rgba(212, 101, 74, 0.18);
    }
}

/* ══════ Responsive ══════ */
@media (max-width: 768px) {
    .lang-panel {
        width: calc(100vw - 20px);
        right: -8px;
    }
    .lang-grid { gap: 4px; }
    .lang-tile { padding: 10px 2px 8px; }
    .lang-tile-flag { font-size: 22px; }
    .lang-tile-name { font-size: 9px; }
}

@media (max-width: 480px) {
    .lang-grid { grid-template-columns: repeat(3, 1fr); }
    .lang-panel { width: calc(100vw - 16px); right: -4px; }
}

/* ===== Sidebar Quick Actions ===== */
.sidebar-quick-actions {
    padding: 12px 12px 8px;
    border-top: 1px solid var(--border-subtle, var(--navy-900));
    flex-shrink: 0;
}

.sidebar-qa-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted, #666);
    padding: 0 4px 8px;
}

.sidebar-qa-buttons {
    display: flex;
    gap: 6px;
}

.sidebar-qa-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--bg-card, #262626);
    border: 1px solid var(--border-subtle, var(--navy-900));
    border-radius: 8px;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.sidebar-qa-btn:hover {
    background: var(--bg-hover, var(--navy-900));
    color: var(--text-primary, var(--gray-100));
    border-color: var(--border-active, #333);
}

.sidebar-qa-btn:active {
    transform: scale(0.96);
}

.sidebar-qa-btn--loading {
    opacity: 0.6;
    pointer-events: none;
}

.sidebar--collapsed .sidebar-quick-actions .sidebar-qa-label,
.sidebar--collapsed .sidebar-qa-btn span {
    display: none;
}

.sidebar--collapsed .sidebar-qa-buttons {
    flex-direction: column;
}

.sidebar--collapsed .sidebar-qa-btn {
    padding: 8px;
}

/* ===== User Level Badge (Header Right) ===== */
.ulb-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.ulb-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-card, #262626);
    border: 1px solid var(--border-subtle, var(--navy-900));
    border-radius: 8px;
    color: var(--text-primary, var(--gray-100));
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.ulb-btn:hover {
    background: var(--bg-hover, var(--navy-900));
    border-color: var(--border-active, #333);
}

.ulb-btn:focus-visible {
    outline: 2px solid var(--ld-400);
    outline-offset: 2px;
}

.ulb-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 18px;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--white);
    background: #6b7280;
}

.ulb-level[data-level="L1"] { background: #6b7280; }
.ulb-level[data-level="L2"] { background: var(--blue-500); }
.ulb-level[data-level="L3"] { background: var(--yellow-500); }
.ulb-level[data-level="L4"] { background: var(--red-500); }

.ulb-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card, #262626);
    border: 1px solid var(--border-subtle, var(--navy-900));
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 6px;
    z-index: 1000;
    animation: ulb-fadeIn 0.15s ease;
}

.ulb-dropdown.open { display: block; }

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

.ulb-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
}

.ulb-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, var(--gray-100));
}

.ulb-user-plan {
    font-size: 11px;
    color: var(--text-muted, #666);
    text-transform: capitalize;
}

.ulb-sep {
    height: 1px;
    background: var(--border-subtle, var(--navy-900));
    margin: 4px 0;
}

.ulb-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text-secondary, #aaa);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: all 0.15s ease;
}

.ulb-item:hover {
    background: var(--bg-hover, var(--navy-900));
    color: var(--text-primary, var(--gray-100));
}

.ulb-logout:hover {
    color: var(--red-500);
}

/* ===== Sidebar Toggle Button (Mobil) ===== */
.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: var(--text-primary, var(--gray-100));
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
    min-height: 36px;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-hover, var(--navy-900));
}

@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: flex;
    }
}

/* ===== Header Responsive ===== */
@media (max-width: 1024px) {
    .header-right .icon-btn span:not(.notif-badge):not(.ulb-level) {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }

    .header-right {
        gap: 4px;
    }

    .header-right .header-vsep {
        display: none;
    }

    /* Gizle: Studio, Lydian, CI butonlari */
    .studio-header-btn,
    .lydian-header-btn {
        display: none;
    }

    /* Mobil sidebar backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        top: var(--header-height, 56px);
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-overlay, 300) - 1);
    }

    .sidebar-backdrop.active {
        display: block;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 8px;
        height: 48px;
    }

    .header-left .logo-text {
        font-size: 14px;
    }

    .header-right .connection-status,
    #voice-trigger {
        display: none;
    }

    .ulb-btn {
        padding: 4px 8px;
    }
}

/* ===== Genel Responsive ===== */
@media (max-width: 768px) {
    /* Izgara duzenlemeleri: tek sutun mobilde */
    .overview-grid,
    .dashboard-grid,
    .stats-grid,
    .cards-grid {
        grid-template-columns: 1fr !important;
    }

    /* Tablolar — yatay kaydir */
    .data-table-wrap,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Modaller — mobilde tam genislik */
    .modal-content,
    .dialog-content {
        width: calc(100% - 24px) !important;
        max-width: none !important;
        margin: 12px;
    }

    /* Dokunma hedefleri minimum 44px */
    .nav-item,
    .btn,
    button:not(.ulb-btn):not(.sidebar-qa-btn) {
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    /* Tam genislik kartlar */
    .card, .panel {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ── LYDIAN Voice Analytics ────────────────────────────── */
.va-root { display:flex; flex-direction:column; gap:1rem; padding:0.5rem; }
.va-header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:0.5rem; }
.va-title { font-size:1.25rem; font-weight:700; color:var(--text-primary,var(--slate-200)); }
.va-pipeline-badge { font-size:0.75rem; padding:0.25rem 0.75rem; border-radius:9999px; font-weight:600; }
.va-active { background:#14532d; color:#4ade80; }
.va-inactive { background:#7f1d1d; color:#fca5a5; }
.va-loading { background:#1e3a5f; color:#93c5fd; animation:va-pulse 1.5s ease infinite; }
@keyframes va-pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.va-kpi-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:0.75rem; }
.va-kpi-card { background:var(--bg-card,var(--slate-800)); border-radius:12px; padding:1rem; text-align:center; display:flex; flex-direction:column; align-items:center; gap:0.25rem; }
.va-kpi-icon { font-size:1.5rem; }
.va-kpi-value { font-size:1.5rem; font-weight:700; color:var(--text-primary,var(--slate-200)); }
.va-kpi-label { font-size:0.7rem; color:var(--text-muted,var(--slate-400)); text-transform:uppercase; letter-spacing:0.05em; }

.va-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.75rem; }
@media(max-width:768px) { .va-grid { grid-template-columns:1fr; } }

.va-card { background:var(--bg-card,var(--slate-800)); border-radius:12px; padding:1rem; }
.va-card-title { font-size:0.85rem; font-weight:600; color:var(--text-secondary,#cbd5e1); margin-bottom:0.75rem; text-transform:uppercase; letter-spacing:0.04em; }
.va-muted { color:var(--text-muted,var(--slate-500)); font-size:0.8rem; }

.va-table-wrap { overflow-x:auto; }
.va-table { width:100%; border-collapse:collapse; font-size:0.8rem; }
.va-th { text-align:left; padding:0.4rem 0.5rem; border-bottom:1px solid var(--border,var(--slate-700)); color:var(--text-muted,var(--slate-400)); font-weight:500; }
.va-td { padding:0.4rem 0.5rem; border-bottom:1px solid var(--border,var(--slate-800)); color:var(--text-primary,var(--slate-200)); }
.va-right { text-align:right; }

.va-bar-chart { display:flex; align-items:flex-end; gap:2px; height:100px; padding-top:0.5rem; }
.va-bar { flex:1; background:linear-gradient(to top,var(--cyan-500),var(--purple-500)); border-radius:3px 3px 0 0; min-width:4px; transition:height 0.3s; }

.va-cohort-list { display:flex; flex-direction:column; gap:0.5rem; }
.va-cohort-item { display:flex; flex-direction:column; gap:0.2rem; }
.va-cohort-bar-bg { height:8px; background:var(--bg-primary,#2c2c2c); border-radius:4px; overflow:hidden; }
.va-cohort-bar { height:100%; border-radius:4px; transition:width 0.5s; }
.va-cohort-label { font-size:0.75rem; color:var(--text-muted,var(--slate-400)); }

.va-trend-list { display:flex; flex-direction:column; gap:0.4rem; }
.va-trend-item { display:flex; align-items:center; gap:0.5rem; font-size:0.8rem; }
.va-trend-topic { flex:1; color:var(--text-primary,var(--slate-200)); font-weight:500; }
.va-trend-count { color:var(--text-muted,var(--slate-400)); min-width:2rem; text-align:right; }
.va-trend-growth { min-width:3.5rem; text-align:right; font-weight:600; }

.va-status-list { display:flex; flex-direction:column; gap:0.4rem; margin-bottom:0.75rem; }
.va-status-item { display:flex; align-items:center; gap:0.5rem; font-size:0.8rem; color:var(--text-primary,var(--slate-200)); }
.va-status-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.va-dot-green { background:var(--emerald-500); box-shadow:0 0 6px #22c55e44; }
.va-dot-red { background:var(--red-500); box-shadow:0 0 6px #E9745144; }

.va-learning-stats { display:flex; gap:1rem; font-size:0.75rem; color:var(--text-muted,var(--slate-400)); padding-top:0.5rem; border-top:1px solid var(--border,var(--slate-700)); }

.va-alerts { border-left:3px solid var(--yellow-500); }
.va-alert-item { display:flex; gap:0.5rem; padding:0.5rem; margin-bottom:0.4rem; background:var(--bg-primary,#2c2c2c); border-radius:6px; font-size:0.8rem; }
.va-alert-type { font-weight:600; color:var(--text-secondary,#cbd5e1); min-width:6rem; }
.va-alert-msg { color:var(--text-primary,var(--slate-200)); }

.va-error { text-align:center; padding:2rem; }
.va-error h3 { color:var(--red-500); margin-bottom:0.5rem; }
.va-error p { color:var(--text-muted,var(--slate-400)); margin-bottom:1rem; }
.va-retry-btn { padding:0.5rem 1.5rem; background:var(--ld-400); color:var(--white); border:none; border-radius:8px; cursor:pointer; font-weight:600; }
.va-retry-btn:hover { background:#a3162f; }

.va-skeleton { background:linear-gradient(90deg,var(--bg-card,var(--slate-800)) 25%,var(--bg-primary,#2c2c2c) 50%,var(--bg-card,var(--slate-800)) 75%); background-size:200% 100%; animation:va-shimmer 1.5s infinite; min-height:80px; }
@keyframes va-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
