/* ═══════════════════════════════════════════════════════════════
   Cash — Sistema de Facturación Electrónica DIAN
   Design System v2.0 — Modern & Responsive
═══════════════════════════════════════════════════════════════ */

:root {
  --primary:       #6366F1;
  --primary-dark:  #4F46E5;
  --primary-light: #E0E7FF;
  --secondary:     #0EA5E9;
  --accent:        #F59E0B;
  --success:       #10B981;
  --danger:        #EF4444;
  --warning:       #F59E0B;
  --info:          #0EA5E9;

  --dark:          #0F172A;
  --sidebar-dark:  #111827;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --text-light:    #94A3B8;

  --bg:            #F8FAFC;
  --white:         #FFFFFF;
  --border:        #E2E8F0;
  --border-light:  #F1F5F9;

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --radius:        14px;
  --radius-sm:     10px;
  --radius-lg:     18px;

  --shadow-sm:     0 1px 3px rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.03);
  --shadow:        0 4px 6px -1px rgba(15,23,42,.05), 0 2px 4px -1px rgba(15,23,42,.03);
  --shadow-md:     0 10px 15px -3px rgba(15,23,42,.06), 0 4px 6px -2px rgba(15,23,42,.03);
  --shadow-lg:     0 20px 25px -5px rgba(15,23,42,.08), 0 10px 10px -5px rgba(15,23,42,.03);
  --shadow-glow:   0 0 0 4px rgba(99,102,241,.12);

  --transition:    .2s cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); text-decoration: none; }

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

/* ═══════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0B0F19 0%, #111827 60%, #1E1B4B 100%);
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform var(--transition);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }

.sidebar-logo {
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-text {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.6px;
  background: linear-gradient(135deg, #fff 0%, #818CF8 50%, #38BDF8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-logo-text::before {
  content: '';
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
  flex-shrink: 0;
}

.sidebar-company {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  background: rgba(255,255,255,.025);
  position: relative;
}
.sidebar-company::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), transparent);
  opacity: .5;
}
.sidebar-company-name { font-weight: 700; color: var(--white); font-size: .86rem; line-height: 1.4; }
.sidebar-company-nit  { font-size: .72rem; color: #64748B; margin-top: 3px; font-weight: 500; }

.sidebar-nav { flex: 1; padding: 12px 14px 16px; }

.nav-section-label {
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #475569;
  padding: 18px 10px 8px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 2px 0;
  color: #94A3B8;
  font-size: .85rem;
  font-weight: 500;
  transition: all var(--transition);
  border-radius: 12px;
  position: relative;
}
.nav-item::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 0; height: 24px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  transition: width var(--transition);
}
.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: #E2E8F0;
  text-decoration: none;
  transform: translateX(3px);
}
.nav-item:hover .nav-icon { background: rgba(99,102,241,.18); color: #C7D2FE; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(99,102,241,.18) 0%, rgba(99,102,241,.06) 100%);
  color: #E0E7FF;
  font-weight: 600;
}
.nav-item.active::before { width: 4px; }
.nav-item.active .nav-icon { background: rgba(99,102,241,.25); color: #C7D2FE; box-shadow: 0 0 14px rgba(99,102,241,.25); }
.nav-item.active:hover { transform: translateX(0); }
.nav-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.04);
  transition: all var(--transition);
  flex-shrink: 0;
}
.nav-icon svg { width: 18px; height: 18px; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(4px);
}
.sidebar-user { display: flex; align-items: center; gap: 12px; overflow: hidden; }
.sidebar-user-avatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--white);
  font-weight: 700;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,.25);
}
.sidebar-user-name { font-size: .82rem; color: #E2E8F0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .68rem; color: #64748B; text-transform: capitalize; font-weight: 500; }
.btn-logout {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  color: #94A3B8;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,.15); color: #FCA5A5; border-color: rgba(239,68,68,.25); transform: translateY(-1px); }

/* ═══════════════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ═══════════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background var(--transition);
}
.topbar-toggle:hover { background: var(--bg); }
.topbar-toggle span { display: block; width: 20px; height: 2px; background: var(--text-muted); border-radius: 2px; transition: all var(--transition); }
.topbar-title { font-weight: 700; font-size: 1rem; color: var(--text); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ═══════════════════════════════════════════════════
   PAGE CONTENT
═══════════════════════════════════════════════════ */
.page-content { padding: 28px; flex: 1; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--dark); letter-spacing: -.5px; }
.page-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: 3px; }
.breadcrumb { font-size: .8rem; color: var(--text-light); margin-bottom: 4px; }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }

/* ═══════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #FAFBFF 0%, var(--white) 100%);
}
.card-title { font-size: .92rem; font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.card-title::before {
  content: ''; display: inline-block; width: 4px; height: 18px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 3px; flex-shrink: 0;
}
.card-body { padding: 22px; }
.card-body.p-0 { padding: 0; }

/* ═══════════════════════════════════════════════════
   DASHBOARD HEADER
═══════════════════════════════════════════════════ */
.dashboard-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 26px; gap: 16px; flex-wrap: wrap;
}
.dashboard-greeting {
  font-size: 1.6rem; font-weight: 800; color: var(--dark);
  letter-spacing: -.6px; margin-bottom: 4px;
}
.dashboard-date {
  color: var(--text-muted); font-size: .9rem; font-weight: 500;
}
.dashboard-header .btn { box-shadow: 0 4px 14px rgba(99,102,241,.3); }

.chart-container {
  position: relative; height: 240px; width: 100%;
}
.chart-container canvas { width: 100% !important; height: 100% !important; }

/* ═══════════════════════════════════════════════════
   KPI CARDS
═══════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }

.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.kpi-card:nth-child(1)::before { background: linear-gradient(90deg, #4F46E5, #818CF8); }
.kpi-card:nth-child(2)::before { background: linear-gradient(90deg, #10B981, #34D399); }
.kpi-card:nth-child(3)::before { background: linear-gradient(90deg, #F59E0B, #FCD34D); }
.kpi-card:nth-child(4)::before { background: linear-gradient(90deg, #0EA5E9, #38BDF8); }
.kpi-card:nth-child(5)::before { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }
.kpi-card::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 110px; height: 110px;
  border-radius: 50%;
  opacity: .06;
  pointer-events: none;
}
.kpi-card:nth-child(1)::after { background: #4F46E5; }
.kpi-card:nth-child(2)::after { background: #10B981; }
.kpi-card:nth-child(3)::after { background: #F59E0B; }
.kpi-card:nth-child(4)::after { background: #0EA5E9; }
.kpi-card:nth-child(5)::after { background: #8B5CF6; }
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-card.kpi-sm { flex-direction: column; align-items: flex-start; padding: 18px; }

.kpi-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.kpi-icon svg { width: 26px; height: 26px; }
.kpi-blue   { background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%); }
.kpi-green  { background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%); }
.kpi-orange { background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%); }
.kpi-purple { background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%); }
.kpi-cyan   { background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%); }

.kpi-value   { font-size: 2rem; font-weight: 800; color: var(--dark); line-height: 1; letter-spacing: -1px; }
.kpi-value-sm { font-size: 1.1rem; font-weight: 700; color: var(--dark); }
.kpi-label   { font-size: .74rem; color: var(--text-muted); font-weight: 600; margin-top: 6px; text-transform: uppercase; letter-spacing: .04em; }

/* ═══════════════════════════════════════════════════
   GRID
═══════════════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 960px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .78rem; font-weight: 600; color: #374151;
  margin-bottom: 6px; letter-spacing: .01em;
}
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-label-link { font-weight: 400; font-size: .78rem; color: var(--primary); }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  font-family: inherit;
}
.form-control:hover { border-color: #CBD5E1; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); background: #FDFDFE; }
.form-control[readonly] { background: #F8FAFC; color: #94A3B8; cursor: not-allowed; }
.form-control::placeholder { color: #CBD5E1; }
input[type="file"].form-control {
  padding: 8px 14px; background: #F8FAFC;
  border-style: dashed; border-color: #CBD5E1;
  cursor: pointer;
}
input[type="file"].form-control:hover { border-color: var(--primary); background: var(--primary-light); }
input[type="file"].form-control:focus { border-style: solid; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.6; }
.form-hint { font-size: .74rem; color: var(--text-light); margin-top: 5px; display: block; }
.form-check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.form-check-input { width: 16px; height: 16px; accent-color: var(--primary); }
.form-check-label { font-size: .875rem; }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding-top: 8px; }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group-btn {
  padding: 0 14px; border: 1.5px solid var(--border); border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #F8FAFC; cursor: pointer; color: var(--text-muted);
  transition: all var(--transition); font-size: .875rem;
}
.input-group-btn:hover { background: var(--primary-light); color: var(--primary); }

.row { display: flex; gap: 14px; }
.row .form-group { flex: 1; }
.col-2  { flex: 0 0 calc(16.66% - 7px) !important; }
.col-4  { flex: 0 0 calc(33.33% - 9px) !important; }
.col-5  { flex: 0 0 calc(41.66% - 7px) !important; }
.col-6  { flex: 0 0 calc(50% - 7px) !important; }
.col-8  { flex: 0 0 calc(66.66% - 5px) !important; }
.col-12 { flex: 0 0 100% !important; }

/* ═══════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 20px; border-radius: var(--radius-sm); font-size: .875rem;
  font-weight: 600; cursor: pointer; border: none;
  transition: all var(--transition); text-decoration: none;
  font-family: inherit; line-height: 1.4; white-space: nowrap;
  letter-spacing: .01em;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }

.btn-primary {
  background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(79,70,229,.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3730A3 0%, #4F46E5 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(79,70,229,.45);
  transform: translateY(-1px);
}

.btn-secondary { background: var(--text-muted); color: var(--white); }
.btn-secondary:hover { background: #475569; color: var(--white); }

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

.btn-success { background: linear-gradient(135deg, #059669 0%, #10B981 100%); color: var(--white); box-shadow: 0 2px 8px rgba(16,185,129,.3); }
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,.4); color: var(--white); }

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

.btn-sm { padding: 5px 12px; font-size: .78rem; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.ml-2 { margin-left: 8px; }

/* ═══════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: .7rem; font-weight: 700; white-space: nowrap;
  letter-spacing: .03em;
}
.badge-success   { background: #ECFDF5; color: #065F46; }
.badge-danger    { background: #FEF2F2; color: #991B1B; }
.badge-warning   { background: #FFFBEB; color: #92400E; }
.badge-info      { background: #EFF6FF; color: #1E40AF; }
.badge-secondary { background: #F8FAFC; color: #475569; border: 1px solid var(--border); }
.badge-outline   { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.badge-primary   { background: var(--primary-light); color: var(--primary); }

/* ═══════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════ */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table thead th {
  padding: 12px 16px; text-align: left;
  background: #F8FAFC; color: var(--text-muted);
  font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid #F8FAFC;
  vertical-align: middle;
  color: var(--text);
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: #FAFBFF; }
.table tbody tr:last-child td { border-bottom: none; }
.table-sm th, .table-sm td { padding: 9px 14px; }

.text-right   { text-align: right !important; }
.text-center  { text-align: center !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-sm      { font-size: .8rem; }
.text-danger  { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-primary { color: var(--primary) !important; }
.link-primary { color: var(--primary); font-weight: 600; }
.link-primary:hover { color: var(--primary-dark); }

/* ═══════════════════════════════════════════════════
   ALERTS / FLASH
═══════════════════════════════════════════════════ */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  margin-bottom: 18px; font-size: .875rem;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-danger  { background: #FEF2F2; border-left: 4px solid var(--danger); color: #991B1B; }
.alert-info    { background: #EFF6FF; border-left: 4px solid var(--info); color: #1E40AF; }
.alert-warning { background: #FFFBEB; border-left: 4px solid var(--warning); color: #92400E; }
.alert-success { background: #ECFDF5; border-left: 4px solid var(--success); color: #065F46; }

.flash {
  position: fixed; top: 18px; right: 22px; z-index: 9999;
  max-width: 440px; padding: 14px 18px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  box-shadow: var(--shadow-lg); animation: slideIn .3s cubic-bezier(.34,1.56,.64,1);
  font-size: .875rem; font-weight: 500;
}
.flash-success { background: #ECFDF5; color: #065F46; border-left: 4px solid var(--success); }
.flash-error   { background: #FEF2F2; color: #991B1B; border-left: 4px solid var(--danger); }
.flash button  { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: inherit; opacity: .6; }
.flash button:hover { opacity: 1; }
@keyframes slideIn {
  from { transform: translateX(60px) scale(.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════════════
   PROGRESS BARS
═══════════════════════════════════════════════════ */
.progress-group { display: flex; flex-direction: column; gap: 14px; }
.progress-item  { display: flex; align-items: center; gap: 12px; }
.progress-label { width: 170px; font-size: .8rem; color: var(--text-muted); flex-shrink: 0; font-weight: 500; }
.progress-bar-wrap {
  flex: 1; background: #F1F5F9; border-radius: 6px; height: 8px; overflow: hidden;
}
.progress-bar { height: 100%; border-radius: 6px; transition: width .7s ease; }
.bg-success   { background: linear-gradient(90deg, #059669, #10B981); }
.bg-warning   { background: linear-gradient(90deg, #D97706, #F59E0B); }
.bg-danger    { background: linear-gradient(90deg, #DC2626, #EF4444); }
.bg-secondary { background: linear-gradient(90deg, #64748B, #94A3B8); }
.progress-val { width: 36px; text-align: right; font-size: .82rem; color: var(--dark); font-weight: 700; }

/* ═══════════════════════════════════════════════════
   QUICK ACTIONS
═══════════════════════════════════════════════════ */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; }
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--white);
  color: var(--text); font-size: .82rem; font-weight: 600;
  transition: all var(--transition); cursor: pointer; text-decoration: none;
  position: relative; overflow: hidden;
}
.quick-action-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,.06) 0%, rgba(14,165,233,.04) 100%);
  opacity: 0;
  transition: opacity var(--transition);
}
.quick-action-btn:hover {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary); transform: translateY(-3px);
  box-shadow: var(--shadow-md); text-decoration: none;
}
.quick-action-btn:hover::before { opacity: 1; }
.qa-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  box-shadow: 0 4px 12px rgba(99,102,241,.12);
  transition: all var(--transition);
  position: relative; z-index: 1;
}
.quick-action-btn:hover .qa-icon {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  box-shadow: 0 8px 20px rgba(99,102,241,.3);
  transform: scale(1.05);
}
.quick-action-btn:hover .qa-icon svg { stroke: #fff; }
.qa-icon svg { width: 28px; height: 28px; transition: stroke var(--transition); }
.qa-text { position: relative; z-index: 1; }

/* ═══════════════════════════════════════════════════
   FILTER FORM
═══════════════════════════════════════════════════ */
.filter-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.filter-form .filter-row {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
}
.filter-form .form-group { margin-bottom: 0; }

/* ═══════════════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════════════ */
.pagination-wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-top: 1px solid var(--border-light);
}
.pagination { display: flex; gap: 5px; }
.pagination-info { font-size: .8rem; color: var(--text-muted); }
.page-btn {
  padding: 6px 12px; border-radius: 7px; font-size: .8rem;
  border: 1.5px solid var(--border); color: var(--text); background: var(--white);
  text-decoration: none; font-weight: 500; transition: all var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; background: var(--primary-light); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: var(--white); box-shadow: 0 2px 6px rgba(79,70,229,.4); }

/* ═══════════════════════════════════════════════════
   DATA LIST
═══════════════════════════════════════════════════ */
.data-list {
  display: grid; grid-template-columns: 160px 1fr;
  gap: 8px 14px; font-size: .875rem;
}
.data-list dt { color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.data-list dd { color: var(--text); }

/* ═══════════════════════════════════════════════════
   TOTALS
═══════════════════════════════════════════════════ */
.totals-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.totals-table td { padding: 7px 4px; }
.totals-final td { border-top: 2px solid var(--border); font-size: 1.05rem; padding-top: 10px; }
.totals-summary { max-width: 340px; margin-left: auto; }
.totals-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: .9rem; border-bottom: 1px solid var(--border-light); }
.totals-row:last-child { border-bottom: none; }
.totals-final {
  border-top: 2px solid var(--primary); margin-top: 8px; padding-top: 10px;
  font-size: 1.15rem; font-weight: 800; color: var(--primary);
  display: flex; justify-content: space-between;
}

/* ═══════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 64px 24px; color: var(--text-light);
}
.empty-icon { font-size: 3.5rem; margin-bottom: 14px; display: block; }
.empty-state h3 { color: var(--text-muted); margin-bottom: 8px; font-size: 1rem; font-weight: 600; }
.empty-state p { margin-bottom: 22px; font-size: .875rem; }

/* ═══════════════════════════════════════════════════
   CUFE CODE
═══════════════════════════════════════════════════ */
.cufe-code {
  display: block; font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: .7rem; word-break: break-all;
  background: #F8FAFC; padding: 8px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  color: #475569; line-height: 1.7;
}

/* ═══════════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════════ */
.tabs {
  display: flex; gap: 4px; margin-bottom: 28px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  overflow-x: auto; scrollbar-width: none;
  box-shadow: var(--shadow-sm);
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 10px 22px; font-size: .82rem; font-weight: 600;
  border: none; background: none; cursor: pointer; color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.active {
  color: var(--white);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 3px 10px rgba(79,70,229,.3);
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════════════════
   REPORTS GRID
═══════════════════════════════════════════════════ */
.reports-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.report-card {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--white); border-radius: var(--radius);
  padding: 22px; border: 1.5px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: all var(--transition);
}
.report-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md);
  transform: translateY(-2px); text-decoration: none;
}
.report-card h3 { font-size: .92rem; font-weight: 700; margin-bottom: 5px; }
.report-card p  { font-size: .8rem; color: var(--text-muted); }
.report-icon    { font-size: 2.2rem; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════ */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 50%, #312E81 100%);
  position: relative;
  overflow: hidden;
}
.login-body::before,
.login-body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .55;
  animation: float 14s ease-in-out infinite;
}
.login-body::before {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(99,102,241,.55) 0%, transparent 70%);
  top: -120px; left: -120px;
  animation-delay: 0s;
}
.login-body::after {
  width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(14,165,233,.45) 0%, transparent 70%);
  bottom: -100px; right: -100px;
  animation-delay: -7s;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -30px) scale(1.08); }
}
.login-orbs {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
}
.login-orb {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35;
  animation: orbFloat 18s ease-in-out infinite;
}
.login-orb.cyan { width: 340px; height: 340px; background: rgba(14,165,233,.5); top: 40%; left: 60%; animation-delay: -4s; }
.login-orb.pink { width: 280px; height: 280px; background: rgba(236,72,153,.35); top: 60%; left: 15%; animation-delay: -10s; }
@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-40px) scale(1.05); }
}
.login-container { width: 100%; max-width: 460px; padding: 24px; position: relative; z-index: 1; }
.login-card {
  background: rgba(255,255,255,.82);
  border-radius: 24px; padding: 46px 42px;
  box-shadow: 0 32px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.18) inset;
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,.25);
  animation: cardIn .6s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-header { text-align: center; margin-bottom: 36px; }
.login-logo {
  margin-bottom: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  box-shadow: 0 12px 30px rgba(99,102,241,.35);
  animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 12px 30px rgba(99,102,241,.35); }
  50% { box-shadow: 0 16px 40px rgba(99,102,241,.55); }
}
.login-logo svg { width: 38px; height: 38px; }
.login-title { font-size: 1.9rem; font-weight: 800; color: var(--dark); letter-spacing: -.8px; }
.login-subtitle { color: var(--text-muted); font-size: .92rem; margin-top: 6px; font-weight: 500; }
.login-form .form-group { margin-bottom: 20px; }
.login-form .form-control {
  background: rgba(255,255,255,.75);
  border: 1.5px solid rgba(226,232,240,.8);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: .95rem;
}
.login-form .form-control:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
.login-form .btn-primary {
  margin-top: 10px;
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
}
.login-form .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(99,102,241,.5);
}
.login-footer { text-align: center; margin-top: 26px; color: rgba(255,255,255,.55); font-size: .76rem; }
.login-footer small { display: block; margin-top: 4px; color: rgba(255,255,255,.38); }

/* ═══════════════════════════════════════════════════
   ENV BANNER
═══════════════════════════════════════════════════ */
.env-banner {
  background: linear-gradient(90deg, #D97706, #F59E0B);
  color: var(--white);
  text-align: center; padding: 7px; font-size: .77rem; font-weight: 700;
  letter-spacing: .02em; box-shadow: 0 2px 8px rgba(245,158,11,.3);
}

/* ═══════════════════════════════════════════════════
   SIDEBAR OVERLAY
═══════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; animation: fadeInBg .2s ease; }
@keyframes fadeInBg { from { opacity: 0; } to { opacity: 1; } }

/* ═══════════════════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════════════════ */
.mt-4  { margin-top: 24px; }
.mb-4  { margin-bottom: 24px; }
.mb-3  { margin-bottom: 14px; }
.mb-0  { margin-bottom: 0 !important; }
.py-4  { padding-top: 24px; padding-bottom: 24px; }
.p-0   { padding: 0 !important; }
.d-flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.d-flex { display: flex; align-items: center; gap: 8px; }
.fw-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: .8rem; }

/* Separador de sección */
.section-divider { border: none; border-top: 2px solid var(--border); margin: 24px 0; }

/* Status dot */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.green { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.status-dot.orange { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.status-dot.red { background: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.status-dot.gray { background: var(--text-light); }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-content { margin-left: 0; max-width: 100vw; }
  .topbar-toggle { display: flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .reports-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .filter-form .filter-row { flex-direction: column; }
  .row { flex-wrap: wrap; }
  .row .col-4, .row .col-5, .row .col-6 { flex: 1 1 calc(50% - 7px) !important; min-width: 140px; }
  .row .col-2 { flex: 1 1 calc(50% - 7px) !important; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .btn { align-self: flex-start; }
  .quick-actions { grid-template-columns: repeat(3, 1fr); }
  .data-list { grid-template-columns: 120px 1fr; }
  .login-card { padding: 32px 24px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 1.5rem; }
  .kpi-icon { width: 42px; height: 42px; font-size: 1.2rem; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .row .col-4, .row .col-6 { flex: 1 1 100% !important; }
  .btn-group { flex-direction: column; }
  .table { font-size: .8rem; }
  .table td, .table th { padding: 9px 10px; }
}

@media (min-width: 1400px) {
  .kpi-grid { gap: 22px; }
}
