/* ==========================================================================
   Vitruvex v2 — Layout System
   Sidebar + header + content grid
   ========================================================================== */

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

html {
    font-family: var(--font-body);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }

/* ---------- App Shell ---------- */
.v2-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.v2-workspace {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
}

/* Dark theme background radial glow */
[data-theme="dark"] .v2-app {
    background-image: radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.06) 0%, transparent 25%);
}

/* ---------- Sidebar ---------- */
.v2-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: var(--sidebar-border);
    padding: 48px 16px 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: transform 0.3s ease, width 0.25s ease, min-width 0.25s ease, padding 0.25s ease, margin-right 0.25s ease, box-shadow 0.2s ease;
}

.v2-sidebar-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: col-resize;
    z-index: 5;
    -webkit-appearance: none;
    appearance: none;
}

.v2-sidebar-resizer::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 1px;
    background: transparent;
    transition: background-color 0.15s ease;
}

.v2-sidebar-resizer:hover::before,
.v2-sidebar-resizer:focus-visible::before,
body.sidebar-resizing .v2-sidebar-resizer::before {
    background: var(--border-strong);
}

.v2-sidebar-resizer:focus-visible {
    outline: none;
    box-shadow: none;
}

body.sidebar-resizing,
body.sidebar-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

[data-theme="dark"] .v2-sidebar {
    backdrop-filter: var(--glass-blur);
    border-right-color: rgba(148, 163, 184, 0.06);
    box-shadow: 8px 0 24px rgba(2, 6, 23, 0.52);
}

[data-theme="light"] .v2-header {
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-subtle: rgba(56, 189, 248, 0.1);
    --border: rgba(255, 255, 255, 0.05);
    --border-strong: rgba(255, 255, 255, 0.1);
    --bg-hover: rgba(56, 189, 248, 0.08);
    --bg-active: rgba(56, 189, 248, 0.12);
    --bg-subtle: rgba(30, 41, 59, 0.3);
    --omnibar-bg: rgba(30, 41, 59, 0.6);
    --omnibar-border: rgba(56, 189, 248, 0.3);
    --omnibar-focus-border: #38bdf8;
    --omnibar-focus-shadow: 0 0 30px rgba(56, 189, 248, 0.2);
    --omnibar-btn-bg: linear-gradient(135deg, #38bdf8, #2563eb);
    --omnibar-btn-color: #ffffff;
    --nav-icon-opacity: 0.7;
    --nav-label-color: #64748b;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.24);
    position: relative;
    z-index: 120;
}

[data-theme="light"] .v2-sidebar {
    /* Keep sidebar dark in light mode (matches header treatment) */
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid rgba(148, 163, 184, 0.06);
    backdrop-filter: var(--glass-blur);
    box-shadow: 8px 0 24px rgba(2, 6, 23, 0.52);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-subtle: rgba(56, 189, 248, 0.1);
    --accent-header: #38bdf8;
    --border: rgba(255, 255, 255, 0.05);
    --border-strong: rgba(255, 255, 255, 0.1);
    --bg-hover: rgba(56, 189, 248, 0.08);
    --bg-active: rgba(56, 189, 248, 0.12);
    --bg-subtle: rgba(30, 41, 59, 0.3);
    --nav-icon-opacity: 0.7;
    --nav-label-color: #64748b;
}

[data-theme="light"] .v2-header-sidebar {
    box-shadow:
        inset -1px 0 0 rgba(255, 255, 255, 0.06),
        8px 0 12px -16px rgba(2, 6, 23, 0.18);
}

/* Sidebar Top */
.v2-sidebar-top {
    display: flex;
    margin-bottom: 0;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

.v2-sidebar-collapse-row {
    display: flex;
    justify-content: flex-end;
    width: auto;
    margin-left: 0;
    padding: 0;
}

.v2-sidebar-collapse {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.v2-sidebar-collapse:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.v2-sidebar-collapse i {
    font-size: 12px;
    transition: transform 0.2s ease;
}

/* Nav Items */
.v2-nav-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 2px;
}

.v2-nav-divider {
    height: 1px;
    margin: 8px 16px;
    background: var(--border-strong);
}

.v2-nav-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--nav-label-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 12px;
    margin-bottom: 8px;
    display: block;
}

.v2-nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    text-decoration: none;
    font: inherit;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}

.v2-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.v2-nav-item.active {
    background: var(--bg-active);
    color: var(--accent);
}

[data-theme="light"] .v2-nav-item.active {
    color: var(--accent-header);
}

.v2-nav-item i {
    width: 24px;
    margin-right: 10px;
    font-size: 15px;
    opacity: var(--nav-icon-opacity);
    text-align: center;
}

.v2-nav-item.active i {
    color: var(--accent);
    opacity: 1;
}

[data-theme="light"] .v2-nav-item.active i {
    color: var(--accent-header);
}

/* Collapsible Parent (Contract Admin) */
.v2-nav-parent {
    margin-bottom: 0;
    flex: 1;
}

.v2-nav-parent-row {
    display: flex;
    align-items: stretch;
    margin-bottom: 0;
}

.v2-nav-parent-toggle {
    width: 34px;
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.v2-nav-parent-row:hover .v2-nav-parent-toggle {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.v2-nav-parent.active + .v2-nav-parent-toggle {
    background: var(--bg-active);
    color: var(--accent);
}

[data-theme="light"] .v2-nav-parent.active + .v2-nav-parent-toggle {
    color: var(--accent-header);
}

.v2-nav-chevron {
    font-size: 12px;
    transition: transform 0.2s ease;
    opacity: 0.5;
    margin-right: 0;
}

.v2-nav-parent-row.expanded .v2-nav-chevron {
    transform: rotate(90deg);
}

.v2-nav-children {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.v2-nav-children.expanded {
    max-height: 300px;
}

.v2-nav-children .v2-nav-item {
    margin-bottom: 0;
    padding-left: 46px;
    font-size: 13px;
}

/* Sidebar footer */
.v2-sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid var(--border);
}

/* ---------- Sidebar User Widget ---------- */
.v2-sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    margin-top: 12px;
    border-radius: 10px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.2),
        0 1px 0 rgba(255, 255, 255, 0.03);
}

.v2-sidebar-user:hover {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.06);
}

.v2-sidebar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.v2-sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.v2-sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.v2-sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.v2-sidebar-user-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    transition: background 0.15s ease, color 0.15s ease;
}

.v2-sidebar-user-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* User popover — portaled to body, opens upward */
.v2-sidebar-user-popover {
    position: fixed;
    min-width: 180px;
    background: rgba(22, 33, 52, 0.96);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: var(--radius-sm);
    box-shadow:
        0 12px 36px rgba(2, 6, 23, 0.6),
        0 0 0 1px rgba(56, 189, 248, 0.06) inset;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.97);
    transform-origin: bottom left;
    transition: opacity 0.15s ease, transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.15s;
    z-index: 200;
    overflow: hidden;
    padding: 4px;
}

.v2-sidebar-user-popover.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.v2-sidebar-user-popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #e2e8f0;
    cursor: pointer;
    transition: background 0.12s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    text-decoration: none;
}

.v2-sidebar-user-popover-item:hover {
    background: rgba(56, 189, 248, 0.08);
}

.v2-sidebar-user-popover-item i {
    width: 16px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

.v2-sidebar-user-popover-divider {
    height: 1px;
    margin: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
}

.v2-sidebar-user-popover-item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.v2-sidebar-user-popover-item--danger:hover i {
    color: #f87171;
}

/* Light theme — sidebar stays dark */
[data-theme="light"] .v2-sidebar .v2-sidebar-user-name {
    color: #e2e8f0;
}

[data-theme="light"] .v2-sidebar .v2-sidebar-user-role {
    color: #64748b;
}

[data-theme="light"] .v2-sidebar .v2-sidebar-user-menu-btn {
    color: #64748b;
}

[data-theme="light"] .v2-sidebar .v2-sidebar-user {
    background: rgba(0, 0, 0, 0.12);
    border-color: rgba(255, 255, 255, 0.04);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.15),
        0 1px 0 rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .v2-sidebar .v2-sidebar-user:hover {
    background: rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .v2-sidebar .v2-sidebar-user-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

/* ---------- Project Selector ---------- */
.v2-project-selector {
    position: relative;
    margin-bottom: 16px;
    z-index: 10;
}

.v2-project-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    text-align: left;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.v2-project-trigger::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.06) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.v2-project-trigger:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
}

.v2-project-trigger:hover::before {
    opacity: 1;
}

.v2-project-selector.open .v2-project-trigger {
    border-color: var(--accent);
    background: var(--bg-active);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.12);
}

.v2-project-trigger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(56, 189, 248, 0.05));
    color: var(--accent);
    font-size: 14px;
    flex-shrink: 0;
    transition: var(--transition);
}

.v2-project-selector.open .v2-project-trigger-icon {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(56, 189, 248, 0.1));
}

.v2-project-trigger-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.v2-project-trigger-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.v2-project-trigger-addr {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.v2-project-trigger-addr:empty {
    display: none;
}

.v2-project-trigger-chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin-left: auto;
}

.v2-project-selector.open .v2-project-trigger-chevron {
    transform: rotate(180deg);
    color: var(--accent);
}

/* Dropdown Panel — uses fixed positioning to escape sidebar overflow clip */
.v2-project-dropdown {
    position: fixed;
    min-width: 300px;
    background: rgba(22, 33, 52, 0.96);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: var(--radius-md);
    box-shadow:
        0 16px 48px rgba(2, 6, 23, 0.65),
        0 0 0 1px rgba(56, 189, 248, 0.06) inset;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top left;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s;
    z-index: 200;
    overflow: hidden;
    /* Always dark — dropdown belongs to the dark sidebar */
    color-scheme: dark;
}

.v2-project-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.v2-project-dropdown-header {
    padding: 12px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.v2-project-dropdown-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.v2-project-dropdown-list {
    padding: 6px;
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.v2-project-dropdown-list::-webkit-scrollbar {
    width: 4px;
}

.v2-project-dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

.v2-project-dropdown-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 2px;
}

/* Project Item */
.v2-project-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit;
}

.v2-project-item:hover {
    background: rgba(56, 189, 248, 0.08);
}

.v2-project-item.is-current {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.15);
}

.v2-project-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-top: 1px;
    font-size: 12px;
}

.v2-project-item.is-current .v2-project-item-icon {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.08));
    color: var(--accent);
}

.v2-project-item:not(.is-current) .v2-project-item-icon {
    background: rgba(30, 41, 59, 0.3);
    color: #64748b;
}

.v2-project-item-body {
    flex: 1;
    min-width: 0;
}

.v2-project-item-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.v2-project-item.is-current .v2-project-item-name {
    color: #38bdf8;
}

.v2-project-item-addr {
    display: block;
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-top: 2px;
}

/* Status Badge */
.v2-project-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    margin-top: 4px;
    line-height: 1.4;
}

.v2-project-status--active {
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
}

.v2-project-status--planning {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
}

.v2-project-status--on_hold {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

.v2-project-status--practical_completion {
    background: rgba(168, 85, 247, 0.12);
    color: #a78bfa;
}

.v2-project-status--defects_liability {
    background: rgba(251, 146, 60, 0.12);
    color: #fb923c;
}

.v2-project-status--completed {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
}

.v2-project-status--cancelled {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
}

/* Light-mode sidebar keeps dark palette — match it */
[data-theme="light"] .v2-sidebar .v2-project-trigger {
    border-color: rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.03);
    color: #e2e8f0;
}

[data-theme="light"] .v2-sidebar .v2-project-trigger:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(56, 189, 248, 0.08);
}

[data-theme="light"] .v2-sidebar .v2-project-trigger-name {
    color: #e2e8f0;
}

[data-theme="light"] .v2-sidebar .v2-project-trigger-addr {
    color: #64748b;
}

[data-theme="light"] .v2-sidebar .v2-project-trigger-chevron {
    color: #64748b;
}

[data-theme="light"] .v2-sidebar .v2-project-trigger-icon {
    color: #38bdf8;
}

[data-theme="light"] .v2-project-selector.open .v2-project-trigger {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
}

[data-theme="light"] .v2-project-selector.open .v2-project-trigger-chevron {
    color: #38bdf8;
}

/* ---------- Desktop Icon-Only Sidebar ---------- */
@media (min-width: 769px) {
    .v2-app.sidebar-collapsed .v2-header-sidebar {
        width: var(--sidebar-width-collapsed);
        min-width: var(--sidebar-width-collapsed);
        padding-left: 8px;
        padding-right: 8px;
        justify-content: center;
        gap: 0;
    }

    .v2-app.sidebar-collapsed .v2-header-brand {
        justify-content: center;
        gap: 0;
    }

    .v2-app.sidebar-collapsed .v2-header-brand-text {
        max-width: 0;
        opacity: 0;
    }

    .v2-app.sidebar-collapsed .v2-sidebar {
        width: var(--sidebar-width-collapsed);
        min-width: var(--sidebar-width-collapsed);
        padding-left: 8px;
        padding-right: 8px;
        margin-right: 0;
    }

    .v2-app.sidebar-collapsed:not(.sidebar-peek-locked) .v2-sidebar:is(:hover, :focus-within) {
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        padding-left: 16px;
        padding-right: 16px;
        margin-right: calc(var(--sidebar-width-collapsed) - var(--sidebar-width));
        box-shadow: var(--shadow-xl);
        z-index: 140;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-sidebar-collapse-row {
        justify-content: flex-end;
        width: auto;
        margin-left: 0;
        padding: 0;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-nav-text,
    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-nav-chevron {
        display: none;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-nav-parent-toggle {
        display: none;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-nav-item {
        justify-content: center;
        padding-left: 8px;
        padding-right: 8px;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-nav-item i {
        margin-right: 0;
        width: 26px;
        font-size: 17px;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-nav-children {
        display: none;
    }

    /* Project selector collapsed */
    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-project-trigger-body,
    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-project-trigger-chevron {
        display: none;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-project-trigger {
        justify-content: center;
        padding: 8px;
        gap: 0;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-project-trigger-icon {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    /* User widget collapsed */
    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-sidebar-user-info,
    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-sidebar-user-menu-btn {
        display: none;
    }

    .v2-app.sidebar-collapsed .v2-sidebar:not(:hover):not(:focus-within) .v2-sidebar-user {
        justify-content: center;
        gap: 0;
    }

    /* Force collapsed visuals immediately after click until pointer leaves once */
    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-sidebar-collapse-row {
        justify-content: flex-end;
        width: auto;
        margin-left: 0;
        padding: 0;
    }

    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-nav-text,
    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-nav-chevron {
        display: none;
    }

    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-nav-parent-toggle {
        display: none;
    }

    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-nav-item {
        justify-content: center;
        padding-left: 8px;
        padding-right: 8px;
    }

    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-nav-item i {
        margin-right: 0;
        width: 26px;
        font-size: 17px;
    }

    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-nav-children {
        display: none;
    }

    /* Project selector peek-locked */
    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-project-trigger-body,
    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-project-trigger-chevron {
        display: none;
    }

    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-project-trigger {
        justify-content: center;
        padding: 8px;
        gap: 0;
    }

    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-project-trigger-icon {
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    /* User widget peek-locked */
    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-sidebar-user-info,
    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-sidebar-user-menu-btn {
        display: none;
    }

    .v2-app.sidebar-collapsed.sidebar-peek-locked .v2-sidebar .v2-sidebar-user {
        justify-content: center;
        gap: 0;
    }

    .v2-app.sidebar-collapsed .v2-sidebar-collapse i {
        transform: rotate(180deg);
    }

    .v2-app.sidebar-collapsed .v2-sidebar-resizer {
        display: none;
    }
}

/* ---------- Main Area ---------- */
.v2-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: var(--bg-page);
}

/* ---------- Header ---------- */
.v2-header {
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 0;
}

[data-theme="dark"] .v2-header {
    backdrop-filter: var(--glass-blur);
    border-bottom-color: transparent;
    box-shadow: none;
    position: relative;
    z-index: 120;
}

[data-theme="dark"] .v2-header-main {
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
    box-shadow: 0 10px 18px -14px rgba(2, 6, 23, 0.72);
    position: relative;
    z-index: 1;
}

.v2-header-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 16px 24px;
    border-right: none;
    overflow: hidden;
    transition: width 0.25s ease, min-width 0.25s ease, padding 0.25s ease, gap 0.2s ease;
}

.v2-header-main {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 16px 32px;
}

.v2-header-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 0;
}

.v2-header-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 20px;
    flex-shrink: 0;
}

.v2-header-brand-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
    max-width: 220px;
    overflow: hidden;
    transition: max-width 0.2s ease, opacity 0.2s ease;
}

/* Breadcrumbs */
.v2-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.v2-breadcrumbs a,
.v2-breadcrumbs .current {
    white-space: nowrap;
}

.v2-breadcrumbs a {
    color: var(--text-muted);
    transition: color 0.2s;
}

.v2-breadcrumbs a:hover {
    color: var(--text-primary);
}

.v2-breadcrumbs .separator {
    font-size: 11px;
    opacity: 0.5;
}

.v2-breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Omni Search */
.v2-omnibar {
    width: 100%;
    max-width: 460px;
    min-width: 0;
    margin: 0 auto;
    position: relative;
}

.v2-omnibar input {
    width: 100%;
    background: var(--omnibar-bg);
    border: 1px solid var(--omnibar-border);
    padding: 10px 126px 10px 16px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    transition: var(--transition);
}

.v2-omnibar-clear {
    position: absolute;
    right: 58px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.34);
    color: #cbd5e1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.v2-omnibar.has-value .v2-omnibar-clear {
    opacity: 1;
    pointer-events: auto;
}

.v2-omnibar-clear:hover {
    border-color: rgba(148, 163, 184, 0.55);
    background: rgba(30, 41, 59, 0.7);
    color: #f8fafc;
}

.v2-omnibar-clear:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.v2-omnibar-shortcut {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    background: rgba(15, 23, 42, 0.36);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.v2-omnibar-shortcut kbd {
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 0 5px;
    min-width: 16px;
    text-align: center;
    font-size: 10px;
    line-height: 1.3;
    color: #e2e8f0;
    background: rgba(30, 41, 59, 0.75);
}

.v2-omnibar.search-open .v2-omnibar-shortcut,
.v2-omnibar input:focus ~ .v2-omnibar-shortcut {
    opacity: 0;
    transform: translateY(-50%) translateX(4px);
}

.v2-omnibar input::placeholder {
    color: var(--text-muted);
}

.v2-omnibar input:focus {
    border-color: var(--omnibar-focus-border);
    box-shadow: var(--omnibar-focus-shadow);
}

[data-theme="dark"] .v2-omnibar input:focus {
    background: rgba(30, 41, 59, 0.9);
}

[data-theme="light"] .v2-omnibar input:focus {
    background: #ffffff;
}

[data-theme="light"] .v2-header .v2-omnibar input {
    color: #e2e8f0;
}

[data-theme="light"] .v2-header .v2-omnibar input::placeholder {
    color: rgba(226, 232, 240, 0.72);
}

[data-theme="light"] .v2-header .v2-omnibar.search-open input,
[data-theme="light"] .v2-header .v2-omnibar input:focus {
    color: #0f172a;
}

[data-theme="light"] .v2-header .v2-omnibar.search-open input::placeholder,
[data-theme="light"] .v2-header .v2-omnibar input:focus::placeholder {
    color: #64748b;
}

[data-theme="light"] .v2-header .v2-omnibar .v2-omnibar-shortcut {
    border-color: rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.16);
    color: #e2e8f0;
}

[data-theme="light"] .v2-header .v2-omnibar .v2-omnibar-shortcut kbd {
    border-color: rgba(148, 163, 184, 0.45);
    background: rgba(30, 41, 59, 0.4);
    color: #f8fafc;
}

[data-theme="light"] .v2-header .v2-omnibar .v2-omnibar-clear {
    border-color: rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.16);
    color: #cbd5e1;
}

[data-theme="light"] .v2-header .v2-omnibar .v2-omnibar-clear:hover {
    border-color: rgba(148, 163, 184, 0.55);
    background: rgba(15, 23, 42, 0.26);
    color: #f8fafc;
}

[data-theme="light"] .v2-header .v2-omnibar.search-open .v2-omnibar-shortcut,
[data-theme="light"] .v2-header .v2-omnibar input:focus ~ .v2-omnibar-shortcut {
    opacity: 0;
}

.v2-omnibar {
    overflow: visible;
}

.v2-omnibar.search-open input {
    border-color: var(--omnibar-focus-border);
    box-shadow: var(--omnibar-focus-shadow);
    background: rgba(30, 41, 59, 0.9);
}

[data-theme="light"] .v2-omnibar.search-open input {
    background: #ffffff;
}

.v2-search-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: clamp(520px, 68vw, 860px);
    max-width: calc(100vw - 40px);
    max-height: min(65vh, 520px);
    z-index: 220;
    display: none;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(27, 39, 58, 0.92), rgba(30, 41, 59, 0.96));
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 14px;
    box-shadow: 0 22px 52px rgba(2, 6, 23, 0.6), 0 0 0 1px rgba(15, 23, 42, 0.4) inset;
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.v2-search-panel.open {
    display: flex;
}

.v2-search-panel.has-many-results {
    max-height: min(90vh, 780px);
}

.v2-search-panel:not(.has-results) .v2-search-results {
    display: none;
}

.v2-search-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.8);
}

.v2-search-chip {
    border: 1px solid rgba(125, 211, 252, 0.32);
    background-color: rgba(8, 22, 44, 0.72);
    background-image: none;
    color: rgba(226, 232, 240, 0.88);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.v2-search-chip i {
    font-size: 11px;
}

.v2-search-chip:hover {
    background-color: rgba(10, 30, 58, 0.82);
    border-color: rgba(125, 211, 252, 0.48);
    color: #f8fafc;
    filter: none;
}

.v2-search-chip.is-active {
    background-color: var(--bg-header);
    color: #ffffff;
    font-weight: 600;
    border-color: transparent;
    box-shadow: none;
}

.v2-search-chip.is-active:hover {
    background-color: var(--bg-header);
    color: #ffffff;
    border-color: transparent;
    filter: none;
}

.v2-search-chip-divider {
    width: 1px;
    height: 14px;
    background: rgba(148, 163, 184, 0.35);
    margin: 0 2px;
}

.v2-search-results {
    max-height: min(46vh, 360px);
    overflow-y: auto;
    padding: 8px 10px 10px;
    background: linear-gradient(180deg, rgba(27, 39, 58, 0.92), rgba(30, 41, 59, 0.96));
}

.v2-search-panel.has-many-results .v2-search-results {
    min-height: min(57vh, 420px);
    max-height: min(69vh, 540px);
}

.v2-search-section + .v2-search-section {
    margin-top: 8px;
}

.v2-search-section[data-filtered="true"] {
    display: none;
}

.v2-search-section-header,
.v2-search-panel .cs-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #93c5fd;
}

.v2-search-result,
.v2-search-panel .cs-item {
    border: 1px solid rgba(71, 85, 105, 0.45);
    background: rgba(15, 23, 42, 0.58);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 6px;
}

.v2-search-result:hover,
.v2-search-result.is-active,
.v2-search-panel .cs-item:hover {
    border-color: rgba(56, 189, 248, 0.62);
    background: rgba(14, 116, 144, 0.16);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.v2-search-result-title {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.35;
}

.v2-search-result-snippet {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.35;
    margin-bottom: 6px;
}

.v2-search-result-snippet b,
.v2-search-result-snippet strong {
    color: #67e8f9;
    font-weight: 700;
    background: rgba(56, 189, 248, 0.16);
    border-radius: 4px;
    padding: 0 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.v2-search-result-snippet em,
.v2-search-result-snippet i {
    color: var(--text-secondary);
}

.v2-search-result-path {
    font-size: 11px;
    color: #93c5fd;
    margin-bottom: 6px;
    opacity: 0.86;
}

.v2-search-result-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.v2-search-result-meta-text {
    color: var(--text-muted);
    font-size: 11px;
}

.v2-search-result-meta-text--code {
    color: #94a3b8;
    font-weight: 500;
}

.v2-search-result-badge,
.v2-search-panel .cs-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    border: none;
    background: rgba(30, 64, 175, 0.24);
    color: #bfdbfe;
    letter-spacing: 0.01em;
}

.v2-search-result-badge--status {
    background: rgba(30, 64, 175, 0.24);
    color: #bfdbfe;
}

.v2-search-result-badge--subtle {
    background: rgba(51, 65, 85, 0.35);
    color: #cbd5e1;
}

.v2-search-result-badge--progress {
    background: rgba(8, 145, 178, 0.28);
    color: #a5f3fc;
}

.v2-search-result-badge--money {
    background: rgba(14, 116, 144, 0.26);
    color: #7dd3fc;
}

.v2-search-result-badge--warning {
    background: rgba(180, 83, 9, 0.24);
    color: #fde68a;
}

.v2-search-result-badge--danger {
    background: rgba(153, 27, 27, 0.26);
    color: #fecaca;
}

.v2-search-empty {
    padding: 18px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.v2-search-empty.v2-search-error {
    color: #fca5a5;
}

.v2-search-panel .cs-snippet {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 6px;
}

.v2-search-panel mark {
    background: rgba(56, 189, 248, 0.2);
    color: #e0f2fe;
    border-radius: 4px;
    padding: 0 2px;
}

.v2-search-panel .cs-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.v2-search-panel .cs-page {
    color: #93c5fd;
}

.v2-search-panel .cs-spinner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(125, 211, 252, 0.25);
    border-top-color: #38bdf8;
    animation: v2-search-spin .7s linear infinite;
}

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

.v2-search-helper {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-wrap: wrap;
    gap: 6px;
}

.v2-search-helper kbd {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 1px 5px;
    font-size: 10px;
    color: var(--text-secondary);
    background: rgba(30, 41, 59, 0.5);
}

[data-theme="light"] .v2-search-panel {
    background: linear-gradient(180deg, #f1f5f9, #f8fbff);
    border-color: rgba(17, 96, 141, 0.24);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(148, 163, 184, 0.16) inset;
}

[data-theme="light"] .v2-search-filters {
    background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
    border-bottom-color: rgba(148, 163, 184, 0.35);
}

[data-theme="light"] .v2-search-results {
    background: linear-gradient(180deg, #f1f5f9, #f8fbff);
}

[data-theme="light"] .v2-search-chip {
    background-color: #f1f5f9;
    background-image: none;
    border: 1px solid rgba(148, 163, 184, 0.58);
    color: #475569;
}

[data-theme="light"] .v2-search-chip:hover {
    background-color: #eef2f7;
    border-color: rgba(100, 116, 139, 0.72);
    color: #334155;
    filter: none;
}

[data-theme="light"] .v2-search-chip.is-active {
    background-color: #0e5278;
    color: #ffffff;
    font-weight: 600;
    border-color: transparent;
    box-shadow: none;
}

[data-theme="light"] .v2-search-chip.is-active:hover {
    background-color: #11608d;
    color: #ffffff;
    border-color: transparent;
    filter: none;
}

[data-theme="light"] .v2-search-section-header,
[data-theme="light"] .v2-search-panel .cs-section-header {
    color: var(--accent-header);
}

[data-theme="light"] .v2-search-result,
[data-theme="light"] .v2-search-panel .cs-item {
    background: #ffffff;
    border-color: rgba(148, 163, 184, 0.38);
}

[data-theme="light"] .v2-search-result:hover,
[data-theme="light"] .v2-search-result.is-active,
[data-theme="light"] .v2-search-panel .cs-item:hover {
    border-color: rgba(17, 96, 141, 0.48);
    background: rgba(17, 96, 141, 0.08);
}

[data-theme="light"] .v2-search-panel .cs-snippet,
[data-theme="light"] .v2-search-result-snippet {
    color: #475569;
}

[data-theme="light"] .v2-search-result-snippet b,
[data-theme="light"] .v2-search-result-snippet strong {
    color: var(--accent-header);
    background: var(--accent-header-subtle);
}

[data-theme="light"] .v2-search-result-meta {
    color: #64748b;
}

[data-theme="light"] .v2-search-result-meta-text {
    color: #64748b;
}

[data-theme="light"] .v2-search-result-meta-text--code {
    color: #475569;
}

[data-theme="light"] .v2-search-result-path {
    color: var(--accent-header);
    opacity: 0.8;
}

[data-theme="light"] .v2-search-panel mark {
    background: var(--accent-header-subtle);
    color: var(--accent-header);
}

[data-theme="light"] .v2-search-result-badge,
[data-theme="light"] .v2-search-panel .cs-badge {
    background: var(--accent-header-subtle);
    color: var(--accent-header-hover);
}

[data-theme="light"] .v2-search-result-badge--status {
    background: var(--accent-header-subtle);
    color: var(--accent-header-hover);
}

[data-theme="light"] .v2-search-result-badge--subtle {
    background: rgba(148, 163, 184, 0.24);
    color: #334155;
}

[data-theme="light"] .v2-search-result-badge--progress {
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
}

[data-theme="light"] .v2-search-result-badge--money {
    background: var(--accent-header-subtle);
    color: var(--accent-header-hover);
}

[data-theme="light"] .v2-search-result-badge--warning {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}

[data-theme="light"] .v2-search-result-badge--danger {
    background: rgba(239, 68, 68, 0.16);
    color: #b91c1c;
}

[data-theme="light"] .v2-search-result-title {
    color: #0f172a;
}

[data-theme="light"] .v2-search-helper {
    background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
    border-top-color: rgba(148, 163, 184, 0.35);
    color: #475569;
}

[data-theme="light"] .v2-search-helper kbd {
    background: #e2e8f0;
    color: #334155;
    border-color: rgba(100, 116, 139, 0.48);
}

.v2-omnibar-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    overflow: hidden;
    background: rgba(10, 14, 26, 0.35);
    color: var(--omnibar-btn-color);
    border: 1px solid rgba(90, 220, 255, 0.55);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: var(--transition);
}

.v2-omnibar-btn::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--radius-sm) + 1px);
    padding: 1px;
    background: linear-gradient(90deg,
        rgba(56, 189, 248, 0),
        rgba(90, 220, 255, 0.65),
        rgba(56, 189, 248, 0));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.55;
    pointer-events: none;
    transition: opacity .16s ease;
}

.v2-omnibar-btn i {
    font-size: 12px;
    line-height: 1;
}

.v2-omnibar-btn:hover {
    border-color: rgba(90, 220, 255, 0.85);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 22px rgba(90, 220, 255, 0.14);
}

.v2-omnibar-btn:hover::before {
    opacity: 0.85;
}

.v2-omnibar-btn:active {
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.35), 0 0 10px rgba(70, 150, 255, 0.18);
    filter: brightness(0.98);
}

[data-theme="light"] .v2-omnibar-btn:not(.v2-header-ai-btn) {
    background: rgba(248, 251, 255, 0.88);
    border-color: rgba(14, 165, 233, 0.55);
    color: #1e3a8a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .v2-omnibar-btn:not(.v2-header-ai-btn):hover {
    border-color: rgba(14, 165, 233, 0.75);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 16px rgba(14, 165, 233, 0.16);
}

.v2-header-ai-btn {
    position: relative;
    transform: none;
    right: auto;
    top: auto;
    height: 32px;
    padding: 0 14px;
    flex-shrink: 0;
    white-space: nowrap;
    border: none;
}

.v2-header-ai-btn::before {
    display: none;
}

.v2-header-ai-logo-shell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.v2-header-ai-logo {
    font-size: 13px;
    line-height: 1;
    color: var(--accent);
}

/* Header actions */
.v2-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
}

.v2-header-icon-btn {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 16px;
    display: flex;
    align-items: center;
    line-height: 1;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.v2-header-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.v2-header-icon-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* ---------- Content Area ---------- */
.v2-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.v2-content-narrow {
    max-width: 1200px;
    margin: 0 auto;
}

/* ---------- Standalone Layout (login, register) ---------- */
.v2-standalone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

[data-theme="dark"] .v2-standalone {
    background-color: var(--bg-page);
    background-image: radial-gradient(circle at 30% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 30%),
                      radial-gradient(circle at 70% 80%, rgba(37, 99, 235, 0.06) 0%, transparent 30%);
}

[data-theme="light"] .v2-standalone {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Search trigger — hidden on desktop, shown on mobile */
.v2-search-trigger {
    display: none;
}

/* ---------- Medium Breakpoint: Compact Search ---------- */
@media (max-width: 1024px) {
    .v2-omnibar .v2-omnibar-shortcut {
        display: none;
    }

    .v2-omnibar input {
        padding-right: 42px;
    }
}

@media (max-width: 900px) {
    .v2-header-main {
        gap: 12px;
        padding: 16px 20px;
    }
}

/* ---------- Mobile Responsive ---------- */
.v2-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.v2-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

@media (max-width: 768px) {
    .v2-sidebar-collapse {
        display: none;
    }

    .v2-sidebar-top {
        display: none;
    }

    .v2-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(88vw, 320px);
        min-width: min(88vw, 320px);
        padding-top: 24px;
        transform: translateX(-100%);
        z-index: 100;
        box-shadow: var(--shadow-xl);
    }

    .v2-sidebar-resizer {
        display: none;
    }

    .v2-project-selector {
        margin-bottom: 12px;
    }

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

    .v2-sidebar-overlay.open {
        display: block;
    }

    .v2-sidebar-toggle {
        display: block;
    }

    .v2-header {
        flex-direction: column;
        align-items: stretch;
    }

    .v2-header-sidebar {
        width: auto;
        min-width: 0;
        border-right: none;
        padding: 12px 16px 8px;
        gap: 10px;
    }

    .v2-header-main {
        display: flex;
        align-items: center;
        padding: 0 16px 12px;
        gap: 12px;
    }

    .v2-header-brand-text {
        font-size: 18px;
    }

    .v2-content {
        padding: 16px;
    }

    .v2-omnibar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 200;
        max-width: none;
        min-width: 0;
        margin: 0;
        padding: 12px 16px;
        background: var(--bg-header);
        transform: translateY(-100%);
        opacity: 0;
        transition: transform 0.2s ease, opacity 0.2s ease;
        pointer-events: none;
    }

    .v2-omnibar.mobile-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .v2-omnibar .v2-search-panel {
        left: 0;
        transform: none;
        width: 100vw;
        max-width: 100vw;
        border-radius: 0 0 14px 14px;
    }

    .v2-search-trigger {
        display: flex;
    }

    .v2-header-actions {
        margin-left: auto;
    }
}
