/* ============================================================
   Wild Group S.r.l. — Dashboard Gestionale File
   Design: Desktop-first, responsive mobile
   Palette: Neutri + accenti per aree aziendali
   ============================================================ */

/* ── Google Font Import ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
  /* Base */
  --font: 'Inter', system-ui, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --transition: .18s ease;

  /* Colors — Light */
  --bg-base: #f5f5f7;
  --bg-card: #ffffff;
  --bg-sidebar: #1c1c1e;
  --bg-sidebar-hover: #2c2c2e;
  --bg-sidebar-active: #3a3a3c;
  --bg-overlay: rgba(0,0,0,.5);

  --text-primary: #1c1c1e;
  --text-secondary: #6e6e73;
  --text-muted: #aeaeb2;
  --text-sidebar: #ebebf0;
  --text-sidebar-muted: #8e8e93;

  --border: #e5e5ea;
  --border-light: #f2f2f7;

  /* Brand accent */
  --accent: #0071e3;
  --accent-hover: #0064c8;
  --accent-light: #e8f1fb;
  --accent-text: #0071e3;

  /* Area colors */
  --area-wma: #ff6b35;       /* Wild Media Agency — arancione */
  --area-wma-bg: #fff4f0;
  --area-ihs: #5856d6;       /* Italia Health Summit — viola */
  --area-ihs-bg: #f2f1ff;
  --area-hpa: #30d158;       /* Health Pro Academy — verde */
  --area-hpa-bg: #edfaf1;
  --area-amm: #0071e3;       /* Amministrazione — blu */
  --area-amm-bg: #e8f1fb;
  --area-default: #8e8e93;
  --area-default-bg: #f2f2f7;

  /* File type badges */
  --badge-sheets: #188038;
  --badge-sheets-bg: #e6f4ea;
  --badge-docs: #1a73e8;
  --badge-docs-bg: #e8f0fe;
  --badge-slides: #e07400;
  --badge-slides-bg: #fef3e2;
  --badge-pdf: #d93025;
  --badge-pdf-bg: #fce8e6;
  --badge-link: #8e8e93;
  --badge-link-bg: #f2f2f7;
  --badge-folder: #5856d6;
  --badge-folder-bg: #f2f1ff;
  --badge-drive: #fbbc04;
  --badge-drive-bg: #fef9e5;

  /* Sidebar */
  --sidebar-w: 260px;
  --sidebar-collapsed: 64px;
  --header-h: 64px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ── Typography ── */
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p  { line-height: 1.6; }

/* ── Scrollbar (desktop) ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d1d6; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #aeaeb2; }

/* ══════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════ */
#login-page {
  display: none;
  min-height: 100vh;
  background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 50%, #1c1c1e 100%);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 32px;
  padding: 24px;
}
#login-page.visible { display: flex; }

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

.login-logo {
  width: 56px;
  height: 56px;
  background: var(--text-primary);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  letter-spacing: -1px;
}

.login-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-card .subtitle {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 36px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: .8rem;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-google:hover {
  background: var(--bg-base);
  border-color: #ccc;
  box-shadow: var(--shadow-sm);
}
.btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(0,113,227,.3); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--bg-base);
  color: var(--text-primary);
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  border: 1.5px solid var(--border);
  cursor: pointer;
}
.btn-secondary:hover { background: var(--border-light); border-color: #ccc; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}
.btn-ghost:hover { background: var(--bg-base); color: var(--text-primary); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: #fce8e6;
  color: #d93025;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
}
.btn-danger:hover { background: #fad2cf; }

.login-footer {
  color: var(--text-sidebar-muted);
  font-size: .78rem;
  text-align: center;
}

/* Form elements */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input::placeholder { color: var(--text-muted); }

/* ══════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════ */
#app {
  display: none;
  height: 100vh;
  overflow: hidden;
}
#app.visible { display: flex; }

/* ══════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width var(--transition);
  position: relative;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-h);
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .75rem;
  color: var(--text-primary);
  letter-spacing: -1px;
  flex-shrink: 0;
}

.sidebar-brand {
  flex: 1;
  min-width: 0;
}
.sidebar-brand h2 {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-sidebar);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand span {
  font-size: .7rem;
  color: var(--text-sidebar-muted);
}

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

.nav-section { margin-bottom: 4px; }

.nav-section-label {
  padding: 6px 20px 4px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-sidebar-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition);
  color: var(--text-sidebar);
  font-size: .875rem;
  font-weight: 400;
  position: relative;
  user-select: none;
}
.nav-item:hover { background: var(--bg-sidebar-hover); }
.nav-item.active {
  background: var(--bg-sidebar-active);
  color: #fff;
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .7;
}
.nav-item.active .icon,
.nav-item:hover .icon { opacity: 1; }

.nav-item .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-item .count {
  font-size: .7rem;
  font-weight: 600;
  background: rgba(255,255,255,.1);
  color: var(--text-sidebar-muted);
  padding: 2px 7px;
  border-radius: 99px;
}
.nav-item.active .count {
  background: rgba(0,113,227,.2);
  color: #5ac8fa;
}

/* Area dot color indicator */
.area-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Folder sub-items */
.nav-sub { padding-left: 12px; overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-sub.open { max-height: 500px; }
.nav-sub .nav-item { font-size: .82rem; padding-left: 32px; }

.nav-toggle {
  margin-left: auto;
  width: 16px; height: 16px;
  opacity: .5;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.nav-item.expanded .nav-toggle { transform: rotate(90deg); }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 14px 20px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 8px;
  transition: background var(--transition);
}
.user-pill:hover { background: var(--bg-sidebar-hover); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { flex: 1; min-width: 0; }
.user-info .name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-sidebar);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .role {
  font-size: .7rem;
  color: var(--text-sidebar-muted);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.role-badge.admin { background: rgba(255,107,53,.2); color: #ff9f7a; }
.role-badge.manager { background: rgba(88,86,214,.2); color: #a29dff; }
.role-badge.collaborator { background: rgba(48,209,88,.2); color: #6bde8e; }

/* ══════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
.header {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}

.header-breadcrumb {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  color: var(--text-secondary);
}
.header-breadcrumb .current {
  font-weight: 600;
  color: var(--text-primary);
}
.header-breadcrumb .sep { opacity: .4; }

.header-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
.header-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: .875rem;
  background: var(--bg-base);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
}
.header-search input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.header-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  display: none;
}
.search-results-dropdown.visible { display: block; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: .875rem;
}
.search-result-item:hover { background: var(--bg-base); }
.search-result-item .sr-name { flex: 1; font-weight: 500; }
.search-result-item .sr-area { font-size: .75rem; color: var(--text-secondary); }

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

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
}
.mobile-menu-btn:hover { background: var(--bg-base); }

/* ── Content Area ── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-header h2 { font-size: 1rem; font-weight: 600; }
.section-header .actions { display: flex; gap: 8px; }

/* ── Stats Bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }

.stat-info .value {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
}
.stat-info .label {
  font-size: .75rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.stat-info .trend {
  font-size: .7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 3px;
}
.trend.up { color: #30d158; }
.trend.neutral { color: var(--text-muted); }

/* ── Folder Grid ── */
.folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.folder-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  user-select: none;
}
.folder-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--folder-color, var(--area-default));
  border-radius: var(--radius) var(--radius) 0 0;
}
.folder-card:hover {
  box-shadow: var(--shadow);
  border-color: #ccc;
  transform: translateY(-2px);
}
.folder-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.folder-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: var(--folder-color-bg, var(--area-default-bg));
}
.folder-icon svg { width: 20px; height: 20px; color: var(--folder-color, var(--area-default)); }

.folder-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-meta {
  font-size: .75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.folder-actions {
  position: absolute;
  top: 10px; right: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}
.folder-card:hover .folder-actions { opacity: 1; }
.folder-action-btn {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}
.folder-action-btn:hover { background: var(--bg-base); color: var(--text-primary); }
.folder-action-btn.danger:hover { background: #fce8e6; color: #d93025; border-color: #fad2cf; }
.folder-action-btn svg { width: 13px; height: 13px; }

/* ── Files Table ── */
.files-section { }

.files-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-chip:hover { border-color: #bbb; color: var(--text-primary); }
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.files-table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

.files-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.files-table th:hover { color: var(--text-primary); }
.files-table th.sorted { color: var(--accent); }

.files-table td {
  padding: 12px 16px;
  font-size: .875rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.files-table tr:last-child td { border-bottom: none; }
.files-table tr:hover td { background: #fafafa; }

.file-row { cursor: pointer; transition: background var(--transition); }

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.file-name-cell .file-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-name-cell .file-icon svg { width: 16px; height: 16px; }
.file-name-cell .name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.file-name-cell .file-star {
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
  flex-shrink: 0;
}
.file-name-cell .file-star:hover,
.file-name-cell .file-star.starred { color: #ff9500; }

/* Type Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-sheets { background: var(--badge-sheets-bg); color: var(--badge-sheets); }
.badge-docs   { background: var(--badge-docs-bg);   color: var(--badge-docs);   }
.badge-slides { background: var(--badge-slides-bg); color: var(--badge-slides); }
.badge-pdf    { background: var(--badge-pdf-bg);    color: var(--badge-pdf);    }
.badge-link   { background: var(--badge-link-bg);   color: var(--badge-link);   }
.badge-drive  { background: var(--badge-drive-bg);  color: #b88a00;             }
.badge-folder { background: var(--badge-folder-bg); color: var(--badge-folder); }

/* Area pill */
.area-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
}

.file-actions-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}
.files-table tr:hover .file-actions-cell { opacity: 1; }
.file-action-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.file-action-btn:hover { background: var(--bg-base); color: var(--text-primary); }
.file-action-btn.danger:hover { background: #fce8e6; color: #d93025; }
.file-action-btn svg { width: 14px; height: 14px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin: 0 auto 12px; display: block; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.empty-state p { font-size: .85rem; }

/* ══════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.visible { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.modal.modal-lg { max-width: 680px; }
.modal.modal-sm { max-width: 380px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-base); color: var(--text-primary); }
.modal-close svg { width: 16px; height: 16px; }

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

/* Color Picker */
.color-picker-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text-primary); }

/* Tabs inside modal */
.modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.modal-tab {
  padding: 8px 16px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }

/* ══════════════════════════════════════════════════
   USERS PAGE
══════════════════════════════════════════════════ */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.user-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-card .avatar-lg {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.user-card .avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.user-card-info { flex: 1; min-width: 0; }
.user-card-info .name { font-weight: 600; font-size: .9rem; }
.user-card-info .email { font-size: .78rem; color: var(--text-secondary); margin-top: 2px; }
.user-card-info .areas { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.user-card-actions { display: flex; gap: 6px; }

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

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--text-primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 380px;
  animation: toastIn .25s ease;
  pointer-events: all;
}
.toast.success { background: #1c4a27; border-left: 3px solid #30d158; }
.toast.error   { background: #4a1c1c; border-left: 3px solid #ff453a; }
.toast.info    { background: #1c2e4a; border-left: 3px solid #0a84ff; }
.toast.warning { background: #4a3419; border-left: 3px solid #ff9f0a; }
.toast.fade-out { animation: toastOut .3s ease forwards; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* ══════════════════════════════════════════════════
   DROPDOWN MENUS
══════════════════════════════════════════════════ */
.dropdown {
  position: relative;
  display: inline-flex;
}
.dropdown-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  min-width: 180px;
  overflow: hidden;
  display: none;
  animation: dropdownIn .15s ease;
}
.dropdown-menu.visible { display: block; }

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: .875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--bg-base); }
.dropdown-item.danger { color: #d93025; }
.dropdown-item.danger:hover { background: #fce8e6; }
.dropdown-item svg { width: 15px; height: 15px; }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ══════════════════════════════════════════════════
   MOBILE OVERLAY
══════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ══════════════════════════════════════════════════
   SETUP BANNER
══════════════════════════════════════════════════ */
.setup-banner {
  background: linear-gradient(135deg, #fff9e6 0%, #fff3cc 100%);
  border: 1.5px solid #ffcc00;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.setup-banner .icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.setup-banner h3 { font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.setup-banner p { font-size: .8rem; color: var(--text-secondary); line-height: 1.5; }
.setup-banner code {
  background: rgba(0,0,0,.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .78rem;
  font-family: 'Courier New', monospace;
}
.setup-banner a { color: var(--accent); text-decoration: underline; }

/* ══════════════════════════════════════════════════
   LOADING SPINNER
══════════════════════════════════════════════════ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.85);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  display: none;
}
.loading-overlay.visible { display: flex; }
.loading-overlay .spinner { width: 36px; height: 36px; border-width: 3px; }
.loading-overlay p { font-size: .9rem; color: var(--text-secondary); }

/* ══════════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-secondary);
}
.pagination-btns { display: flex; gap: 4px; }
.page-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}
.page-btn:hover { background: var(--bg-base); color: var(--text-primary); }
.page-btn.active { background: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .4; pointer-events: none; }

/* ══════════════════════════════════════════════════
   RESPONSIVE — TABLET
══════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .folders-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0; bottom: 0;
    z-index: 200;
    transition: left .25s ease;
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay { display: block; }
  .mobile-menu-btn { display: flex; }

  .header { padding: 0 16px; }
  .header-breadcrumb { display: none; }
  .content { padding: 16px; }

  .files-table .col-area,
  .files-table .col-added { display: none; }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — MOBILE
══════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-info .value { font-size: 1.2rem; }

  .folders-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

  .files-table .col-modified { display: none; }

  .header-search { max-width: 100%; }

  .modal { padding: 20px 16px; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn-primary,
  .modal-footer .btn-secondary { width: 100%; justify-content: center; }

  #toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { min-width: unset; }

  .login-card { padding: 32px 24px; }
}

/* ══════════════════════════════════════════════════
   UTILITY CLASSES
══════════════════════════════════════════════════ */
.hidden { display: none !important; }
.view { display: none; }
.view.active { display: block; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.mt-0 { margin-top: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
