:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar-bg: #111827;
  --sidebar-hover: #1f2937;
  --sidebar-width: 260px;
  --topbar-height: 60px;
}

* { box-sizing: border-box; }

body {
  background: #f3f4f6;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #e5e7eb;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.25s ease;
}
.sidebar-brand {
  padding: 20px 18px;
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand i { color: var(--primary); font-size: 1.5rem; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user .avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.text-role { color: #9ca3af; font-size: 0.7rem; letter-spacing: 0.5px; }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 20px;
}
.sidebar-nav .nav-link {
  color: #d1d5db;
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  margin-bottom: 2px;
  text-decoration: none;
}
.sidebar-nav .nav-link i { width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1035;
}
.sidebar-overlay.show { display: block; }

/* ===== MAIN ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
}
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.topbar-title { font-weight: 600; color: #374151; }
.topbar-cycle { margin-left: auto; }
.content-area { padding: 24px; flex: 1; }
.app-footer {
  padding: 14px 24px;
  text-align: center;
  color: #9ca3af;
  font-size: 0.85rem;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

/* Cards de estadísticas */
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-left: 4px solid var(--primary);
  height: 100%;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: #111827; }
.stat-card .stat-label { color: #6b7280; font-size: 0.85rem; }
.stat-card i { font-size: 1.8rem; color: var(--primary); opacity: 0.85; }

.card-panel {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Tablas */
.table-responsive-card table thead { background: #f9fafb; }
.table > :not(caption) > * > * { padding: 0.7rem 0.85rem; }

/* Login público */
.public-hero {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary), #1e3a8a);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  display: flex;
  flex-wrap: wrap;
}
.login-info {
  background: #111827;
  color: #fff;
  padding: 50px 40px;
  flex: 1 1 320px;
}
.login-form-side { flex: 1 1 360px; padding: 50px 40px; }
.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin: 3px 4px 3px 0;
}

/* Responsivo */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; }
}
