/* ============================================================
   GROUPE EMAT-VOYAGE — Styles principaux
   ============================================================ */

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

:root {
  --emerald: #1e40af;
  --emerald-light: #2563eb;
  --emerald-deep: #0c1d3d;
  --gold: #C9A84C;
  --gold-light: #E8C97A;
  --gold-dark: #8B6914;
  --cream: #FAF7F0;
  --cream-dark: #F0EAD6;
  --white: #FFFFFF;
  --text: #1A1A1A;
  --text-m: #5A5A5A;
  --text-l: #9A9A9A;
  --border: #E5E5E5;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --green: #16A34A;
  --green-bg: #F0FDF4;
  --blue: #2563EB;
  --blue-bg: #EFF6FF;
  --orange: #EA580C;
  --orange-bg: #FFF7ED;
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

body { font-family: 'Inter', -apple-system, sans-serif; background: #F5F5F5; color: var(--text); }

/* ===== LAYOUT ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--emerald-deep);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(201,168,76,0.15);
}

.brand-badge {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--emerald-deep);
  flex-shrink: 0;
  letter-spacing: -1px;
}

.brand-name { font-size: 12px; font-weight: 700; color: var(--gold); line-height: 1.3; }
.brand-sub { font-size: 10px; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 1px; }

/* Year picker */
.year-picker { padding: 12px 14px; }
.year-label-small { font-size: 9px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.3); margin-bottom: 6px; }
.year-select-wrap { position: relative; }
.year-select {
  width: 100%;
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 8px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  padding: 9px 34px 9px 12px;
  cursor: pointer;
  appearance: none;
  outline: none;
}
.year-select option { background: var(--emerald-deep); color: var(--white); }
.year-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none; }

/* Nav */
.nav { flex: 1; padding: 8px 0; }
.nav-section { padding: 14px 14px 4px; }
.nav-section-label { font-size: 9px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.28); padding: 0 4px; margin-bottom: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 1px;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.85); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(201,168,76,0.08));
  color: var(--gold);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.nav-icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 15px; }
.nav-badge { margin-left: auto; background: var(--gold); color: var(--emerald-deep); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }

/* Sidebar footer */
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.06); }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
}

.user-avatar, .topbar-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: var(--emerald-deep);
  flex-shrink: 0;
}

.user-name { font-size: 12px; color: rgba(255,255,255,0.8); font-weight: 500; }
.user-role { font-size: 10px; color: rgba(255,255,255,0.35); }
.logout-btn { margin-left: auto; color: rgba(255,255,255,0.4); text-decoration: none; font-size: 16px; transition: color var(--transition); }
.logout-btn:hover { color: var(--gold); }

/* ===== MAIN CONTAINER ===== */
.main-container {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-m); }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); flex: 1; }

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

.year-badge-top {
  background: rgba(13,92,58,0.08);
  color: var(--emerald);
  border: 1px solid rgba(13,92,58,0.15);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

.notif-btn {
  position: relative;
  text-decoration: none;
  font-size: 18px;
  padding: 6px;
  border-radius: 8px;
  transition: background var(--transition);
}
.notif-btn:hover { background: var(--cream); }
.notif-count {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--red);
  color: var(--white);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
}

.user-menu { position: relative; cursor: pointer; }
.user-dropdown {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 8px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition);
}
.user-dropdown a:hover { background: var(--cream); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.user-dropdown .logout-dd { color: var(--red); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; padding: 24px; }

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

.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 14px; color: var(--text-m); margin-top: 3px; }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition);
}

.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.green { background: var(--green-bg); }
.stat-icon.blue { background: var(--blue-bg); }
.stat-icon.gold { background: rgba(201,168,76,0.1); }
.stat-icon.red { background: var(--red-bg); }
.stat-icon.orange { background: var(--orange-bg); }
.stat-icon.purple { background: #F5F3FF; }

.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-m); margin-top: 3px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

table { width: 100%; border-collapse: collapse; background: var(--white); }

thead th {
  background: #F8F8F8;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 13px 16px;
  font-size: 14px;
  border-bottom: 1px solid #F0F0F0;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFA; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green { background: var(--green-bg); color: #15803D; }
.badge-red { background: var(--red-bg); color: #B91C1C; }
.badge-blue { background: var(--blue-bg); color: #1D4ED8; }
.badge-orange { background: var(--orange-bg); color: #C2410C; }
.badge-gray { background: #F3F3F3; color: var(--text-m); }
.badge-gold { background: rgba(201,168,76,0.12); color: var(--gold-dark); }
.badge-purple { background: #F5F3FF; color: #6D28D9; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--emerald); color: var(--white); }
.btn-primary:hover { background: var(--emerald-light); }
.btn-gold { background: var(--gold); color: var(--emerald-deep); }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: none; border: 1.5px solid var(--border); color: var(--text-m); }
.btn-outline:hover { border-color: var(--text-m); color: var(--text); }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: #B91C1C; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(13,92,58,0.08);
}

.form-hint { font-size: 12px; color: var(--text-l); }

/* ===== ALERTS ===== */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: var(--green-bg); border: 1px solid #BBF7D0; color: #15803D; }
.alert-error { background: var(--red-bg); border: 1px solid #FECACA; color: #B91C1C; }
.alert-info { background: var(--blue-bg); border: 1px solid #BFDBFE; color: #1D4ED8; }
.alert-warning { background: var(--orange-bg); border: 1px solid #FED7AA; color: #C2410C; }

/* ===== SEARCH & FILTERS ===== */
.search-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-input input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  background: var(--white);
}

.search-input input:focus { border-color: var(--emerald); }

.search-input::before {
  content: '🔍';
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}

.filter-select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--white);
  outline: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--emerald); }

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

.modal {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-m); padding: 4px; }
.modal-body { padding: 24px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--border); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-m);
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--emerald); }
.tab-btn.active { color: var(--emerald); border-bottom-color: var(--emerald); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== PROGRESS ===== */
.progress-bar { height: 8px; background: #EBEBEB; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-fill.green { background: var(--green); }
.progress-fill.gold { background: var(--gold); }
.progress-fill.red { background: var(--red); }
.progress-fill.blue { background: var(--blue); }

/* ===== PHOTO UPLOAD ===== */
.photo-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.photo-upload:hover { border-color: var(--emerald); background: rgba(13,92,58,0.02); }
.photo-preview { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gold); }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 20px 0; flex-wrap: wrap; }

.page-btn {
  min-width: 36px; height: 36px;
  padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-m);
  background: var(--white);
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--emerald); color: var(--emerald); }
.page-btn.active { background: var(--emerald); color: var(--white); border-color: var(--emerald); }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ===== LOADING ===== */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--emerald);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, #F0F0F0 25%, #E0E0E0 50%, #F0F0F0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-container { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .stat-value { font-size: 20px; }
}

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }

.toast {
  background: var(--white);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  max-width: 340px;
}

.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
.toast.warning { border-left-color: var(--orange); }

@keyframes slideIn { from { transform: translateX(50px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { to { transform: translateX(50px); opacity: 0; } }

/* ===== UTILS ===== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-m); }
.text-small { font-size: 12px; }
.text-bold { font-weight: 700; }
.text-gold { color: var(--gold-dark); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.gap-8 { gap: 8px; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* ============================================================
   ADDITIONS v2 — Alignement avec header.php révisé
   ============================================================ */

/* Layout global */
.app-layout { display: flex; min-height: 100vh; }
.main-area { margin-left: var(--sidebar-w); display: flex; flex-direction: column; flex: 1; min-width: 0; }
.page-content { padding: 1.5rem; flex: 1; }

/* Sidebar nav */
.sidebar-nav { flex: 1; padding: 0.5rem 0; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: rgba(255,255,255,0.65);
  font-size: 13.5px; text-decoration: none;
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-link.active { background: rgba(201,168,76,0.15); color: var(--gold); border-left: 3px solid var(--gold); }

/* User card sidebar */
.user-card-sidebar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-avatar-sidebar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold); color: var(--emerald-deep);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.user-info-sidebar { flex: 1; min-width: 0; }
.user-name-sidebar { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-sidebar { font-size: 11px; color: rgba(255,255,255,0.4); }

/* Topbar */
.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  position: sticky; top: 0; z-index: 100;
}
.sidebar-toggle { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text); padding: 0.4rem; border-radius: 6px; }
.sidebar-toggle:hover { background: #f5f5f5; }
.topbar-breadcrumb { font-weight: 600; font-size: 0.95rem; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }

/* Year chip */
.year-chip {
  background: var(--emerald); color: #fff;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.25rem 0.75rem; border-radius: 20px;
  white-space: nowrap;
}

/* Notif button */
.notif-btn {
  position: relative; background: none; border: none; cursor: pointer;
  font-size: 1.2rem; padding: 0.4rem; border-radius: 8px;
  text-decoration: none; display: flex; align-items: center; justify-content: center;
}
.notif-btn:hover { background: #f5f5f5; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  background: #ef4444; color: #fff;
  font-size: 0.6rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* User menu */
.user-menu-wrap { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: 0.5rem;
  background: none; border: none; cursor: pointer;
  padding: 0.35rem 0.6rem; border-radius: 8px;
  transition: background var(--transition);
}
.user-menu-btn:hover { background: #f5f5f5; }
.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--emerald); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-menu-name { font-size: 0.875rem; font-weight: 600; color: var(--text); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 200px;
  display: none; z-index: 500;
}
.user-menu-wrap.open .user-dropdown { display: block; }
.user-dropdown a {
  display: block; padding: 0.65rem 1rem; font-size: 0.875rem;
  color: var(--text); text-decoration: none;
  transition: background var(--transition);
}
.user-dropdown a:hover { background: #f9f9f9; }
.user-dropdown .dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 0.25rem 0; }
.user-dropdown .dropdown-danger { color: #ef4444; }
.user-dropdown .dropdown-danger:hover { background: #fef2f2; }

/* Toast container */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1.25rem; border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow-lg); border-left: 4px solid #10b981;
  font-size: 0.875rem; max-width: 360px;
  opacity: 0; transform: translateX(20px); transition: all 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left-color: #10b981; }
.toast-error { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
.toast-info { border-left-color: #3b82f6; }
.toast-icon { font-size: 1.1rem; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; }
.modal { display: none; position: fixed; inset: 0; z-index: 1001; align-items: center; justify-content: center; padding: 1rem; }
.modal-dialog { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-header button { background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-l); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.75rem; justify-content: flex-end; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .form-grid-2 { grid-template-columns: 1fr !important; }
  .year-chip { display: none; }
  .user-menu-name { display: none; }
}
