/* ── Altumatim File Portal ── */

/* ══════════════════════════════════════════
   DESIGN TOKENS — Light Theme (default)
   ══════════════════════════════════════════ */

:root {
    /* Brand */
    --orange: #ff7800;
    --orange-hover: #e66d00;
    --orange-subtle: rgba(255, 120, 0, 0.1);
    --green: #059669;
    --red: #dc2626;
    --red-hover: #b91c1c;

    /* Sidebar (always dark) */
    --sidebar-bg: #070b1a;
    --sidebar-bg-light: #0f1629;
    --sidebar-bg-mid: #1a2236;
    --sidebar-border: #252f45;
    --sidebar-text: #e2e8f0;
    --sidebar-text-secondary: #90a1b9;
    --sidebar-text-muted: #62748e;

    /* Surfaces */
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --hover-bg: #f8fafc;

    /* Text */
    --text-heading: #1a1a2e;
    --text-body: #374151;
    --text-secondary: #475569;
    --text-muted: #6b7280;
    --text-faint: #94a3b8;
    --text-table-header: #64748b;

    /* Borders */
    --border: #e5e7eb;
    --border-light: #f1f5f9;
    --border-input: #d1d5db;
    --border-dropzone: #cbd5e1;

    /* Buttons */
    --btn-login-bg: #45556c;
    --btn-login-hover: #374151;
    --btn-cancel-bg: #f1f5f9;
    --btn-cancel-text: #475569;
    --btn-cancel-hover: #e2e8f0;

    /* Flash / Banners */
    --flash-error-bg: #fef2f2;
    --flash-error-border: #fca5a5;
    --flash-error-text: #b91c1c;
    --flash-success-bg: #f0fdf4;
    --flash-success-border: #86efac;
    --flash-success-text: #15803d;
    --banner-bg: #fef3c7;
    --banner-border: #fcd34d;
    --banner-text: #92400e;
    --banner-text-secondary: #b45309;

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 40px rgba(0, 0, 0, 0.3);
    --shadow-modal: 0 12px 40px rgba(0, 0, 0, 0.15);

    /* File preview */
    --file-preview-bg: rgba(255, 120, 0, 0.1);
    --file-preview-text: #e66d00;

    /* Delete button */
    --btn-delete-bg: rgba(220, 38, 38, 0.08);
    --btn-logout-hover-bg: rgba(220, 38, 38, 0.08);

    /* Disk */
    --disk-warning: #eab308;

    /* Typography */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;

    /* Spacing (4px grid) */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ══════════════════════════════════════════
   DARK THEME
   ══════════════════════════════════════════ */

[data-theme="dark"] {
    /* Surfaces */
    --bg: #0c0f1a;
    --card-bg: #141827;
    --input-bg: #0f1322;
    --hover-bg: #1a2035;

    /* Text */
    --text-heading: #e2e8f0;
    --text-body: #c1cad6;
    --text-secondary: #8e9bb3;
    --text-muted: #6b7a94;
    --text-faint: #4a576d;
    --text-table-header: #8e9bb3;

    /* Borders */
    --border: #252d40;
    --border-light: #1c2333;
    --border-input: #2d3650;
    --border-dropzone: #2d3650;

    /* Buttons */
    --btn-login-bg: #2d3650;
    --btn-login-hover: #3d4a6a;
    --btn-cancel-bg: #1c2333;
    --btn-cancel-text: #c1cad6;
    --btn-cancel-hover: #252d40;

    /* Flash / Banners */
    --flash-error-bg: rgba(220, 38, 38, 0.1);
    --flash-error-border: rgba(220, 38, 38, 0.3);
    --flash-error-text: #fca5a5;
    --flash-success-bg: rgba(5, 150, 105, 0.1);
    --flash-success-border: rgba(5, 150, 105, 0.3);
    --flash-success-text: #86efac;
    --banner-bg: rgba(251, 191, 36, 0.1);
    --banner-border: rgba(251, 191, 36, 0.3);
    --banner-text: #fcd34d;
    --banner-text-secondary: #fbbf24;

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-modal: 0 12px 40px rgba(0, 0, 0, 0.4);

    /* File preview */
    --file-preview-bg: rgba(255, 120, 0, 0.15);
    --file-preview-text: #ff7800;

    /* Delete button */
    --btn-delete-bg: rgba(220, 38, 38, 0.15);
    --btn-logout-hover-bg: rgba(220, 38, 38, 0.15);

    --orange-subtle: rgba(255, 120, 0, 0.15);
}

/* ══════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════ */

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

[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    min-height: 100vh;
}

/* ══════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════ */

.login-body {
    background: #070b1a;
    background-image: url('https://storage.googleapis.com/altumatim-cdn/hero-img.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#constellation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--sp-4);
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--sp-10);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--sp-2);
}

.login-logo img {
    height: 40px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--sp-8);
    font-size: var(--text-base);
}

/* ── Theme toggle (login page) ── */

.theme-toggle-login {
    position: fixed;
    top: var(--sp-4);
    right: var(--sp-4);
    z-index: 10;
}

/* ── Forms ── */

.form-group {
    margin-bottom: var(--sp-4);
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--sp-2);
    color: var(--text-body);
}

.form-group input {
    width: 100%;
    padding: var(--sp-3);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    transition: border-color 0.2s;
    background: var(--input-bg);
    color: var(--text-body);
}

.form-group input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(255, 120, 0, 0.12);
}

/* ── Buttons ── */

.btn {
    display: inline-block;
    padding: var(--sp-2) var(--sp-5);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-login {
    background: var(--btn-login-bg);
    color: #ffffff;
    width: 100%;
    padding: var(--sp-3);
    margin-top: var(--sp-3);
    font-size: 1rem;
    border-radius: var(--radius-sm);
}

.btn-login:hover {
    background: var(--btn-login-hover);
}

.btn-primary {
    background: var(--orange);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--orange-hover);
}

.btn-secondary {
    background: var(--sidebar-bg-mid);
    color: var(--sidebar-text);
}

.btn-secondary:hover {
    background: var(--sidebar-border);
}

.header-actions {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.btn-danger {
    background: var(--red);
    color: #ffffff;
}

.btn-danger:hover {
    background: var(--red-hover);
}

.btn-ghost {
    background: var(--orange-subtle);
    color: var(--orange);
    font-weight: 600;
}

.btn-ghost:hover {
    background: var(--orange);
    color: #ffffff;
}

.btn-ghost-danger {
    background: var(--btn-delete-bg);
    color: var(--red);
    font-weight: 600;
}

.btn-ghost-danger:hover {
    background: var(--red);
    color: #ffffff;
}

.action-cell {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.inline-form {
    display: inline;
}

.modal-warning {
    color: var(--red);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--sp-4);
}

.upload-btn-wrapper {
    text-align: center;
    margin: var(--sp-5) 0;
}

.btn-upload {
    padding: var(--sp-3) var(--sp-10);
}

/* ── Theme Toggle Button ── */

.btn-theme {
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text-secondary);
    padding: var(--sp-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.btn-theme:hover {
    background: var(--sidebar-bg-light);
    color: var(--sidebar-text);
}

.btn-theme svg {
    width: 18px;
    height: 18px;
}

/* ── Overflow Dropdown ── */

.dropdown {
    position: relative;
}

.btn-more {
    background: var(--sidebar-bg-mid);
    color: var(--sidebar-text);
    padding: var(--sp-2) var(--sp-3);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.1em;
    transition: background 0.2s;
}

.btn-more:hover {
    background: var(--sidebar-border);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + var(--sp-1));
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    min-width: 200px;
    z-index: 60;
    padding: var(--sp-1) 0;
}

.dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: var(--sp-2) var(--sp-4);
    background: none;
    border: none;
    text-align: left;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-body);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--hover-bg);
}

.dropdown-item-danger {
    color: var(--red);
}

.dropdown-item-danger:hover {
    background: var(--btn-delete-bg);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: var(--sp-1) 0;
}

/* Show/hide icons based on theme */
.theme-icon-dark { display: block; }
.theme-icon-light { display: none; }

[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: block; }

/* ── Flash Messages ── */

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    margin-bottom: var(--sp-4);
    font-size: var(--text-sm);
    cursor: pointer;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 var(--sp-3);
    opacity: 0.6;
    color: inherit;
}

.flash-close:hover {
    opacity: 1;
}

.flash-error,
.flash-message {
    background: var(--flash-error-bg);
    border: 1px solid var(--flash-error-border);
    color: var(--flash-error-text);
}

.flash-success {
    background: var(--flash-success-bg);
    border: 1px solid var(--flash-success-border);
    color: var(--flash-success-text);
}

/* ══════════════════════════════════════════
   PORTAL PAGE — SIDEBAR LAYOUT
   ══════════════════════════════════════════ */

.portal-body {
    background: var(--bg);
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
}

.sidebar-logo {
    padding: var(--sp-5) var(--sp-5) var(--sp-4);
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo img {
    height: 28px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--sp-3) 0;
    overflow-y: auto;
}

.nav-section-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text-muted);
    padding: var(--sp-4) var(--sp-5) var(--sp-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-5);
    color: var(--sidebar-text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--sidebar-bg-light);
    color: var(--sidebar-text);
}

.nav-item.active {
    background: var(--orange-subtle);
    color: var(--orange);
    border-left-color: var(--orange);
}

.nav-sub {
    padding-left: var(--sp-10);
    font-size: var(--text-xs);
}

.nav-sub svg {
    width: 15px;
    height: 15px;
}

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: var(--sp-3) 0;
}

.sidebar-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-2) var(--sp-5);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--sidebar-text-secondary);
    overflow: hidden;
}

.sidebar-user svg {
    width: 18px;
    height: 18px;
}

.sidebar-user small {
    color: var(--sidebar-text-muted);
    font-weight: 400;
}

.nav-logout {
    color: var(--sidebar-text-muted);
}

.nav-logout:hover {
    color: var(--red);
    background: var(--btn-logout-hover-bg);
}

/* ── Main Content ── */

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: var(--sp-8);
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--sp-12);
    margin-bottom: var(--sp-6);
}

.content-header h1 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-heading);
}

/* ── Dashboard Stats ── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.2;
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--sp-1);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 500;
}

.stat-card-disk {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.stat-disk-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-btn-group {
    display: flex;
    gap: var(--sp-1);
}

.disk-stats-mini {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-4);
}

.card-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-heading);
}

@media (max-width: 900px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

/* ── Cards ── */

.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    margin-bottom: var(--sp-5);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* ── Upload Dropzone ── */

.dropzone {
    border: 2px dashed var(--border-dropzone);
    border-radius: var(--radius-md);
    padding: var(--sp-10) var(--sp-6);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--card-bg);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--orange);
    background: rgba(255, 120, 0, 0.03);
}

.dropzone-icon {
    width: 44px;
    height: 44px;
    color: var(--text-faint);
    margin-bottom: var(--sp-3);
}

.dropzone-text {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.browse-link {
    color: var(--orange);
    font-weight: 600;
    cursor: pointer;
}

.browse-link:hover {
    text-decoration: underline;
}

.dropzone-hint {
    font-size: var(--text-xs);
    color: var(--text-faint);
    margin-top: var(--sp-2);
}

/* ── Selected Files Preview ── */

.file-list-preview {
    margin: var(--sp-3) var(--sp-5) 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.file-preview-item {
    background: var(--file-preview-bg);
    color: var(--file-preview-text);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
}

/* ── Upload Progress Bar ── */

.progress-container {
    padding: var(--sp-5);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--sp-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-body);
}

.progress-bar-track {
    background: var(--border);
    border-radius: var(--radius-sm);
    height: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    background: var(--orange);
    height: 100%;
    width: 0%;
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
}

.progress-bar-fill.progress-complete {
    background: var(--green);
}

.progress-bar-fill.progress-error {
    background: var(--red);
}

/* ── Disk Management Card ── */

.disk-card {
    margin-top: var(--sp-6);
}

.disk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-4);
}

.disk-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-heading);
}

.btn-sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--text-xs);
}

.disk-bar-container {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.disk-bar {
    background: var(--border);
    border-radius: var(--radius-sm);
    height: 10px;
    overflow: hidden;
}

.disk-bar-fill {
    background: var(--orange);
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.5s ease;
}

.disk-bar-fill.disk-warning {
    background: var(--disk-warning);
}

.disk-bar-fill.disk-critical {
    background: var(--red);
}

.disk-stats {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.progress-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--sp-2);
}

.progress-detail {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.progress-controls {
    display: flex;
    gap: var(--sp-2);
    flex-shrink: 0;
}

/* ── Resume Banner ── */

.resume-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-5);
    background: var(--banner-bg);
    border: 1px solid var(--banner-border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--sp-4);
}

.resume-info {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--banner-text);
}

.resume-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--banner-text);
}

.resume-detail {
    font-size: var(--text-xs);
    color: var(--banner-text-secondary);
    margin-top: var(--sp-1);
}

.resume-actions {
    display: flex;
    gap: var(--sp-2);
    flex-shrink: 0;
}

/* ── Breadcrumbs ── */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    margin-bottom: var(--sp-4);
    font-size: var(--text-sm);
}

.breadcrumbs a {
    color: var(--orange);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.bc-sep {
    color: var(--text-faint);
}

.bc-current {
    color: var(--text-body);
    font-weight: 600;
}

/* ── Folder links ── */

.folder-link {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--text-heading);
    text-decoration: none;
    font-weight: 500;
}

.folder-link:hover {
    color: var(--orange);
}

.folder-icon {
    width: 18px;
    height: 18px;
    color: var(--orange);
    flex-shrink: 0;
}

.text-muted {
    color: var(--text-faint);
    font-size: var(--text-sm);
}

/* ── Mode Toggle ── */

.mode-toggle {
    margin: var(--sp-4) 0;
    padding: var(--sp-3) var(--sp-4);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.mode-toggle-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.mode-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-body);
}

.mode-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--sp-2);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--orange);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--sidebar-bg-mid);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ── File Table ── */

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table thead {
    border-bottom: 1px solid var(--border);
}

.file-table th {
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-table-header);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.file-table td {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--border-light);
    font-size: var(--text-sm);
    color: var(--text-body);
}

.file-table tbody tr:hover {
    background: var(--hover-bg);
}

.file-name {
    font-weight: 500;
    color: var(--text-heading);
    word-break: break-all;
}

.no-files {
    text-align: center;
    color: var(--text-faint);
    padding: var(--sp-8);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--sp-12) var(--sp-8);
    text-align: center;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    color: var(--text-faint);
    margin-bottom: var(--sp-4);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: var(--sp-1);
}

.empty-state-hint {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--sp-5);
}

/* ── Modal ── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: var(--sp-4);
}

.modal-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--sp-8);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-modal);
}

.modal-card h2 {
    font-size: var(--text-lg);
    margin-bottom: var(--sp-1);
    color: var(--text-heading);
}

.modal-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--sp-5);
}

.modal-card select {
    width: 100%;
    padding: var(--sp-3);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    background: var(--input-bg);
    color: var(--text-body);
}

.modal-actions {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-3);
}

.modal-actions .btn-primary {
    flex: 1;
}

.btn-cancel {
    background: var(--btn-cancel-bg);
    color: var(--btn-cancel-text);
    flex: 1;
}

.btn-cancel:hover {
    background: var(--btn-cancel-hover);
}

/* ── Loading Spinner ── */

.btn-loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    margin-left: var(--sp-2);
    vertical-align: middle;
    animation: spin 0.6s linear infinite;
}

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

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-faint);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Table Scroll ── */

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Hamburger ── */

.hamburger {
    display: none;
    position: fixed;
    top: var(--sp-3);
    left: var(--sp-3);
    z-index: 60;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    padding: var(--sp-2);
    cursor: pointer;
}

.hamburger svg {
    width: 20px;
    height: 20px;
    display: block;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .sidebar-overlay {
        display: none;
    }

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

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

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

    .main-content {
        margin-left: 0;
        padding: var(--sp-4);
        padding-top: calc(var(--sp-12) + var(--sp-4));
    }

    .portal-body {
        flex-direction: column;
    }

    .content-header {
        flex-wrap: wrap;
        gap: var(--sp-2);
    }

    .header-actions {
        flex-wrap: wrap;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .content-header h1 {
        font-size: var(--text-lg);
    }
}