/* ─── VARIABLES ──────────────────────────────────────────────────────────── */
:root {
  --blue-50:  #EFF6FF;
  --blue-100: #DBEAFE;
  --blue-600: #2563EB;
  --blue-700: #1D4ED8;
  --blue-800: #1E40AF;
  --navy:     #0F2D5A;
  --navy-light: #1A3F7A;

  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;

  --green-50:  #F0FDF4;
  --green-600: #16A34A;
  --red-50:    #FEF2F2;
  --red-600:   #DC2626;
  --red-700:   #B91C1C;
  --orange-500: #F97316;
  --purple-600: #9333EA;
  --yellow-500: #EAB308;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --nav-h: 60px;
  --sidebar-w: 260px;
  --admin-sidebar-w: 220px;

  --transition: 0.18s ease;
}

/* ─── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; color: var(--gray-900); background: var(--gray-50); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }

/* ─── SCROLLBAR ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── TOP NAV ────────────────────────────────────────────────────────────── */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--navy);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), var(--shadow-sm);
}
.topnav--admin { background: #1A1A2E; }

.topnav__left  { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topnav__center { flex: 1; max-width: 480px; margin: 0 auto; }
.topnav__right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }

.topnav__brand {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-weight: 700; font-size: 1.05rem;
  text-decoration: none; white-space: nowrap;
}
.topnav__brand i { font-size: 1.2rem; color: #93C5FD; }
.topnav__brand:hover { text-decoration: none; }

.topnav__sep { color: rgba(255,255,255,.3); }
.topnav__site-link { color: rgba(255,255,255,.7); font-size: .875rem; }
.topnav__site-link:hover { color: #fff; text-decoration: none; }

.topnav__hamburger {
  display: none; background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 1.2rem; padding: 6px; border-radius: var(--radius-sm);
}
.topnav__hamburger:hover { background: rgba(255,255,255,.1); color: #fff; }

.topnav__admin-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.9);
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500; text-decoration: none;
  transition: background var(--transition);
}
.topnav__admin-btn:hover { background: rgba(255,255,255,.18); text-decoration: none; }

/* ─── SEARCH ─────────────────────────────────────────────────────────────── */
.search-form { width: 100%; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; color: var(--gray-400); font-size: .9rem; pointer-events: none; }
.search-input {
  width: 100%; padding: 8px 36px 8px 36px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15);
  border-radius: 99px; color: #fff; font-size: .9rem;
  transition: all var(--transition);
}
.search-input::placeholder { color: rgba(255,255,255,.5); }
.search-input:focus { outline: none; background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.3); }
.search-clear {
  position: absolute; right: 12px; color: rgba(255,255,255,.6);
  font-size: .85rem; line-height: 1;
}
.search-clear:hover { color: #fff; text-decoration: none; }

.search-wrap--sm .search-input { background: #fff; color: var(--gray-900); border-color: var(--gray-300); border-radius: var(--radius-sm); padding: 7px 12px 7px 34px; }
.search-wrap--sm .search-icon { color: var(--gray-400); }
.search-wrap--sm .search-input:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-50); }

/* ─── USER MENU ──────────────────────────────────────────────────────────── */
.user-menu { position: relative; }
.user-menu__trigger {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.1); border: none;
  padding: 6px 12px 6px 6px; border-radius: 99px;
  color: #fff; transition: background var(--transition);
}
.user-menu__trigger:hover { background: rgba(255,255,255,.18); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue-600); color: #fff;
  font-size: .8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-avatar--sm { width: 28px; height: 28px; font-size: .75rem; }
.user-name { font-size: .875rem; font-weight: 500; }
.user-chevron { font-size: .7rem; color: rgba(255,255,255,.6); transition: transform var(--transition); }
.user-menu.is-open .user-chevron { transform: rotate(180deg); }

.user-menu__dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200); min-width: 200px; overflow: hidden;
  z-index: 200;
}
.user-menu.is-open .user-menu__dropdown { display: block; }
.user-menu__header { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
.user-menu__header strong { display: block; color: var(--gray-900); font-size: .9rem; }
.user-menu__header span { color: var(--gray-500); font-size: .8rem; }
.user-menu__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--gray-700); font-size: .9rem;
  transition: background var(--transition); text-decoration: none;
}
.user-menu__item:hover { background: var(--gray-50); text-decoration: none; }
.user-menu__item--danger { color: var(--red-600); }
.user-menu__item--danger:hover { background: var(--red-50); }

/* ─── APP LAYOUT ─────────────────────────────────────────────────────────── */
.app-body { background: var(--gray-100); }
.app-layout { display: flex; min-height: 100vh; padding-top: var(--nav-h); }

/* ─── SIDEBAR ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--gray-200);
  position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h));
  overflow-y: auto; transition: transform var(--transition);
}
.sidebar__nav { padding: 16px 8px; }
.sidebar__home {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--gray-700); font-weight: 500; font-size: .9rem;
  margin-bottom: 4px; text-decoration: none; transition: all var(--transition);
}
.sidebar__home:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-900); }
.sidebar__home.is-active { background: var(--blue-50); color: var(--blue-700); }
.sidebar__section-label {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gray-400);
  padding: 16px 12px 6px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 99; top: var(--nav-h);
}

/* ─── FOLDER TREE ─────────────────────────────────────────────────────────── */
.folder-list { list-style: none; }
.folder-list--root { }
.folder-list .folder-list { display: none; margin-left: 0; }
.folder-item.is-open > .folder-list { display: block; }

.folder-item { }
.folder-link {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  color: var(--gray-700); font-size: .875rem;
  text-decoration: none; transition: all var(--transition);
  position: relative;
}
.folder-link:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.folder-item.is-active > .folder-link { background: var(--blue-50); color: var(--blue-700); font-weight: 600; }
.folder-item.is-active > .folder-link i.fa-folder { color: var(--blue-600); }

.folder-toggle {
  cursor: pointer; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--gray-400); font-size: .65rem;
  border-radius: 4px; transition: all var(--transition); margin-left: 4px;
}
.folder-toggle:hover { background: var(--gray-200); color: var(--gray-700); }
.folder-toggle.placeholder { pointer-events: none; }
.folder-item.is-open > .folder-toggle { transform: rotate(90deg); }

/* Indentation for nested folder links */
.folder-list .folder-list .folder-link { padding-left: 28px; }
.folder-list .folder-list .folder-list .folder-link { padding-left: 44px; }
.folder-list .folder-list .folder-list .folder-list .folder-link { padding-left: 60px; }

/* ─── MAIN CONTENT ───────────────────────────────────────────────────────── */
.main-content { flex: 1; min-width: 0; }
.content-header { padding: 24px 28px 0; }
.content-title { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); }
.content-subtitle { color: var(--gray-500); margin-top: 4px; }
.content-body { padding: 20px 28px 40px; }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: .85rem; color: var(--gray-500); flex-wrap: wrap;
}
.breadcrumb a { color: var(--gray-500); text-decoration: none; }
.breadcrumb a:hover { color: var(--blue-600); }
.breadcrumb span { color: var(--gray-900); font-weight: 500; }
.breadcrumb i.fa-chevron-right { font-size: .65rem; }

.section-label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); margin-bottom: 12px; }

.section-divider { display: flex; align-items: center; gap: 12px; margin: 28px 0 16px; }
.section-divider span { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); white-space: nowrap; }
.section-divider::before, .section-divider::after { content:''; flex:1; height:1px; background: var(--gray-200); }

.results-count { font-size: .875rem; color: var(--gray-500); margin-bottom: 16px; }

/* ─── FOLDER GRID ────────────────────────────────────────────────────────── */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.folder-grid--home { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.folder-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 20px 12px 16px;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); text-decoration: none;
  transition: all var(--transition); text-align: center;
  box-shadow: var(--shadow-sm);
}
.folder-card:hover { border-color: var(--blue-200, #BFDBFE); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.folder-card--large { padding: 24px 16px 20px; }
.folder-card__icon { font-size: 2rem; color: var(--blue-600); }
.folder-card--large .folder-card__icon { font-size: 2.4rem; }
.folder-card__name { font-size: .875rem; font-weight: 600; color: var(--gray-900); line-height: 1.3; word-break: break-word; }
.folder-card__meta { font-size: .75rem; color: var(--gray-400); margin-top: 2px; }

/* ─── FILE GRID ──────────────────────────────────────────────────────────── */
.file-grid { display: flex; flex-direction: column; gap: 8px; }

.file-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.file-card:hover { border-color: var(--gray-300); box-shadow: var(--shadow); }

.file-card__icon-wrap { flex-shrink: 0; }
.file-card__icon { font-size: 2rem; color: #E53E3E; }
.file-card__body { flex: 1; min-width: 0; }
.file-card__name { font-size: .95rem; font-weight: 600; color: var(--gray-900); margin-bottom: 2px; word-break: break-word; }
.file-card__desc { font-size: .825rem; color: var(--gray-500); margin-top: 2px; }
.file-card__meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 6px; font-size: .78rem; color: var(--gray-400);
}
.file-card__meta span { display: flex; align-items: center; gap: 4px; }
.file-card__folder { color: var(--blue-600); }
.file-card__folder i { font-size: .7rem; }

.file-card__download {
  flex-shrink: 0; width: 36px; height: 36px;
  background: var(--blue-600); color: #fff;
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  font-size: .9rem; transition: background var(--transition); text-decoration: none; margin-top: 2px;
}
.file-card__download:hover { background: var(--blue-700); text-decoration: none; }

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-state--sm { padding: 40px 20px; }
.empty-state__icon { font-size: 2.5rem; color: var(--gray-300); }
.empty-state h3 { font-size: 1.1rem; color: var(--gray-700); }
.empty-state p { color: var(--gray-400); font-size: .9rem; max-width: 320px; }

/* ─── AUTH PAGES ─────────────────────────────────────────────────────────── */
.auth-body { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 50%, #1D4ED8 100%); min-height: 100vh; display: flex; flex-direction: column; }
.auth-wrapper { display: flex; align-items: center; justify-content: center; flex: 1; padding: 20px; width: 100%; }
.auth-card { background: #fff; border-radius: var(--radius-xl); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-card--wide { max-width: 580px; }
.auth-logo { width: 56px; height: 56px; background: var(--blue-50); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.auth-logo i { font-size: 1.6rem; color: var(--blue-700); }
.auth-title { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); }
.auth-subtitle { color: var(--gray-500); margin-top: 4px; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-footer { text-align: center; font-size: .875rem; color: var(--gray-500); margin-top: 20px; }
.auth-link { color: var(--blue-600); font-weight: 500; }
.auth-link:hover { color: var(--blue-700); }
.auth-success-state { text-align: center; padding: 20px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.success-icon { width: 60px; height: 60px; background: var(--blue-50); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.success-icon i { font-size: 1.8rem; color: var(--blue-600); }
.auth-success-state h2 { font-size: 1.3rem; color: var(--gray-900); }
.auth-success-state p { color: var(--gray-500); font-size: .9rem; max-width: 320px; }

/* ─── FORM ELEMENTS ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label { display: block; font-size: .875rem; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-hint { color: var(--gray-400); font-weight: 400; font-size: .8rem; }
.required { color: var(--red-600); }

.form-input {
  display: block; width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: .95rem; color: var(--gray-900); background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-50); }
.form-input::placeholder { color: var(--gray-400); }

.form-select {
  display: block; width: 100%; padding: 9px 32px 9px 12px;
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: .95rem; color: var(--gray-900); background: #fff;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 20px;
  cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition);
}
.form-select:focus { outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-50); }
.form-select--sm { padding: 7px 28px 7px 10px; font-size: .875rem; }

.form-textarea { resize: vertical; min-height: 60px; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 24px; }

.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: .9rem; pointer-events: none; }
.input-with-icon { padding-left: 36px; }
.input-toggle-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--gray-400); padding: 4px; border-radius: 4px; }
.input-toggle-btn:hover { color: var(--gray-600); }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; border: none;
  cursor: pointer; text-decoration: none; transition: all var(--transition);
  white-space: nowrap; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn--full { width: 100%; justify-content: center; }
.btn--sm { padding: 5px 10px; font-size: .8rem; border-radius: var(--radius-sm); }

.btn--primary { background: var(--blue-600); color: #fff; }
.btn--primary:hover { background: var(--blue-700); }

.btn--outline { background: transparent; color: var(--blue-600); border: 1.5px solid var(--blue-600); }
.btn--outline:hover { background: var(--blue-50); }

.btn--ghost { background: transparent; color: var(--gray-600); border: 1.5px solid var(--gray-200); }
.btn--ghost:hover { background: var(--gray-100); color: var(--gray-900); border-color: var(--gray-300); }

.btn--danger { background: var(--red-600); color: #fff; }
.btn--danger:hover { background: var(--red-700); }

.btn--danger-ghost { color: var(--red-600); border-color: var(--gray-200); }
.btn--danger-ghost:hover { background: var(--red-50); border-color: var(--red-600); }

.btn--success { background: var(--green-600); color: #fff; }
.btn--success:hover { background: #15803D; }

/* ─── ALERTS ─────────────────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: .9rem; margin-bottom: 20px;
}
.alert--error   { background: var(--red-50);   color: #991B1B; border: 1px solid #FECACA; }
.alert--success { background: var(--green-50); color: #166534; border: 1px solid #BBF7D0; }
.alert i { flex-shrink: 0; margin-top: 1px; }

/* ─── BADGES ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 99px;
  font-size: .72rem; font-weight: 600;
}
.badge--folder  { background: var(--blue-50);  color: var(--blue-700); }
.badge--count   { background: var(--gray-100); color: var(--gray-600); }
.badge--alert   { background: var(--red-600);  color: #fff; }
.badge--you     { background: var(--blue-100); color: var(--blue-800); }
.badge--role    { background: var(--gray-100); color: var(--gray-700); text-transform: capitalize; }
.badge--role-file_admin  { background: var(--blue-50); color: var(--blue-800); }
.badge--pending   { background: #FEF9C3; color: #854D0E; }
.badge--approved  { background: var(--green-50); color: #166534; }
.badge--suspended { background: var(--red-50); color: #991B1B; }

/* ─── FILE UPLOAD DROP ZONE ──────────────────────────────────────────────── */
.file-drop-zone {
  position: relative; border: 2px dashed var(--gray-300);
  border-radius: var(--radius); padding: 40px 20px; text-align: center;
  transition: all var(--transition); cursor: pointer;
}
.file-drop-zone:hover, .file-drop-zone.drag-over { border-color: var(--blue-600); background: var(--blue-50); }
.file-drop-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-drop-icon { font-size: 2.5rem; color: var(--gray-300); margin-bottom: 12px; }
.file-drop-zone:hover .file-drop-icon, .file-drop-zone.drag-over .file-drop-icon { color: var(--blue-600); }
.file-drop-content p { color: var(--gray-600); font-size: .9rem; }
.file-drop-selected {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--blue-50);
  border-radius: var(--radius-sm); border: 1px solid var(--blue-100);
}
.file-drop-selected i { font-size: 1.5rem; color: #E53E3E; }
.file-drop-selected span { flex: 1; font-size: .9rem; color: var(--gray-700); word-break: break-all; }

/* Upload progress */
.upload-progress { margin-top: 20px; }
.progress-bar { height: 6px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--blue-600); border-radius: 99px; width: 0%; transition: width .2s; }
.progress-label { font-size: .825rem; color: var(--gray-500); margin-top: 6px; }

/* ─── ADMIN LAYOUT ───────────────────────────────────────────────────────── */
.admin-body { background: var(--gray-100); }
.admin-layout { display: flex; min-height: 100vh; padding-top: var(--nav-h); }

.admin-sidebar {
  width: var(--admin-sidebar-w); flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--gray-200);
  position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); overflow-y: auto;
}
.admin-sidebar__nav { padding: 12px 8px; }
.admin-nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--gray-700); font-size: .875rem; font-weight: 500;
  text-decoration: none; transition: all var(--transition); gap: 8px; margin-bottom: 2px;
}
.admin-nav-item > :first-child { display: flex; align-items: center; gap: 8px; flex: 1; }
.admin-nav-item i { color: var(--gray-400); width: 16px; text-align: center; font-size: .9rem; }
.admin-nav-item:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.admin-nav-item.is-active { background: var(--blue-50); color: var(--blue-700); }
.admin-nav-item.is-active i { color: var(--blue-600); }
.admin-sidebar__divider { height: 1px; background: var(--gray-100); margin: 8px 12px; }

.admin-main { flex: 1; min-width: 0; padding: 28px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-header h1 { font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.admin-header h1 i { color: var(--blue-600); }
.admin-header p { color: var(--gray-500); font-size: .9rem; margin-top: 2px; }

.admin-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.admin-section { margin-top: 28px; }
.admin-section__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.admin-section__header h3 { font-size: 1rem; font-weight: 600; }

/* ─── STATS CARDS ────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: flex-start; gap: 14px; box-shadow: var(--shadow-sm);
}
.stat-card--alert { border-color: #FECACA; }
.stat-card__icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.stat-card__icon--blue   { background: var(--blue-50);  color: var(--blue-600); }
.stat-card__icon--green  { background: var(--green-50); color: var(--green-600); }
.stat-card__icon--purple { background: #FAF5FF;          color: var(--purple-600); }
.stat-card__icon--orange { background: #FFF7ED;          color: var(--orange-500); }
.stat-card__value { font-size: 1.8rem; font-weight: 700; line-height: 1; color: var(--gray-900); }
.stat-card__label { font-size: .8rem; color: var(--gray-500); margin-top: 3px; }
.stat-card__action { font-size: .78rem; color: var(--blue-600); display: block; margin-top: 6px; }

/* ─── QUICK ACTIONS ──────────────────────────────────────────────────────── */
.admin-quick-actions { margin-bottom: 28px; }
.admin-quick-actions h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.quick-actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.quick-action-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 12px; background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); text-decoration: none; color: var(--gray-700);
  font-size: .85rem; font-weight: 600; text-align: center;
  transition: all var(--transition); box-shadow: var(--shadow-sm);
}
.quick-action-card i { font-size: 1.4rem; color: var(--blue-600); }
.quick-action-card:hover { border-color: var(--blue-600); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; color: var(--blue-700); }

/* ─── TABLE ──────────────────────────────────────────────────────────────── */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table thead { border-bottom: 1px solid var(--gray-200); }
.admin-table th { padding: 10px 16px; text-align: left; font-size: .78rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--gray-50); }
.admin-table .row--highlight td { background: #FFFBEB; }

.table-file-name { display: flex; flex-direction: column; gap: 2px; }
.table-pdf-icon { color: #E53E3E; margin-right: 8px; }
.table-desc { font-size: .78rem; color: var(--gray-400); }
.table-user { display: flex; align-items: center; gap: 8px; }
.table-actions { display: flex; align-items: center; gap: 4px; }
.table-footer { padding: 10px 16px; font-size: .8rem; color: var(--gray-400); border-top: 1px solid var(--gray-100); }

/* ─── FOLDER ADMIN TREE ──────────────────────────────────────────────────── */
.folder-tree-admin { }
.folder-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; border-bottom: 1px solid var(--gray-100);
  transition: background var(--transition);
}
.folder-row:last-child { border-bottom: none; }
.folder-row:hover { background: var(--gray-50); }
.folder-row.drag-over { background: var(--blue-50); border-color: var(--blue-300); }
.folder-row__left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.drag-handle { cursor: grab; color: var(--gray-300); font-size: .8rem; padding: 4px; }
.drag-handle:hover { color: var(--gray-500); }
.folder-row__icon { color: var(--blue-600); font-size: .95rem; }
.folder-row__name { font-size: .9rem; font-weight: 500; color: var(--gray-900); }
.folder-row__actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* ─── FILTERS ────────────────────────────────────────────────────────────── */
.admin-filters { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-form { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
.filter-tabs { display: flex; align-items: center; gap: 2px; background: var(--gray-100); border-radius: var(--radius-sm); padding: 3px; }
.filter-tab {
  padding: 5px 14px; border-radius: 6px; font-size: .85rem; font-weight: 500;
  color: var(--gray-600); text-decoration: none; transition: all var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.filter-tab:hover { text-decoration: none; color: var(--gray-900); }
.filter-tab.is-active { background: #fff; color: var(--blue-700); box-shadow: var(--shadow-sm); }

/* ─── MODALS ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg); animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.95) translateY(8px); } to { opacity:1; transform: none; } }
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--gray-200); }
.modal__header h3 { font-size: 1rem; font-weight: 700; }
.modal__close { background: none; border: none; color: var(--gray-400); font-size: 1rem; padding: 4px; border-radius: 4px; }
.modal__close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal__body { padding: 20px; }
.modal__footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; background: var(--gray-50); border-top: 1px solid var(--gray-200); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ─── LOGO IMAGE IN NAV ──────────────────────────────────────────────────── */
.topnav__logo-img {
  height: 36px; width: auto; display: block;
  /* The dark-bg logo (FPAS2) is a square image; show it cropped to just the logo */
  object-fit: contain; object-position: left center;
}
.topnav__platform-badge {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.1); padding: 2px 7px; border-radius: 99px;
  margin-left: 4px; align-self: center;
}

/* ─── AUTH PAGE — FRIAS LOGO ─────────────────────────────────────────────── */
.auth-logo-img { margin-bottom: 16px; }
.auth-logo-img img { height: 80px; width: auto; }
/* On the dark auth background the light logo works; add drop shadow for pop */
.auth-body .auth-logo-img img { filter: drop-shadow(0 2px 8px rgba(0,0,0,.2)); }

/* ─── HOA HERO BANNER ────────────────────────────────────────────────────── */
.hoa-hero {
  position: relative; width: 100%;
  height: 220px; background-size: cover; background-position: center;
  flex-shrink: 0;
}
.hoa-hero__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.15) 0%, rgba(0,0,0,.65) 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 24px 28px;
}
.hoa-hero__title {
  font-size: 1.6rem; font-weight: 700; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.4); margin: 0 0 4px;
}
.hoa-hero__sub {
  font-size: .85rem; color: rgba(255,255,255,.8);
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* ─── HOA CARD — with photo ──────────────────────────────────────────────── */
.hoa-card__photo {
  height: 150px; background-size: cover; background-position: center;
  border-radius: var(--radius) var(--radius) 0 0; position: relative;
  margin: -20px -20px 16px; /* bleed to card edges */
}
.hoa-card__inactive-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.5); color: #fff;
  font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 99px;
}
.hoa-card__body { }
.hoa-card__name { font-size: 1rem; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.hoa-card__stats { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8rem; color: var(--gray-500); margin-bottom: 14px; }
.hoa-card__stats i { font-size: .75rem; }
.hoa-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* HOA table thumbnail */
.hoa-table-thumb {
  width: 60px; height: 40px; object-fit: cover;
  border-radius: var(--radius-sm); display: block;
}
.hoa-table-thumb--empty {
  width: 60px; height: 40px; border-radius: var(--radius-sm);
  background: var(--gray-100); display: flex; align-items: center;
  justify-content: center; color: var(--gray-300); font-size: 1rem;
}

/* HOA photo preview in edit form */
.hoa-photo-preview { margin-bottom: 10px; display: flex; align-items: center; gap: 12px; }
.hoa-photo-preview img { width: 140px; height: 90px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--gray-200); }

/* ─── SITE FOOTER ────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy); color: rgba(255,255,255,.7);
  padding: 40px 0 0; margin-top: auto;
}
.site-footer__inner { max-width: 1100px; margin: 0 auto; padding: 0 28px; }

.site-footer__brand {
  display: flex; align-items: flex-start; gap: 32px;
  padding-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.1);
  flex-wrap: wrap;
}
.site-footer__logo {
  height: 60px; width: auto; opacity: .9;
  /* The light logo (FPAS_logo) has a white/transparent bg, use it on dark footer */
  filter: brightness(0) invert(1); /* makes it fully white */
}
.site-footer__contact {
  display: flex; flex-direction: column; gap: 6px; font-size: .875rem;
}
.site-footer__contact-link {
  color: rgba(255,255,255,.75); text-decoration: none;
  display: flex; align-items: center; gap: 8px; transition: color var(--transition);
}
.site-footer__contact-link:hover { color: #fff; text-decoration: none; }
.site-footer__contact-link i, .site-footer__address i { color: rgba(255,255,255,.4); font-size: .85rem; }
.site-footer__address { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: rgba(255,255,255,.6); }

.site-footer__disclaimer {
  padding: 20px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.site-footer__disclaimer p {
  font-size: .78rem; line-height: 1.65; color: rgba(255,255,255,.45);
}

.site-footer__bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; font-size: .78rem; color: rgba(255,255,255,.35);
  flex-wrap: wrap; gap: 8px;
}
.site-footer__privacy-link { color: rgba(255,255,255,.4); text-decoration: underline; }
.site-footer__privacy-link:hover { color: rgba(255,255,255,.7); }

/* Auth pages footer: slim, centered, dark strip */
.auth-body .site-footer {
  padding: 20px 28px;
  background: rgba(0,0,0,.25);
}
.auth-body .site-footer__inner { max-width: 100%; }
.auth-body .site-footer__brand { display: none; }
.auth-body .site-footer__disclaimer { border: none; padding: 0 0 12px; }
.auth-body .site-footer__disclaimer p { text-align: center; font-size: .72rem; }
.auth-body .site-footer__bottom { justify-content: center; padding: 8px 0 0; }

/* ─── PLATFORM ADMIN ─────────────────────────────────────────────────────── */
.topnav--platform { background: #1A1A2E; }
.topnav__hoa-badge { color: #93C5FD; font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.topnav__site-link--warn { color: #FCA5A5; }
.topnav__site-link--warn:hover { color: #fff; }

.user-avatar--platform { background: var(--purple-600); }
.admin-sidebar--platform { background: #16162A; border-right-color: #2D2D4E; }
.admin-sidebar--platform .admin-nav-item { color: rgba(255,255,255,.7); }
.admin-sidebar--platform .admin-nav-item i { color: rgba(255,255,255,.4); }
.admin-sidebar--platform .admin-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-sidebar--platform .admin-nav-item.is-active { background: rgba(147,51,234,.2); color: #C4B5FD; }
.admin-sidebar--platform .admin-nav-item.is-active i { color: #A78BFA; }
.admin-sidebar--platform .admin-sidebar__divider { background: rgba(255,255,255,.1); }

/* HOA cards on platform dashboard */
.platform-hoa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.hoa-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.hoa-card:hover { box-shadow: var(--shadow); }
.hoa-card--inactive { opacity: .65; }
.hoa-card__header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.hoa-card__icon { width: 40px; height: 40px; background: #FAF5FF; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hoa-card__icon i { color: var(--purple-600); font-size: 1.1rem; }
.hoa-card__name { font-size: .95rem; font-weight: 700; color: var(--gray-900); line-height: 1.3; }
.hoa-card__slug { font-size: .75rem; color: var(--gray-400); font-family: monospace; }
.hoa-card__stats { display: flex; gap: 14px; font-size: .8rem; color: var(--gray-500); margin-bottom: 14px; }
.hoa-card__stats i { color: var(--gray-400); font-size: .75rem; }
.hoa-card__actions { display: flex; gap: 8px; }
.quick-action-card--alert { border-color: #FECACA; background: #FEF2F2; }
.quick-action-card--alert i { color: var(--red-600); }
.quick-action-card--alert:hover { border-color: var(--red-600); }

/* ─── COOKIE BANNER ──────────────────────────────────────────────────────── */
.cookie-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
  background: #1E293B; color: #CBD5E1;
  padding: 14px 20px; box-shadow: 0 -4px 20px rgba(0,0,0,.2);
  align-items: center; gap: 16px; flex-wrap: wrap;
}
.cookie-banner.is-visible { display: flex; }
.cookie-banner__content { flex: 1; min-width: 280px; font-size: .85rem; line-height: 1.6; }
.cookie-banner__content i { color: #93C5FD; margin-right: 6px; }
.cookie-banner__link { color: #93C5FD; text-decoration: underline; }
.cookie-banner__link:hover { color: #BFDBFE; }
.cookie-banner__actions { flex-shrink: 0; }

/* ─── PRIVACY PAGE ───────────────────────────────────────────────────────── */
.privacy-page { padding: 80px 20px 60px; min-height: 100vh; }
.privacy-page--standalone { display: flex; align-items: flex-start; justify-content: center; padding-top: 40px; }
.privacy-card { background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow); max-width: 760px; margin: 0 auto; overflow: hidden; }
.privacy-header { background: var(--navy); color: #fff; padding: 40px; text-align: center; }
.privacy-icon { font-size: 2.4rem; color: #93C5FD; margin-bottom: 12px; }
.privacy-header h1 { font-size: 1.8rem; font-weight: 700; }
.privacy-date { color: rgba(255,255,255,.6); font-size: .85rem; margin-top: 6px; }
.privacy-intro { font-size: 1rem; color: var(--gray-600); margin-bottom: 28px; line-height: 1.7; }
.privacy-body { padding: 36px 40px; }
.privacy-body h2 { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); margin: 28px 0 10px; padding-top: 4px; border-top: 1px solid var(--gray-100); }
.privacy-body h2:first-child { border-top: none; margin-top: 0; }
.privacy-body p { color: var(--gray-700); font-size: .9rem; line-height: 1.7; margin-bottom: 10px; }
.privacy-body ul { padding-left: 20px; margin-bottom: 10px; }
.privacy-body ul li { color: var(--gray-700); font-size: .9rem; line-height: 1.7; margin-bottom: 4px; }
.privacy-body code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: .85rem; font-family: monospace; }
.privacy-footer { padding: 24px 40px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topnav__hamburger { display: flex; }
  .topnav__center { max-width: none; }
  .topnav__admin-btn span { display: none; }
  .user-name { display: none; }

  .sidebar {
    position: fixed; left: 0; top: var(--nav-h); bottom: 0; z-index: 98;
    transform: translateX(-100%);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-overlay.is-open { display: block; }

  .main-content { width: 100%; }
  .content-header { padding: 16px 16px 0; }
  .content-body { padding: 16px 16px 32px; }

  .folder-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .form-row { grid-template-columns: 1fr; }

  .admin-sidebar {
    position: fixed; left: 0; top: var(--nav-h); bottom: 0; z-index: 98;
    width: var(--admin-sidebar-w); transform: translateX(-100%);
    transition: transform 0.22s ease; box-shadow: 4px 0 16px rgba(0,0,0,.18);
  }
  .admin-sidebar.is-open { transform: translateX(0); }
  .admin-sidebar-overlay {
    display: none; position: fixed; inset: 0; top: var(--nav-h);
    background: rgba(0,0,0,.45); z-index: 97;
  }
  .admin-sidebar-overlay.is-open { display: block; }
  .topnav__hoa-badge--mobile-hide, .topnav__sep--mobile-hide { display: none; }
  .topnav__link-label { display: none; }
  .admin-main { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; border-radius: var(--radius-lg); }
  .stats-grid { grid-template-columns: 1fr; }
  .folder-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── SORTABLE COLUMN HEADERS ────────────────────────────────────────────── */
.admin-table th[data-sort] {
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: color var(--transition);
}
.admin-table th[data-sort]:hover { color: var(--gray-900); }
.admin-table th[data-sort]::after {
  content: ' \21C5'; /* ⇅ */
  color: var(--gray-300); font-size: .65rem; vertical-align: middle;
}
.admin-table th[data-sort].sort-asc::after  { content: ' \25B2'; color: var(--blue-600); }
.admin-table th[data-sort].sort-desc::after { content: ' \25BC'; color: var(--blue-600); }

/* ─── DRAGGABLE FILE ROWS ────────────────────────────────────────────────── */
.th-drag { width: 32px; }
tr.file-row { transition: background var(--transition); }
tr.file-row[draggable="true"] .drag-handle { cursor: grab; color: var(--gray-300); }
tr.file-row[draggable="true"] .drag-handle:hover { color: var(--gray-500); }
tr.file-row.drag-over td { background: var(--blue-50) !important; }
tr.file-row.drag-over td:first-child { border-left: 3px solid var(--blue-600); }
tr.file-row.is-dragging { opacity: .4; }
.reorder-hint { padding: 8px 16px 12px; font-size: .78rem; color: var(--gray-400); }
.reorder-hint i { margin-right: 4px; }

/* ─── FOLDER REORDER DRAG GROUP ─────────────────────────────────────────── */
.folder-row.is-dragging { opacity: .35; background: var(--blue-50); }

/* ─── SAVE / CANCEL REORDER BAR ─────────────────────────────────────────── */
.reorder-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #FEF9C3; border-top: 1px solid #FDE68A;
  flex-wrap: wrap; gap: 10px;
}
.reorder-bar__msg { font-size: .875rem; color: #854D0E; font-weight: 500; }
.reorder-bar__msg i { margin-right: 6px; }
.reorder-bar__actions { display: flex; gap: 8px; }

/* ─── FOLDER REORDER DRAG GROUP ─────────────────────────────────────────── */
.folder-row.is-dragging { opacity: .35; background: var(--blue-50); }

/* ─── SAVE / CANCEL REORDER BAR ─────────────────────────────────────────── */
.reorder-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #FEF9C3; border-top: 1px solid #FDE68A;
  flex-wrap: wrap; gap: 10px;
}
.reorder-bar__msg { font-size: .875rem; color: #854D0E; font-weight: 500; }
.reorder-bar__msg i { margin-right: 6px; }
.reorder-bar__actions { display: flex; gap: 8px; }

/* ─── FOLDER COLLAPSE BUTTON ─────────────────────────────────────────────── */
.collapse-btn {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: .65rem;
  width: 20px; height: 20px; padding: 0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all var(--transition);
}
.collapse-btn:hover { background: var(--gray-200); color: var(--gray-700); }
.collapse-btn .fa-chevron-down { transition: transform 0.18s ease; }
.collapse-placeholder { width: 20px; flex-shrink: 0; display: inline-block; }

/* Default collapsed chevron — JS also sets this via inline style on load */
.folder-row.is-collapsed .collapse-btn .fa-chevron-down {
  transform: rotate(-90deg);
}

/* ─── DOCUMENTS MANAGER — TWO-PANEL LAYOUT ──────────────────────────────── */
.admin-main--full { padding: 0; }

.doc-manager {
  display: grid;
  grid-template-columns: 320px 5px 1fr;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

/* Left panel — folder tree */
.doc-tree {
  border-right: 1px solid var(--gray-200);
  background: #fff;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.doc-tree__header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; background: #fff;
}
.doc-tree__title { font-size: .875rem; font-weight: 600; color: var(--gray-700); display: flex; align-items: center; gap: 6px; }
.doc-tree__title i { color: var(--blue-600); }
.doc-tree__body { flex: 1; overflow-y: auto; padding-bottom: 20px; }

/* Folder tree items — links */
.folder-row__link {
  display: flex; align-items: center; gap: 6px; flex: 1;
  color: var(--gray-700); text-decoration: none;
  padding: 1px 4px; border-radius: 4px; min-width: 0;
  transition: all var(--transition);
}
.folder-row__link:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-900); }
.folder-row__link--active { color: var(--blue-700); font-weight: 600; }
.folder-row__link--active .folder-row__icon { color: var(--blue-600); }
.is-active-folder { background: var(--blue-50); }
.is-active-folder .folder-row__actions { opacity: 1; }

/* Show actions on hover in the tree */
.folder-row__actions { opacity: 0; transition: opacity var(--transition); }
.folder-row:hover .folder-row__actions { opacity: 1; }

/* Right panel — file content */
.doc-content {
  display: flex; flex-direction: column;
  overflow-y: auto; background: var(--gray-50);
}
.doc-content__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: #fff;
  border-bottom: 1px solid var(--gray-200); flex-shrink: 0;
  flex-wrap: wrap; gap: 10px;
}

/* Inline upload panel */
.upload-panel {
  background: var(--blue-50); border-bottom: 1px solid var(--blue-100);
  padding: 16px 20px; flex-shrink: 0;
}
.upload-panel__fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px;
}
.upload-panel__drop { padding: 16px; margin-bottom: 12px; }
.upload-panel__drop .file-drop-icon { font-size: 1.4rem; margin-bottom: 4px; }
.upload-panel__footer { display: flex; gap: 8px; }

/* Content sections */
.doc-content__section { padding: 16px 20px; }
.doc-section-label {
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gray-400); margin-bottom: 10px;
}

/* Subfolder cards in right panel */
.doc-subfolder-grid {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px;
}
.doc-subfolder-card {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; background: #fff;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  color: var(--gray-700); text-decoration: none; font-size: .875rem;
  font-weight: 500; transition: all var(--transition);
}
.doc-subfolder-card i { color: var(--blue-600); font-size: .95rem; }
.doc-subfolder-card:hover { border-color: var(--blue-600); color: var(--blue-700); text-decoration: none; box-shadow: var(--shadow-sm); }

/* Mobile: stack panels vertically */
@media (max-width: 768px) {
  .doc-manager { grid-template-columns: 1fr; grid-template-rows: auto 5px 1fr; height: auto; }
  .doc-resize-handle { cursor: row-resize; }
  .doc-tree { height: 40vh; min-height: 200px; border-right: none; border-bottom: 1px solid var(--gray-200); }
  .upload-panel__fields { grid-template-columns: 1fr; }
  .folder-row__actions { opacity: 1; }
}

/* ─── DOC-TREE FOLDER ROW — SCOPED FIXES ────────────────────────────────── */

/* Remove the outer padding so only the inline padding-left on __left provides indent */
.doc-tree .folder-row {
  padding: 0;
  border-bottom: 1px solid var(--gray-100);
}
.doc-tree .folder-row:last-child { border-bottom: none; }

/* __left fills the row and provides its own padding */
.doc-tree .folder-row__left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 6px 6px 6px 0; /* left padding comes from inline style for indentation */
}

/* Folder link takes remaining space and lays out icon + name horizontally */
.doc-tree .folder-row__link {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  color: var(--gray-700);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.doc-tree .folder-row__link:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-900); }
.doc-tree .folder-row__link--active { color: var(--blue-700); font-weight: 600; }
.doc-tree .folder-row__link--active .folder-row__icon { color: var(--blue-600); }

.doc-tree .folder-row__name {
  font-size: .85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Actions: hidden by default using display:none (no layout space taken),
   shown on hover — fixes the 90px invisible-space problem */
.doc-tree .folder-row__actions {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding-right: 6px;
}
.doc-tree .folder-row:hover .folder-row__actions,
.doc-tree .is-active-folder .folder-row__actions {
  display: flex;
}

/* Keep drag handle tight */
.doc-tree .drag-handle { padding: 2px 3px; }

/* Active folder highlight */
.doc-tree .is-active-folder { background: var(--blue-50); }

/* ─── RESIZABLE PANEL HANDLE ────────────────────────────────────────────── */
.doc-resize-handle {
  background: var(--gray-200);
  cursor: col-resize;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}
.doc-resize-handle:hover,
.doc-resize-handle.is-dragging { background: var(--blue-600); }

/* ─── DOC-TREE HOVER — badge hides when actions are visible ─────────────── */
/* Hide file count badge on hover so action buttons have room */
.doc-tree .folder-row:hover .badge--count { display: none; }
.doc-tree .is-active-folder:hover .badge--count { display: none; }

/* Make action buttons smaller and tighter */
.doc-tree .folder-row__actions .btn--sm {
  padding: 3px 6px;
  font-size: .75rem;
}

/* ─── FORCE PASSWORD RESET BUTTON ───────────────────────────────────────── */
.force-pwd-btn {
  font-size: .75rem;
  padding: 4px 8px;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-500);
  background: transparent;
  border-radius: 99px;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
  transition: all var(--transition);
}
.force-pwd-btn:hover {
  border-color: var(--orange-500);
  color: var(--orange-500);
  background: #FFF7ED;
}
.force-pwd-btn--on {
  border-color: var(--orange-500);
  color: var(--orange-500);
  background: #FFF7ED;
  font-weight: 600;
}
.force-pwd-btn--on:hover {
  border-color: var(--red-600);
  color: var(--red-600);
  background: var(--red-50);
}

/* ─── SIDEBAR SUB-NAV ITEMS ─────────────────────────────────────────────── */
.admin-nav-item--sub {
  padding-left: 32px !important;
  font-size: .82rem;
  color: var(--gray-500);
}
.admin-nav-item--sub i { font-size: .8rem; }
.admin-nav-item--sub:hover { color: var(--gray-900); }
.admin-nav-item--sub.is-active { color: var(--blue-700); background: var(--blue-50); }

/* ─── PASSWORD STRENGTH METER ────────────────────────────────────────────── */
.pw-strength-bar { height: 4px; background: var(--gray-200); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.pw-strength-bar__fill { height: 100%; border-radius: 99px; transition: width .2s, background .2s; }
.pw-strength-label { font-size: .72rem; font-weight: 600; margin-top: 3px; }
.pw-rules { font-size: .75rem; color: var(--gray-400); margin-top: 4px; line-height: 1.4; }
.pw-missing { font-size: .72rem; color: var(--gray-400); margin-top: 2px; }

/* ─── PASSWORD EXPIRY WARNING BANNER ─────────────────────────────────────── */
.expiry-banner {
  background: #FEF9C3; border-bottom: 1px solid #FDE68A;
  padding: 8px 20px; display: flex; align-items: center; gap: 10px;
  font-size: .85rem; color: #854D0E; flex-wrap: wrap;
}
.expiry-banner i { flex-shrink: 0; }
.expiry-banner a { color: #92400E; font-weight: 600; }
