/* ==========================================================================
   STOREME ENTERPRISE DESIGN SYSTEM (B2B SaaS - Tailwind Slate Neutral Tokens)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* --- Neutral Canvas & Surfaces (Tailwind Slate Scale) --- */
    --bg-canvas: #f8fafc;         /* Slate 50: Page body background */
    --bg-surface: #ffffff;        /* Pure white: Card, modal, table background */
    --bg-surface-subtle: #f1f5f9; /* Slate 100: Table header, secondary inputs */
    --bg-surface-hover: #f1f5f9;  /* Slate 100: Row hover, list item hover */
    --bg-surface-active: #e2e8f0; /* Slate 200: Active tab, pressed button */
    
    /* --- Borders & Dividers --- */
    --border-subtle: #f1f5f9;     /* Slate 100: Inner grid dividers */
    --border-default: #e2e8f0;    /* Slate 200: Card borders, input outlines */
    --border-strong: #cbd5e1;     /* Slate 300: Focus rings, active borders */
    
    /* --- Typography (Slate High-Contrast Scale) --- */
    --text-primary: #0f172a;      /* Slate 900: High-contrast headings & file names */
    --text-secondary: #475569;    /* Slate 600: Body labels, dates, table headers */
    --text-muted: #94a3b8;        /* Slate 400: Placeholders, empty states, icons */
    --text-inverse: #ffffff;      /* White on dark fills */
    
    /* --- Enterprise Brand Accents (Deep Corporate Blue) --- */
    --brand-primary: #2563eb;        /* Blue 600: Primary actions, brand mark */
    --brand-primary-hover: #1d4ed8;  /* Blue 700: Hover state */
    --brand-primary-subtle: #eff6ff; /* Blue 50: Selected rows, active nav items */
    --brand-primary-ring: rgba(37, 99, 235, 0.25); /* Focus outline halo */

    /* --- Legacy Aliases for Seamless Backward Compatibility --- */
    --primary: var(--brand-primary);
    --primary-hover: var(--brand-primary-hover);
    --primary-light: var(--brand-primary-subtle);
    --text-main: var(--text-primary);
    --bg-main: var(--bg-surface);
    --bg-body: var(--bg-canvas);
    --bg-hover: var(--bg-surface-hover);
    --border: var(--border-default);
    
    /* --- Semantic Status Colors --- */
    --status-success: #059669;        /* Emerald 600 */
    --status-success-bg: #ecfdf5;     /* Emerald 50 */
    --status-success-border: #a7f3d0; /* Emerald 200 */
    --status-warning: #d97706;        /* Amber 600 */
    --status-warning-bg: #fffbeb;     /* Amber 50 */
    --status-warning-border: #fde68a; /* Amber 200 */
    --status-danger: #dc2626;         /* Red 600 */
    --status-danger-hover: #b91c1c;   /* Red 700 */
    --status-danger-bg: #fef2f2;      /* Red 50 */
    --status-danger-border: #fecaca;  /* Red 200 */
    --status-info: #0284c7;           /* Sky 600 */
    --status-info-bg: #f0f9ff;        /* Sky 50 */
    --status-info-border: #bae6fd;    /* Sky 200 */
    --danger: var(--status-danger);
    
    /* --- Role Badge Tokens --- */
    --role-admin-color: #6366f1;      /* Indigo 600 */
    --role-admin-bg: #eef2ff;         /* Indigo 50 */
    --role-admin-border: #c7d2fe;     /* Indigo 200 */
    --role-uploader-color: #2563eb;   /* Blue 600 */
    --role-uploader-bg: #eff6ff;      /* Blue 50 */
    --role-uploader-border: #bfdbfe;  /* Blue 200 */
    --role-viewer-color: #475569;     /* Slate 600 */
    --role-viewer-bg: #f1f5f9;        /* Slate 100 */
    --role-viewer-border: #cbd5e1;    /* Slate 300 */
    
    /* --- Shadows & Elevations (Subtle SaaS Shadows) --- */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
    
    /* --- Radii & Layout --- */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
}

/* ================= BASE & TYPOGRAPHY RESET ================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--bg-canvas);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography Hierarchy Utilities */
.font-display { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.02em; }
.font-h1      { font-size: 18px; line-height: 26px; font-weight: 600; letter-spacing: -0.01em; }
.font-h2      { font-size: 15px; line-height: 22px; font-weight: 600; letter-spacing: -0.005em; }
.font-body    { font-size: 14px; line-height: 20px; font-weight: 400; }
.font-body-md { font-size: 14px; line-height: 20px; font-weight: 500; }
.font-caption { font-size: 12px; line-height: 16px; font-weight: 500; }
.font-overline{ font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }

.tnum {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* ================= ENTERPRISE ROLE BADGES ================= */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    user-select: none;
    transition: all 0.2s ease;
}

.role-badge .role-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.role-badge.role-admin {
    background: var(--role-admin-bg);
    color: var(--role-admin-color);
    border-color: var(--role-admin-border);
}
.role-badge.role-admin .role-dot {
    background: var(--role-admin-color);
}

.role-badge.role-uploader {
    background: var(--role-uploader-bg);
    color: var(--role-uploader-color);
    border-color: var(--role-uploader-border);
}
.role-badge.role-uploader .role-dot {
    background: var(--role-uploader-color);
}

.role-badge.role-viewer {
    background: var(--role-viewer-bg);
    color: var(--role-viewer-color);
    border-color: var(--role-viewer-border);
}
.role-badge.role-viewer .role-dot {
    background: var(--role-viewer-color);
}

/* ================= LOGIN SCREEN ================= */
#login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    display: none;
    z-index: 9999;
}

#login-overlay.active {
    display: flex;
}

.login-left-panel {
    flex: 1;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
}

.login-branding h1 {
    font-size: 44px;
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-branding p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 32px;
}

.isometric-cloud {
    margin-top: 16px;
}

.login-right-panel {
    flex: 1;
    background-color: var(--bg-canvas);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px;
}

.login-card {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-default);
    width: 100%;
    max-width: 420px;
    text-align: left;
}

.login-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 18px 14px 6px 14px;
    font-size: 14px;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-ring);
}

.input-group label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: 0.15s ease all;
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
    top: 11px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-primary);
}

.btn-primary {
    width: 100%;
    background: var(--brand-primary);
    color: white;
    border: 1px solid transparent;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-primary-ring);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-danger {
    background: var(--status-danger);
    color: #ffffff;
    border: 1px solid transparent;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

.btn-subtle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.btn-subtle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

#login-status {
    color: var(--status-danger);
    margin-top: 14px;
    font-size: 13px;
    min-height: 20px;
    font-weight: 500;
    text-align: center;
}

/* ================= DASHBOARD LAYOUT ================= */
#app-container {
    display: flex;
    height: 100vh;
    background: var(--bg-canvas);
    overflow: hidden;
}

#app-container.hidden {
    display: none;
}

/* SIDEBAR */
.sidebar {
    width: 256px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    z-index: 10;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 8px;
    gap: 10px;
}

.brand-icon {
    color: var(--brand-primary);
    font-size: 28px;
}

.brand .title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.new-btn-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.new-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all 0.15s ease;
    width: 100%;
}

.new-btn:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-strong);
    background: var(--bg-surface-hover);
}

.new-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-primary-ring);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-links li {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-links li:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-links li.active {
    background: var(--brand-primary-subtle);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-links li .material-icons {
    margin-right: 12px;
    font-size: 20px;
}

/* STORAGE CAPACITY METER */
.storage-info {
    margin-top: auto;
    background: var(--bg-surface);
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.storage-info:hover {
    border-color: var(--border-strong);
}

.storage-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.progress-bar {
    height: 8px;
    background: var(--bg-surface-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.progress {
    height: 100%;
    background: var(--brand-primary);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* Multi-Segmented Storage Bar */
.storage-progress-segmented {
    display: flex;
    height: 8px;
    background: var(--bg-surface-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}
.storage-seg {
    height: 100%;
    transition: width 0.3s ease;
}
.storage-seg-video    { background: #f43f5e; } /* Rose */
.storage-seg-image    { background: #a855f7; } /* Purple */
.storage-seg-doc      { background: #3b82f6; } /* Blue */
.storage-seg-audio    { background: #eab308; } /* Yellow */
.storage-seg-other    { background: #64748b; } /* Slate */

#storage-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ================= MAIN CONTENT & FILE EXPLORER ================= */
.main-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    margin: 16px; /* Symmetric clean margin */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-default);
    height: calc(100vh - 32px);
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.content-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg-surface);
    flex-shrink: 0;
}

.path-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 14px;
}

.breadcrumb {
    background: var(--bg-surface-subtle);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.breadcrumb:hover {
    background: var(--brand-primary-subtle);
    color: var(--brand-primary);
    border-color: var(--brand-primary-ring);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    width: 320px;
    transition: all 0.15s ease;
}

.search-bar:focus-within {
    background: var(--bg-surface);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-ring);
}

.search-bar input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    width: 100%;
    color: var(--text-primary);
}

.search-bar .material-icons {
    color: var(--text-muted);
    font-size: 18px;
}

.avatar {
    width: 34px;
    height: 34px;
    background: var(--brand-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    user-select: none;
    flex-shrink: 0;
}

/* ================= ENTERPRISE DATA TABLE ================= */
.file-view {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* STICKY 40PX TABLE HEADER */
.list-header {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 24px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface-subtle);
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 5;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
    flex-shrink: 0;
}

.col-check {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.col-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--brand-primary);
}

.col-name {
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
}

.col-owner {
    width: 140px;
    flex-shrink: 0;
    padding-right: 12px;
}

.col-modified {
    width: 160px;
    flex-shrink: 0;
    padding-right: 12px;
}

.col-size {
    width: 100px;
    text-align: right;
    flex-shrink: 0;
    padding-right: 16px;
    font-variant-numeric: tabular-nums;
}

.col-actions {
    width: 110px;
    text-align: right;
    flex-shrink: 0;
}

/* 44PX CLEAN ROW HEIGHT WITH NO TRANSFORM JITTER */
.file-row {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background-color 0.1s ease;
    user-select: none;
}

/* ELIMINATED transform: scale(1.005) - NO SUBPIXEL JITTER */
.file-row:hover {
    background-color: var(--bg-surface-hover);
}

.file-row.selected {
    background-color: var(--brand-primary-subtle);
    border-left: 3px solid var(--brand-primary);
    padding-left: 21px; /* Offset for left border */
}

.file-row .col-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-row .file-type-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-right: 8px;
}

.file-row .col-owner,
.file-row .col-modified,
.file-row .col-size {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

/* ROW QUICK ACTIONS (HOVER) */
.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.file-row:hover .row-actions {
    opacity: 1;
}

.row-action-btn {
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    padding: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.row-action-btn:hover {
    background-color: var(--bg-surface-active);
    color: var(--brand-primary);
}

.row-action-btn.btn-danger-action:hover {
    background-color: var(--status-danger-bg);
    color: var(--status-danger);
}

/* ================= TOP BATCH ACTION BAR ================= */
/* Seamless header replacement when files are selected */
.top-batch-bar {
    display: none;
    align-items: center;
    height: 40px;
    padding: 0 24px;
    background: var(--brand-primary-subtle);
    border-bottom: 1px solid var(--brand-primary);
    position: sticky;
    top: 0;
    z-index: 6;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 500;
}

.top-batch-bar.active {
    display: flex;
}

.top-batch-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.batch-count-badge {
    font-weight: 600;
    color: var(--text-primary);
}

.top-batch-divider {
    height: 20px;
    width: 1px;
    background: rgba(37, 99, 235, 0.3);
    margin: 0 8px;
}

.top-batch-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.batch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.batch-btn:hover {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

.batch-btn.batch-btn-danger:hover {
    background: var(--status-danger);
    color: #ffffff;
    border-color: var(--status-danger);
}

.batch-btn .material-icons {
    font-size: 16px;
}

/* Deprecate floating dock without breaking fallback */
.action-bar {
    display: none !important;
}

/* ================= FULL WINDOW DRAG & DROP ZONE ================= */
#drop-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(239, 246, 255, 0.85);
    backdrop-filter: blur(4px);
    border: 2px dashed var(--brand-primary);
    border-radius: var(--radius-lg);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#drop-overlay.active {
    display: flex;
}

#drop-overlay .drop-icon {
    font-size: 56px;
    color: var(--brand-primary);
    margin-bottom: 12px;
}

#drop-overlay .drop-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

#drop-overlay .drop-sub {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ================= MULTI-FILE UPLOAD DRAWER ================= */
.upload-drawer {
    position: fixed;
    bottom: 0;
    right: 24px;
    width: 380px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.upload-drawer.active {
    display: flex;
}

.upload-drawer.minimized .upload-drawer-body {
    display: none;
}

.upload-drawer-header {
    background: var(--text-primary);
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
}

.upload-drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-drawer-header-actions .material-icons {
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.15s ease;
}
.upload-drawer-header-actions .material-icons:hover {
    opacity: 1;
}

.upload-drawer-body {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px 16px;
    background: var(--bg-surface);
}

.upload-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.upload-drawer-item:last-child {
    border-bottom: none;
}

.upload-item-icon {
    font-size: 24px;
    color: var(--brand-primary);
    flex-shrink: 0;
}

.upload-item-details {
    flex: 1;
    min-width: 0;
}

.upload-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-item-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.upload-item-progress-bar {
    height: 4px;
    background: var(--bg-surface-subtle);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.upload-item-progress-fill {
    height: 100%;
    background: var(--brand-primary);
    transition: width 0.15s linear;
}

.upload-item-progress-fill.done {
    background: var(--status-success);
}

.upload-item-cancel {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    transition: color 0.15s ease;
    flex-shrink: 0;
}
.upload-item-cancel:hover {
    color: var(--status-danger);
}

/* ================= ENTERPRISE MODALS & DIALOGS ================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border-default);
    animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.modal-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* DESTRUCTIVE DELETE MODAL */
.destructive-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.destructive-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--status-danger-bg);
    border: 1px solid var(--status-danger-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--status-danger);
    flex-shrink: 0;
}
.destructive-icon-wrap .material-icons {
    font-size: 22px;
}

/* ADMIN USER MANAGEMENT MODAL */
.admin-users-card {
    max-width: 680px;
    width: 90%;
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 13px;
}

.admin-users-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-surface-subtle);
    border-bottom: 1px solid var(--border-default);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-users-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.admin-add-user-form {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-default);
    align-items: flex-end;
}

.admin-add-user-form .form-group {
    flex: 1;
}

.admin-add-user-form label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.admin-add-user-form input,
.admin-add-user-form select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
}

/* ================= TOAST NOTIFICATION SYSTEM ================= */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-default);
    min-width: 300px;
    max-width: 420px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast .toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    transition: color 0.15s ease;
}
.toast-close:hover {
    color: var(--text-primary);
}

.toast.toast-success {
    border-left: 4px solid var(--status-success);
}
.toast.toast-success .toast-icon { color: var(--status-success); }

.toast.toast-error {
    border-left: 4px solid var(--status-danger);
}
.toast.toast-error .toast-icon { color: var(--status-danger); }

.toast.toast-warning {
    border-left: 4px solid var(--status-warning);
}
.toast.toast-warning .toast-icon { color: var(--status-warning); }

.toast.toast-info {
    border-left: 4px solid var(--brand-primary);
}
.toast.toast-info .toast-icon { color: var(--brand-primary); }

/* ================= DETAILS PANEL ================= */
.details-panel {
    width: 320px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-default);
    display: none;
    flex-direction: column;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.details-panel.active {
    display: flex;
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 50%;
    transition: background 0.15s ease;
}
.close-btn:hover { background: var(--bg-surface-hover); }

.panel-body {
    padding: 20px;
}

.detail-preview {
    height: 160px;
    background: var(--bg-surface-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border: 1px solid var(--border-default);
}
.detail-preview .material-icons {
    font-size: 64px;
    color: var(--text-muted);
}

.props-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prop-row {
    margin-bottom: 12px;
}
.prop-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 2px;
    text-transform: uppercase;
}
.prop-value {
    font-size: 13px;
    color: var(--text-primary);
    word-break: break-all;
    font-variant-numeric: tabular-nums;
}

.download-btn {
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    background: var(--bg-surface);
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary-ring);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s ease;
}
.download-btn:hover {
    background: var(--brand-primary-subtle);
    border-color: var(--brand-primary);
}

#download-progress {
    font-size: 12px;
    color: var(--brand-primary);
    margin-top: 8px;
    text-align: center;
}

/* CONTEXT MENU */
.context-menu {
    position: absolute;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-default);
    padding: 6px;
    min-width: 200px;
    z-index: 1000;
    display: none;
}
.context-menu.active { display: block; }
.shadow-menu { box-shadow: var(--shadow-lg); }

.menu-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.1s ease;
}
.menu-item:hover { background: var(--bg-surface-hover); }
.menu-item.danger-item { color: var(--status-danger); }
.menu-item.danger-item .material-icons { color: var(--status-danger); }
.menu-item.danger-item:hover { background: var(--status-danger-bg); }

.menu-divider {
    height: 1px;
    background: var(--border-default);
    margin: 6px 0;
}

/* FULLSCREEN PREVIEW MODAL */
#preview-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(9, 13, 22, 0.95);
    z-index: 99999;
    display: none;
    flex-direction: column;
}
#preview-modal .modal-header {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    background: rgba(15, 23, 42, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.header-left, .header-right { display: flex; align-items: center; gap: 16px; }
.icon-btn { color: white; cursor: pointer; padding: 8px; border-radius: 50%; transition: background 0.15s ease; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.15); }
#preview-content { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: hidden; }
#preview-filename { font-size: 16px; font-weight: 600; }

/* DOWNLOAD PROGRESS WIDGET */
#download-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    background: var(--bg-surface);
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 320px;
    border: 1px solid var(--border-default);
}
.dl-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.dl-info #dl-filename {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}
.dl-progress-bar-container {
    height: 6px;
    background: var(--bg-surface-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}
#dl-progress-bar {
    height: 100%;
    background: var(--brand-primary);
    width: 0%;
    transition: width 0.1s linear;
}
.dl-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.hidden { display: none !important; }

/* READ-ONLY / VIEWER RESTRICTION STATE */
.readonly-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-surface-subtle);
    border-radius: var(--radius-sm);
    margin-left: 8px;
}
