@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&family=Syne:wght@400;500;600;700;800&display=swap');

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

:root {
    --bg:          #09090d;
    --surface-1:   #111118;
    --surface-2:   #18181f;
    --surface-3:   #22222c;
    --border:      rgba(255,255,255,0.055);
    --border-med:  rgba(255,255,255,0.09);
    --text:        #eeeef2;
    --text-2:      #8888a0;
    --text-3:      #44445a;
    --accent:      #4f7fff;
    --accent-glow: rgba(79,127,255,0.13);
    --loved:       #d1607a;
    --loved-glow:  rgba(209,96,122,0.12);
    --danger:      #d16060;
    --danger-glow: rgba(209,96,96,0.12);
    --success:     #5aaa78;
    --sidebar-w:   244px;
    --topbar-h:    52px;
    --radius:      14px;
    --radius-sm:   9px;
    --radius-xs:   6px;
    --shadow:      0 8px 32px rgba(0,0,0,0.6);
    --shadow-card: 0 28px 72px rgba(0,0,0,0.75);
    --font:        'Syne', system-ui, sans-serif;
    --mono:        'DM Mono', monospace;
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
}

html, body {
    height: 100%; width: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    user-select: none;
}

/* Grain overlay */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 180px;
}

input, textarea { -webkit-user-select: text; user-select: text; }

/* ══════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

/* ══════════════════════════════════════════
   LAYOUT SHELL
══════════════════════════════════════════ */
.app-shell {
    position: fixed;
    inset: 0;
    left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    transition: left 0.3s var(--ease-out);
}

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 200;
    transition: transform 0.3s var(--ease-out);
    padding-bottom: env(safe-area-inset-bottom);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 190;
    backdrop-filter: blur(2px);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.app-icon {
    width: 30px; height: 30px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.app-name {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex: 1;
    color: var(--text);
}

.sidebar-close {
    display: none;
    width: 28px; height: 28px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-2);
    cursor: pointer;
    align-items: center; justify-content: center;
    transition: background 0.15s;
}
.sidebar-close:hover { background: var(--surface-3); color: var(--text); }

.load-btn-row {
    margin: 14px 12px 6px;
    display: flex;
    gap: 6px;
}
.load-btn {
    padding: 10px 14px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.load-btn-half {
    flex: 1;
    justify-content: center;
}
.load-btn-secondary {
    background: var(--surface-2);
    border: 1px solid var(--border-med);
    color: var(--text-2);
}
.load-btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.load-btn:hover { opacity: 0.88; }
.load-btn:active { transform: scale(0.97); }

.section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 14px 16px 6px;
    flex-shrink: 0;
}

.github-footer {
    margin-top: 16px;
    text-align: center;
}

.github-main-link {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 6px;
}

.github-main-link:hover {
    text-decoration: underline;
}

.github-stats {
    font-size: 11px;
    opacity: 0.6;
    color: var(--text);
}

.github-stats .divider {
    margin: 0 6px;
    opacity: 0.4;
}

/* ── Folder List ── */
.folder-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 8px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.folder-item:hover { background: var(--surface-2); }
.folder-item.active {
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--border-med);
}
.folder-item.drag-over {
    background: rgba(77,143,255,0.08);
    box-shadow: inset 0 0 0 1px rgba(77,143,255,0.3);
}
.folder-item.dragging { opacity: 0.4; }

.folder-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: var(--text-2);
    background: var(--surface-2);
}
.folder-item.active .folder-icon { background: var(--surface-3); }

.queue-icon  { color: var(--accent); }
.loved-icon  { color: var(--loved); }
.trash-icon  { color: var(--text-3); }
.custom-icon { color: var(--accent); }

.folder-label {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-2);
}
.folder-item.active .folder-label { color: var(--text); }

.folder-badge {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    background: var(--surface-3);
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: color 0.15s;
}
.folder-item.active .folder-badge { color: var(--text-2); }

.folder-del-btn {
    display: none;
    width: 20px; height: 20px;
    background: transparent;
    border: none;
    border-radius: 5px;
    color: var(--text-3);
    cursor: pointer;
    align-items: center; justify-content: center;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.folder-item:hover .folder-del-btn { display: flex; }
.folder-del-btn:hover { background: var(--danger-glow); color: var(--danger); }

.add-folder-btn {
    margin: 8px 8px 0;
    padding: 9px 10px;
    background: transparent;
    border: 1px dashed var(--border-med);
    border-radius: var(--radius-sm);
    color: var(--text-3);
    font-family: var(--font);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.add-folder-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.sidebar-bottom {
    padding: 12px 8px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.action-btn {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    text-align: left;
}
.action-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.action-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.action-btn.danger { color: var(--danger); border-color: rgba(255,92,92,0.2); background: rgba(255,92,92,0.05); }
.action-btn.danger:hover:not(:disabled) { background: var(--danger-glow); }
.action-btn.loading { opacity: 0.6; cursor: wait; pointer-events: none; }

/* ══════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════ */
.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-1);
    flex-shrink: 0;
}

.menu-btn {
    display: none;
    width: 36px; height: 36px;
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-2);
    cursor: pointer;
    align-items: center; justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.menu-btn:hover { background: var(--surface-2); color: var(--text); }

.topbar-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex: 1;
}

.topbar-meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
}

/* ══════════════════════════════════════════
   MAIN AREA
══════════════════════════════════════════ */
.main-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 24px;
}
.empty-illustration { margin-bottom: 8px; opacity: 0.6; }
.empty-state h2 { font-size: 18px; font-weight: 700; color: var(--text); }
.empty-state p { font-size: 13px; color: var(--text-2); }
.load-btn-inline {
    margin-top: 8px;
    padding: 10px 24px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.load-btn-inline:hover { opacity: 0.88; }

/* ── Loading progress bar ── */
.load-progress-wrap {
    width: min(320px, 80vw);
    margin-bottom: 16px;
}
.load-progress-bar {
    height: 3px;
    background: var(--surface-3);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 8px;
}
.load-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    border-radius: 99px;
    transition: width 0.2s ease;
}
.load-progress-label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    text-align: center;
}

/* ══════════════════════════════════════════
   SWIPE MODE
══════════════════════════════════════════ */
.swipe-wrap {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px 20px;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.swipe-topbar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.progress-pill {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
}

.swipe-hint {
    font-size: 11px;
    color: var(--text-3);
    display: flex;
    gap: 12px;
}
.swipe-hint span { display: flex; align-items: center; gap: 4px; }

.swipe-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    overflow: visible;
}

/* Direction feedback overlays */
.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.12s;
    pointer-events: none;
    z-index: 20;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
}
.swipe-indicator.left {
    left: 8px;
    color: var(--danger);
    border: 2px solid var(--danger);
    background: var(--danger-glow);
}
.swipe-indicator.right {
    right: 8px;
    color: var(--success);
    border: 2px solid var(--success);
    background: rgba(90,170,120,0.12);
}
.swipe-indicator.active { opacity: 1; }

/* ── File Card ── */
.file-card {
    position: relative;
    background: var(--surface-1);
    border-radius: var(--radius);
    border: 1px solid var(--border-med);
    box-shadow: var(--shadow-card);
    cursor: grab;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    will-change: transform;
    width: min(480px, calc(100% - 32px));
    height: auto;
    max-height: calc(100vh - var(--topbar-h) - 140px);
    min-width: 260px;
    min-height: 300px;
    align-self: center;
    transition: box-shadow 0.2s;
}
.file-card:active { cursor: grabbing; }

.file-card.selected {
    box-shadow: 0 0 0 2px var(--loved), var(--shadow-card);
}

/* Card loading bar */
.card-load-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: transparent;
    z-index: 10;
    overflow: hidden;
}
.card-load-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--loved));
    width: 0%;
    transition: width 0.4s ease;
}
.card-load-bar.done { display: none; }

/* Preview area */
.file-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    overflow: hidden;
    position: relative;
    min-width: 240px;
    min-height: 160px;
    max-height: 340px;
    flex: 1 1 auto;
}

.file-preview img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto; height: auto;
}
.file-preview video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.file-preview audio { width: 85%; }

.preview-text {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    padding: 16px;
    white-space: pre-wrap;
    overflow-y: auto;
    overflow-x: hidden;
    text-align: left;
    width: min(420px, calc(100vw - 60px));
    height: 220px;
    line-height: 1.65;
    word-break: break-all;
}

.preview-icon-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 60px;
}
.preview-icon { font-size: 52px; }
.preview-ext {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Canvas 3D container */
.preview-3d-container {
    width: 100%; height: 100%;
    min-height: 220px;
    position: relative;
    background: #0a0a0c;
}
.preview-3d-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}
.preview-3d-hint {
    position: absolute;
    bottom: 8px; left: 0; right: 0;
    text-align: center;
    font-size: 10px;
    color: var(--text-3);
    font-family: var(--mono);
    pointer-events: none;
    transition: opacity 1s ease;
}

/* ZIP tree */
.zip-tree {
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    padding: 10px 12px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-2);
    line-height: 1.8;
}
.zip-tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 0;
    cursor: default;
}
.zip-tree-item .zt-icon { opacity: 0.5; flex-shrink: 0; }
.zip-tree-item .zt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zip-tree-item .zt-size { margin-left: auto; color: var(--text-3); flex-shrink: 0; padding-left: 8px; }
.zip-tree-item.is-dir { color: var(--accent); }
.zip-tree-more { color: var(--text-3); padding: 4px 0; cursor: default; }

/* File info panel inside card */
.file-info {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface-1);
    flex-shrink: 0;
}

.file-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.file-name-input {
    flex: 1;
    padding: 6px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: var(--mono);
    font-size: 11px;
    outline: none;
    transition: border-color 0.15s;
    min-width: 0;
}
.file-name-input:focus { border-color: var(--accent); }

.ext-warning {
    display: none;
    font-size: 10px;
    color: #ffb347;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: rgba(255,179,71,0.08);
    border-radius: var(--radius-xs);
    border-left: 2px solid #ffb347;
}
.ext-warning.visible { display: block; }

.file-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
}
.file-detail-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-family: var(--mono);
    font-size: 9px;
    line-height: 1.7;
}
.file-detail-row.fw { grid-column: 1 / -1; }
.fdk { color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }
.fdv { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Swipe Controls ── */
.swipe-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom);
}

.ctrl-btn {
    width: 52px; height: 52px;
    border-radius: 50%;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:hover { transform: scale(1.08); }
.ctrl-btn:active { transform: scale(0.92); }

.ctrl-trash {
    background: rgba(255,92,92,0.1);
    color: var(--danger);
    box-shadow: 0 0 0 1px rgba(255,92,92,0.25);
}
.ctrl-trash:hover { box-shadow: 0 4px 20px rgba(255,92,92,0.3); }

.ctrl-skip {
    background: var(--surface-2);
    color: var(--text-3);
    box-shadow: 0 0 0 1px var(--border);
    width: 42px; height: 42px;
    font-size: 16px;
}

.ctrl-love {
    background: rgba(90,170,120,0.12);
    color: var(--success);
    box-shadow: 0 0 0 1px rgba(90,170,120,0.3);
}
.ctrl-love:hover { box-shadow: 0 4px 20px rgba(90,170,120,0.3); }

/* ══════════════════════════════════════════
   FOLDER PICKER PANEL
══════════════════════════════════════════ */
.folder-picker-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
}
.folder-picker-backdrop.active { display: block; }

.folder-picker-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(340px, 90vw);
    background: var(--surface-1);
    border-left: 1px solid var(--border-med);
    z-index: 310;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out);
    box-shadow: -20px 0 60px rgba(0,0,0,0.5);
    padding-bottom: env(safe-area-inset-bottom);
}
.folder-picker-panel.active { transform: translateX(0); }

.folder-picker-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 18px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.folder-picker-file-info {
    flex: 1;
    min-width: 0;
}

.folder-picker-file-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.folder-picker-file-meta {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
}

.folder-picker-cancel {
    width: 30px; height: 30px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-2);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.folder-picker-cancel:hover { background: var(--surface-3); color: var(--text); }

.folder-picker-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 14px 18px 6px;
    flex-shrink: 0;
}

.folder-picker-list {
    list-style: none;
    padding: 0 10px 10px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.picker-folder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.picker-folder-item:hover { background: var(--surface-2); }
.picker-folder-item:active { background: var(--surface-3); transform: scale(0.99); }

.picker-folder-icon {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.picker-folder-icon.queue-icon  { background: rgba(77,143,255,0.1); color: var(--accent); }
.picker-folder-icon.loved-icon  { background: rgba(255,92,138,0.1); color: var(--loved); }
.picker-folder-icon.trash-icon  { background: rgba(255,92,92,0.08); color: var(--danger); }
.picker-folder-icon.custom-icon { background: rgba(77,143,255,0.1); color: var(--accent); }

.picker-folder-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}
.picker-folder-count {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
}

/* ══════════════════════════════════════════
   REVIEW GRID MODE
══════════════════════════════════════════ */
.review-wrap {
    width: 100%; height: 100%;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Date group sections ── */
.review-date-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-date-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 0 2px 6px;
    border-bottom: 1px solid var(--border);
}

.review-date-header-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.review-date-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
.review-date-label.special {
    color: var(--accent);
}

.review-date-sub {
    font-size: 10px;
    color: var(--text-3);
    font-family: var(--mono);
    white-space: nowrap;
}

.review-date-count {
    font-size: 10px;
    color: var(--text-3);
    font-family: var(--mono);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Time badge overlaid on thumbnail */
.review-time-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    font-size: 9px;
    font-family: var(--mono);
    color: rgba(255,255,255,0.9);
    background: rgba(0,0,0,0.55);
    padding: 1px 5px;
    border-radius: 4px;
    pointer-events: none;
    letter-spacing: .02em;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.review-item {
    background: var(--surface-1);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.review-item:hover { transform: scale(1.03); border-color: var(--border-med); box-shadow: var(--shadow); }
.review-item:active { transform: scale(0.98); }

.review-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    position: relative;
}
.review-thumb img,
.review-thumb video {
    width: 100%; height: 100%;
    object-fit: cover;
}
.review-thumb .r-icon { font-size: 28px; }

.review-thumb.loading::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }

.review-thumb-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 2px; background: var(--surface-2); overflow: hidden;
}
.review-thumb-bar-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s;
}

.review-name {
    padding: 6px 8px;
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.review-actions {
    position: absolute;
    top: 4px; right: 4px;
    display: none;
    gap: 3px;
}
.review-item:hover .review-actions { display: flex; }

.r-action-btn {
    width: 24px; height: 24px;
    border-radius: 6px;
    border: none;
    font-size: 11px;
    cursor: pointer;
    background: rgba(0,0,0,0.8);
    color: var(--text);
    backdrop-filter: blur(6px);
    transition: background 0.1s;
    display: flex; align-items: center; justify-content: center;
}
.r-action-btn:hover { background: rgba(0,0,0,0.95); }

/* Move button in review */
.r-move-btn {
    background: rgba(77,143,255,0.15);
    color: var(--accent);
}

/* ══════════════════════════════════════════
   TOAST
══════════════════════════════════════════ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--surface-2);
    border: 1px solid var(--border-med);
    border-radius: 100px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    box-shadow: var(--shadow);
    z-index: 9999;
    transition: transform 0.3s var(--ease-spring), opacity 0.3s;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ══════════════════════════════════════════
   MODALS
══════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
    z-index: 400;
    backdrop-filter: blur(6px);
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--surface-1);
    border: 1px solid var(--border-med);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 320px;
    box-shadow: var(--shadow);
    animation: modal-in 0.25s var(--ease-spring);
}
@keyframes modal-in { from { opacity:0; transform: scale(0.92) translateY(8px); } to { opacity:1; transform: none; } }

.modal-icon {
    width: 44px; height: 44px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.modal-icon.danger-icon { background: var(--danger-glow); }

.modal-box h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.modal-box p  { font-size: 13px; color: var(--text-2); margin-bottom: 16px; line-height: 1.5; }

.modal-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-med);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    margin-bottom: 14px;
    outline: none;
    transition: border-color 0.15s;
    -webkit-user-select: text;
    user-select: text;
}
.modal-input:focus { border-color: var(--accent); }

.modal-actions { display: flex; gap: 8px; }

.modal-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-weight: 600;
    font-size: 13px;
    transition: opacity 0.15s, transform 0.15s;
}
.modal-btn:active { transform: scale(0.97); }
.modal-btn.primary   { background: var(--accent); color: #fff; }
.modal-btn.secondary { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.modal-btn.danger    { background: var(--danger-glow); color: var(--danger); border: 1px solid rgba(255,92,92,0.3); }
.modal-btn:hover     { opacity: 0.88; }

/* ══════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════ */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.94);
    z-index: 450;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
}
.lightbox.active { display: flex; }

.lightbox-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}

.lightbox-name {
    flex: 1;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lb-counter {
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 2px 8px;
    font-size: 10px;
    color: var(--text-2);
    flex-shrink: 0;
}
.lb-filename {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
}
.lb-meta {
    color: var(--text-3);
    flex-shrink: 0;
}

.lightbox-close {
    width: 32px; height: 32px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-2);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.lightbox-close:hover { background: var(--surface-3); color: var(--text); }

.lightbox-content {
    max-width: 90vw;
    max-height: calc(100vh - 120px);
    margin-top: 52px;
    margin-bottom: 60px;
}
.lightbox-content img,
.lightbox-content video {
    max-width: 90vw;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* Prev/Next nav buttons */
.lb-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
    z-index: 10;
}
.lb-nav-btn:hover { background: var(--surface-3); color: var(--text); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

/* Bottom action bar */
.lb-action-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}
.lb-rename-input {
    flex: 1;
    height: 32px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 12px;
    font-family: var(--mono);
    padding: 0 10px;
    min-width: 0;
    outline: none;
    transition: border-color 0.15s;
}
.lb-rename-input:focus { border-color: var(--accent); }
.lb-action-btn {
    height: 32px;
    padding: 0 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex; align-items: center; gap: 5px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.lb-action-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-med); }
.lb-move-btn-el:hover { border-color: var(--accent); color: var(--accent); }

/* ══════════════════════════════════════════
   RESPONSIVE — TABLET & MOBILE
══════════════════════════════════════════ */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }

    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        box-shadow: 20px 0 60px rgba(0,0,0,0.6);
        pointer-events: none;
    }
    .sidebar.open { transform: translateX(0); pointer-events: auto; }
    .sidebar-close { display: flex; }
    .sidebar-overlay.active { display: block; }

    .app-shell { left: 0; }
    .menu-btn { display: flex; }

    .swipe-wrap { padding: 12px 12px 18px; }
    .file-card {
        max-width: calc(100% - 40px);
        max-height: calc(100vh - var(--topbar-h) - 150px);
        height: auto;
    }

    .ctrl-btn { width: 54px; height: 54px; font-size: 22px; }
    .ctrl-skip { width: 40px; height: 40px; font-size: 16px; }

    .review-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }

    .folder-picker-panel { width: 85vw; }
    .swipe-hint { display: none; }
}

@media (max-width: 400px) {
    .review-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 5px; }
    .file-card { max-width: calc(100% - 24px); }
    .ctrl-btn { width: 50px; height: 50px; font-size: 20px; }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
    .swipe-wrap { padding: 8px 14px 10px; gap: 8px; }
    .file-card { max-height: calc(100vh - var(--topbar-h) - 100px); }
    .ctrl-btn { width: 42px; height: 42px; font-size: 18px; }
    .ctrl-skip { width: 34px; height: 34px; font-size: 14px; }
    .swipe-hint { display: none; }
}

/* ══════════════════════════════════════════
   LIGHTBOX EXPANDED
══════════════════════════════════════════ */
.lb-text-content {
    width: 88vw;
    max-width: 900px;
    height: 82vh;
    overflow: hidden;
    background: var(--surface-1);
    border-radius: 12px;
    border: 1px solid var(--border-med);
    display: flex;
    flex-direction: column;
}
.lb-font-content {
    width: min(700px, 92vw);
    max-height: 88vh;
    overflow-y: auto;
    background: var(--surface-1);
    border-radius: 12px;
    border: 1px solid var(--border-med);
}
.lb-loading {
    padding: 32px;
    text-align: center;
    color: var(--text-3);
    font-family: var(--mono);
    font-size: 12px;
}
/* Markdown in lightbox */
.lb-md {
    padding: 28px 36px;
    overflow-y: auto;
    height: 100%;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.75;
}
.lb-md h1,.lb-md h2,.lb-md h3,.lb-md h4 {
    color: var(--text); font-weight: 700;
    margin: 20px 0 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}
.lb-md h1{font-size:24px}.lb-md h2{font-size:20px}.lb-md h3{font-size:16px}.lb-md h4{font-size:14px;border:none}
.lb-md p{margin:8px 0;color:var(--text-2);line-height:1.75}
.lb-md a{color:var(--accent);text-decoration:none}
.lb-md a:hover{text-decoration:underline}
.lb-md code{font-family:var(--mono);font-size:12px;background:var(--surface-2);padding:2px 6px;border-radius:4px;color:var(--accent)}
.lb-md pre{background:var(--surface-2);border-radius:8px;padding:16px;overflow-x:auto;margin:12px 0}
.lb-md pre code{background:none;padding:0;color:var(--text-2);font-size:12px}
.lb-md ul,.lb-md ol{padding-left:24px;color:var(--text-2);margin:8px 0}
.lb-md li{margin:4px 0}
.lb-md blockquote{border-left:3px solid var(--accent);margin:12px 0;padding:8px 16px;background:var(--surface-2);border-radius:0 6px 6px 0;color:var(--text-3);font-style:italic}
.lb-md table{border-collapse:collapse;width:100%;font-size:13px;margin:12px 0}
.lb-md th,.lb-md td{border:1px solid var(--border-med);padding:8px 12px;color:var(--text-2)}
.lb-md th{background:var(--surface-2);color:var(--text);font-weight:600}
.lb-md tr:nth-child(even) td{background:rgba(255,255,255,0.02)}
.lb-md img{max-width:100%;border-radius:6px;margin:8px 0}
.lb-md hr{border:none;border-top:1px solid var(--border);margin:20px 0}

/* Code in lightbox */
.lb-code {
    overflow: auto;
    height: 100%;
    font-size: 13px;
    line-height: 1.6;
}
.lb-code pre{margin:0;min-height:100%;background:transparent !important}
.lb-code .hljs{background:transparent !important;padding:20px;font-size:13px;line-height:1.6}

/* Plain text in lightbox */
.lb-plaintext {
    margin: 0;
    padding: 20px 24px;
    overflow: auto;
    height: 100%;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-2);
    white-space: pre-wrap;
    word-break: break-word;
    background: transparent;
    border: none;
}

/* Font in lightbox */
.lb-font-wrap {
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.lb-font-big    {font-size:64px;color:var(--text);line-height:1.1}
.lb-font-pangram{font-size:20px;color:var(--text-2);line-height:1.4}
.lb-font-alpha  {font-size:15px;color:var(--text-2);letter-spacing:.02em}
.lb-font-digits {font-size:14px;color:var(--text-3);letter-spacing:.05em}
.lb-font-sizes  {display:flex;flex-direction:column;gap:8px;border-top:1px solid var(--border);padding-top:16px;color:var(--text-2)}

/* Audio in lightbox */
.lb-audio-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 40px;
    background: var(--surface-1);
    border-radius: 16px;
    border: 1px solid var(--border-med);
    min-width: min(400px, 88vw);
}
.lb-audio-icon{font-size:64px}
.lb-audio-name{font-family:var(--mono);font-size:12px;color:var(--text-3);text-align:center;max-width:360px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ZIP tree in lightbox */
.lb-zip-tree {
    padding: 12px 16px;
    overflow-y: auto;
    max-height: 82vh;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.9;
}

/* 3D in lightbox */
.lb-3d-container {
    width: min(820px, 88vw);
    height: 75vh;
    background: #080810;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}
.lb-3d-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* No preview */
.lb-no-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 60px 40px;
    color: var(--text-3);
    text-align: center;
}

/* Preview helpers (used by swipe card too) */
.preview-markdown {
    width: min(480px, calc(100vw - 80px));
    max-height: calc(100vh - var(--topbar-h) - 280px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 18px;
    text-align: left;
    font-family: var(--font);
    font-size: 12px;
    line-height: 1.7;
}
.preview-markdown h1,.preview-markdown h2,.preview-markdown h3 {color:var(--text);font-weight:700;margin:10px 0 5px;border-bottom:1px solid var(--border);padding-bottom:3px}
.preview-markdown h1{font-size:17px}.preview-markdown h2{font-size:14px}.preview-markdown h3{font-size:12px}
.preview-markdown p{margin:5px 0;color:var(--text-2)}
.preview-markdown code{font-family:var(--mono);font-size:10px;background:var(--surface-2);padding:1px 5px;border-radius:4px;color:var(--accent)}
.preview-markdown pre{background:var(--surface-2);border-radius:6px;padding:8px;overflow-x:auto;margin:6px 0}
.preview-markdown pre code{background:none;padding:0;color:var(--text-2)}
.preview-markdown a{color:var(--accent)}
.preview-markdown ul,.preview-markdown ol{padding-left:18px;color:var(--text-2)}
.preview-markdown li{margin:2px 0}
.preview-markdown blockquote{border-left:3px solid var(--accent);margin:6px 0;padding-left:10px;color:var(--text-3);font-style:italic}
.preview-markdown table{border-collapse:collapse;width:100%;font-size:10px}
.preview-markdown th,.preview-markdown td{border:1px solid var(--border);padding:3px 7px;color:var(--text-2)}
.preview-markdown th{background:var(--surface-2);color:var(--text)}
.preview-markdown img{max-width:100%;border-radius:4px}
.preview-markdown hr{border:none;border-top:1px solid var(--border);margin:8px 0}
.preview-code{width:min(480px,calc(100vw - 80px));max-height:calc(100vh - var(--topbar-h) - 280px);overflow:auto;text-align:left;}
.preview-code pre{margin:0;background:transparent !important}
.preview-code .hljs{background:transparent !important}
.preview-font-block{padding:20px 24px;width:min(420px,calc(100vw - 80px));display:flex;flex-direction:column;gap:10px;text-align:left}
.preview-font-pangram{font-size:17px;color:var(--text);line-height:1.4}
.preview-font-alpha{font-size:13px;color:var(--text-2);line-height:1.5}
.preview-font-digits{font-size:12px;color:var(--text-3);letter-spacing:.05em}
.preview-font-sizes{color:var(--text-2);display:flex;align-items:baseline;gap:4px;flex-wrap:wrap;margin-top:8px;border-top:1px solid var(--border);padding-top:8px}
.preview-sub{font-family:var(--mono);font-size:9px;color:var(--text-3);letter-spacing:.1em;text-transform:uppercase;margin-top:-4px}

/* Grid type badge */
.r-type-badge{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.r-type-icon{font-size:22px;font-weight:800;font-family:var(--mono);letter-spacing:-.04em;line-height:1}

/* ══════════════════════════════════════════════
   LIST SECTION (Queue / Skipped / Trash)
══════════════════════════════════════════════ */
.list-section {
    flex: 0 0 auto;
    overflow: visible;
}
.folder-list-item {
    border-left: 2px solid transparent;
}
.folder-list-item.active {
    border-left-color: var(--accent);
}
.skipped-icon { color: #f59e0b; }
.documents-icon { color: #60a5fa; }
.music-icon { color: #a78bfa; }
.pictures-icon { color: #34d399; }
.videos-icon { color: #f87171; }

/* ══════════════════════════════════════════════
   UNDO / REDO BUTTONS
══════════════════════════════════════════════ */
.swipe-topbar-actions {
    display: flex;
    gap: 6px;
}
.undo-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-med);
    border-radius: 20px;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.undo-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.undo-btn:disabled { opacity: 0.3; cursor: default; }

/* ══════════════════════════════════════════════
   SKIPPED SECTION (bottom of queue)
══════════════════════════════════════════════ */
.swipe-wrap {
    overflow-y: auto;
}
.skipped-section {
    width: 100%;
    max-width: 480px;
    background: var(--surface-1);
    border: 1px solid var(--border-med);
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
    margin-top: 4px;
}
.skipped-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.skipped-count {
    background: #f59e0b22;
    color: #f59e0b;
    border-radius: 10px;
    padding: 1px 6px;
    font-family: var(--mono);
    font-size: 10px;
    margin-left: 4px;
}
.skipped-clear-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-3);
    font-size: 10px;
    font-family: var(--font);
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.skipped-clear-btn:hover { border-color: var(--danger); color: var(--danger); }
.skipped-list {
    max-height: 160px;
    overflow-y: auto;
}
.skipped-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}
.skipped-item:last-child { border-bottom: none; }
.skipped-item:hover { background: var(--surface-2); }
.skipped-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.skipped-size {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    flex-shrink: 0;
}
.skipped-restore-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-3);
    font-size: 13px;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.12s;
    flex-shrink: 0;
}
/* ══════════════════════════════════════════════
   RENAME SPLIT (base name editable, ext greyed)
══════════════════════════════════════════════ */
.rename-split {
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border-med);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.rename-split .file-name-input {
    flex: 1;
    border: none;
    background: transparent;
    border-radius: 0;
    min-width: 0;
}
.rename-ext-badge {
    padding: 0 10px 0 4px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
    flex-shrink: 0;
    cursor: default;
    user-select: none;
}

/* Lightbox rename ext badge */
.lb-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.lb-rename-ext-badge {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
    flex-shrink: 0;
    cursor: default;
    user-select: none;
    padding: 0 2px;
}

/* Picker empty / add folder */
.picker-no-folders {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 20px;
}
.picker-no-folders-msg {
    font-size: 13px;
    color: var(--text-3);
}
.picker-add-folder-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
.picker-add-folder-btn:hover { opacity: 0.88; }
.picker-add-folder-btn:active { transform: scale(0.97); }

/* ══════════════════════════════════════════════
   LIVE EXPORT BUTTON
══════════════════════════════════════════════ */
.live-export-btn {
    border-color: rgba(79,127,255,0.25);
}
.live-export-btn.live-active {
    background: rgba(79,127,255,0.12);
    border-color: var(--accent);
    color: var(--accent);
}
.live-export-btn.live-active:hover {
    background: rgba(79,127,255,0.2);
}
.live-export-status {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--accent);
    padding: 3px 10px 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(79,127,255,0.07);
    border: 1px solid rgba(79,127,255,0.2);
    border-radius: var(--radius-xs);
    margin: 0 8px 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.le-status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    animation: livepulse 1.4s ease-in-out infinite;
}
.le-status-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.le-change-btn {
    font-size: 10px; padding: 1px 5px;
    background: var(--surface-3); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-2); cursor: pointer;
    flex-shrink: 0;
}
@keyframes livepulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* Live Export card in Export panel */
.ep-method-card.ep-live { border-color: rgba(79,127,255,0.3); }
.ep-method-card.ep-live:hover { background: rgba(79,127,255,0.08); border-color: var(--accent); }
.ep-method-card.ep-live-active { background: rgba(79,127,255,0.1); border-color: var(--accent); }
.ep-method-card.ep-live-active:hover { background: rgba(209,96,96,0.1); border-color: var(--danger); }
.ep-live-badge {
    display: inline-block; font-size: 9px; font-weight: 700;
    background: var(--accent); color: #fff;
    padding: 1px 5px; border-radius: 3px; margin-left: 5px;
    vertical-align: middle; letter-spacing: 0.05em;
}

/* ══════════════════════════════════════════
   PREVIEW THUMB SKELETON (card loading state)
══════════════════════════════════════════ */
.preview-thumb-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    min-height: 160px;
    background: linear-gradient(135deg, var(--surface-1) 0%, var(--surface-2) 100%);
    position: relative;
    overflow: hidden;
}
.preview-thumb-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,0.035) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: skeletonSweep 1.8s ease-in-out infinite;
}
@keyframes skeletonSweep {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Spinner */
.pts-spinner {
    width: 28px; height: 28px;
    border: 2.5px solid rgba(255,255,255,0.08);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: ptsSpin 0.75s linear infinite;
    flex-shrink: 0;
}
.pts-spinner-sm {
    width: 14px; height: 14px;
    border-width: 2px;
    animation: ptsSpin 0.75s linear infinite;
}
@keyframes ptsSpin { to { transform: rotate(360deg); } }

.pts-label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    z-index: 1;
}

/* Progress bar inside skeleton (archive extraction) */
.pts-bar {
    width: 80px;
    height: 2px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    overflow: hidden;
    z-index: 1;
}
.pts-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 0%;
}

/* Inline loading indicator (text/code/md previews) */
.preview-loading-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-3);
    opacity: 0.6;
}

/* Scrollable previews — allow scroll without triggering swipe */
.preview-scrollable {
    overscroll-behavior: contain;
    touch-action: pan-y;
    cursor: default;
}
.preview-text.preview-scrollable,
.preview-code.preview-scrollable,
.preview-markdown.preview-scrollable {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - var(--topbar-h) - 270px);
    min-height: 100px;
}

/* Fade in when thumbnail swaps in */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}


/* ════════════════════════════════════════════════════════════════════════════════
   DUPLICATE DETECTOR
════════════════════════════════════════════════════════════════════════════════ */

/* ── scan picker screen ── */
.dup-panel { position: absolute; inset: 0; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.dup-hero { display: flex; align-items: center; gap: 16px; }
.dup-hero h2 { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.dup-hero p  { font-size: 12px; color: var(--text-3); }
.dup-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dup-method-card {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 6px;
    text-align: left; font-family: var(--font); transition: all .18s;
}
.dup-method-card:hover { background: var(--surface-2); border-color: var(--accent); transform: translateY(-2px); }
.dup-method-icon  { font-size: 24px; }
.dup-method-label { font-size: 12px; font-weight: 600; color: var(--text); }
.dup-method-time  { font-size: 10px; color: var(--text-3); font-family: var(--mono); }
.dup-tip { background: var(--accent-glow); border-left: 3px solid var(--accent); border-radius: var(--radius-xs); padding: 10px 14px; font-size: 12px; color: var(--text-2); }

/* ── results screen — position absolute so height is always the viewport, not content ── */
.dup-results-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; }
.dup-results-header {
    flex-shrink: 0;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 14px 16px; background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.dup-results-header h2 { font-size: 16px; font-weight: 700; }
.dup-action-btn {
    padding: 7px 14px; border-radius: var(--radius-xs); border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: var(--font); transition: all .15s; white-space: nowrap;
}
.dup-action-btn:hover { background: var(--surface-3); color: var(--text); }
.dup-action-btn.dup-danger { background: var(--danger-glow); color: var(--danger); border-color: rgba(209,96,96,.3); }
.dup-action-btn.dup-danger:hover { background: var(--danger); color: #fff; }

/* groups list — plain BLOCK scroll, no flex on children so nothing can be squished */
.dup-groups { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }
.dup-group { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 14px; }
.dup-group:last-child { margin-bottom: 0; }
.dup-group-toggle {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--surface-2);
    border: none; border-bottom: 1px solid transparent;
    cursor: pointer; text-align: left; color: var(--text);
    font-family: var(--font); font-size: 13px;
}
.dup-group-toggle:hover { background: var(--surface-3); }
.dup-group-folder  { font-size: 12px; font-weight: 600; color: var(--accent); flex-shrink: 0; }
.dup-group-keep    { font-size: 12px; color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup-group-chevron { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.dup-badge-keep  { background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.dup-orig-row    { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.dup-dupes-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 6px 14px 4px; }
.dup-dupe-row    { display: flex; align-items: center; gap: 10px; padding: 8px 14px; transition: background .15s; }
.dup-dupe-row:hover { background: var(--surface-2); }
.dup-file-thumb  { flex-shrink: 0; width: 52px; height: 52px; border-radius: var(--radius-xs); overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); }
.dup-file-thumb img, .dup-file-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.dup-file-info   { flex: 1; min-width: 0; }
.dup-fname { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dup-fmeta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.dup-trash-btn {
    padding: 5px 12px; background: var(--danger-glow); color: var(--danger);
    border: 1px solid rgba(209,96,96,.3); border-radius: var(--radius-xs);
    font-size: 11px; font-weight: 600; cursor: pointer; flex-shrink: 0;
    transition: all .15s; font-family: var(--font);
}
.dup-trash-btn:hover { background: var(--danger); color: #fff; }

/* ════════════════════════════════════════════════════════════════════════════════
   STORAGE ANALYSIS
════════════════════════════════════════════════════════════════════════════════ */

.storage-wrap { padding: 20px; overflow-y: auto; height: 100%; display: flex; flex-direction: column; gap: 16px; }
.storage-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); gap: 10px; }
.storage-stat-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 10px; text-align: center; }
.ssc-val { font-size: 18px; font-weight: 700; color: var(--text); }
.ssc-lbl { font-size: 10px; color: var(--text-3); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }
.storage-chart { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sc-row  { display: flex; align-items: center; gap: 10px; }
.sc-ext  { width: 44px; font-size: 11px; font-weight: 700; font-family: var(--mono); flex-shrink: 0; }
.sc-bar-wrap { flex: 1; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.sc-bar-fill { height: 100%; border-radius: 4px; transition: width .6s var(--ease-out); }
.sc-info { font-size: 11px; color: var(--text-2); white-space: nowrap; min-width: 90px; text-align: right; }

/* ════════════════════════════════════════════════════════════════════════════════
   FILE ORGANIZER MENU
════════════════════════════════════════════════════════════════════════════════ */

.org-menu-wrap { padding: 20px; overflow-y: auto; height: 100%; display: flex; flex-direction: column; gap: 18px; }
.org-menu-hero { display: flex; align-items: center; gap: 14px; }
.org-menu-hero h2 { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.org-menu-hero p  { font-size: 12px; color: var(--text-3); }
.org-sections { display: flex; flex-direction: column; gap: 14px; }
.org-section  { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.org-section-head { padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.org-items { display: flex; flex-direction: column; }
.org-item-btn {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: transparent; border: none;
    border-bottom: 1px solid var(--border); cursor: pointer;
    font-family: var(--font); font-size: 13px; color: var(--text-2);
    transition: all .15s; text-align: left;
}
.org-item-btn:last-child { border-bottom: none; }
.org-item-btn:hover { background: var(--surface-2); color: var(--text); }
.org-item-btn svg { color: var(--accent); flex-shrink: 0; transition: transform .15s; }
.org-item-btn:hover svg { transform: translateX(3px); }

/* Sidebar organizer/duplicate buttons */
.action-btn.org-btn { border-color: rgba(79,127,255,.25); color: var(--accent); }
.action-btn.org-btn:hover { background: var(--accent-glow); }

/* ════════════════════════════════════════════════════════════════════════════════
   EXPORT PANEL
════════════════════════════════════════════════════════════════════════════════ */

.export-panel-wrap { padding: 20px; overflow-y: auto; height: 100%; display: flex; flex-direction: column; gap: 18px; }
.ep-hero { display: flex; align-items: center; gap: 14px; }
.ep-hero h2 { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.ep-hero p  { font-size: 12px; color: var(--text-3); }

.ep-methods { display: flex; flex-direction: column; gap: 8px; }

.ep-method-card {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; background: var(--surface-1);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: all .15s;
}
.ep-method-card:hover { background: var(--surface-2); border-color: var(--border-med); transform: translateX(2px); }
.ep-method-card.ep-primary { border-color: rgba(79,127,255,.4); background: rgba(79,127,255,.07); }
.ep-method-card.ep-primary:hover { background: rgba(79,127,255,.13); }

.ep-method-icon { font-size: 22px; flex-shrink: 0; width: 32px; text-align: center; }
.ep-method-body { flex: 1; min-width: 0; }
.ep-method-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.ep-method-desc  { font-size: 11px; color: var(--text-3); line-height: 1.5; }
.ep-method-arrow { font-size: 16px; color: var(--text-3); flex-shrink: 0; transition: transform .15s; }
.ep-method-card:hover .ep-method-arrow { transform: translateX(3px); color: var(--accent); }

.ep-section-head { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }

.ep-folder-list { display: flex; flex-direction: column; gap: 6px; }
.ep-folder-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--surface-1);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
}
.ep-folder-icon  { font-size: 16px; flex-shrink: 0; }
.ep-folder-name  { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-folder-meta  { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.ep-single-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 10px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    font-size: 11px; font-weight: 600; color: var(--text-2);
    cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.ep-single-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.ep-empty { font-size: 13px; color: var(--text-3); padding: 16px; text-align: center; }

/* Sidebar export button style */
.action-btn.export-panel-btn { border-color: rgba(79,127,255,.25); color: var(--accent); }
.action-btn.export-panel-btn:hover { background: var(--accent-glow); }

/* ════════════════════════════════════════════════════════════════════════════════
   EXPORT SELECT MODE
════════════════════════════════════════════════════════════════════════════════ */

.esel-wrap { display: flex; flex-direction: column; height: 100%; }

.esel-toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 14px; background: var(--surface-1);
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.esel-tool-btn {
    padding: 5px 10px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    font-size: 12px; color: var(--text-2); cursor: pointer; transition: all .15s;
}
.esel-tool-btn:hover { background: var(--surface-3); color: var(--text); }
.esel-count { font-size: 12px; color: var(--text-3); margin-left: auto; }
.esel-export-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; background: var(--accent); border: none;
    border-radius: var(--radius-xs); font-size: 12px; font-weight: 700;
    color: #fff; cursor: pointer; transition: all .15s;
}
.esel-export-btn:hover:not(:disabled) { background: #6b9fff; }
.esel-export-btn:disabled { opacity: .4; cursor: not-allowed; }

.esel-grid {
    flex: 1; overflow-y: auto; padding: 10px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px;
}

.esel-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; background: var(--surface-1);
    border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    cursor: pointer; transition: all .15s; position: relative;
}
.esel-item:hover  { border-color: var(--border-med); background: var(--surface-2); }
.esel-item.selected { border-color: var(--accent); background: rgba(79,127,255,.09); }

.esel-check {
    width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0;
    border: 1.5px solid var(--border-med); background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.esel-check.checked { background: var(--accent); border-color: var(--accent); }

.esel-thumb {
    width: 36px; height: 36px; border-radius: 4px; flex-shrink: 0;
    background: var(--surface-2); display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.esel-ext { font-size: 9px; font-weight: 700; color: var(--text-3); font-family: var(--mono); }
.esel-info { flex: 1; min-width: 0; }
.esel-name { font-size: 12px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.esel-meta { font-size: 10px; color: var(--text-3); margin-top: 2px; }
