/* ============================================================
   ARCHIVAGE SYSTEM - Global Stylesheet
   Black & White Futuristic Theme
   ============================================================ */

:root {
    --bg-dark:       #0a0a0a;
    --bg-panel:      #111111;
    --bg-card:       #161616;
    --bg-hover:      #1e1e1e;
    --bg-input:      #1a1a1a;
    --border:        #2a2a2a;
    --border-light:  #333333;
    --text-primary:  #f0f0f0;
    --text-secondary:#a0a0a0;
    --text-muted:    #555555;
    --accent:        #ffffff;
    --accent-dim:    #cccccc;
    --danger:        #e53e3e;
    --danger-dim:    #c53030;
    --success:       #38a169;
    --warning:       #d69e2e;
    --info:          #3182ce;
    --sidebar-w:     260px;
    --sidebar-w-col: 70px;
    --header-h:      60px;
    --radius:        8px;
    --radius-lg:     12px;
    --shadow:        0 4px 24px rgba(0,0,0,0.6);
    --transition:    0.25s ease;
}

/* ============================================================
   LIGHT THEME
   ============================================================ */

body.theme-light {
    --bg-dark:       #f0f0f0;
    --bg-panel:      #ffffff;
    --bg-card:       #fafafa;
    --bg-hover:      #f2f2f2;
    --bg-input:      #ffffff;
    --border:        #e0e0e0;
    --border-light:  #cccccc;
    --text-primary:  #111111;
    --text-secondary:#444444;
    --text-muted:    #999999;
    --accent:        #111111;
    --accent-dim:    #333333;
    --shadow:        0 4px 24px rgba(0,0,0,0.1);
}

body.theme-light .sidebar-toggle { background: var(--bg-panel); }
body.theme-light select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23444' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); }
body.theme-light .stat-card:hover { box-shadow: 0 0 0 1px var(--border-light), 0 4px 16px rgba(0,0,0,0.08); }
body.theme-light .topbar, body.theme-light .sidebar { box-shadow: 0 1px 0 var(--border); }
body.theme-light .welcome-progress-bar { background: #111; }

/* Theme toggle button */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent-dim); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }

/* ============================================================
   LAYOUT
   ============================================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: width var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-w-col);
}

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

.sidebar-logo .logo-box {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo .logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-logo .logo-text {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition);
}

.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.sidebar-toggle {
    position: absolute;
    top: 18px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    color: var(--text-secondary);
    z-index: 10;
    transition: background var(--transition), color var(--transition);
}

.sidebar-toggle:hover { background: var(--bg-hover); color: var(--accent); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 20px 6px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    border-left: 3px solid transparent;
    white-space: nowrap;
    position: relative;
}

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

.nav-item.active {
    background: var(--bg-hover);
    color: var(--accent);
    border-left-color: var(--accent);
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-item .nav-label {
    opacity: 1;
    transition: opacity var(--transition);
    overflow: hidden;
}

.sidebar.collapsed .nav-label { opacity: 0; width: 0; }

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    line-height: 1;
}

.sidebar.collapsed .nav-badge { display: none; }

/* Tooltip on collapsed */
.sidebar.collapsed .nav-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-w-col) + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: var(--radius);
    white-space: nowrap;
    z-index: 300;
    pointer-events: none;
    box-shadow: var(--shadow);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.sidebar-footer .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    flex-shrink: 0;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    overflow: hidden;
}

.sidebar-footer .user-info {
    flex: 1;
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar.collapsed .sidebar-footer .user-info { opacity: 0; width: 0; }

.sidebar-footer .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer .user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: margin-left var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-w-col);
}

/* ============================================================
   HEADER
   ============================================================ */

.topbar {
    height: var(--header-h);
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.topbar-btn:hover { background: var(--bg-hover); color: var(--accent); }

.topbar-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */

.page-content {
    padding: 28px 28px 40px;
    flex: 1;
}

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

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-header .page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   CARDS & STATS
   ============================================================ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--border-light);
    box-shadow: 0 0 0 1px var(--border-light), var(--shadow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover::before { opacity: 0.3; }

.stat-card .card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
}

.stat-card .card-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    line-height: 1;
}

.stat-card .card-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.stat-card .card-trend {
    font-size: 11px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-card .card-trend.down { color: var(--danger); }

/* ============================================================
   TABLES
   ============================================================ */

.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.table-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

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

thead th {
    background: var(--bg-hover);
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }

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

tbody td {
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody td:first-child { color: var(--text-primary); font-weight: 500; }

.table-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: var(--bg-dark); }

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

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-dim); }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
}

/* ============================================================
   BADGES & PILLS
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-admin    { background: rgba(255,255,255,0.1); color: var(--accent); border: 1px solid var(--border-light); }
.badge-collab   { background: rgba(56,161,105,0.15); color: #68d391; border: 1px solid rgba(56,161,105,0.3); }
.badge-lecteur  { background: rgba(49,130,206,0.15); color: #63b3ed; border: 1px solid rgba(49,130,206,0.3); }
.badge-active   { background: rgba(56,161,105,0.15); color: #68d391; border: 1px solid rgba(56,161,105,0.3); }
.badge-locked   { background: rgba(229,62,62,0.15); color: #fc8181; border: 1px solid rgba(229,62,62,0.3); }
.badge-warning  { background: rgba(214,158,46,0.15); color: #f6e05e; border: 1px solid rgba(214,158,46,0.3); }
.badge-destroyed{ background: rgba(229,62,62,0.15); color: #fc8181; border: 1px solid rgba(229,62,62,0.3); }

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--border-light);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    transform: translateY(16px);
    transition: transform var(--transition);
}

.modal-overlay.active .modal { transform: translateY(0); }

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 20px 24px; }

.modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success { background: rgba(56,161,105,0.1); border-color: rgba(56,161,105,0.3); color: #68d391; }
.alert-danger   { background: rgba(229,62,62,0.1); border-color: rgba(229,62,62,0.3); color: #fc8181; }
.alert-warning  { background: rgba(214,158,46,0.1); border-color: rgba(214,158,46,0.3); color: #f6e05e; }
.alert-info     { background: rgba(49,130,206,0.1); border-color: rgba(49,130,206,0.3); color: #63b3ed; }

/* ============================================================
   FILE EXPLORER
   ============================================================ */

.explorer-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    flex-wrap: wrap;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-muted); font-size: 11px; }
.breadcrumb .current { color: var(--text-primary); font-weight: 600; }

.view-toggle { display: flex; gap: 4px; }
.view-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all var(--transition);
}
.view-btn.active, .view-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }

.explorer-body {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    min-height: 300px;
    padding: 16px;
}

/* Grid view */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.file-item {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    position: relative;
}

.file-item:hover {
    border-color: var(--border-light);
    background: var(--bg-panel);
    transform: translateY(-1px);
}

.file-item .file-icon {
    font-size: 36px;
    line-height: 1;
}

.file-item .file-name {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
    line-height: 1.3;
}

.file-item .file-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.file-item .file-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    gap: 4px;
}

.file-item:hover .file-actions { display: flex; }

.file-action-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all var(--transition);
}

.file-action-btn:hover { color: var(--accent); border-color: var(--accent); }
.file-action-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

/* List view */
.file-list .file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    transition: background var(--transition);
    cursor: pointer;
}

.file-list .file-row:hover { background: var(--bg-hover); }

.file-list .file-row .file-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.file-list .file-row .file-name { flex: 1; font-size: 13.5px; color: var(--text-primary); font-weight: 500; }
.file-list .file-row .file-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.file-list .file-row .file-size { font-size: 12px; color: var(--text-muted); width: 70px; text-align: right; }
.file-list .file-row .row-actions { display: flex; gap: 4px; }

/* ============================================================
   WELCOME OVERLAY
   ============================================================ */

#welcome-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity 0.6s ease;
}

#welcome-overlay.fade-out { opacity: 0; pointer-events: none; }

.welcome-logo {
    width: 80px;
    height: 80px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 8px;
    overflow: hidden;
}

.welcome-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#welcome-overlay h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.04em;
}

#welcome-overlay p {
    font-size: 14px;
    color: var(--text-muted);
}

.welcome-progress {
    width: 200px;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    margin-top: 12px;
    overflow: hidden;
}

.welcome-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 1px;
    width: 0;
    animation: progress-fill 10s linear forwards;
}

@keyframes progress-fill { to { width: 100%; } }

/* ============================================================
   EXPIRY POPUP
   ============================================================ */

#expiry-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-panel);
    border: 1px solid var(--warning);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    max-width: 360px;
    z-index: 400;
    box-shadow: var(--shadow);
    display: none;
}

#expiry-popup.show { display: block; animation: slideInUp 0.3s ease; }

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

#expiry-popup .popup-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--warning);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#expiry-popup .popup-body { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
#expiry-popup .popup-link { font-size: 12px; color: var(--accent); margin-top: 10px; display: inline-block; }
#expiry-popup .popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    padding: 20px;
}

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

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-box {
    width: 60px;
    height: 60px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    overflow: hidden;
}

.login-logo .logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-logo h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.05em; }
.login-logo p  { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.1em; }

/* ============================================================
   DASHBOARD FUTURISTIC ELEMENTS
   ============================================================ */

.dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.activity-feed {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.activity-feed-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.activity-feed-header h3 { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.activity-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 12.5px;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-light);
    flex-shrink: 0;
    margin-top: 4px;
}

.activity-dot.upload   { background: var(--success); }
.activity-dot.delete   { background: var(--danger); }
.activity-dot.login    { background: var(--info); }
.activity-dot.view     { background: var(--text-muted); }
.activity-dot.create   { background: var(--warning); }

.activity-text { color: var(--text-secondary); line-height: 1.4; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; margin-top: 2px; }

.radar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.radar-card h3 { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.mini-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.mini-stat:last-child { border-bottom: none; }
.mini-stat .label { font-size: 12px; color: var(--text-muted); }
.mini-stat .value { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.progress-bar-wrapper {
    background: var(--bg-hover);
    border-radius: 2px;
    height: 4px;
    margin-top: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    transition: width 1s ease;
}

/* ============================================================
   PROFILE / AVATAR
   ============================================================ */

.avatar-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 2px solid var(--border-light);
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-muted);
    overflow: hidden;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================================
   FOOTER
   ============================================================ */

.app-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================================
   UTILITIES
   ============================================================ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-w-col); }
    .sidebar .logo-text,
    .sidebar .nav-label,
    .sidebar .nav-badge,
    .sidebar .nav-section-label,
    .sidebar .user-info { opacity: 0; width: 0; }
    .main-content { margin-left: var(--sidebar-w-col); }

    .dash-grid { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
    .file-grid { grid-template-columns: repeat(2, 1fr); }

    .topbar-title { font-size: 13px; }
    .login-card { padding: 28px 20px; }

    table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}
