:root {
    --bg: #0b0d10;
    --panel: #12151a;
    --panel-2: #171b21;
    --panel-3: #1d2229;
    --text: #f5f7fa;
    --muted: #8e98a8;
    --line: rgba(255,255,255,.075);
    --accent: #77e6b6;
    --accent-2: #a6ffcf;
    --danger: #ff7474;
    --warning: #f0c56b;
    --shadow: 0 24px 70px rgba(0,0,0,.28);
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    background:
        radial-gradient(circle at 18% 0%, rgba(119,230,182,.08), transparent 34rem),
        radial-gradient(circle at 92% 8%, rgba(129,154,255,.07), transparent 30rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .38; cursor: not-allowed; }

.app-shell { min-height: 100vh; padding-bottom: 116px; }
.app-scroll-area { display: contents; }
.topbar {
    height: 82px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(11,13,16,.76);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand, .topbar-actions, .now-playing, .transport-buttons, .timeline, .volume-control, .heading-actions { display: flex; align-items: center; }
.brand { gap: 13px; }
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #07130e;
    background: linear-gradient(145deg, var(--accent-2), #55c998);
    box-shadow: 0 10px 30px rgba(119,230,182,.17);
    font-size: 22px;
    font-weight: 800;
}
h1, h2, p { margin: 0; }
h1 { font-size: 19px; letter-spacing: -.02em; }
h2 { font-size: 19px; letter-spacing: -.02em; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin-bottom: 3px; }
.muted { color: var(--muted); }
.compact { font-size: 12px; }
.topbar-actions { gap: 12px; }
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.025);
    color: var(--muted);
    font-size: 12px;
}
.status-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(119,230,182,.08); }
.status-badge i.busy { background: var(--warning); box-shadow: 0 0 0 4px rgba(240,197,107,.08); }
.status-badge i.error { background: var(--danger); box-shadow: 0 0 0 4px rgba(255,116,116,.08); }

.workspace {
    padding: 22px 24px 28px;
    display: grid;
    grid-template-columns: minmax(210px, 260px) minmax(380px, 1fr) minmax(270px, 340px);
    gap: 16px;
    min-height: calc(100vh - 198px);
}
.panel {
    background: linear-gradient(180deg, rgba(24,28,34,.98), rgba(16,19,24,.98));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-width: 0;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-heading {
    min-height: 74px;
    padding: 18px 18px 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}
.tracks-heading { align-items: center; }
.heading-actions { gap: 8px; }
.library-panel, .tracks-panel, .queue-panel { min-height: 0; }
.library-panel { display: flex; flex-direction: column; }
.folder-list, .track-list, .queue-list { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #30363f transparent; }
.folder-list { padding: 8px; flex: 1; }
.track-list { max-height: calc(100vh - 325px); }
.queue-list { max-height: calc(100vh - 330px); }

.folder-row {
    width: 100%;
    border: 0;
    background: transparent;
    color: #cfd5de;
    min-height: 44px;
    border-radius: 11px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 24px 1fr 18px;
    align-items: center;
    gap: 8px;
    text-align: left;
    cursor: pointer;
}
.folder-row:hover { background: rgba(255,255,255,.05); color: #fff; }
.folder-icon { color: var(--accent); }
.folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-arrow { color: #596270; text-align: right; }
.back-row { color: var(--muted); }
.breadcrumbs {
    min-height: 39px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
}
.breadcrumbs button { border: 0; background: transparent; color: #aab3c0; cursor: pointer; padding: 3px 4px; white-space: nowrap; }
.breadcrumbs button:hover { color: var(--accent); }
.breadcrumbs span { color: #4e5662; }

.search-box {
    margin: 12px 16px;
    min-height: 42px;
    padding: 0 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(6,8,10,.48);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: #6d7683;
}
.search-box:focus-within { border-color: rgba(119,230,182,.48); box-shadow: 0 0 0 3px rgba(119,230,182,.05); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; }
.search-box input::placeholder { color: #646d79; }
.compact-search { margin-bottom: 8px; }

.track-row {
    min-height: 62px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-top: 1px solid rgba(255,255,255,.045);
    animation: rise .24s ease both;
    animation-delay: var(--delay, 0ms);
}
.track-row:hover { background: rgba(255,255,255,.035); }
.track-play {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #11151a;
    color: var(--accent);
    cursor: pointer;
}
.track-row:hover .track-play { background: var(--accent); color: #07130e; border-color: var(--accent); }
.track-info, .queue-track {
    border: 0;
    background: transparent;
    min-width: 0;
    text-align: left;
    cursor: pointer;
    padding: 4px 0;
}
.track-info strong, .queue-track strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 650; }
.track-info span, .queue-track span { display: block; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }

.queue-row {
    min-height: 58px;
    padding: 7px 12px 7px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 6px;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,.045);
    position: relative;
}
.queue-row.current { background: linear-gradient(90deg, rgba(119,230,182,.09), transparent); }
.queue-row.current::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; background: var(--accent); border-radius: 2px; }
.queue-row.current strong { color: var(--accent-2); }

.icon-button, .ghost-button, .secondary-button, .primary-button, .play-button {
    border: 1px solid var(--line);
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.icon-button:hover, .ghost-button:hover, .secondary-button:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); }
.icon-button:active, .ghost-button:active, .secondary-button:active, .primary-button:active, .play-button:active { transform: translateY(1px); }
.icon-button { width: 36px; height: 36px; border-radius: 11px; background: rgba(255,255,255,.025); display: grid; place-items: center; }
.icon-button.active { color: var(--accent); border-color: rgba(119,230,182,.34); background: rgba(119,230,182,.08); }
.icon-button.mini { width: 30px; height: 30px; border-radius: 9px; }
.ghost-button, .secondary-button { min-height: 36px; padding: 0 12px; border-radius: 10px; background: rgba(255,255,255,.025); }
.ghost-button.small { min-height: 31px; padding: 0 9px; font-size: 12px; color: var(--muted); }
.secondary-button { color: #d9dee6; font-size: 12px; }
.primary-button { min-height: 44px; border-radius: 12px; background: var(--accent); color: #07130e; font-weight: 800; border-color: var(--accent); }
.play-button { width: 48px; height: 48px; border-radius: 50%; background: #f8fafb; color: #101318; font-weight: 900; border-color: #fff; font-size: 16px; }
.play-button:hover { transform: scale(1.035); }

.empty-state {
    padding: 48px 22px;
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 7px;
    color: var(--muted);
}
.empty-state[hidden] { display: none !important; }
.empty-state div { width: 48px; height: 48px; display: grid; place-items: center; border: 1px dashed #37404b; border-radius: 50%; color: #697484; font-size: 20px; }
.empty-state strong { color: #cbd1da; font-size: 13px; }
.empty-state span { font-size: 12px; }
.queue-empty { padding-top: 56px; }
.inline-error { margin: 18px; padding: 18px; border: 1px solid rgba(255,116,116,.22); background: rgba(255,116,116,.06); border-radius: 14px; display: grid; gap: 9px; color: #e5b3b3; }
.inline-error strong { color: #ffd0d0; }
.inline-error .secondary-button { width: max-content; margin-top: 4px; }

.player-bar {
    position: fixed;
    z-index: 30;
    left: 18px;
    right: 18px;
    bottom: 16px;
    min-height: 88px;
    display: grid;
    grid-template-columns: minmax(210px, 1fr) minmax(360px, 1.35fr) minmax(170px, 1fr);
    align-items: center;
    gap: 20px;
    padding: 12px 18px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 20px;
    background: rgba(19,23,28,.92);
    backdrop-filter: blur(22px);
    box-shadow: 0 20px 75px rgba(0,0,0,.48);
}
.now-playing { min-width: 0; gap: 12px; }
.cover-placeholder { width: 50px; height: 50px; flex: 0 0 50px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #2d343d, #171b20); color: var(--accent); border: 1px solid var(--line); }
.now-playing-text { min-width: 0; }
.now-playing-text span, .now-playing-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-playing-text strong { margin-top: 4px; font-size: 13px; }
.transport { display: grid; gap: 7px; justify-items: center; }
.transport-buttons { gap: 8px; }
.timeline { width: 100%; gap: 9px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 10px; }
.seek-shell {
    position: relative;
    flex: 1;
    height: 18px;
    display: flex;
    align-items: center;
}
.seek-shell::before,
.seek-buffer,
.seek-played {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    height: 4px;
    border-radius: 999px;
    transform: translateY(-50%);
    pointer-events: none;
}
.seek-shell::before { width: 100%; background: rgba(255,255,255,.085); }
.seek-buffer { width: 0; background: rgba(255,255,255,.28); transition: width .15s linear; }
.seek-played { width: 0; background: var(--accent); }
.seek-shell input[type="range"] {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 18px;
    margin: 0;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.seek-shell input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.seek-shell input[type="range"]::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    margin-top: -4px;
    border: 2px solid var(--panel);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 1px 5px rgba(0,0,0,.28);
    appearance: none;
    -webkit-appearance: none;
}
.seek-shell input[type="range"]::-moz-range-track { height: 4px; background: transparent; }
.seek-shell input[type="range"]::-moz-range-progress { height: 4px; background: transparent; }
.seek-shell input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: 2px solid var(--panel);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 1px 5px rgba(0,0,0,.28);
}
.volume-control { justify-self: end; width: min(190px, 100%); gap: 8px; color: var(--muted); }
.volume-control input { flex: 1; }
.volume-control input[type="range"] { accent-color: var(--accent); height: 4px; }
#audio {
    position: fixed;
    left: -2px;
    bottom: -2px;
    width: 1px;
    height: 1px;
    opacity: .001;
    pointer-events: none;
}

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); padding: 32px; background: rgba(18,21,26,.94); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 22px; }
.login-card h1 { font-size: 27px; margin-bottom: 8px; }
.login-form { display: grid; gap: 14px; margin-top: 24px; }
.login-form label { display: grid; gap: 7px; color: #b9c1cc; font-size: 12px; }
.login-form input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #0d1014; color: var(--text); }
.notice { margin-top: 20px; padding: 14px; border-radius: 12px; display: grid; gap: 6px; font-size: 12px; line-height: 1.5; }
.notice-error { border: 1px solid rgba(255,116,116,.22); background: rgba(255,116,116,.06); color: #efb1b1; }
.notice code { color: #fff; }
.setup-panel { max-width: 760px; margin: 40px auto; padding: 0 20px; }
.toast { position: fixed; right: 24px; bottom: 124px; z-index: 60; max-width: 420px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: #222830; color: #e8edf2; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.loading { opacity: .55; }

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

@media (max-width: 1020px) {
    .workspace { grid-template-columns: 220px minmax(0, 1fr); }
    .queue-panel { grid-column: 1 / -1; }
    .queue-list { max-height: 260px; }
    .player-bar { grid-template-columns: 1fr 1.25fr; }
    .volume-control {
        display: flex;
        grid-column: 1 / -1;
        justify-self: center;
        width: min(360px, 100%);
    }
}

@media (max-width: 720px) {
    .app-shell {
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        padding-bottom: 0;
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        overflow: hidden;
    }
    .app-scroll-area {
        display: block;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .topbar {
        position: static;
        top: auto;
        z-index: auto;
        width: 100%;
        height: auto;
        min-height: 72px;
        padding: 12px 14px;
    }
    .status-badge { display: none; }
    .workspace {
        display: block;
        min-height: 0;
        padding: 12px;
        overflow: visible;
    }
    .panel { margin-bottom: 12px; }
    .folder-list, .queue-list { max-height: 390px; }
    .track-list { max-height: 286px; }
    .player-bar {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        width: auto;
        min-height: 0;
        margin: 7px;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "now"
            "controls"
            "timeline"
            "volume";
        row-gap: 7px;
        padding: 9px 11px 10px;
        border-radius: 16px;
    }
    .now-playing {
        grid-area: now;
        justify-content: flex-start;
        gap: 8px;
        min-width: 0;
    }
    .cover-placeholder { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
    .now-playing-text strong { margin-top: 2px; font-size: 12px; }
    .now-playing-text .compact { font-size: 10px; }
    .transport { display: contents; }
    .transport-buttons {
        grid-area: controls;
        width: 100%;
        gap: 8px;
        justify-self: stretch;
        justify-content: center;
    }
    .transport-buttons .icon-button {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        touch-action: manipulation;
    }
    #previousButton, #nextButton {
        width: 46px;
        height: 46px;
        border-radius: 13px;
        font-size: 17px;
    }
    #shuffleButton, #repeatButton { opacity: .82; }
    .play-button {
        width: 60px;
        height: 60px;
        font-size: 21px;
        touch-action: manipulation;
        box-shadow: 0 6px 22px rgba(0,0,0,.22);
    }
    .timeline {
        grid-area: timeline;
        max-width: none;
        min-width: 0;
        gap: 6px;
        font-size: 9px;
    }
    .seek-shell { height: 14px; }
    .seek-shell input[type="range"] { height: 14px; }
    .volume-control {
        grid-area: volume;
        display: flex;
        justify-self: center;
        width: min(360px, calc(100% - 20px));
        min-width: 0;
        margin: 0;
        gap: 5px;
        font-size: 11px;
        overflow: visible;
    }
    .volume-control span { flex: 0 0 auto; }
    .volume-control input[type="range"] {
        flex: 1 1 0;
        width: 100%;
        min-width: 0;
        max-width: none;
        margin: 0;
    }
    .tracks-heading {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }
    .tracks-heading > div:first-child { min-width: 0; }
    .tracks-heading h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .heading-actions {
        margin-top: 0;
        justify-self: end;
        flex-wrap: nowrap;
    }
    .heading-actions .secondary-button {
        padding-inline: 10px;
        white-space: nowrap;
    }
    .login-card { padding: 24px; }
}

/* v3 controls */
.topbar-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.theme-button { flex: 0 0 auto; font-size: 16px; }
.login-theme-toggle { position: fixed; top: 18px; right: 18px; z-index: 10; }
.compact-primary { min-height: 38px; padding: 0 14px; }
.track-date { color: var(--muted); }

/* VK grabber */
.grabber-shell { padding-bottom: 28px; }
.grabber-workspace {
    padding: 22px 24px 28px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(270px, 340px);
    gap: 16px;
    min-height: calc(100vh - 82px);
}
.grabber-main-panel { min-width: 0; display: flex; flex-direction: column; }
.grabber-info-panel { align-self: start; position: sticky; top: 104px; }
.grabber-heading { align-items: center; }
.grabber-heading code, .grabber-note code { color: var(--accent-2); overflow-wrap: anywhere; }
.grabber-setup-error { margin: 16px; }
.grabber-setup-error ul { margin: 3px 0 0; padding-left: 18px; }
.grabber-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
}
.grabber-search { margin: 0; flex: 1; }
.grabber-selection-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grabber-list { overflow-y: auto; max-height: calc(100vh - 310px); scrollbar-width: thin; scrollbar-color: #30363f transparent; }
.grabber-row {
    min-height: 82px;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 76px;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid rgba(255,255,255,.045);
}
.grabber-row:hover { background: rgba(255,255,255,.035); }
.grabber-row.imported { background: rgba(119,230,182,.055); opacity: .72; }
.grabber-row.failed { background: rgba(255,116,116,.045); }
.grabber-checkbox { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.grabber-track-info { min-width: 0; display: grid; gap: 3px; }
.grabber-track-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.grabber-track-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grabber-artist { color: #c4cbd5; font-size: 12px; }
.grabber-track-meta { color: var(--muted); font-size: 11px; }
.grabber-filename { color: #5f6976; font: 10px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.grabber-row-state { justify-self: end; color: var(--muted); font-size: 11px; }
.grabber-row.imported .grabber-row-state { color: var(--accent); }
.grabber-row.failed .grabber-row-state { color: var(--danger); cursor: help; }
.grabber-empty { min-height: 310px; }
.import-dock {
    margin-top: auto;
    min-height: 78px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    background: rgba(9,11,14,.42);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}
.import-progress-wrap { min-width: 0; display: grid; gap: 8px; }
.import-progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.import-progress-copy strong { font-size: 12px; }
.progress-track { height: 5px; overflow: hidden; background: rgba(255,255,255,.075); border-radius: 999px; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .22s ease; }
.grabber-stats { padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.stat-card { min-height: 82px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.025); display: grid; align-content: space-between; gap: 8px; }
.stat-card span { color: var(--muted); font-size: 11px; }
.stat-card strong { font-size: 22px; letter-spacing: -.03em; }
.grabber-note { margin: 0 14px 12px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.02); }
.grabber-note strong { display: block; margin-bottom: 5px; font-size: 12px; }
.grabber-note p { color: var(--muted); font-size: 11px; line-height: 1.55; }
.warning-note { border-color: rgba(240,197,107,.18); background: rgba(240,197,107,.035); }


.diagnostic-note { display: grid; gap: 9px; }
.diagnostic-lines { display: grid; gap: 8px; }
.diagnostic-line { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; }
.diagnostic-icon { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 11px; }
.diagnostic-line.ok .diagnostic-icon { color: var(--accent); background: rgba(119,230,182,.09); }
.diagnostic-line.bad .diagnostic-icon { color: var(--danger); background: rgba(255,116,116,.09); }
.diagnostic-line div { min-width: 0; display: grid; gap: 2px; }
.diagnostic-line strong { margin: 0; font-size: 11px; }
.diagnostic-line div span { color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }

/* Light theme. Dark remains the default and the user's choice is persisted in localStorage. */
html[data-theme="light"] {
    --bg: #f3f6f8;
    --panel: #ffffff;
    --panel-2: #f8fafb;
    --panel-3: #edf1f4;
    --text: #17202a;
    --muted: #6f7a87;
    --line: rgba(26,38,49,.11);
    --accent: #169b67;
    --accent-2: #087b50;
    --danger: #c83d47;
    --warning: #a66f0a;
    --shadow: 0 18px 48px rgba(27,39,49,.10);
}
html[data-theme="light"] body {
    background:
        radial-gradient(circle at 18% 0%, rgba(22,155,103,.09), transparent 34rem),
        radial-gradient(circle at 92% 8%, rgba(67,99,187,.075), transparent 30rem),
        var(--bg);
}
html[data-theme="light"] .topbar { background: rgba(250,252,253,.86); }
html[data-theme="light"] .panel { background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,251,.99)); }
html[data-theme="light"] .status-badge,
html[data-theme="light"] .icon-button,
html[data-theme="light"] .ghost-button,
html[data-theme="light"] .secondary-button,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .grabber-note { background: rgba(25,39,52,.025); }
html[data-theme="light"] .folder-row { color: #36414d; }
html[data-theme="light"] .folder-row:hover,
html[data-theme="light"] .track-row:hover,
html[data-theme="light"] .grabber-row:hover { background: rgba(22,37,50,.045); color: var(--text); }
html[data-theme="light"] .folder-arrow { color: #98a1aa; }
html[data-theme="light"] .breadcrumbs button { color: #5d6875; }
html[data-theme="light"] .breadcrumbs span { color: #a5adb5; }
html[data-theme="light"] .search-box { background: #f7f9fa; color: #8c96a0; }
html[data-theme="light"] .search-box input::placeholder { color: #9ba4ad; }
html[data-theme="light"] .track-row,
html[data-theme="light"] .queue-row,
html[data-theme="light"] .grabber-row { border-top-color: rgba(26,38,49,.075); }
html[data-theme="light"] .track-play { background: #fff; }
html[data-theme="light"] .track-row:hover .track-play { color: #fff; }
html[data-theme="light"] .queue-row.current { background: linear-gradient(90deg, rgba(22,155,103,.10), transparent); }
html[data-theme="light"] .secondary-button { color: #3b4652; }
html[data-theme="light"] .primary-button { color: #fff; }
html[data-theme="light"] .play-button { background: #17202a; color: #fff; border-color: #17202a; }
html[data-theme="light"] .empty-state div { border-color: #c9d0d6; color: #87919b; }
html[data-theme="light"] .empty-state strong { color: #3c4650; }
html[data-theme="light"] .player-bar { background: rgba(255,255,255,.94); border-color: rgba(26,38,49,.13); box-shadow: 0 18px 55px rgba(28,39,49,.16); }
html[data-theme="light"] .cover-placeholder { background: linear-gradient(145deg, #edf2f4, #dfe7ea); }
html[data-theme="light"] .login-card { background: rgba(255,255,255,.96); }
html[data-theme="light"] .login-form label { color: #55616d; }
html[data-theme="light"] .login-form input { background: #f8fafb; }
html[data-theme="light"] .notice code { color: #21303b; }
html[data-theme="light"] .toast { background: #fff; color: #25313b; border-color: rgba(26,38,49,.13); }
html[data-theme="light"] .grabber-artist { color: #4d5965; }
html[data-theme="light"] .grabber-filename { color: #87909a; }
html[data-theme="light"] .import-dock { background: rgba(244,247,249,.78); }
html[data-theme="light"] .progress-track { background: rgba(22,37,50,.10); }
html[data-theme="light"] .grabber-row.imported { background: rgba(22,155,103,.055); }
html[data-theme="light"] .grabber-row.failed { background: rgba(200,61,71,.045); }

@media (max-width: 900px) {
    .grabber-workspace { grid-template-columns: 1fr; }
    .grabber-info-panel { position: static; }
    .grabber-list { max-height: 520px; }
}

@media (max-width: 720px) {
    .topbar-actions { gap: 7px; }
    .topbar-link { padding: 0 9px; }
    .grabber-workspace { padding: 12px; }
    .grabber-toolbar { align-items: stretch; flex-direction: column; }
    .grabber-selection-actions { justify-content: space-between; }
    .grabber-row { grid-template-columns: 26px minmax(0, 1fr); }
    .grabber-row-state { grid-column: 2; justify-self: start; }
    .import-dock { grid-template-columns: 1fr; }
    .import-dock .primary-button { width: 100%; }
}

html[data-theme="light"] .seek-shell::before { background: rgba(22,37,50,.10); }
html[data-theme="light"] .seek-buffer { background: rgba(22,37,50,.28); }

/* VK Sync v5 */
.sync-shell { min-height: 100vh; }
.sync-workspace { width: min(1180px, calc(100% - 36px)); margin: 24px auto 48px; display: grid; gap: 18px; }
.sync-notice { margin: 0; }
.sync-hero { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 28px; }
.sync-hero h2 { margin: 3px 0 8px; font-size: clamp(24px, 3vw, 38px); }
.sync-lead { max-width: 780px; margin: 0; line-height: 1.65; }
.sync-install { white-space: nowrap; text-decoration: none; }
.sync-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.sync-card { padding: 22px; }
.sync-card .panel-heading { margin-bottom: 12px; }
.token-copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin-top: 16px; }
.token-field { min-width: 0; border: 1px solid var(--border); background: var(--input); color: var(--text); border-radius: 10px; padding: 10px 12px; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-card { overflow: auto; padding: 13px 14px; margin: 14px 0 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--input); color: var(--text); }
.sync-steps { margin: 8px 0 0; padding-left: 22px; color: var(--muted); line-height: 1.7; }
.sync-results { padding: 22px; }
.sync-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 4px 0 12px; }
.sync-stat { padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--input); display: flex; flex-direction: column; gap: 2px; }
.sync-stat strong { font-size: 24px; }
.sync-stat span { color: var(--muted); font-size: 12px; }
.sync-missing-list { display: grid; gap: 8px; margin-top: 16px; }
.sync-missing-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--input); }
.sync-missing-row > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sync-missing-row strong, .sync-missing-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-missing-row span { color: var(--muted); font-size: 12px; }
@media (max-width: 760px) {
    .sync-hero { align-items: flex-start; flex-direction: column; }
    .sync-grid { grid-template-columns: 1fr; }
    .sync-stats { grid-template-columns: repeat(2, 1fr); }
    .token-copy-row { grid-template-columns: 1fr 1fr; }
    .token-field { grid-column: 1 / -1; }
}
