/* ═══════════════════════════════════════════════
   Sazman App - Style v120
   ═══════════════════════════════════════════════ */

@font-face {
    font-family: 'Iran';
    src: url('iran.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #0ea5e9;
    --info-light: #e0f2fe;
    --purple: #8b5cf6;

    --status-green: #10b981;
    --status-green-bg: #d1fae5;
    --status-yellow: #f59e0b;
    --status-yellow-bg: #fef3c7;
    --status-gray: #94a3b8;
    --status-gray-bg: #f1f5f9;
    --status-deleted: #ef4444;
    --status-deleted-bg: #fee2e2;

    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-hover: #f1f5f9;
    --bg-input: #ffffff;

    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border: #e2e8f0;
    --border-dark: #cbd5e1;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);

    --radius: 10px;
    --radius-lg: 16px;

    --header-h: 64px;
    --sidebar-w: 220px;
}

body.dark {
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-sidebar: #020617;
    --bg-hover: #334155;
    --bg-input: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border: #334155;
    --border-dark: #475569;
    --primary-light: #1e3a8a;
    --success-light: #064e3b;
    --danger-light: #7f1d1d;
    --warning-light: #78350f;
    --info-light: #0c4a6e;
    --status-green-bg: #064e3b;
    --status-yellow-bg: #78350f;
    --status-gray-bg: #334155;
    --status-deleted-bg: #7f1d1d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; width: 100%; }

body {
    font-family: 'Iran', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
    direction: rtl;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; cursor: pointer; }
.hidden { display: none !important; }

/* ═══ Loading ═══ */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 9999;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-inline { text-align: center; padding: 40px; color: var(--text-muted); }
.screen { height: 100vh; width: 100vw; }

/* ═══ Auth ═══ */
#login-screen, #setup-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-box {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 44px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-logo { font-size: 60px; text-align: center; margin-bottom: 16px; }
.auth-box h1 { text-align: center; font-size: 22px; margin-bottom: 6px; font-weight: 700; }
.auth-sub { text-align: center; color: var(--text-secondary); margin-bottom: 28px; font-size: 13px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    outline: none;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group input[dir="ltr"] { direction: ltr; text-align: left; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
    text-align: center;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4); }
.btn-primary.btn-auto { width: auto; }

.btn-secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

.btn-icon {
    padding: 10px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 16px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

.error-msg {
    margin-top: 12px;
    padding: 12px;
    background: var(--danger-light);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 13px;
    text-align: center;
}

/* ═══ Layout ═══ */
#app-screen {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas: "sidebar topbar" "sidebar main";
    height: 100vh;
    overflow: hidden;
}

.topbar {
    grid-area: topbar;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 16px;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.topbar-right, .topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-center { flex: 1; max-width: 480px; }
.logo { font-size: 15px; font-weight: 700; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box .search-icon { position: absolute; right: 14px; color: var(--text-muted); pointer-events: none; }

.search-box input {
    width: 100%;
    padding: 9px 40px 9px 14px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    font-size: 13px;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.user-menu { position: relative; }

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border-radius: 22px;
    background: var(--bg);
    transition: background 0.2s;
}

.user-btn:hover { background: var(--bg-hover); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.user-name { font-weight: 600; font-size: 13px; }
.user-btn .arrow { font-size: 9px; color: var(--text-muted); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 6px;
    z-index: 100;
}

.user-dropdown a {
    display: block;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.15s;
}

.user-dropdown a:hover { background: var(--bg-hover); }
.user-dropdown a.danger { color: var(--danger); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ═══ Sidebar ═══ */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-sidebar);
    padding: 20px 12px;
    overflow-y: auto;
}

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-item .icon { font-size: 18px; width: 24px; text-align: center; }

/* ═══ Main ═══ */
.main-content {
    grid-area: main;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg);
}

.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 { font-size: 20px; font-weight: 700; }

/* ═══ Today Summary ═══ */
.today-summary {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.today-summary .summary-title {
    font-weight: 700;
    color: var(--text);
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
}

.summary-item.created { background: var(--success-light); color: var(--success); }
.summary-item.modified { background: var(--info-light); color: var(--info); }
.summary-item.deleted { background: var(--danger-light); color: var(--danger); }

.summary-item.clickable {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.15s;
}

.summary-item.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.summary-item.clickable.created:hover { background: var(--success); color: white; }
.summary-item.clickable.modified:hover { background: var(--info); color: white; }
.summary-item.clickable.deleted:hover { background: var(--danger); color: white; }

/* ═══ Controls Bar ═══ */
.controls-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.view-switch {
    display: inline-flex;
    background: var(--bg);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.view-btn {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
}

.view-btn.active {
    background: var(--bg-elevated);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.filter-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-btn {
    padding: 7px 14px;
    border-radius: 18px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
    cursor: pointer;
}

.filter-btn:hover { background: var(--bg-hover); color: var(--text); }

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

.filter-select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text);
    outline: none;
    font-size: 13px;
    cursor: pointer;
    min-width: 140px;
    transition: all 0.2s;
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-clear {
    padding: 8px 16px;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s;
}

.btn-clear:hover { background: var(--danger); color: white; }

/* ═══ Breadcrumb ═══ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.breadcrumb a {
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.15s;
    font-weight: 500;
}

.breadcrumb a:hover { background: var(--primary-light); }
.breadcrumb .sep { color: var(--text-muted); font-size: 11px; }
.breadcrumb .current { font-weight: 700; padding: 4px 10px; }

/* ═══ Containers ═══ */
.tree-container, .list-container, .files-container {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-height: 200px;
}

/* ═══ Status Dot ═══ */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.green { background: var(--status-green); box-shadow: 0 0 0 3px var(--status-green-bg); }
.status-dot.yellow { background: var(--status-yellow); box-shadow: 0 0 0 3px var(--status-yellow-bg); }
.status-dot.gray { background: var(--status-gray); box-shadow: 0 0 0 3px var(--status-gray-bg); }
.status-dot.deleted { background: var(--status-deleted); }

/* ═══ Folder Row ═══ */
.folder-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
    border-right: 3px solid transparent;
}

.folder-row:hover { background: var(--bg-hover); border-right-color: var(--warning); }

.folder-row-icon {
    font-size: 22px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--warning-light);
    border-radius: 8px;
    flex-shrink: 0;
}

.folder-row-body { flex: 1; min-width: 0; }

.folder-row-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.folder-row-stats {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.folder-row-stats .ago { color: var(--text-muted); }

.folder-row-expand {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
    padding: 4px 8px;
    border-radius: 6px;
}

.folder-row.expanded .folder-row-expand { transform: rotate(180deg); }
.folder-row-expand:hover { background: var(--bg); color: var(--text); }

.folder-children { background: rgba(0,0,0,0.02); }
body.dark .folder-children { background: rgba(0,0,0,0.15); }
.folder-children.hidden { display: none; }

/* ═══ File Row Tree ═══ */
.file-row-tree {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.file-row-tree:last-child { border-bottom: none; }
.file-row-tree:hover { background: var(--bg-hover); }
.file-row-tree.deleted { background: rgba(239, 68, 68, 0.06); }
.file-row-tree.deleted .file-row-name {
    text-decoration: line-through;
    color: var(--status-deleted);
}

.file-icon {
    font-size: 20px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 8px;
    flex-shrink: 0;
}

.file-row-tree .file-icon { width: 32px; height: 32px; font-size: 18px; }
.file-row-body { flex: 1; min-width: 0; }

.file-row-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.file-row-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.file-row-size {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ═══ List View ═══ */
.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-hover); }

.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-item-path { font-size: 11px; color: var(--text-muted); direction: ltr; text-align: right; word-break: break-all; }
.list-item-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); margin-top: 4px; flex-wrap: wrap; }
.list-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.list-item-size { font-size: 12px; font-weight: 700; }

/* ═══ Badges ═══ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-created { background: var(--success-light); color: var(--success); }
.badge-modified { background: var(--info-light); color: var(--info); }
.badge-deleted { background: var(--danger-light); color: var(--danger); }

/* ═══ Timeline ═══ */
.timeline { display: flex; flex-direction: column; gap: 10px; }

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-right: 4px solid var(--border-dark);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.timeline-item:hover { transform: translateX(-3px); box-shadow: var(--shadow); }

.timeline-item.action-created { border-right-color: var(--success); }
.timeline-item.action-modified { border-right-color: var(--info); }
.timeline-item.action-deleted { border-right-color: var(--danger); }

.timeline-icon {
    font-size: 20px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

.timeline-icon.created { background: var(--success-light); }
.timeline-icon.modified { background: var(--info-light); }
.timeline-icon.deleted { background: var(--danger-light); }

.timeline-body { flex: 1; min-width: 0; }

.timeline-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ═══ Timeline Breadcrumb ═══ */
.timeline-breadcrumb {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    margin: 6px 0 8px 0;
    font-size: 12px;
    padding: 6px 10px;
    background: var(--bg);
    border-radius: 8px;
    direction: rtl;
}

.timeline-breadcrumb .bc-item {
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s;
}

.timeline-breadcrumb .bc-link {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
}

.timeline-breadcrumb .bc-link:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.timeline-breadcrumb .bc-current {
    color: var(--text);
    font-weight: 700;
    background: var(--bg-elevated);
}

.timeline-breadcrumb .bc-sep {
    color: var(--text-muted);
    font-size: 11px;
    padding: 0 2px;
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.timeline-meta .meta-item { display: inline-flex; align-items: center; gap: 4px; }

.size-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--bg);
    border-radius: 10px;
    font-weight: 600;
    font-size: 11px;
    direction: ltr;
}

.size-change .old { color: var(--text-muted); text-decoration: line-through; }
.size-change .new { color: var(--success); }
.size-change .arrow { color: var(--text-muted); }

/* ═══ Pagination ═══ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    padding: 14px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--primary); color: var(--primary); }

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { color: var(--text-secondary); font-size: 13px; padding: 0 8px; }

/* ═══ Users ═══ */
.users-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.user-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s;
}

.user-card:hover { box-shadow: var(--shadow); }

.user-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.user-card-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.user-card-info h3 { font-size: 15px; margin-bottom: 2px; font-weight: 700; }
.user-card-info p { font-size: 12px; color: var(--text-muted); direction: ltr; text-align: right; }

.user-card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

.role-admin { background: var(--danger-light); color: var(--danger); }
.role-user { background: var(--primary-light); color: var(--primary); }
.role-archive { background: var(--warning-light); color: var(--warning); }
.role-auditor { background: #ede9fe; color: var(--purple); }

.user-card-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ═══ Empty ═══ */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

/* ═══ Toast ═══ */
#toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
    border-right: 4px solid var(--info);
    font-size: 13px;
    color: var(--text);
    animation: slideIn 0.3s ease;
    min-width: 240px;
    max-width: 400px;
    font-weight: 500;
}

.toast.success { border-right-color: var(--success); }
.toast.error { border-right-color: var(--danger); }
.toast.warning { border-right-color: var(--warning); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ═══ Modal ═══ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 20px;
}

.modal {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 26px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 { font-size: 17px; margin-bottom: 18px; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }
.modal-actions-vertical { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.modal-actions-vertical .btn { width: 100%; padding: 13px; }

.file-path-box {
    margin: 14px 0;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    direction: ltr;
    text-align: left;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    word-break: break-all;
    color: var(--text-secondary);
    line-height: 1.6;
}

.file-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.file-info-row:last-child { border-bottom: none; }
.file-info-row .label { color: var(--text-muted); min-width: 90px; }
.file-info-row .value { color: var(--text); font-weight: 600; }

kbd {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 5px;
    border: 1px solid var(--border);
    font-family: monospace;
    font-size: 11px;
    color: var(--text);
    direction: ltr;
    display: inline-block;
    min-width: 22px;
    text-align: center;
    box-shadow: 0 2px 0 var(--border);
    font-weight: 600;
}

/* ═══ Responsive ═══ */
@media (max-width: 900px) {
    :root { --sidebar-w: 64px; }
    .nav-item span:not(.icon) { display: none; }
    .nav-item { justify-content: center; padding: 14px 8px; }
    .topbar-center { display: none; }
}

@media (max-width: 600px) {
    .main-content { padding: 12px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .user-name { display: none; }
    .users-list { grid-template-columns: 1fr; }
    .controls-bar { padding: 10px 12px; }
    .folder-row, .file-row-tree { padding-right: 12px !important; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }