/* ============================================
   MiaSys — Design System
   Thème: Nature, Écologie, Professionnel
   Mobile-First Responsive
   ============================================ */

/* --- Variables Light --- */
:root {
  --primary: #2D6A4F;
  --primary-light: #40916C;
  --primary-dark: #1B4332;
  --primary-glow: rgba(45, 106, 79, 0.12);

  --accent: #E09F3E;
  --accent-light: #F2C85B;
  --accent-dark: #CC8B2A;
  --accent-glow: rgba(224, 159, 62, 0.15);

  --rose: #C77D8A;
  --rose-light: #E8B4BC;
  --rose-glow: rgba(199, 125, 138, 0.12);

  --danger: #E63946;
  --danger-light: #FF6B6B;
  --success: #2D6A4F;
  --warning: #E09F3E;
  --info: #457B9D;
  --info-light: #A8DADC;

  --bg: #FEFCF6;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FAFAF5;
  --bg-input: #FFFFFF;
  --text: #2B2D42;
  --text-light: #6C757D;
  --text-muted: #ADB5BD;
  --border: #E9ECEF;
  --shadow: rgba(43, 45, 66, 0.06);
  --shadow-md: rgba(43, 45, 66, 0.1);
  --shadow-lg: rgba(43, 45, 66, 0.15);

  --font-main: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Poppins', 'Inter', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 200ms ease;

  --sidebar-width: 260px;
  --header-height: 60px;
  --bottom-nav-height: 64px;
}

/* --- Variables Dark --- */
[data-theme="dark"] {
  --bg: #0F1419;
  --bg-card: #1A1F2E;
  --bg-sidebar: #151A24;
  --bg-input: #1E2433;
  --text: #E8EAED;
  --text-light: #9AA0A6;
  --text-muted: #5F6368;
  --border: #2D3340;
  --shadow: rgba(0, 0, 0, 0.2);
  --shadow-md: rgba(0, 0, 0, 0.3);
  --shadow-lg: rgba(0, 0, 0, 0.4);
  --primary-glow: rgba(45, 106, 79, 0.2);
  --accent-glow: rgba(224, 159, 62, 0.2);
  --rose-glow: rgba(199, 125, 138, 0.2);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

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

/* --- Sidebar (Desktop) --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease-out);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
}

.sidebar-brand .brand-name span { color: var(--rose); }

/* Nav items */
.sidebar-nav {
  flex: 1;
  padding: 12px;
  list-style: none;
}

.sidebar-nav .nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}

.sidebar-nav .nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all var(--transition);
}

.sidebar-nav .nav-item a:hover {
  background: var(--primary-glow);
  color: var(--primary);
}

.sidebar-nav .nav-item a.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.3);
}

.sidebar-nav .nav-item a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-nav .nav-item a .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

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

.sidebar-user:hover { background: var(--primary-glow); }

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* --- Top Header --- */
.top-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.top-header .header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-header .header-left h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.top-header .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* Header buttons */
.header-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1rem;
  color: var(--text-light);
  position: relative;
}

.header-btn:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: var(--primary-light);
}

.header-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-card);
}

/* Theme toggle */
.theme-selector {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px;
}

.theme-selector button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
  color: var(--text-muted);
}

.theme-selector button.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 4px rgba(45, 106, 79, 0.3);
}

/* Language selector */
.lang-selector {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px;
}

.lang-selector button {
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: all var(--transition);
}

.lang-selector button.active {
  background: var(--primary);
  color: white;
}

/* --- Page Content --- */
.page-content {
  flex: 1;
  padding: 24px;
}

/* ===== BOTTOM NAV (Mobile) ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 50;
  padding: 0 8px;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  transition: all var(--transition);
  min-width: 52px;
}

.bottom-nav a .nav-icon { font-size: 1.2rem; }

.bottom-nav a.active {
  color: var(--primary);
  background: var(--primary-glow);
}

.bottom-nav a:hover { color: var(--primary); }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s var(--ease-out);
}

.card:hover {
  box-shadow: 0 4px 20px var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s var(--ease-out);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--shadow-md);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-card .stat-icon.green { background: var(--primary-glow); }
.stat-card .stat-icon.gold { background: var(--accent-glow); }
.stat-card .stat-icon.rose { background: var(--rose-glow); }
.stat-card .stat-icon.blue { background: rgba(69, 123, 157, 0.12); }
.stat-card .stat-icon.red { background: rgba(230, 57, 70, 0.12); }

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  background: var(--bg-sidebar);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--primary-glow);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
}

/* Checkbox / Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.3);
}
.btn-primary:hover { background: var(--primary-dark); color: white; }

.btn-accent {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(224, 159, 62, 0.3);
}
.btn-accent:hover { background: var(--accent-dark); color: white; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #d32f3e; color: white; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-light);
}
.btn-ghost:hover { background: var(--primary-glow); color: var(--primary); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green { background: var(--primary-glow); color: var(--primary-dark); }
.badge-gold { background: var(--accent-glow); color: var(--accent-dark); }
.badge-rose { background: var(--rose-glow); color: var(--rose); }
.badge-blue { background: rgba(69, 123, 157, 0.12); color: var(--info); }
.badge-red { background: rgba(230, 57, 70, 0.12); color: var(--danger); }
.badge-gray { background: var(--border); color: var(--text-light); }

/* Status badges */
.status-pending { background: var(--accent-glow); color: var(--accent-dark); }
.status-confirmed { background: var(--primary-glow); color: var(--primary-dark); }
.status-in_progress { background: rgba(69, 123, 157, 0.12); color: var(--info); }
.status-completed { background: var(--primary-glow); color: var(--primary); }
.status-cancelled { background: var(--border); color: var(--text-muted); }
.status-rejected { background: rgba(230, 57, 70, 0.12); color: var(--danger); }
.status-draft { background: var(--border); color: var(--text-light); }
.status-sent { background: rgba(69, 123, 157, 0.12); color: var(--info); }
.status-signed { background: var(--primary-glow); color: var(--primary); }
.status-paid { background: var(--primary-glow); color: var(--primary-dark); }
.status-overdue { background: rgba(230, 57, 70, 0.12); color: var(--danger); }

/* Alert levels */
.alert-level-green { color: var(--success); }
.alert-level-orange { color: var(--warning); }
.alert-level-red { color: var(--danger); }

/* ===== ALERTS / FLASH ===== */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s var(--ease-out);
}

.alert-success {
  background: var(--primary-glow);
  border: 1px solid var(--primary-light);
  color: var(--primary-dark);
}

.alert-error {
  background: rgba(230, 57, 70, 0.1);
  border: 1px solid var(--danger-light);
  color: var(--danger);
}

.alert-warning {
  background: var(--accent-glow);
  border: 1px solid var(--accent-light);
  color: var(--accent-dark);
}

.alert-info {
  background: rgba(69, 123, 157, 0.1);
  border: 1px solid var(--info-light);
  color: var(--info);
}

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

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px var(--shadow-lg);
  animation: slideUp 0.3s var(--ease-out);
}

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

.modal-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

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

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}

.page-header .header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== SIGNATURE PAD ===== */
.signature-pad-container {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.signature-pad-container canvas {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: crosshair;
  max-width: 100%;
  touch-action: none;
}

/* ===== CALENDAR ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar-header-cell {
  background: var(--bg-sidebar);
  padding: 10px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.calendar-cell {
  background: var(--bg-card);
  padding: 8px;
  min-height: 80px;
  font-size: 0.82rem;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
}

.calendar-cell:hover { background: var(--primary-glow); }

.calendar-cell .day-number {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.calendar-cell.today .day-number {
  background: var(--primary);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.calendar-cell.other-month { opacity: 0.4; }

.calendar-event {
  display: block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== ANIMATIONS ===== */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  position: relative;
}

.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, var(--primary-glow) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, var(--rose-glow) 0%, transparent 50%);
  pointer-events: none;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px var(--shadow-md);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s var(--ease-out);
}

.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-brand .brand-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: white;
  margin-bottom: 12px;
}

.auth-brand h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.auth-brand h1 span { color: var(--rose); }

.auth-brand p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 600;
}

/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 49;
    display: none;
  }
  .sidebar-overlay.active { display: block; }
  .main-content { margin-left: 0; max-width: 100vw; }
  .menu-toggle { display: flex; }
}

/* Mobile */
@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .main-content { padding-bottom: var(--bottom-nav-height); }
  .page-content { padding: 16px; }

  .top-header { padding: 0 16px; }
  .top-header .header-left h1 { font-size: 1rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-card .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
  .stat-card .stat-value { font-size: 1.2rem; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h1 { font-size: 1.2rem; }

  .form-row { grid-template-columns: 1fr; }

  .auth-card { padding: 24px; }

  .calendar-cell { min-height: 50px; padding: 4px; }
  .calendar-event { display: none; }

  .theme-selector,
  .lang-selector { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* Print */
@media print {
  .sidebar, .bottom-nav, .top-header, .menu-toggle { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}
