/* ═══════════════════════════════════════════
   CDN Kit — Dashboard Styles
   Dark premium theme matching Orblinn aesthetic
   ═══════════════════════════════════════════ */

:root {
    --bg-deep: #08080c;
    --bg-base: #0e0e14;
    --bg-surface: #14141e;
    --bg-card: #1a1a28;
    --bg-hover: #20202f;
    --bg-glass: rgba(255, 255, 255, 0.025);
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.14);
    --text-primary: #e8eaf0;
    --text-secondary: #7a7f96;
    --text-muted: #4a4e63;
    --accent: #7c6aef;
    --accent-hover: #8f7ff5;
    --accent-glow: rgba(124, 106, 239, 0.15);
    --success: #34d399;
    --danger: #f06060;
    --danger-hover: #e04848;
    --warning: #f5b74e;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1;
}
.btn svg { flex-shrink: 0; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow); }
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══ AUTH SCREENS ═══ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(ellipse at 50% 0%, rgba(124, 106, 239, 0.08) 0%, transparent 60%);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    text-align: center;
}
.auth-logo {
    font-size: 2.5rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 12px var(--accent-glow));
}
.auth-card h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.auth-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
}
.input-group {
    text-align: left;
    margin-bottom: 16px;
}
.input-group label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.input-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.88rem;
    transition: border-color var(--transition);
    outline: none;
}
.input-group input:focus { border-color: var(--accent); }
.input-group input::placeholder { color: var(--text-muted); }
.pass-wrap {
    position: relative;
}
.pass-wrap input { padding-right: 42px; }
.pass-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}
.pass-toggle:hover { color: var(--text-primary); }
.auth-card .btn { margin-top: 8px; }
.auth-error {
    margin-top: 16px;
    font-size: 0.82rem;
    color: var(--danger);
    min-height: 20px;
}

/* ═══ LAYOUT & SIDEBAR ═══ */
.layout-sidebar {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.sidebar-logo {
    display: flex;
    align-items: center;
}
.sidebar-title {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 12px;
}

.nav-group {
    margin-bottom: 24px;
}
.nav-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    padding: 0 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition);
}
.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.nav-item.active {
    color: var(--accent);
    background: var(--accent-glow);
}
.nav-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.cluster-list {
    margin-bottom: 4px;
}
.btn-create-cluster {
    color: var(--accent);
    font-size: 0.8rem;
}
.btn-create-cluster:hover {
    color: var(--accent-hover);
    background: transparent;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-user {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}

.dashboard-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
}

#view-files.dashboard-view {
    overflow-y: hidden;
}

.main-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-base);
    flex-shrink: 0;
}

.stat-pills {
    display: flex;
    gap: 8px;
}
.stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}
.stat-pill .stat-val { color: var(--text-primary); font-weight: 600; }

/* ═══ TOOLBAR ═══ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-base);
    gap: 16px;
    flex-wrap: wrap;
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.breadcrumb a:hover { color: var(--text-primary); background: var(--bg-glass); }
.breadcrumb .bc-sep { color: var(--text-muted); font-size: 0.7rem; }
.breadcrumb .bc-current { color: var(--text-primary); font-weight: 500; padding: 4px 8px; }
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.view-toggle {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.view-toggle .btn {
    border: none;
    border-radius: 0;
    padding: 6px 10px;
}
.view-toggle .btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

/* ═══ FILE BROWSER ═══ */
.file-browser {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    position: relative;
}

/* Loading */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 1rem; font-weight: 500; margin-bottom: 4px; }
.empty-state span { font-size: 0.82rem; color: var(--text-muted); }

/* ── Grid View ── */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 24px;
}
.cluster-group-header {
    padding: 24px 24px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.cluster-group-header h3 {
    font-size: 1rem;
    font-weight: 600;
}
.cluster-group-header .cluster-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.file-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 0 24px 32px;
}
.file-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.file-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
/* Folder card — tab shape */
.file-card.is-folder {
    padding-top: 22px;
    border-color: rgba(124, 106, 239, 0.15);
}
.file-card.is-folder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 16px;
    width: 44px;
    height: 6px;
    background: var(--accent);
    border-radius: 0 0 4px 4px;
    opacity: 0.5;
    transition: opacity var(--transition);
}
.file-card.is-folder:hover::before { opacity: 0.8; }
.file-card.is-folder .fc-icon { width: 56px; height: 56px; }
.file-card.is-folder .fc-icon svg { width: 28px; height: 28px; }
/* Media preview cards */
.file-card.has-preview { padding: 0; display: flex; flex-direction: column; }
.file-card.has-preview .fc-info { padding: 12px 16px; }
.fc-preview {
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: var(--bg-card);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fc-preview img, .fc-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.file-card:hover .fc-preview img,
.file-card:hover .fc-preview video { transform: scale(1.05); }
.fc-preview .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    transition: background var(--transition);
}
.file-card:hover .play-overlay { background: rgba(0, 0, 0, 0.15); }
.play-overlay svg { opacity: 0.9; }
.file-card .fc-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 12px;
}
.file-card .fc-thumb {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    background: var(--bg-card);
}
.file-card .fc-name {
    font-size: 0.82rem;
    font-weight: 500;
    word-break: break-all;
    line-height: 1.3;
    margin-bottom: 4px;
}
.file-card .fc-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.file-card .fc-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 2;
}
.file-card:hover .fc-actions { opacity: 1; }
.fc-actions .btn {
    padding: 4px 6px;
    font-size: 0.7rem;
    background: var(--bg-deep);
    border: 1px solid var(--border);
}

/* Icon colors */
.icon-folder { background: rgba(124, 106, 239, 0.12); color: #7c6aef; }
.icon-image { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.icon-video { background: rgba(245, 183, 78, 0.12); color: #f5b74e; }
.icon-audio { background: rgba(240, 96, 96, 0.12); color: #f06060; }
.icon-font { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.icon-doc { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }
.icon-code { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.icon-archive { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.icon-other { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }

/* ── List View ── */
.file-list table {
    width: 100%;
    border-collapse: collapse;
}
.file-list th {
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.file-list td {
    padding: 10px 12px;
    font-size: 0.82rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}
.file-list tr { cursor: pointer; transition: background var(--transition); }
.file-list tbody tr:hover { background: var(--bg-glass); }
.fl-name {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fl-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.fl-actions { display: flex; gap: 4px; }
.fl-actions .btn { padding: 4px 8px; font-size: 0.72rem; }

/* ═══ DROP OVERLAY ═══ */
.drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 12, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.drop-overlay.active { display: flex; }
.drop-content {
    text-align: center;
    color: var(--accent);
    animation: dropPulse 1.5s ease-in-out infinite;
}
.drop-content svg { margin-bottom: 12px; }
.drop-content p { font-size: 1.1rem; font-weight: 500; }
@keyframes dropPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* ═══ MODAL ═══ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 400px;
    animation: modalIn 0.2s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } }
.modal h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 16px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ═══ TOAST ═══ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    color: var(--text-primary);
    pointer-events: auto;
    animation: toastIn 0.3s ease-out;
    max-width: 340px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ═══ UPLOAD PROGRESS ═══ */
.upload-progress {
    margin-top: 12px;
}
.upload-bar-wrap {
    width: 100%;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.upload-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}
.upload-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ═══ SVG ICON SIZING ═══ */
.fc-icon svg, .fl-icon svg { width: 20px; height: 20px; }
.fc-actions svg, .fl-actions svg { width: 14px; height: 14px; }
.breadcrumb a svg { width: 14px; height: 14px; vertical-align: -2px; }
.auth-logo svg { stroke: var(--accent); }
.empty-icon svg { stroke: var(--text-muted); }
.toast-dot { font-size: 0.6rem; line-height: 1; }
.toast-dot-success { color: var(--success); }
.toast-dot-error { color: var(--danger); }
.toast-dot-info { color: var(--accent); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .toolbar { flex-direction: column; align-items: flex-start; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .stat-pills { display: none; }
    .topbar { padding: 0 16px; }
    .toolbar { padding: 12px 16px; }
    .file-browser { padding: 16px; }
}
@media (max-width: 480px) {
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
    .file-card { padding: 12px; }
    .auth-card { padding: 28px 20px; }
}

/* ═══ SELECTION SYSTEM ═══ */
.sel-all-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all var(--transition);
    user-select: none;
}
.sel-all-toggle:hover { border-color: var(--border-hover); color: var(--text-primary); }
.sel-all-toggle input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

.selection-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: var(--accent-glow);
    border: 1px solid rgba(124, 106, 239, 0.25);
    border-radius: var(--radius-sm);
    animation: fadeIn 0.2s ease-out;
}
.sel-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

/* Checkbox on file cards (grid) */
.fc-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    opacity: 0;
    transition: opacity var(--transition);
}
.file-card:hover .fc-checkbox,
.file-card.selected .fc-checkbox { opacity: 1; }
.fc-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.file-card.selected {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 1px var(--accent), 0 4px 16px rgba(124, 106, 239, 0.15);
    background: rgba(124, 106, 239, 0.04);
}

/* List view checkbox */
.fl-checkbox { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.file-list tbody tr.selected { background: rgba(124, 106, 239, 0.06); }

/* ═══ UPLOAD PROGRESS MODAL ═══ */
.upload-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    padding: 20px;
}
.upload-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    animation: modalIn 0.25s ease-out;
}
.upload-modal-header {
    padding: 28px 28px 20px;
    text-align: center;
}
.upload-modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: var(--accent);
    animation: uploadPulse 2s ease-in-out infinite;
}
.upload-modal-icon.done { animation: none; background: rgba(52, 211, 153, 0.15); color: var(--success); }
@keyframes uploadPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 12px transparent; }
}
.upload-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.upload-modal-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.upload-modal-files {
    max-height: 200px;
    overflow-y: auto;
    padding: 0 28px;
}
.upload-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.upload-file-row:last-child { border-bottom: none; }
.upload-file-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}
.upload-file-details { flex: 1; min-width: 0; }
.upload-file-name {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-file-size { font-size: 0.7rem; color: var(--text-muted); }
.upload-file-bar {
    height: 3px;
    background: var(--bg-card);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}
.upload-file-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}
.upload-file-bar-fill.done { background: var(--success); }
.upload-file-bar-fill.error { background: var(--danger); }
.upload-file-status {
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 36px;
    text-align: right;
}
.upload-file-status.done { color: var(--success); }
.upload-file-status.error { color: var(--danger); }
.upload-file-status.pending { color: var(--text-muted); }
.upload-modal-overall {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
}
.upload-overall-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.upload-bar-track {
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
}
.upload-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}
.upload-bar-fill.done { background: linear-gradient(90deg, #34d399, #2dd4bf); }
.upload-modal-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* ═══ TOPBAR NAVIGATION ═══ */
.topbar-nav {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.nav-btn {
    border: none !important;
    border-radius: 0 !important;
    padding: 6px 14px !important;
    font-size: 0.78rem !important;
    gap: 5px !important;
    transition: all var(--transition);
}
.nav-btn.active {
    background: var(--accent-glow) !important;
    color: var(--accent) !important;
}
.nav-btn:hover:not(.active) {
    background: var(--bg-hover) !important;
}

/* ═══ API KEYS PAGE ═══ */
.api-page {
    padding: 28px 24px 40px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

.api-section {
    margin-bottom: 36px;
}

.api-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.api-section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.api-section-sub {
    font-size: 0.84rem;
    color: var(--text-secondary);
}

/* ── API Key Cards ── */
.api-keys-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.api-key-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition);
    position: relative;
}

.api-key-card:hover {
    border-color: var(--border-hover);
}

.api-key-card.inactive {
    opacity: 0.55;
}

.api-key-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}

.api-key-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-key-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.api-key-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--accent);
}

.api-key-name {
    font-size: 0.92rem;
    font-weight: 600;
}

.api-key-created {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.api-key-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.api-key-status.active {
    background: rgba(52, 211, 153, 0.12);
    color: var(--success);
}

.api-key-status.paused {
    background: rgba(245, 183, 78, 0.12);
    color: var(--warning);
}

.api-key-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.api-key-actions {
    display: flex;
    gap: 6px;
}

.api-key-tokens {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.api-key-token-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.api-key-token-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.api-key-token-value {
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    overflow: hidden;
}

.api-key-token-value span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-key-token-value .copy-token-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    transition: color var(--transition);
    display: flex;
}

.api-key-token-value .copy-token-btn:hover {
    color: var(--accent);
}

.api-key-stats {
    display: flex;
    gap: 20px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.api-key-stats strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ── New Key Created Banner ── */
.new-key-banner {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-out;
}

.new-key-banner h4 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.new-key-banner p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.new-key-banner .secret-display {
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
    background: var(--bg-deep);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    word-break: break-all;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } }

/* ── Empty Keys State ── */
.api-keys-empty {
    text-align: center;
    padding: 48px 20px;
    background: var(--bg-surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.api-keys-empty svg {
    stroke: var(--text-muted);
    margin-bottom: 12px;
    opacity: 0.5;
}

.api-keys-empty p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.api-keys-empty span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ═══ USAGE GUIDE ═══ */
.guide-tabs {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.guide-tab {
    border: none !important;
    border-radius: 0 !important;
    padding: 6px 16px !important;
    font-size: 0.78rem !important;
}

.guide-tab.active {
    background: var(--accent-glow) !important;
    color: var(--accent) !important;
}

.guide-content {
    display: none;
}

.guide-content.active {
    display: block;
}

.guide-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 12px;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.guide-step h4 {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.guide-step p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.guide-step code {
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--accent);
}

/* ── Code Blocks ── */
.code-block {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.code-header span {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.code-header .copy-btn {
    font-size: 0.7rem !important;
    padding: 3px 8px !important;
}

.code-block pre {
    padding: 16px;
    margin: 0;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.65;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre;
    tab-size: 2;
}

/* ═══ ANALYTICS DASHBOARD ═══ */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.analytics-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.analytics-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.analytics-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-card-header h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0;
}

.analytics-val {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    line-height: 1;
}

.analytics-trend {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.analytics-chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
}

.analytics-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.analytics-chart-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-period {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted);
}

.analytics-chart-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.analytics-tab {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.analytics-tab:hover {
    color: var(--text-primary);
}

.analytics-tab.active {
    background: var(--accent);
    color: #fff;
}

.analytics-chart-summary {
    margin-bottom: 24px;
}

.chart-summary-val {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.chart-summary-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.analytics-chart-container {
    width: 100%;
    min-height: 200px;
    position: relative;
}

.analytics-chart-container svg {
    display: block;
    width: 100%;
    height: auto;
}

/* ═══ API PAGE RESPONSIVE ═══ */
@media (max-width: 768px) {
    .api-page { padding: 20px 16px; }
    .api-key-tokens { grid-template-columns: 1fr; }
    .api-key-top { flex-direction: column; align-items: flex-start; }
    .api-key-actions { width: 100%; }
    .api-section-header { flex-direction: column; }
    .topbar-nav { display: none; }
}

@media (max-width: 480px) {
    .api-key-stats { flex-direction: column; gap: 4px; }
    .guide-tabs { width: 100%; }
    .guide-tab { flex: 1; text-align: center; }
}

/* ═══ ENHANCED MODAL ═══ */
.modal-header-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.modal-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.modal-icon-wrap:empty { display: none; }
.modal-icon-wrap.icon-accent {
    background: var(--accent-glow);
    color: var(--accent);
}
.modal-icon-wrap.icon-danger {
    background: rgba(240, 96, 96, 0.12);
    color: var(--danger);
}
.modal-icon-wrap.icon-success {
    background: rgba(52, 211, 153, 0.12);
    color: var(--success);
}
.modal-icon-wrap.icon-warning {
    background: rgba(245, 183, 78, 0.12);
    color: var(--warning);
}
.modal-icon-wrap svg {
    width: 22px;
    height: 22px;
}

/* ═══ CLUSTER SIDEBAR — DELETE BUTTON ═══ */
.cluster-nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}
.cluster-nav-item .nav-item {
    flex: 1;
    min-width: 0;
}
.cluster-nav-item .nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cluster-delete-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}
.cluster-nav-item:hover .cluster-delete-btn { opacity: 1; }
.cluster-delete-btn:hover {
    color: var(--danger);
    background: rgba(240, 96, 96, 0.12);
}
.cluster-delete-btn svg { width: 12px; height: 12px; }

/* ═══ MOVE-TO DESTINATION PICKER ═══ */
.moveto-modal {
    max-width: 520px;
}
.moveto-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.moveto-browser {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 280px;
    margin-bottom: 8px;
}
.moveto-clusters {
    width: 180px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: var(--bg-card);
    flex-shrink: 0;
}
.moveto-cluster-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.moveto-cluster-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.moveto-cluster-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 500;
}
.moveto-cluster-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}
.moveto-folders {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-surface);
}
.moveto-current {
    padding: 10px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-deep);
}
.moveto-current svg { width: 14px; height: 14px; opacity: 0.6; }
.moveto-back-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-family: var(--font);
    transition: all var(--transition);
}
.moveto-back-btn:hover { background: var(--accent-glow); }
.moveto-folder-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.moveto-folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}
.moveto-folder-item:hover {
    background: var(--bg-hover);
}
.moveto-folder-item svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
    opacity: 0.7;
    flex-shrink: 0;
}
.moveto-folder-item .folder-arrow {
    margin-left: auto;
    opacity: 0.3;
}
.moveto-folder-item .folder-arrow svg {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
}
.moveto-empty {
    padding: 32px 16px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ═══ CLIPBOARD INDICATOR BAR ═══ */
.clipboard-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(124, 106, 239, 0.08), rgba(124, 106, 239, 0.04));
    border: 1px solid rgba(124, 106, 239, 0.2);
    border-radius: var(--radius-sm);
    margin: 8px 24px;
    animation: fadeIn 0.25s ease-out;
}
.clipboard-bar .cb-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent);
}
.clipboard-bar .cb-icon svg { width: 14px; height: 14px; }
.clipboard-bar .cb-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex: 1;
}
.clipboard-bar .cb-text strong {
    color: var(--accent);
    font-weight: 600;
}
.clipboard-bar .btn { flex-shrink: 0; }

/* ═══ TRASH BIN VIEW ═══ */
.trash-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.trash-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}
.trash-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-card);
}
.trash-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.trash-icon svg { width: 18px; height: 18px; }
.trash-details {
    flex: 1;
    min-width: 0;
}
.trash-name {
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.trash-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.trash-meta span { display: flex; align-items: center; gap: 4px; }
.trash-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.trash-empty-state {
    text-align: center;
    padding: 64px 20px;
    background: var(--bg-surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}
.trash-empty-state svg {
    stroke: var(--text-muted);
    margin-bottom: 12px;
    opacity: 0.4;
}
.trash-empty-state p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}
.trash-empty-state span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ═══ CONTEXT MENU (Right-click) ═══ */
.context-menu {
    position: fixed;
    z-index: 3000;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 0;
    min-width: 200px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
    animation: contextIn 0.15s ease-out;
}
@keyframes contextIn { from { opacity: 0; transform: scale(0.95); } }
.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}
.context-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: rgba(240, 96, 96, 0.1); }
.context-menu-item svg { width: 15px; height: 15px; opacity: 0.7; flex-shrink: 0; }
.context-menu-item .ctx-shortcut {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.4;
    font-weight: 500;
}
.context-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.context-menu-item.disabled {
    opacity: 0.35;
    pointer-events: none;
}
