:root {
  --okun-gold: #FFBC50;
  --okun-gold-dark: #E09926;
  --okun-navy: #242837;
  --okun-navy-2: #1a1d29;
  --okun-gray: #434343;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e6e8ee;
  --muted: #6c757d;
  --text: #242837;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
}

/* ==================== AUTH ==================== */
.auth-body {
  background: linear-gradient(135deg, var(--okun-navy) 0%, var(--okun-navy-2) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--card);
  border-radius: 14px;
  padding: 2.25rem 2rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-bottom: 1.75rem; color: var(--okun-navy);
}
.brand-text-auth { font-size: 1.7rem; font-weight: 600; color: var(--okun-navy); letter-spacing: .01em; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--okun-gold), var(--okun-gold-dark));
  box-shadow: 0 0 0 3px rgba(255,188,80,0.2);
}
.auth-title { font-size: 1.5rem; font-weight: 600; margin: 0 0 .25rem; }
.auth-sub { color: var(--muted); margin-bottom: 1.25rem; font-size: .95rem; }
.auth-foot { text-align: center; color: rgba(255,255,255,0.6); font-size: .8rem; margin-top: 1.5rem; }

/* Tamaño y centrado consistente de todos los .btn */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .42rem .9rem; font-size: .92rem; line-height: 1.25;
  border-radius: 8px;
}
.btn-sm { padding: .28rem .65rem; font-size: .82rem; }
.btn i.bi { line-height: 1; font-size: 1em; display: inline-flex; align-items: center; }

.btn-primary-okun {
  background: linear-gradient(135deg, var(--okun-gold), var(--okun-gold-dark));
  border: none; color: #fff; font-weight: 500;
}
.btn-primary-okun:hover { filter: brightness(1.05); color: #fff; }

/* ==================== APP SHELL ==================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--okun-navy);
  color: #e9ecef;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-logo { width: 100px; height: auto; object-fit: contain; }
.brand-logo-auth { width: 72px; height: 72px; object-fit: contain; }
.brand-name { font-weight: 600; }
.brand-sub { font-size: .75rem; color: rgba(255,255,255,0.5); }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: .75rem 0;
}
.nav-group {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,0.4); padding: 1rem 1.25rem .35rem;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: .55rem 1.25rem; color: rgba(255,255,255,0.8);
  text-decoration: none; font-size: .92rem;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.nav-item.active {
  background: rgba(255,188,80,0.08);
  color: var(--okun-gold);
  border-left-color: var(--okun-gold);
}
.nav-item i { width: 18px; font-size: 1rem; }

.sidebar-foot { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.08); }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.user-chip i { font-size: 1.5rem; color: var(--okun-gold); }
.user-name { font-weight: 500; }
.user-role { font-size: .72rem; color: rgba(255,255,255,0.5); text-transform: capitalize; }

/* ==================== MAIN ==================== */
.app-main { flex: 1; min-width: 0; }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 1.35rem; font-weight: 600; margin: 0; }
.page { padding: 1.5rem 2rem 3rem; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

/* ==================== TABS ==================== */
.tab-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.tab-pill {
  padding: .35rem .9rem; border-radius: 20px; font-size: .85rem;
  text-decoration: none; color: var(--muted);
  border: 1px solid var(--border); background: var(--card);
}
.tab-pill:hover { border-color: var(--okun-gold); color: var(--okun-gold-dark); }
.tab-pill.active { background: var(--okun-gold); border-color: var(--okun-gold); color: #242837; font-weight: 600; }

/* ==================== CARDS ==================== */
.card-header-ok {
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: .95rem;
}
.badge-count {
  background: var(--okun-gold); color: var(--okun-navy);
  font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 20px;
}
.empty-state {
  padding: 3rem; text-align: center; color: var(--muted);
}

/* ==================== TABLAS ==================== */
.ok-table { width: 100%; border-collapse: collapse; }
.ok-table th {
  background: #f8f9fb; color: var(--muted); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .04em;
  padding: .65rem 1rem; border-bottom: 1px solid var(--border);
  font-weight: 600; text-align: left;
}
.ok-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); font-size: .92rem; vertical-align: middle; }
.ok-table tbody tr:last-child td { border-bottom: none; }
.ok-table tbody tr:hover { background: #f8f9fb; }
.ok-table a { color: inherit; text-decoration: none; }
.ok-table a:hover { color: var(--okun-gold-dark); text-decoration: underline; text-decoration-color: var(--okun-gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.td-actions { text-align: right; white-space: nowrap; }
.fw-500 { font-weight: 500; }

/* ==================== BOTONES ==================== */
.btn-icon {
  background: none; border: none; padding: .3rem .5rem;
  color: var(--muted); cursor: pointer; border-radius: 6px; font-size: .95rem;
}
.btn-icon:hover { background: var(--border); color: var(--text); }
.btn-icon.danger:hover { background: #fde8e8; color: #dc3545; }
.btn-back { color: var(--muted); text-decoration: none; font-size: .9rem; }
.btn-back:hover { color: var(--text); }

/* ==================== CHIPS/BADGES ==================== */
.color-chip { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.badge-ok { background: #d4edda; color: #155724; padding: .2rem .6rem; border-radius: 20px; font-size: .8rem; font-weight: 500; }
.badge-no { background: #f0f0f0; color: var(--muted); padding: .2rem .6rem; border-radius: 20px; font-size: .8rem; }

/* ==================== CLIENTES ==================== */
.client-logo { width: 110px; height: 44px; object-fit: contain; border-radius: 6px; display: block; margin: 0 auto; }
.client-logo-placeholder {
  width: 110px; height: 44px; border-radius: 6px; margin: 0 auto;
  background: linear-gradient(135deg, var(--okun-gold), var(--okun-gold-dark));
  color: #fff; font-weight: 700; font-size: .8rem;
  display: flex; align-items: center; justify-content: center;
}

/* ==================== FORMS ==================== */
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .35rem; }
.form-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.25rem; }

/* ==================== KPI DASHBOARD ==================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.kpi-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }

/* ==================== ESTADO BADGES ==================== */
.estado-badge {
  display: inline-block; padding: .2rem .65rem; border-radius: 20px;
  font-size: .78rem; font-weight: 600; color: var(--okun-navy);
}
.estado-badge.success { background: #d4edda; color: #155724; }
.estado-badge.warning { background: #fff3cd; color: #856404; }
.estado-badge.danger  { background: #f8d7da; color: #721c24; }
.estado-badge.info    { background: #d1ecf1; color: #0c5460; }
.estado-badge.muted   { background: #f0f0f0; color: #6c757d; }

/* ==================== CLIENTE ESTADO BADGES ==================== */
.cli-badge-activo   { background:#d4edda; color:#155724; padding:.2rem .65rem; border-radius:20px; font-size:.78rem; font-weight:600; }
.cli-badge-inactivo { background:#fff3cd; color:#856404; padding:.2rem .65rem; border-radius:20px; font-size:.78rem; font-weight:600; }
.cli-badge-sin      { background:#f0f0f0; color:#6c757d; padding:.2rem .65rem; border-radius:20px; font-size:.78rem; font-weight:600; }

/* ==================== KPI AVG ==================== */
.kpi-avg { font-size:.78rem; color:var(--muted); margin-top:.25rem; }

/* ==================== MISC UTILITIES ==================== */
.fw-600 { font-weight: 600; }
.text-code { font-family: 'Courier New', monospace; font-size: .85rem; }

/* ==================== SORT ==================== */
.th-sortable { cursor:pointer; user-select:none; white-space:nowrap; }
.th-sortable:hover { color: var(--okun-gold-dark); }
.th-sortable::after { content:''; display:inline-block; width:12px; text-align:center; margin-left:4px; opacity:.4; }
.th-sortable.sort-asc::after  { content:'↑'; opacity:1; color:var(--okun-gold-dark); }
.th-sortable.sort-desc::after { content:'↓'; opacity:1; color:var(--okun-gold-dark); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: .5rem; }
  .nav-group { display: none; }
  .nav-item { padding: .4rem .75rem; border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; }
  .nav-item.active { border-color: var(--okun-gold); }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
  .topbar, .page { padding-left: 1rem; padding-right: 1rem; }
}
