/* ════════════════════════════════════════════════════════════════
   global.css — GestionPM System-Wide Stylesheet
   Tokens de diseño, componentes base, tipografía y estilos compartidos.
   Adaptado con paleta Verde Bosque (#1a4a2a) según GEMINI.md §2.2
════════════════════════════════════════════════════════════════ */

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

/* ─── Design Tokens (GEMINI.md §2.2) ─────────────────────────── */
:root {
  /* Brand palette — Verde Bosque */
  --crimson:       #1a4a2a;
  --crimson-light: #246b3a;
  --crimson-dark:  #112e1a;
  --crimson-glow:  rgba(26, 74, 42, 0.18);
  --crimson-pale:  rgba(26, 74, 42, 0.07);

  /* Neutrales */
  --white:         #ffffff;
  --off-white:     #f6faf7;
  --gray-50:       #f0f7f2;
  --gray-100:      #e0ede4;
  --gray-200:      #c4d9c9;
  --gray-300:      #9dbfa5;
  --gray-400:      #6a9975;
  --gray-500:      #4a7555;
  --gray-600:      #3a5a42;

  /* Texto */
  --text-dark:     #0a1a0e;
  --text-mid:      #2a4a30;
  --text-soft:     #507a5a;

  /* Colores de estado y alertas */
  --status-active:    #1a4a2a;
  --status-pending:   #c88a1e;
  --status-completed: #1e7040;
  --status-delayed:   #b52a10;
  --status-info:      #195b8c;

  /* Sombras */
  --shadow-sm:  0 1px 3px rgba(26, 74, 42, 0.08), 0 1px 2px rgba(26, 74, 42, 0.05);
  --shadow-md:  0 4px 16px rgba(26, 74, 42, 0.10), 0 2px 6px rgba(26, 74, 42, 0.06);
  --shadow-lg:  0 10px 40px rgba(26, 74, 42, 0.16), 0 4px 12px rgba(26, 74, 42, 0.08);
  --shadow-xl:  0 20px 60px rgba(26, 74, 42, 0.22), 0 8px 20px rgba(26, 74, 42, 0.10);

  /* Radios de borde */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Movimiento */
  --transition: all .22s cubic-bezier(.4, 0, .2, 1);

  /* Dimensiones del Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 64px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--off-white);
  color: var(--text-dark);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Fondo sutil con gradientes radiales ─────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 5%, rgba(26, 74, 42, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 90% 90%, rgba(26, 74, 42, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Scrollbars personalizados ──────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ─── Sidebar iframe & Drawer móvil ──────────────────────────── */
.sidebar-frame {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  height: 100%;
  border: none;
  z-index: 100;
  background: linear-gradient(160deg, var(--crimson-dark) 0%, var(--crimson) 60%, var(--crimson-light) 100%);
  box-shadow: 4px 0 30px rgba(26, 74, 42, 0.25);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 14, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity .25s ease;
}
.mobile-overlay.active {
  display: block;
  opacity: 1;
}

/* ─── Componentes del Sidebar ────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(160deg, var(--crimson-dark) 0%, var(--crimson) 60%, var(--crimson-light) 100%);
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--white);
  box-shadow: 4px 0 30px rgba(26, 74, 42, 0.25);
}

/* Modo iframe cuando sidebar.html se monta directamente */
body.sidebar-frame-body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: transparent;
}
body.sidebar-frame-body::before {
  display: none;
}
body.sidebar-frame-body .sidebar {
  position: static;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  box-shadow: none;
}

.sidebar-brand {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sidebar-brand .logo-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}
.sidebar-brand h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.3px;
  line-height: 1.2;
}
.sidebar-brand p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
  font-weight: 400;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 12px;
  margin: 12px 0 6px;
}
.nav-label:first-child {
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  text-decoration: none;
  line-height: 1.2;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--white);
}
.nav-item.active {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  font-weight: 600;
}
.nav-item .icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ─── Dropdown de Navegación ─────────────────────────────────── */
.nav-dropdown {
  position: relative;
  margin-bottom: 2px;
}
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  line-height: 1.2;
}
.nav-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--white);
}
.nav-dropdown-toggle.open {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}
.nav-dropdown-toggle .icon {
  font-size: 16px;
  flex-shrink: 0;
}
.nav-dropdown-arrow {
  margin-left: auto;
  font-size: 10px;
  opacity: .6;
  transition: transform .22s cubic-bezier(.4, 0, .2, 1), opacity .2s;
  display: inline-block;
}
.nav-dropdown-toggle.open .nav-dropdown-arrow {
  transform: rotate(180deg);
  opacity: .95;
}

.nav-dropdown-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height .28s cubic-bezier(.4, 0, .2, 1);
  border-left: 2px solid rgba(255, 255, 255, 0.15);
  margin: 0 10px 4px 20px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.nav-dropdown-items.open {
  max-height: 300px;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  margin-bottom: 2px;
  line-height: 1.2;
}
.nav-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--white);
}
.nav-dropdown-item.active {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  font-weight: 600;
}
.nav-dropdown-item .sub-icon {
  font-size: 14px;
  flex-shrink: 0;
  opacity: .85;
}

/* ─── Footer del Sidebar ─────────────────────────────────────── */
.sidebar-footer {
  padding: 14px 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.1);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: inherit;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}
.user-info {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-logout {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-logout:hover {
  color: #e56363;
}

.sidebar-atomo-credit {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: .02em;
}
.sidebar-atomo-credit .atomo-link {
  color: #e56363;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--transition);
}
.sidebar-atomo-credit .atomo-link:hover {
  color: #ff8585;
  text-decoration: underline;
}

/* ─── Layout Principal ───────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-width);
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s ease;
}

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--gray-100);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 14px;
}

.topbar-left  {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Botón Hamburguesa Móvil */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  cursor: pointer;
  padding: 8px;
  transition: var(--transition);
  flex-shrink: 0;
}
.mobile-nav-toggle:hover {
  background: var(--gray-100);
  border-color: var(--crimson);
}
.mobile-nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--crimson);
  border-radius: 2px;
  transition: var(--transition);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb span     { color: var(--text-dark); font-weight: 600; }
.breadcrumb .bc-sep  { color: var(--gray-300); font-weight: 400; }
.breadcrumb .bc-root { color: var(--text-soft); font-weight: 400; }

/* ─── Botones ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-light) 100%);
  color: var(--white);
  box-shadow: 0 3px 12px var(--crimson-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26, 74, 42, 0.35);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border: 1.5px solid var(--gray-200);
}
.btn-ghost:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--crimson);
}

.btn-danger {
  background: #b52a10;
  color: var(--white);
  box-shadow: 0 3px 12px rgba(181, 42, 16, 0.25);
}
.btn-danger:hover {
  background: #9b240e;
  transform: translateY(-1px);
}

.btn-sm   { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); width: 36px; height: 36px; }

/* ─── Envoltorio de Contenido ────────────────────────────────── */
.content {
  padding: 28px 32px;
  flex: 1;
}

/* ─── Stats Grid (Colapsable en móvil) ───────────────────────── */
.stats-container {
  margin-bottom: 24px;
}
.stats-toggle-btn {
  display: none;
  width: 100%;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stats-toggle-icon {
  transition: transform .2s ease;
}
.stats-toggle-btn.is-open .stats-toggle-icon {
  transform: rotate(180deg);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -.5px;
}

/* ─── Panel (Componente de Tarjeta Principal) ────────────────── */
.panel {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}
.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to right, var(--gray-50), var(--white));
  gap: 14px;
}
.panel-title    { font-size: 16px; font-weight: 700; color: var(--text-dark); }
.panel-subtitle { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.panel-body     { padding: 24px; }

/* ─── Formularios ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 6px;
  letter-spacing: .2px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-dark);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-glow);
}
.form-control::placeholder {
  color: var(--gray-400);
}
.form-row             { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; min-width: 0; }
select.form-control   { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ─── Modales ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 14, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 520px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  margin: auto;
  transform: translateY(20px) scale(.97);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
  overflow: hidden;
}
.modal-overlay.open .modal {
  transform: none;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to right, var(--crimson-pale), var(--white));
  flex-shrink: 0;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--gray-100);
  cursor: pointer;
  font-size: 15px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--crimson-pale);
  color: var(--crimson);
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--gray-50);
  flex-shrink: 0;
}

/* ─── Toast Notifications ────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--text-dark);
  color: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  animation: toastIn .3s cubic-bezier(.34, 1.56, .64, 1) forwards;
  border-left: 4px solid var(--crimson-light);
}
.toast.fade-out {
  animation: toastOut .3s ease forwards;
}
.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-msg b {
  display: block;
  margin-bottom: 2px;
}
@keyframes toastIn  { from { opacity: 0; transform: translateX(30px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(30px) scale(.95); } }

/* ─── Progress Bar ───────────────────────────────────────────── */
.progress-bar-wrap {
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--crimson), var(--crimson-light));
  border-radius: 3px;
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

/* ─── Badges, Chips & Dividers ───────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--crimson-pale);
  color: var(--crimson);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
}
.divider {
  height: 1px;
  background: var(--gray-100);
  margin: 8px 0;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: .8;
}
.empty-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.empty-sub {
  font-size: 13px;
  color: var(--text-soft);
}

/* ─── Footer Institucional ───────────────────────────────────── */
.page-footer {
  margin-top: 40px;
  padding: 20px 0 10px;
  border-top: 1px solid var(--gray-100);
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
  letter-spacing: .02em;
}
.atomo-link {
  color: #cb4949;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--transition), text-decoration var(--transition);
}
.atomo-link:hover {
  color: #e56363;
  text-decoration: underline;
}

/* ─── Responsividad General ──────────────────────────────────── */
@media (max-width: 900px) {
  .mobile-nav-toggle {
    display: flex;
  }
  .sidebar-frame {
    transform: translateX(-100%);
    width: 280px;
    max-width: 85vw;
  }
  .sidebar-frame.mobile-open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0 !important;
  }
  .topbar {
    padding: 12px 20px;
  }
  .content {
    padding: 20px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-toggle-btn {
    display: flex;
  }
  .stats-grid.is-collapsed {
    display: none;
  }
  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

@media (max-width: 576px) {
  .topbar {
    padding: 10px 14px;
  }
  .content {
    padding: 14px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .modal-overlay {
    padding: 10px;
  }
  .modal {
    max-height: calc(100dvh - 20px);
  }
  .modal-header, .modal-footer {
    padding: 14px 18px;
  }
  .modal-body {
    padding: 18px;
  }
  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
  .toast {
    min-width: auto;
    width: 100%;
  }
}
