/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --primary-muted: #c7d2fe;
  --sidebar-bg: #0f0f13;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(99,102,241,0.18);
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-text: #8b8fa8;
  --sidebar-text-active: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --bg: #f5f5f7;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --text: #111827;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --success: #059669;
  --success-bg: #d1fae5;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --info-bg: #eff6ff;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.05), 0 20px 60px rgba(0,0,0,0.12);
  --sidebar-width: 232px;
  --header-height: 52px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
input::placeholder { color: var(--text-subtle); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: -0.01em;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79,70,229,0.25);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 6px rgba(79,70,229,0.35); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg); border-color: #d1d5db; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 1px 2px rgba(220,38,38,0.2); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { color: var(--text-muted); padding: 6px 10px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); }
.btn-icon:hover { background: var(--bg); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ============================================================
   LAYOUT
   ============================================================ */
#app { min-height: 100vh; }

.app-shell {
  display: grid;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-areas:
    "header header"
    "sidebar main";
  min-height: 100vh;
}

/* HEADER */
.app-header {
  grid-area: header;
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.app-logo .logo-mark {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; letter-spacing: -0.5px;
  box-shadow: 0 0 0 1px rgba(79,70,229,0.5);
}
.app-logo .logo-name { font-size: 15px; color: #f1f1f3; }
.app-logo .logo-name span { opacity: 0.45; font-weight: 400; }

.header-spacer { flex: 1; }

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  color: #e2e2e8;
  position: relative;
}
.user-menu:hover { background: rgba(255,255,255,0.08); }
.user-avatar {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  color: #fff;
  letter-spacing: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: #e2e2e8; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  overflow: hidden;
  z-index: 200;
}
.user-dropdown-info {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}
.user-dropdown-info .name { font-weight: 600; color: var(--text); font-size: 13px; }
.user-dropdown-info .email { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.user-dropdown a, .user-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 16px;
  color: var(--text);
  font-size: 13px;
  transition: background 0.1s;
  text-decoration: none;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--surface-2); }
.user-dropdown .logout-btn { color: var(--danger); }

/* SIDEBAR */
.app-sidebar {
  grid-area: sidebar;
  background: var(--sidebar-bg);
  overflow-y: auto;
  padding: 12px 0;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #3d3d52;
  padding: 14px 14px 5px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
  border-radius: 0;
  width: 100%;
  text-align: left;
  letter-spacing: -0.01em;
}
.sidebar-nav-item:hover { background: var(--sidebar-hover); color: #d4d4e8; }
.sidebar-nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text-active); }
.sidebar-nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.sidebar-nav-item.active svg { opacity: 1; }

/* Folder tree */
.folder-tree { padding: 2px 0; }
.folder-tree-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 5px 8px;
  color: var(--sidebar-text);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
  letter-spacing: -0.01em;
}
.folder-tree-item:hover { background: var(--sidebar-hover); color: #d4d4e8; }
.folder-tree-item.active { background: var(--sidebar-active); color: #fff; }
.folder-tree-item .expand-btn {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  color: inherit; opacity: 0.5; flex-shrink: 0;
  transition: transform 0.15s;
}
.folder-tree-item .expand-btn.open { transform: rotate(90deg); }
.folder-tree-item .expand-btn svg { width: 10px; height: 10px; }
.folder-tree-item .folder-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.85; }
.folder-tree-item .folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-subtree { overflow: hidden; }

/* MAIN CONTENT */
.app-main {
  grid-area: main;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.main-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}
.breadcrumb-item {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.1s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: -0.01em;
}
.breadcrumb-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.breadcrumb-item:hover { background: var(--border-light); color: var(--text); }
.breadcrumb-item.current { color: var(--text); font-weight: 600; cursor: default; }
.breadcrumb-item.current:hover { background: none; }
.breadcrumb-sep { color: #d1d5db; font-size: 14px; user-select: none; padding: 0 1px; }

.toolbar-actions { display: flex; align-items: center; gap: 8px; }

.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.2; margin-bottom: 16px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 320px; color: var(--text-muted); line-height: 1.6; }

/* ============================================================
   FILE GRID
   ============================================================ */
.file-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 10px;
  margin-top: 4px;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 13px 11px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  user-select: none;
  box-shadow: var(--shadow-sm);
}
.file-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #e0e0ef;
  transform: translateY(-1px);
}
.file-card.selected { border-color: var(--primary); background: var(--primary-light); }

.file-card-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
}
.file-card-icon svg { width: 36px; height: 36px; }

.file-card-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.file-card-meta {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: auto;
}

.file-card-actions {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  gap: 1px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.file-card:hover .file-card-actions { display: flex; }
.file-card-actions button {
  padding: 5px 6px;
  color: var(--text-muted);
  transition: all 0.1s;
  border-right: 1px solid var(--border-light);
  display: flex; align-items: center;
}
.file-card-actions button:last-child { border-right: none; }
.file-card-actions button:hover { background: var(--bg); color: var(--text); }
.file-card-actions button svg { width: 13px; height: 13px; }
.file-card-actions .danger-btn:hover { background: var(--danger-bg); color: var(--danger); }

/* Folder card icon */
.folder-card .file-card-icon svg { color: #f59e0b; }

/* ============================================================
   DRAG & DROP UPLOAD ZONE
   ============================================================ */
.drop-zone {
  border: 2px dashed #e0e0ea;
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer;
  margin-bottom: 20px;
  background: linear-gradient(180deg, #fafbff 0%, var(--surface) 100%);
  font-size: 13px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.drop-zone svg { margin-bottom: 6px; opacity: 0.4; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0a14 0%, #12122a 50%, #0d1526 100%);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.05);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 100%);
  padding: 36px 32px 30px;
  text-align: center;
  color: #fff;
}
.login-logo-mark {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.15);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 22px; font-weight: 800;
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
}
.login-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.login-header p { font-size: 13px; opacity: 0.65; margin-top: 5px; }

.login-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.login-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.login-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--surface);
}

.login-form { padding: 28px 32px 32px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 8px; }
.login-submit { width: 100%; margin-top: 8px; padding: 10px; font-size: 14px; border-radius: var(--radius-sm); }

/* ============================================================
   VIEWER PAGE
   ============================================================ */
.viewer-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
}

.viewer-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0 20px;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.viewer-header .back-btn { color: var(--primary); }
.viewer-title { font-weight: 600; font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.viewer-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.viewer-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.viewer-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

/* Public viewer */
.public-viewer {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.public-viewer-banner {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 100%);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.public-viewer-banner .logo { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.public-viewer-banner .file-info { flex: 1; }
.public-viewer-banner .file-name { font-weight: 600; font-size: 14px; }
.public-viewer-banner .file-meta { font-size: 12px; opacity: 0.7; margin-top: 2px; }
.public-viewer-banner .actions { display: flex; gap: 8px; flex-shrink: 0; }
.public-viewer-banner .actions .btn { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.25); }
.public-viewer-banner .actions .btn:hover { background: rgba(255,255,255,0.25); }
.public-viewer-frame { flex: 1; border: none; width: 100%; }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--primary); letter-spacing: -0.03em; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.data-table th {
  background: var(--surface-2);
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfd; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-admin { background: var(--primary-light); color: var(--primary); }
.badge-user { background: #f3f4f6; color: var(--text-muted); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }

/* ============================================================
   SHARED WITH ME
   ============================================================ */
.shared-list { display: flex; flex-direction: column; gap: 8px; }
.shared-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.shared-item:hover { box-shadow: var(--shadow); border-color: #d4d4ef; transform: translateY(-1px); }
.shared-item-icon { flex-shrink: 0; color: var(--primary); }
.shared-item-info { flex: 1; min-width: 0; }
.shared-item-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.shared-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.shared-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.06);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; flex: 1; letter-spacing: -0.02em; }
.modal-close-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.1s;
}
.modal-close-btn:hover { background: var(--bg); color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--surface-2);
}

/* Share modal */
.share-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.share-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 10px;
}
.share-link-box {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-link-box input {
  font-size: 12px;
  background: var(--bg);
  color: var(--text-muted);
}
.share-user-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.share-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--border-light);
}
.share-user-row .share-user-info { flex: 1; }
.share-user-row .share-user-name { font-weight: 600; letter-spacing: -0.01em; }
.share-user-row .share-user-email { color: var(--text-muted); font-size: 11px; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  min-width: 240px;
  max-width: 360px;
  pointer-events: all;
  animation: slideIn 0.2s cubic-bezier(0.16,1,0.3,1);
  border: 1px solid transparent;
}
.toast-success { background: #f0fdf4; color: #14532d; border-color: #bbf7d0; }
.toast-error { background: #fff5f5; color: #7f1d1d; border-color: #fecaca; }
.toast-info { background: #f0f1ff; color: #312e81; border-color: #c7d2fe; }

@keyframes slideIn {
  from { transform: translateX(100%) scale(0.95); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to { transform: translateX(100%) scale(0.95); opacity: 0; }
}
.toast.removing { animation: slideOut 0.2s cubic-bezier(0.16,1,0.3,1) forwards; }

/* ============================================================
   PROGRESS / LOADING
   ============================================================ */
.loading-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

/* ============================================================
   UPLOAD PROGRESS
   ============================================================ */
.upload-progress {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.upload-progress-name { font-size: 12px; font-weight: 600; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.progress-bar { background: var(--bg); border-radius: 999px; height: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #818cf8); border-radius: 999px; transition: width 0.3s; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  margin-bottom: 20px;
}
.page-title { font-size: 19px; font-weight: 700; letter-spacing: -0.03em; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.mt-12 { margin-top: 12px; }
.mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dde0e7; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #bcc1cc; }
