/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --color-primary: #2563eb;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-warning: #d97706;
  --color-bg: #f1f5f9;
  --color-sidebar: #1e293b;
  --color-sidebar-text: #94a3b8;
  --color-sidebar-active: #fff;
  --color-card: #ffffff;
}

/* ─── Reset / Base ──────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  margin: 0;
  padding: 0;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.empresa-badge {
  padding: 10px 16px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  font-size: 13px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
}

.sidebar-nav .nav-link.active {
  color: var(--color-sidebar-active);
  background: rgba(37,99,235,0.2);
  border-left-color: var(--color-primary);
}

.nav-section {
  padding: 14px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #475569;
  text-transform: uppercase;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ─── Main Content ──────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--color-card);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-content {
  padding: 24px;
  flex: 1;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card {
  border-radius: 10px;
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  margin: 4px 0;
}

.stat-card .stat-label {
  font-size: 12px;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-icon {
  position: absolute;
  right: 16px;
  top: 16px;
  font-size: 36px;
  opacity: 0.2;
}

.stat-bg-blue   { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.stat-bg-green  { background: linear-gradient(135deg, #16a34a, #15803d); }
.stat-bg-red    { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.stat-bg-orange { background: linear-gradient(135deg, #d97706, #b45309); }
.stat-bg-purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  border-top: none;
}

.table td {
  font-size: 14px;
  vertical-align: middle;
}

/* ─── Badges estado ──────────────────────────────────────────────────────── */
.badge-pendiente  { background: #fef3c7; color: #92400e; }
.badge-cobrada    { background: #dcfce7; color: #166534; }
.badge-pagada     { background: #dcfce7; color: #166534; }
.badge-vencida    { background: #fee2e2; color: #991b1b; }
.badge-cancelada  { background: #f1f5f9; color: #64748b; }
.badge-en_curso   { background: #dbeafe; color: #1e40af; }
.badge-finalizado { background: #dcfce7; color: #166534; }
.badge-cobrado    { background: #f0fdf4; color: #166534; }
.badge-pedido     { background: #fef3c7; color: #92400e; }
.badge-recibido   { background: #dcfce7; color: #166534; }

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

/* ─── Alertas inline ─────────────────────────────────────────────────────── */
.alerta-box {
  border-left: 4px solid;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}

.alerta-box.warning { border-color: #d97706; background: #fffbeb; }
.alerta-box.danger  { border-color: #dc2626; background: #fef2f2; }
.alerta-box.info    { border-color: #2563eb; background: #eff6ff; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.form-control, .form-select {
  border-radius: 7px;
  font-size: 14px;
}

/* ─── Responsive sidebar ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
}

/* ─── Login page ─────────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h2 {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

.btn-xs {
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.btn-xs {
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 4px;
}
