/* Cuevoo - unified design system
   Cabinet Grotesk · Satoshi · JetBrains Mono
   Premium tokens shared with landing & login. */

:root {
    /* Brand */
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-200: #bfdbfe;
    --brand-500: #3b82f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
    --brand-800: #1e40af;
    --brand-900: #1e3a8a;

    /* Neutrals - slightly warm, deeper ink */
    --ink: #0a0b0f;
    --ink-soft: #1f232c;
    --ink-mute: #5a626e;
    --ink-faint: #9aa1ad;
    --line: #e8e9ec;
    --line-soft: #f0f1f4;
    --bg: #fbfbf8;
    --bg-warm: #f6f5f0;
    --surface: #ffffff;

    /* Shadows - layered, refined */
    --shadow-xs: 0 1px 2px rgba(10, 11, 15, .04);
    --shadow-sm: 0 1px 2px rgba(10, 11, 15, .05), 0 1px 3px rgba(10, 11, 15, .04);
    --shadow: 0 1px 2px rgba(10, 11, 15, .04), 0 8px 16px -6px rgba(10, 11, 15, .06);
    --shadow-md: 0 2px 4px rgba(10, 11, 15, .04), 0 12px 24px -8px rgba(10, 11, 15, .08);
    --shadow-lg: 0 4px 8px rgba(10, 11, 15, .04), 0 30px 60px -20px rgba(10, 11, 15, .12);
    --shadow-xl: 0 8px 16px rgba(10, 11, 15, .04), 0 40px 80px -24px rgba(10, 11, 15, .18);

    /* Easing */
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* {
    box-sizing: border-box;
}

*::selection {
    background: var(--brand-100);
    color: var(--brand-700);
}

html {
    scroll-behavior: smooth;
}

html,
body {
    font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    font-feature-settings: 'ss01', 'cv01', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
}

/* Subtle gradient mesh + grain — matches landing/login */
body {
    min-height: 100vh;
    position: relative;
}

/* Sticky footer: stack in-flow content as a column so the page fills the
   viewport and .cv-foot is pushed to the bottom when content is short.
   The sidebar/overlay/toggle are position:fixed, so they sit outside this
   flex flow and are unaffected. */
.has-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.has-sidebar main,
.has-sidebar .cv-page {
    flex: 1 0 auto;
}

.has-sidebar .cv-foot {
    flex-shrink: 0;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 50% at 85% 8%, rgba(191, 219, 254, .42) 0%, transparent 55%),
        radial-gradient(ellipse 50% 50% at 8% 92%, rgba(199, 210, 254, .32) 0%, transparent 55%),
        radial-gradient(ellipse 40% 40% at 55% 65%, rgba(221, 214, 254, .16) 0%, transparent 55%);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .22;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/></svg>");
    mix-blend-mode: overlay;
}

/* Position-relative only - DO NOT add z-index. Setting z-index here would
   create a stacking context that traps modals (cv-overlay z:60) below the
   sticky nav (z:30). The body's background pseudos use negative z-index, so
   main at z-index auto already sits above them. */
main,
.glass-shell {
    position: relative;
}

.display {
    font-family: 'Cabinet Grotesk', 'Satoshi', sans-serif;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* ───────────── Reveal animations ───────────── */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .65s var(--ease-out), transform .65s var(--ease-out);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-stagger .reveal-child {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .55s var(--ease-out), transform .55s var(--ease-out);
}

.reveal-stagger.visible .reveal-child {
    opacity: 1;
    transform: translateY(0);
}

.reveal-stagger.visible .reveal-child:nth-child(1) {
    transition-delay: 0ms;
}

.reveal-stagger.visible .reveal-child:nth-child(2) {
    transition-delay: 70ms;
}

.reveal-stagger.visible .reveal-child:nth-child(3) {
    transition-delay: 140ms;
}

.reveal-stagger.visible .reveal-child:nth-child(4) {
    transition-delay: 210ms;
}

.reveal-stagger.visible .reveal-child:nth-child(5) {
    transition-delay: 280ms;
}

.reveal-stagger.visible .reveal-child:nth-child(6) {
    transition-delay: 350ms;
}

.reveal-stagger.visible .reveal-child:nth-child(7) {
    transition-delay: 420ms;
}

.reveal-stagger.visible .reveal-child:nth-child(8) {
    transition-delay: 490ms;
}

.hero-fade {
    opacity: 0;
    transform: translateY(14px);
    animation: heroIn .85s var(--ease-out) forwards;
}

.hero-fade-delay {
    animation-delay: .12s;
}

.hero-fade-delay-2 {
    animation-delay: .24s;
}

@keyframes heroIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ───────────── Surfaces ───────────── */
.glass {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.glass-lite {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.card-hover {
    transition: transform .28s var(--ease-out), box-shadow .3s var(--ease-out), border-color .25s var(--ease-out);
}

.card-hover:hover {
    transform: translateY(-2px);
    border-color: rgba(10, 11, 15, .08);
    box-shadow: var(--shadow-md);
}

/* ───────────── Top nav ───────────── */
.cv-nav,
.glass-nav,
.nav-glass {
    background: rgba(251, 251, 248, 0.72);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border-bottom: 1px solid rgba(232, 233, 236, .65);
}

/* ───────────── Buttons ───────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Satoshi', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    /* 14px */
    line-height: 1;
    padding: 0.625rem 1rem;
    border-radius: 10px;
    transition: transform .2s var(--ease-out), background .25s var(--ease-out),
        box-shadow .3s var(--ease-out), color .2s var(--ease-out), border-color .2s var(--ease-out);
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
    letter-spacing: -0.005em;
}

.btn:active {
    transform: translateY(1px);
}

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

.btn-primary {
    color: white;
    background: linear-gradient(180deg, #2f6fec 0%, var(--brand-600) 100%);
    box-shadow:
        0 1px 2px rgba(10, 11, 15, .10),
        0 4px 10px -2px rgba(37, 99, 235, .26),
        inset 0 1px 0 rgba(255, 255, 255, .18);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #2563eb 0%, var(--brand-700) 100%);
    transform: translateY(-1px);
    box-shadow:
        0 1px 2px rgba(10, 11, 15, .14),
        0 12px 24px -6px rgba(37, 99, 235, .40),
        inset 0 1px 0 rgba(255, 255, 255, .20);
}

.btn-secondary {
    background: white;
    color: var(--ink-soft);
    border-color: var(--line);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
    background: white;
    border-color: rgba(10, 11, 15, .16);
    color: var(--ink);
}

.btn-danger {
    background: white;
    color: #b91c1c;
    border-color: #fecaca;
    box-shadow: var(--shadow-xs);
}

.btn-danger:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--ink);
    background: var(--line-soft);
}

.btn-sm {
    padding: 0.42rem 0.78rem;
    font-size: 0.8125rem;
    border-radius: 8px;
}

/* Button shine - subtle highlight sweep */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
    transition: left .6s var(--ease-out);
    pointer-events: none;
}

.btn-shine:hover::after {
    left: 100%;
}

/* ───────────── Inputs ───────────── */
.input,
.select,
.textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: white;
    padding: 0.62rem 0.85rem;
    font-size: 0.9375rem;
    /* 15px */
    font-family: 'Satoshi', sans-serif;
    color: var(--ink);
    transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out), background .2s var(--ease-out);
    box-shadow: inset 0 1px 2px rgba(10, 11, 15, .02);
    letter-spacing: -0.005em;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--ink-faint);
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: rgba(10, 11, 15, .16);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow:
        inset 0 1px 2px rgba(10, 11, 15, .02),
        0 0 0 4px rgba(59, 130, 246, .14);
    background: white;
}

.textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

.input-sm {
    padding: 0.4rem 0.65rem;
    font-size: 0.8125rem;
}

.label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-mute);
    margin-bottom: 0.45rem;
    display: block;
}

/* ───────────── Badges ───────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--line-soft);
    color: var(--ink-soft);
    border: 1px solid var(--line);
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.badge-success {
    background: #f0fdf4;
    color: #047857;
    border-color: #bbf7d0;
}

.badge-warn {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.badge-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.badge-info {
    background: var(--brand-50);
    color: var(--brand-700);
    border-color: var(--brand-100);
}

/* ───────────── Tables ───────────── */
.cv-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.cv-table thead th {
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    color: var(--ink-faint);
    padding: 0.78rem 0.95rem;
    background: rgba(251, 251, 248, .85);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.cv-table tbody td {
    padding: 0.8rem 0.95rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
    color: var(--ink-soft);
}

.cv-table tbody tr {
    transition: background .15s var(--ease-out);
}

.cv-table tbody tr:hover td {
    background: rgba(239, 246, 255, .45);
}

.cv-table tbody tr:last-child td {
    border-bottom: 0;
}

/* Inputs in table cells - tighter for spreadsheet feel */
.cv-table .input,
.cv-table .select {
    padding: 0.4rem 0.6rem;
    font-size: 0.8125rem;
    border-radius: 7px;
    box-shadow: none;
    background: transparent;
    border-color: transparent;
}

.cv-table .input:hover,
.cv-table .select:hover {
    background: var(--line-soft);
    border-color: transparent;
}

.cv-table .input:focus,
.cv-table .select:focus {
    background: white;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .14);
}

/* ───────────── Toasts ───────────── */
.cv-toast-stack {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.cv-toast {
    pointer-events: auto;
    padding: 0.78rem 1.05rem;
    border-radius: 11px;
    background: var(--ink);
    color: white;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    min-width: 260px;
    max-width: 420px;
    transform: translateY(8px);
    opacity: 0;
    animation: cv-toast-in 280ms var(--ease-out) forwards;
    letter-spacing: -0.005em;
    border: 1px solid rgba(255, 255, 255, .08);
}

.cv-toast.error {
    background: #991b1b;
    border-color: rgba(255, 255, 255, .10);
}

.cv-toast.success {
    background: #047857;
    border-color: rgba(255, 255, 255, .10);
}

.cv-toast.info {
    background: var(--brand-700);
    border-color: rgba(255, 255, 255, .10);
}

@keyframes cv-toast-in {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ───────────── Spinner ───────────── */
.cv-spinner {
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: white;
    border-radius: 50%;
    animation: cv-spin .7s linear infinite;
    display: inline-block;
}

.cv-spinner.dark {
    border-color: rgba(10, 11, 15, .16);
    border-top-color: var(--ink);
}

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

.cv-spinner-sm {
    width: .7rem;
    height: .7rem;
    border-width: 2px;
    vertical-align: -1px;
}

/* ───────────── Sync status (optimistic-update pill + dots) ───────────── */
.cv-sync-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 500;
    line-height: 1;
    border: 1px solid transparent;
    transition: opacity .25s var(--ease-out);
}

.cv-sync-pill.cv-sync-pending {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.cv-sync-pill.cv-sync-pending .cv-spinner-sm {
    border-color: rgba(29, 78, 216, .25);
    border-top-color: #1d4ed8;
}

.cv-sync-pill.cv-sync-failed {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.cv-sync-pill.cv-sync-synced {
    background: #f0fdf4;
    color: #047857;
    border-color: #bbf7d0;
}

.cv-sync-retry {
    margin-left: .35rem;
    padding: .1rem .45rem;
    border-radius: 6px;
    background: rgba(185, 28, 28, .08);
    border: 1px solid rgba(185, 28, 28, .25);
    color: inherit;
    font-size: .72rem;
    cursor: pointer;
}

.cv-sync-retry:hover {
    background: rgba(185, 28, 28, .16);
}

.cv-sync-dot {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.cv-sync-dot.cv-sync-pending {
    background: #3b82f6;
    box-shadow: 0 0 0 2px #eff6ff;
    animation: cv-pulse 1.4s ease-in-out infinite;
}

.cv-sync-dot.cv-sync-failed {
    background: #ef4444;
    box-shadow: 0 0 0 2px #fef2f2;
}

button.cv-sync-dot {
    border: 0;
    padding: 0;
    cursor: pointer;
}

button.cv-sync-dot.cv-sync-failed:hover {
    filter: brightness(1.1);
}

/* Variation matrix row tints when push is pending / failed */
tr.cv-row-pending td {
    background: rgba(59, 130, 246, .045);
}

tr.cv-row-failed td {
    background: rgba(239, 68, 68, .06);
}

/* Global sync pill in the nav */
.cv-sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .75rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .2s var(--ease-out), border-color .2s var(--ease-out), color .2s var(--ease-out);
    background: transparent;
}

.cv-sync-indicator-dot {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background .2s var(--ease-out);
}

.cv-sync-indicator.cv-sync-idle {
    background: rgba(16, 185, 129, .08);
    border-color: rgba(16, 185, 129, .22);
    color: #047857;
}

.cv-sync-indicator.cv-sync-idle .cv-sync-indicator-dot {
    background: #10b981;
}

.cv-sync-indicator.cv-sync-busy {
    background: rgba(59, 130, 246, .08);
    border-color: rgba(59, 130, 246, .25);
    color: #1d4ed8;
}

.cv-sync-indicator.cv-sync-busy .cv-sync-indicator-dot {
    background: #3b82f6;
    animation: cv-pulse 1.4s ease-in-out infinite;
}

.cv-sync-indicator.cv-sync-error {
    background: rgba(239, 68, 68, .08);
    border-color: rgba(239, 68, 68, .28);
    color: #b91c1c;
}

.cv-sync-indicator.cv-sync-error .cv-sync-indicator-dot {
    background: #ef4444;
}

@keyframes cv-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .55;
        transform: scale(.78);
    }
}

/* ───────────── Gallery tiles ───────────── */
.gallery-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    background: white;
    border: 1px solid var(--line);
    border-radius: 11px;
    overflow: hidden;
    cursor: grab;
    transition: transform .18s var(--ease-out), box-shadow .25s var(--ease-out), border-color .18s var(--ease-out);
}

.gallery-tile:hover {
    box-shadow: var(--shadow);
    border-color: rgba(10, 11, 15, .12);
}

.gallery-tile.dragging {
    opacity: .4;
}

.gallery-tile.drag-over {
    border-color: var(--brand-500);
    transform: scale(1.03);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.gallery-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.gallery-tile .tile-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--ink);
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    pointer-events: none;
}

.gallery-tile .tile-del {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: white;
    border: 1px solid var(--line);
    color: #b91c1c;
    display: grid;
    place-items: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(.92);
    transition: opacity .15s ease, transform .15s ease, background .15s ease;
    font-size: 13px;
    line-height: 1;
}

.gallery-tile:hover .tile-del {
    opacity: 1;
    transform: scale(1);
}

.gallery-tile .tile-del:hover {
    background: #fef2f2;
}

.gallery-tile.uploading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .55) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 50 50'><circle cx='25' cy='25' r='20' stroke='%232563eb' stroke-width='4' fill='none' stroke-linecap='round' stroke-dasharray='90 60'><animateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='.8s' repeatCount='indefinite'/></circle></svg>") center no-repeat;
}

/* ───────────── Image well ───────────── */
.image-well {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background: white;
    border: 2px dashed var(--brand-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-mute);
    overflow: hidden;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    position: relative;
}

.image-well:hover {
    background: var(--brand-50);
    border-color: var(--brand-500);
    color: var(--brand-700);
}

.image-well img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.feature-icon {
    transition: transform .25s ease, box-shadow .25s ease;
}

.group:hover .feature-icon {
    transform: scale(1.08);
    box-shadow: 0 8px 24px -8px rgba(37, 99, 235, .25);
}

/* ───────────── Skeleton ───────────── */
.skel {
    background: linear-gradient(90deg, rgba(10, 11, 15, .04), rgba(10, 11, 15, .09), rgba(10, 11, 15, .04));
    background-size: 200% 100%;
    animation: skel 1.3s linear infinite;
    border-radius: 8px;
}

@keyframes skel {
    to {
        background-position: -200% 0;
    }
}

/* ───────────── Section heading ───────────── */
.cv-section-title {
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: 2rem;
    /* 32px */
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.04;
    color: var(--ink);
}

.cv-section-sub {
    font-size: 0.9375rem;
    color: var(--ink-mute);
    margin-top: 0.5rem;
    line-height: 1.55;
    letter-spacing: -0.005em;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--brand-700);
    margin-bottom: 0.65rem;
    font-weight: 500;
}

.section-tag::before {
    content: "";
    width: 22px;
    height: 1px;
    background: var(--brand-600);
}

/* ───────────── Stat tile ───────────── */
.stat-tile {
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    background: white;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-xs);
    transition: border-color .2s var(--ease-out), box-shadow .25s var(--ease-out);
}

.stat-tile:hover {
    border-color: rgba(10, 11, 15, .08);
    box-shadow: var(--shadow-sm);
}

.stat-tile .num {
    font-family: 'Cabinet Grotesk', sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--ink);
}

.stat-tile .lbl {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    margin-top: 0.4rem;
    font-weight: 500;
}

/* Compact checkbox alignment */
input[type="checkbox"] {
    accent-color: var(--brand-600);
}

/* ───────────── Page-level layout ───────────── */
.cv-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.75rem 1.75rem;
}

@media (min-width: 768px) {
    .cv-page {
        padding: 3.25rem 2.5rem;
    }
}

/* ───────────── Footer ───────────── */
.cv-foot {
    margin-top: 4rem;
    padding: 2.5rem 0 2rem;
    border-top: 1px solid var(--line-soft);
    background: transparent;
}

.cv-foot-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    font-size: 0.8125rem;
    color: var(--ink-faint);
}

@media (min-width: 768px) {
    .cv-foot-inner {
        padding: 0 2.5rem;
    }
}

.cv-foot-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-mute);
    text-decoration: none;
    font-weight: 500;
}

.cv-foot-brand img {
    width: 18px;
    height: 18px;
    opacity: .9;
}

.cv-foot-links {
    display: flex;
    gap: 1.5rem;
}

.cv-foot-links a {
    color: var(--ink-mute);
    text-decoration: none;
    font-weight: 500;
    transition: color .2s var(--ease-out);
}

.cv-foot-links a:hover {
    color: var(--ink);
}

.cv-foot-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.02em;
}

/* ───────────── Modal overlay ───────────── */
.cv-overlay {
    /* !important defeats Tailwind's .space-y-8 > * ~ * { margin-top: 2rem }
       which has higher specificity than a single-class selector and would
       otherwise push the overlay below the nav. */
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    z-index: 60;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(10, 11, 15, .42);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    animation: cv-overlay-in .22s var(--ease-out);
}

/* Display rule kept separate so the inline `display:none/flex` toggle
   from the JS still works without fighting !important. */
.cv-overlay {
    display: flex;
}

@keyframes cv-overlay-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cv-modal {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 32rem;
    padding: 1.75rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: cv-modal-in .3s var(--ease-out);
}

@keyframes cv-modal-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ───────────── Tab pill group (used in modals, login, etc.) ───────────── */
.cv-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--line-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
}

.cv-tabs>button,
.cv-tabs>.cv-tab-btn {
    flex: 1;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--ink-mute);
    cursor: pointer;
    transition: all .2s var(--ease-out);
    letter-spacing: -0.005em;
}

.cv-tabs>button:hover,
.cv-tabs>.cv-tab-btn:hover {
    color: var(--ink-soft);
}

.cv-tabs>button.is-active,
.cv-tabs>.cv-tab-btn.is-active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
    border-color: var(--line);
}

/* ───────────── Sticky bulk toolbar ───────────── */
.cv-bulk-bar {
    position: sticky;
    top: 64px;
    z-index: 20;
    background: rgba(251, 251, 248, .88);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.625rem 0.875rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.cv-bulk-bar .badge-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.6rem;
    background: var(--brand-50);
    color: var(--brand-700);
    border: 1px solid var(--brand-100);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}

/* ───────────── Spreadsheet variation matrix ───────────── */

/* Sticky-header scroll container */
.cv-matrix-scroll {
    max-height: calc(100vh - 280px);
    overflow: auto;
    border-radius: inherit;
}

.cv-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(251, 251, 248, .96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Sortable header */
.cv-th-sort {
    cursor: pointer;
    user-select: none;
    transition: color .15s var(--ease-out), background .15s var(--ease-out);
}

.cv-th-sort:hover {
    color: var(--ink);
    background: rgba(239, 246, 255, .55) !important;
}

.cv-sort-ind {
    display: inline-block;
    margin-left: 4px;
    font-size: .65rem;
    opacity: .35;
    transition: opacity .15s var(--ease-out);
}

.cv-sort-ind.active {
    opacity: 1;
    color: var(--brand-600);
}

/* Tighter row height for spreadsheet feel */
.cv-matrix tbody td {
    padding: 0.4rem 0.65rem;
    font-size: 0.8125rem;
}

.cv-matrix tbody tr {
    content-visibility: auto;
    contain-intrinsic-size: 0 44px;
}

.cv-matrix .cv-cell-td {
    padding: 0.25rem 0.4rem;
}

.cv-matrix .input,
.cv-matrix .select {
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
}

/* Attribute cells (read-only display) */
.cv-attr-cell {
    font-weight: 500;
    color: var(--ink);
    white-space: nowrap;
}

/* Row state tints */
tr.cv-row.cv-row-dirty td {
    background: rgba(251, 191, 36, .07);
}

tr.cv-row.cv-row-selected td {
    background: rgba(59, 130, 246, .07);
}

tr.cv-row.cv-row-dirty.cv-row-selected td {
    background: rgba(168, 85, 247, .08);
}

/* Per-row meta cell (sync dot + delete) */
.cv-row-meta {
    text-align: right;
    white-space: nowrap;
    padding-right: 0.5rem !important;
}

.cv-row-meta .cv-sync-dot {
    margin-right: 6px;
    vertical-align: middle;
}

.cv-row-meta .cv-del-row {
    opacity: 0;
    transition: opacity .15s var(--ease-out);
}

tr.cv-row:hover .cv-row-meta .cv-del-row {
    opacity: 1;
}

/* Filter bar */
.cv-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(251, 251, 248, .85);
    border: 1px solid var(--line);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 8px;
    z-index: 15;
}

.cv-filter-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 240px;
    flex: 1 1 240px;
    max-width: 360px;
}

.cv-filter-search svg {
    position: absolute;
    left: 10px;
    color: var(--ink-mute);
    pointer-events: none;
}

.cv-filter-search .input {
    padding-left: 30px;
    width: 100%;
}

.cv-filter-clear {
    position: absolute;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--ink-mute);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-filter-clear:hover {
    background: var(--line-soft);
    color: var(--ink);
}

.cv-filter-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cv-filter-count {
    margin-left: auto;
    font-size: .75rem;
    color: var(--ink-mute);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.005em;
}

/* Bulk toolbar refinements */
.cv-bulk-bar {
    top: 84px;
}

.cv-bulk-divider {
    width: 1px;
    height: 22px;
    background: var(--line);
    margin: 0 4px;
    flex-shrink: 0;
}

.cv-bulk-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    background: rgba(255, 255, 255, .7);
    border: 1px solid var(--line-soft);
    border-radius: 9px;
}

/* Combo generator modal */
#cv-gen-modal.cv-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
    display: none;
    align-items: center;
    justify-content: center;
    animation: none;
}

.cv-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 11, 15, .42);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: cv-overlay-in .2s var(--ease-out);
}

.cv-modal-panel {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 86vh;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: cv-modal-in .25s var(--ease-out);
    margin: 1rem;
}

.cv-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0.75rem;
    gap: 1rem;
}

.cv-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}

.cv-modal-sub {
    font-size: .82rem;
    color: var(--ink-mute);
    margin: 4px 0 0;
}

.cv-modal-x {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: transparent;
    font-size: 18px;
    color: var(--ink-mute);
    cursor: pointer;
    line-height: 1;
}

.cv-modal-x:hover {
    background: var(--line-soft);
    color: var(--ink);
}

.cv-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cv-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--line);
    background: rgba(251, 251, 248, .6);
}

.cv-gen-summary {
    font-size: .85rem;
    color: var(--ink-soft);
}

.cv-gen-group {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    background: rgba(255, 255, 255, .6);
}

.cv-gen-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: .9rem;
}

.cv-gen-group-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: .7rem;
    color: var(--ink-mute);
    letter-spacing: -0.005em;
}

.cv-gen-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.cv-gen-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 4px;
}

.cv-gen-opt {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--line-soft);
    border: 1px solid transparent;
    font-size: .8rem;
    cursor: pointer;
    transition: all .12s var(--ease-out);
}

.cv-gen-opt:has(input:checked) {
    background: var(--brand-50);
    border-color: var(--brand-200, #bfdbfe);
    color: var(--brand-700);
}

.cv-gen-opt input {
    width: 14px;
    height: 14px;
}

/* Fill-existing section inside generate modal */
.cv-gen-fill {
    border-top: 1px solid var(--line-soft);
    background: rgba(255, 251, 235, .7);
    padding: 12px 1.5rem 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cv-gen-fill-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.cv-gen-fill-head-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.005em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cv-gen-fill-head-label svg { color: #d97706; flex-shrink: 0; }

.cv-gen-fill-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: white;
    border: 1px solid rgba(217, 119, 6, .2);
    border-radius: 9px;
}

.cv-gen-fill-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    flex: 1;
    letter-spacing: -0.005em;
}

.cv-gen-fill-missing {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: var(--ink-faint);
    white-space: nowrap;
}

/* Attribute column fill button (visible on th hover) */
.cv-th-attr-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.cv-th-attr-fill {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-faint);
    cursor: pointer;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    transition: all .12s var(--ease-out);
}

.cv-th-sort:hover .cv-th-attr-fill,
.cv-th-attr-fill:focus {
    opacity: 1;
}

.cv-th-attr-fill:hover {
    background: var(--brand-50);
    border-color: var(--brand-200);
    color: var(--brand-600);
    opacity: 1;
}

/* Attribute fill popover */
.cv-attr-fill-pop {
    position: fixed;
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    overflow: hidden;
    animation: cv-dd-in .18s var(--ease-out);
}

.cv-attr-fill-pop-head {
    padding: 8px 12px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-faint);
    border-bottom: 1px solid var(--line-soft);
    font-weight: 500;
}

.cv-attr-fill-pop-opt {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    transition: background .12s var(--ease-out);
    font-family: inherit;
    letter-spacing: -0.005em;
}

.cv-attr-fill-pop-opt:last-child {
    border-bottom: 0;
    color: var(--ink-mute);
    font-weight: 400;
    font-style: italic;
}

.cv-attr-fill-pop-opt:hover {
    background: var(--brand-50);
    color: var(--brand-700);
}

/* Shortcut hint footer */
.cv-shortcuts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 4px;
    font-size: .72rem;
    color: var(--ink-faint);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.005em;
}

.cv-shortcuts kbd {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--line-soft);
    border: 1px solid var(--line);
    font-size: .68rem;
    font-family: inherit;
    color: var(--ink-soft);
    margin: 0 1px;
}

/* ───────────── Products list row actions ───────────── */
.cv-row-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: flex-end;
}

.cv-row-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-mute);
    cursor: pointer;
    transition: all .12s var(--ease-out);
    text-decoration: none;
    opacity: 0;
}

tr.cv-prod-row:hover .cv-row-act {
    opacity: 1;
}

tr.cv-prod-row .cv-row-act-edit {
    opacity: .7;
}

tr.cv-prod-row:hover .cv-row-act-edit {
    opacity: 1;
}

.cv-row-act:hover {
    background: var(--line-soft);
    color: var(--ink);
    border-color: var(--line);
}

.cv-row-act:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 1px;
    opacity: 1;
}

tr.cv-row-duplicating {
    opacity: .55;
    pointer-events: none;
}

tr.cv-row-duplicating .cv-row-act {
    opacity: 1;
}

/* ───────────── Product attribute reorder ───────────── */
.cv-attr-row {
    position: relative;
    transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), opacity .15s var(--ease-out);
}

.cv-attr-row[draggable="true"] {
    cursor: grab;
}

.cv-attr-row[draggable="true"]:active {
    cursor: grabbing;
}

.cv-attr-grip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    color: var(--ink-faint);
    cursor: grab;
    flex-shrink: 0;
    transition: color .15s var(--ease-out), background .15s var(--ease-out);
}

.cv-attr-row:hover .cv-attr-grip {
    color: var(--ink-mute);
}

.cv-attr-grip:hover {
    background: var(--line-soft);
    color: var(--ink);
}

.cv-attr-grip:active {
    cursor: grabbing;
}

.cv-attr-dragging {
    opacity: .4;
}

.cv-attr-drag-over {
    box-shadow: 0 -2px 0 var(--brand-500), 0 0 0 2px rgba(59, 130, 246, .15);
}

/* Re-enable native input interactions inside a draggable row */
.cv-attr-row input,
.cv-attr-row button,
.cv-attr-row label {
    cursor: auto;
}

.cv-attr-row label,
.cv-attr-row input[type="checkbox"] {
    cursor: pointer;
}

/* ───────────── Variation image picker ───────────── */
#cv-img-modal.cv-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
    display: none;
    align-items: center;
    justify-content: center;
    animation: none;
}

#cv-img-modal .cv-modal-panel {
    max-width: 720px;
}

.cv-img-body {
    gap: 1.25rem;
}

.cv-img-section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    margin-bottom: 8px;
}

.cv-img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding: 2px;
}

.cv-img-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--line);
    background: var(--line-soft);
    padding: 0;
    cursor: pointer;
    transition: border-color .12s var(--ease-out), transform .12s var(--ease-out), box-shadow .12s var(--ease-out);
}

.cv-img-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cv-img-tile:hover {
    border-color: var(--brand-500);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, .18);
}

.cv-img-tile.is-current {
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.cv-img-tile-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand-600);
    color: white;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cv-img-empty {
    padding: 1rem;
    text-align: center;
    font-size: .82rem;
    color: var(--ink-mute);
    background: var(--line-soft);
    border-radius: 10px;
    border: 1px dashed var(--line);
}

.cv-img-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1.25rem;
    border: 2px dashed var(--line);
    border-radius: 12px;
    background: rgba(251, 251, 248, .5);
    color: var(--ink-mute);
    cursor: pointer;
    transition: all .12s var(--ease-out);
    font-size: .85rem;
}

.cv-img-upload:hover,
.cv-img-upload.is-drag {
    border-color: var(--brand-500);
    background: var(--brand-50);
    color: var(--brand-700);
}

.cv-img-upload svg {
    flex-shrink: 0;
}

.cv-img-upload-status {
    margin-top: 8px;
    font-size: .8rem;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Sidebar layout ── */

/* Shell */
.cv-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    z-index: 40;
    background: #ffffff;
    border-right: 1px solid var(--line);
    box-shadow: 2px 0 12px rgba(10, 11, 15, .05);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Logo area */
.cv-sidebar-logo {
    height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--line-soft);
}

.cv-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    color: var(--ink);
    flex-shrink: 0;
}

.cv-brand img {
    width: 24px;
    height: 24px;
}

.cv-brand-text {
    font-family: 'Cabinet Grotesk', sans-serif;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.025em;
    color: var(--ink);
}

/* Store switcher container */
.cv-sidebar-switcher {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    flex-shrink: 0;
}

/* Scrollable nav body */
.cv-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 10px;
}

/* Section label */
.cv-sidebar-section {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-faint);
    padding: 12px 10px 4px;
    font-weight: 500;
    user-select: none;
}

/* Nav item */
.cv-sidebar-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-mute);
    text-decoration: none;
    transition: background .15s var(--ease-out), color .15s var(--ease-out);
    position: relative;
    width: 100%;
    letter-spacing: -0.005em;
    line-height: 1.3;
}

.cv-sidebar-item:hover {
    background: var(--line-soft);
    color: var(--ink);
}

.cv-sidebar-item.is-active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.cv-sidebar-item.is-active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--brand-500);
    border-radius: 999px;
}

/* Sub-nav items (indented) */
.cv-sidebar-subitem {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px 7px 36px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-mute);
    text-decoration: none;
    transition: background .15s var(--ease-out), color .15s var(--ease-out);
    position: relative;
    width: 100%;
    letter-spacing: -0.005em;
}

.cv-sidebar-subitem:hover {
    background: var(--line-soft);
    color: var(--ink);
}

.cv-sidebar-subitem.is-active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.cv-sidebar-subitem.is-active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: var(--brand-500);
    border-radius: 999px;
}


/* Bottom bar */
.cv-sidebar-bottom {
    flex-shrink: 0;
    margin-top: auto;
    border-top: 1px solid var(--line-soft);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cv-sidebar-bottom-divider {
    height: 1px;
    background: var(--line-soft);
    margin: 6px 0;
}

/* Profile avatar circle */
.cv-sidebar-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--brand-100);
    line-height: 1;
}

/* Main content area shift */
.has-sidebar .cv-page,
.has-sidebar main {
    margin-left: 240px;
    margin-right: 0;
}

/* Footer shift */
.has-sidebar .cv-foot {
    margin-left: 240px;
}

/* Mobile: sidebar off-canvas, toggle visible */
.cv-sidebar-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 45;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: white;
    color: var(--ink-mute);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: color .15s var(--ease-out), background .15s var(--ease-out);
}

.cv-sidebar-toggle:hover {
    color: var(--ink);
    background: var(--line-soft);
}

/* Mobile overlay */
.cv-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(10, 11, 15, .40);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@media (max-width: 767px) {
    .cv-sidebar {
        transform: translateX(-240px);
        transition: transform .25s var(--ease-out);
    }

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

    body.sidebar-open .cv-sidebar-overlay {
        display: block;
    }

    .cv-sidebar-toggle {
        display: inline-flex;
    }

    .has-sidebar .cv-page,
    .has-sidebar main {
        margin-left: 0;
    }

    .has-sidebar .cv-foot {
        margin-left: 0;
    }

    .has-sidebar main,
    .has-sidebar .cv-page {
        padding-top: 3.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cv-sidebar {
        transition: none;
    }
}