:root {
    --bg: #07090f;
    --surface: #0d1117;
    --card: #131820;
    --card-hover: #1a2030;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text: #e4e8f0;
    --text-secondary: #7a8299;
    --text-muted: #404860;

    --brand: #6366f1;
    --brand-light: #818cf8;
    --brand-dark: #4f46e5;
    --brand-glow: rgba(99, 102, 241, 0.15);
    --gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-hover: linear-gradient(135deg, #818cf8, #a78bfa);

    --green: #22c55e;
    --red: #ef4444;
    --amber: #f59e0b;
    --cyan: #06b6d4;
    --pink: #ec4899;
    
    --green-glow: rgba(34, 197, 94, 0.15);
    --red-glow: rgba(239, 68, 68, 0.15);
    --cyan-glow: rgba(6, 182, 212, 0.15);

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

[data-theme='light'] {
    --bg: #f8fafc;
    --surface: #ffffff;
    --card: #ffffff;
    --card-hover: #f1f5f9;
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color var(--transition), color var(--transition);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-normal { color: var(--text); }
.text-brand { color: var(--brand); }
.text-cyan { color: var(--cyan); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-sm { font-size: 13px; }
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mono { font-family: var(--mono); }
.w-full { width: 100%; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.pt-4 { padding-top: 16px; }
.border-t { border-top: 1px solid var(--border); }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.bg-brand-glow { background-color: var(--brand-glow); }
.bg-cyan-glow { background-color: var(--cyan-glow); }
.bg-green-glow { background-color: var(--green-glow); }
.bg-red-glow { background-color: var(--red-glow); }

/* Splash / Loading Screen */
.splash-wrapper {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.splash-wrapper.fade-out {
    opacity: 0;
    visibility: hidden;
}
.splash-content {
    text-align: center;
}
.splash-icon {
    width: 56px;
    height: 56px;
    color: var(--brand-light);
    margin-bottom: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}
.splash-title {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
}
.splash-loader {
    width: 200px;
    height: 3px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
}
.splash-bar {
    width: 40%;
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    animation: splashSlide 1.2s ease-in-out infinite;
}
@keyframes splashSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

/* SVG Icon Base */
svg {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}

/* Focus States */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    height: 38px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 14px;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 2px 10px var(--brand-glow);
}
.btn-primary:hover:not(:disabled) {
    background: var(--gradient-hover);
    box-shadow: 0 4px 15px var(--brand-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--card-hover);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--red);
    color: white;
}
.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    box-shadow: 0 4px 15px var(--red-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--surface);
    color: var(--text);
}

.btn-icon {
    padding: 0;
    width: 38px;
    border-radius: var(--radius);
}

.btn-lg {
    height: 48px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}
.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
}

/* Inputs */
input[type="text"],
input[type="password"],
input[type="url"] {
    width: 100%;
    height: 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 16px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: all var(--transition);
}
input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
    background: var(--card);
}
input::placeholder { color: var(--text-muted); }

/* Login Screen */
.login-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    background: var(--bg);
}
.login-bg-anim {
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle at 50% 50%, var(--brand-glow) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    animation: gradientShift 20s ease infinite alternate;
    z-index: -1;
}
.login-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    border-radius: var(--radius-xl);
    background: rgba(19, 24, 32, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme='light'] .login-card {
    background: rgba(255, 255, 255, 0.8);
}
.brand-header {
    text-align: center;
    margin-bottom: 32px;
}
.brand-icon-wrapper {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px var(--brand-glow);
}
.brand-icon-wrapper svg { width: 32px; height: 32px; }
.brand-title {
    font-size: 32px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 4px;
}
.brand-subtitle { color: var(--text-muted); font-size: 15px; }
.input-group { margin-bottom: 20px; }
.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.password-wrapper { position: relative; }
.password-wrapper button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
}
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    animation: fadeIn 0.3s ease;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--red);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
#sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}
.sidebar-brand {
    height: var(--topbar-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.brand-icon-small {
    width: 24px; height: 24px;
    color: var(--brand);
}
.brand-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
}
.sidebar-connection {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.conn-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}
.conn-details { flex: 1; min-width: 0; }
#sb-endpoint { font-size: 13px; font-weight: 500; font-family: var(--mono); }
#sb-bucket-name { font-size: 12px; margin-top: 2px; }
.bucket-selector-wrapper { padding: 0 16px 16px; border-bottom: 1px solid var(--border); }
.bucket-select {
    width: 100%;
    height: 36px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0 12px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
.sidebar-nav {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 42px;
    padding: 0 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.nav-btn:hover {
    background: var(--card-hover);
    color: var(--text);
}
.nav-btn.active {
    background: var(--brand-glow);
    color: var(--brand-light);
    font-weight: 600;
    border-left: 3px solid var(--brand);
    padding-left: 13px;
}
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}
.hover-red:hover { color: var(--red); background: rgba(239, 68, 68, 0.1); }

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Topbar */
#topbar {
    height: var(--topbar-height);
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}
#topbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient);
    opacity: 0.4;
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
}
.breadcrumb-item {
    color: var(--text);
    cursor: pointer;
    transition: color var(--transition);
}
.breadcrumb-item:hover { color: var(--brand); }
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.search-wrapper {
    position: relative;
    width: 240px;
}
.search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px; height: 16px;
}
#search-input {
    width: 100%;
    height: 38px;
    padding-left: 36px;
    border-radius: 20px;
}
.mobile-only { display: none; }

/* View Sections */
.view-section {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}
.view-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}

/* File Grid */
.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.file-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
}
.file-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--border-hover);
    background: var(--card-hover);
}
.file-icon {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--card) 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.file-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 80%, var(--brand-glow), transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
}
.file-card:hover .file-icon::after { opacity: 1; }
.file-icon svg { width: 48px; height: 48px; z-index: 1; }
.file-body { padding: 12px; }
.file-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}
.file-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}
.file-actions {
    position: absolute;
    top: 8px; right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}
.file-card:hover .file-actions { opacity: 1; }
.file-actions .btn-icon {
    width: 28px; height: 28px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    color: white;
}
.file-actions .btn-icon:hover { background: var(--brand); }

/* File List Mode */
.list-view {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.file-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    cursor: pointer;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--card-hover); }
.row-icon svg { width: 24px; height: 24px; }
.row-name { flex: 1; font-size: 14px; font-weight: 500; }
.row-size { width: 80px; font-size: 13px; color: var(--text-secondary); text-align: right; }
.row-date { width: 120px; font-size: 13px; color: var(--text-secondary); text-align: right; }
.row-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    width: 100px;
    justify-content: flex-end;
}
.file-row:hover .row-actions { opacity: 1; }

/* File Type Colors */
.type-folder svg { color: var(--brand-light); }
.type-image svg { color: var(--pink); }
.type-video svg { color: #a855f7; }
.type-audio svg { color: var(--green); }
.type-doc svg { color: var(--cyan); }
.type-archive svg { color: var(--amber); }
.type-code svg { color: #f43f5e; }

/* Empty & Loading States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    text-align: center;
}
.empty-icon {
    width: 64px; height: 64px;
    color: var(--border-hover);
    margin-bottom: 16px;
}
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }

.skeleton {
    background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.skeleton-card {
    height: 180px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-lg { max-width: 700px; }
.modal-sm { max-width: 400px; padding: 24px; }
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 600; }
.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 70vh;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg);
}
.modal-icon-header {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.modal-icon-header svg { width: 28px; height: 28px; }

/* Upload Specifics */
.upload-drop-zone {
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    transition: all var(--transition);
    background: var(--card);
}
.upload-drop-zone.active {
    border-color: var(--brand);
    background: var(--brand-glow);
}
.upload-hero-icon {
    width: 48px; height: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.upload-drop-zone h3 { font-size: 16px; margin-bottom: 16px; font-weight: 500; }
.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
}
.divider::before, .divider::after {
    content: ''; flex: 1;
    border-bottom: 1px solid var(--border);
}
.divider span { padding: 0 16px; }
.upload-actions { display: flex; justify-content: center; gap: 12px; }

/* Preview Modal */
.fullscreen { padding: 0; background: rgba(0,0,0,0.9); }
.preview-container {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
}
.preview-header {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}
.preview-title { font-size: 16px; font-weight: 500; color: white; }
.preview-actions { display: flex; gap: 8px; }
.preview-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
}
.preview-body img, .preview-body video {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.preview-footer {
    padding: 16px 24px;
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}
.dot-sep { margin: 0 8px; opacity: 0.5; }

/* Storage View */
.storage-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; }
.storage-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.storage-chart-card, .storage-breakdown-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.donut-container { height: 250px; display: flex; align-items: center; justify-content: center; }

/* Settings View */
.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 600px;
}
.settings-card h2 { margin-bottom: 24px; font-size: 18px; }
.settings-list { display: flex; flex-direction: column; gap: 16px; }
.settings-item {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.settings-item:last-child { border-bottom: none; padding-bottom: 0; }
.settings-label { color: var(--text-secondary); font-size: 14px; }
.settings-value { font-size: 14px; font-weight: 500; }
.with-dot { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.green { background: var(--green); box-shadow: 0 0 8px var(--green); }

/* Toasts */
.toast-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow);
    min-width: 250px; max-width: 350px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-info .toast-icon { color: var(--cyan); }
.toast-warning .toast-icon { color: var(--amber); }
.toast-body { flex: 1; }
.toast-body strong { display: block; font-size: 13px; margin-bottom: 2px; }
.toast-body span { font-size: 12px; color: var(--text-secondary); }
.toast-close { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 4px; flex-shrink: 0; }
.toast-close:hover { background: var(--card-hover); }
.toast-close svg { width: 14px; height: 14px; }
.toast.out { animation: slideOut 0.25s ease forwards; }
@keyframes slideOut { to { opacity: 0; transform: translateX(110%); } }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    #sidebar {
        position: fixed;
        left: -100%; top: 0; bottom: 0;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
    }
    #sidebar.open { left: 0; }
    .mobile-only { display: inline-flex; }
    .topbar-actions .search-wrapper { display: none; }
    .storage-details { grid-template-columns: 1fr; }
}

/* === DYNAMIC CONTENT STYLES (generated by app.js) === */

/* File Type Color Coding */
.file-type-folder svg { color: var(--amber); }
.file-type-image svg { color: var(--pink); }
.file-type-video svg { color: var(--brand); }
.file-type-audio svg { color: var(--green); }
.file-type-document svg { color: var(--cyan); }
.file-type-archive svg { color: var(--amber); }
.file-type-code svg { color: var(--brand-light); }
.file-type-other svg { color: var(--text-muted); }

/* Breadcrumbs */
.crumb {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}
.crumb.clickable {
    cursor: pointer;
    transition: color var(--transition);
}
.crumb.clickable:hover { color: var(--brand-light); }
.crumb:last-child { color: var(--text); font-weight: 600; }
.crumb-sep {
    color: var(--text-muted);
    margin: 0 6px;
    font-size: 16px;
}

/* Upload Queue Items */
.upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}
.upload-info { flex: 1; min-width: 0; }
.upload-name {
    font-size: 13px;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-size {
    font-size: 11px;
    color: var(--text-muted);
}
.upload-progress {
    flex: 1;
    height: 6px;
    background: var(--card-hover);
    border-radius: 3px;
    overflow: hidden;
}
.upload-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
    position: relative;
}
.upload-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 1.5s infinite;
}
.upload-stats {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}
.upload-speed {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--cyan);
    font-weight: 500;
}
.upload-status {
    font-size: 12px;
    color: var(--text-secondary);
}
.upload-cancel {
    flex-shrink: 0;
    width: 28px; height: 28px;
}
.upload-cancel:hover { color: var(--red); }
.upload-item.done { opacity: 0.6; }
.upload-item.done .upload-bar { background: var(--green); }
.upload-item.error .upload-bar { background: var(--red); }
.upload-item.cancelled { opacity: 0.4; }
.bar-pulse {
    animation: barPulse 1s ease-in-out infinite;
}
@keyframes barPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Download Progress Items */
#download-bar-container {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 8000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}
.dl-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}
.dl-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.dl-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.dl-speed {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--cyan);
    font-weight: 500;
}
.dl-progress {
    height: 4px;
    background: var(--card-hover);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}
.dl-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 2px;
    transition: width 0.2s ease;
}
.dl-cancel {
    width: 24px; height: 24px;
    margin-left: auto;
    display: block;
}
.dl-cancel:hover { color: var(--red); }

/* Bucket Cards */
.bucket-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 8px;
}
.bucket-card:hover {
    background: var(--card-hover);
    border-color: var(--brand);
    transform: translateX(4px);
}
.bucket-icon { color: var(--brand-light); flex-shrink: 0; }
.bucket-icon svg { width: 28px; height: 28px; }
.bucket-info { flex: 1; min-width: 0; }
.bucket-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bucket-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* Storage Breakdown Rows */
.storage-type-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.storage-type-row:last-child { border-bottom: none; }
.type-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.type-label {
    font-size: 14px;
    font-weight: 500;
    width: 90px;
}
.type-count {
    font-size: 13px;
    color: var(--text-secondary);
    width: 70px;
    text-align: right;
}
.type-size {
    font-size: 13px;
    font-family: var(--mono);
    color: var(--text);
    width: 80px;
    text-align: right;
}
.type-bar {
    flex: 1;
    height: 6px;
    background: var(--card);
    border-radius: 3px;
    overflow: hidden;
}
.type-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Drop Overlay */
#drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(99, 102, 241, 0.08);
    border: 3px dashed var(--brand);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 100;
    animation: pulse 2s ease infinite;
}
#drop-overlay svg { width: 64px; height: 64px; color: var(--brand); }
#drop-overlay span { font-size: 18px; font-weight: 600; color: var(--brand); }
@keyframes pulse {
    0%, 100% { border-color: var(--brand); }
    50% { border-color: var(--brand-light); }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    animation: fadeIn 0.2s ease;
}

/* Preview specific */
#preview-body img {
    max-width: 100%; max-height: 70vh;
    object-fit: contain;
    border-radius: var(--radius);
}
#preview-body video {
    max-width: 100%; max-height: 70vh;
    border-radius: var(--radius);
}
#preview-body audio {
    width: 100%;
    margin-top: 40px;
}
#preview-body iframe {
    width: 100%; height: 70vh;
    border: none;
    border-radius: var(--radius);
}
#preview-body pre {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    max-height: 70vh;
    overflow: auto;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}
#preview-body .no-preview {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
#preview-body .no-preview svg { width: 64px; height: 64px; margin-bottom: 16px; }

/* Storage donut */
#storage-donut-chart {
    width: 200px; height: 200px;
    margin: 20px auto;
}

/* ===================== FILE EDITOR ===================== */
.editor-modal {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}
.editor-header {
    height: 56px;
    min-height: 56px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.editor-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--brand-light);
    font-weight: 600;
    font-size: 15px;
}
.editor-title-area svg { color: var(--brand); }
.editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.editor-status {
    font-size: 13px;
    color: var(--green);
    font-weight: 500;
}
.editor-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.editor-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Text/Code Editor */
.text-editor-toolbar {
    padding: 8px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 10;
}
.text-editor-toolbar label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
#text-editor {
    flex: 1;
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: none;
    padding: 16px 20px;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.7;
    resize: none;
    outline: none;
    tab-size: 4;
    overflow: auto;
}
#text-editor.no-wrap { white-space: pre; overflow-x: auto; }

/* Spreadsheet Editor */
.sheet-toolbar {
    padding: 8px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    z-index: 10;
}
.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 6px;
    background: var(--card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-sm:hover { background: var(--card-hover); color: var(--text); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.15); color: var(--red); }
.sheet-grid-container {
    flex: 1;
    overflow: auto;
}
.sheet-grid-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: var(--mono);
}
.sheet-grid-container thead th {
    background: var(--surface);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: center;
    min-width: 80px;
}
.sheet-grid-container td {
    padding: 0;
    border: 1px solid var(--border);
    min-width: 100px;
    height: 32px;
}
.sheet-grid-container td input {
    width: 100%;
    height: 100%;
    background: transparent;
    color: var(--text);
    border: none;
    padding: 4px 8px;
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}
.sheet-grid-container td input:focus {
    background: var(--brand-glow);
}
.sheet-grid-container .row-num {
    background: var(--surface);
    color: var(--text-muted);
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    min-width: 50px;
    max-width: 50px;
    padding: 4px;
}

/* Document (Quill) Editor */
#doc-editor-wrap {
    background: var(--bg);
}
#doc-editor-wrap .ql-toolbar {
    background: var(--surface) !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}
#doc-editor-wrap .ql-toolbar .ql-stroke { stroke: var(--text-secondary) !important; }
#doc-editor-wrap .ql-toolbar .ql-fill { fill: var(--text-secondary) !important; }
#doc-editor-wrap .ql-toolbar .ql-picker-label { color: var(--text-secondary) !important; }
#doc-editor-wrap .ql-toolbar button:hover .ql-stroke,
#doc-editor-wrap .ql-toolbar .ql-active .ql-stroke { stroke: var(--brand) !important; }
#doc-editor-wrap .ql-toolbar button:hover .ql-fill,
#doc-editor-wrap .ql-toolbar .ql-active .ql-fill { fill: var(--brand) !important; }
#doc-editor-wrap .ql-container {
    border: none !important;
    font-size: 15px;
    flex: 1;
    overflow-y: auto;
}
#doc-editor-wrap .ql-editor {
    min-height: 100%;
    color: var(--text);
    padding: 40px 60px;
    max-width: 900px;
    margin: 0 auto;
    background: var(--card);
    line-height: 1.8;
}
#doc-editor-wrap .ql-editor h1,
#doc-editor-wrap .ql-editor h2,
#doc-editor-wrap .ql-editor h3 { color: var(--text); }
#doc-editor-wrap .ql-snow .ql-picker-options {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
}
#doc-editor-wrap .ql-snow .ql-picker-options .ql-picker-item { color: var(--text) !important; }

/* Edit button on file cards */
.btn-edit { color: var(--green); }
.btn-edit:hover { color: var(--brand-light); }
