/* ════════════════════════════════════════════════════
   NEGOFIN × ARIZAR IA — Design System v2.0
   ════════════════════════════════════════════════════ */

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

/* ── DARK THEME (default) ─────────────────────────── */
:root,
[data-theme="dark"] {
  --bg: #030712;
  --surface: #0c1220;
  --surface2: #111827;
  --border: rgba(99, 102, 241, .1);
  --indigo: #6366f1;
  --emerald: #10b981;
  --sky: #0ea5e9;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --text: #f1f5f9;
  --muted: #64748b;
  --muted2: #94a3b8;
  --input-bg: rgba(255, 255, 255, .04);
  --input-border: rgba(99, 102, 241, .12);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, .4);
  --sidebar-shadow: 4px 0 40px rgba(0, 0, 0, .6);
  --topbar-bg: rgba(12, 18, 32, .9);
}

/* ── LIGHT THEME ──────────────────────────────────── */
[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: rgba(99, 102, 241, .18);
  --indigo: #6366f1;
  --emerald: #059669;
  --sky: #0284c7;
  --amber: #d97706;
  --rose: #e11d48;
  --text: #0f172a;
  --muted: #64748b;
  --muted2: #475569;
  --input-bg: rgba(99, 102, 241, .04);
  --input-border: rgba(99, 102, 241, .2);
  --card-shadow: 0 2px 16px rgba(0, 0, 0, .08);
  --sidebar-shadow: 4px 0 24px rgba(0, 0, 0, .15);
  --topbar-bg: rgba(255, 255, 255, .92);
}

/* ── Light overrides específicos ─────────────────── */
[data-theme="light"] .sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
}

[data-theme="light"] .topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .kpi-card,
[data-theme="light"] .chart-card,
[data-theme="light"] .table-card,
[data-theme="light"] .empresa-chip {
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

[data-theme="light"] .nav-item:hover {
  background: rgba(99, 102, 241, .08);
}

[data-theme="light"] .nav-item.active {
  background: rgba(99, 102, 241, .12);
  color: var(--indigo);
}

[data-theme="light"] input[type=text],
[data-theme="light"] input[type=password],
[data-theme="light"] input[type=email],
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--text);
}

[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(99, 102, 241, .15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .12), 0 0 0 1px rgba(99, 102, 241, .06) inset;
}

[data-theme="light"] .login-body {
  background: #f1f5f9
}

[data-theme="light"] .bg-grad {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, .07), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 110%, rgba(16, 185, 129, .05), transparent 55%);
}

[data-theme="light"] .orb1 {
  background: #6366f1;
  opacity: .04
}

[data-theme="light"] .orb2 {
  background: #10b981;
  opacity: .04
}

[data-theme="light"] .orb3 {
  background: #3b82f6;
  opacity: .03
}

[data-theme="light"] .user-card {
  background: rgba(99, 102, 241, .06)
}

[data-theme="light"] .btn-logout {
  background: rgba(239, 68, 68, .06);
  border-color: rgba(239, 68, 68, .2);
}

[data-theme="light"] .modal-box {
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
}

[data-theme="light"] .perm-check {
  color: var(--emerald)
}

[data-theme="light"] .sesion-row {
  background: rgba(99, 102, 241, .04)
}

[data-theme="light"] .usr-stat-pill {
  background: var(--surface)
}

[data-theme="light"] .date-badge {
  background: rgba(99, 102, 241, .06)
}

[data-theme="light"] .grid-bg {
  background-image:
    linear-gradient(rgba(99, 102, 241, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, .04) 1px, transparent 1px);
}

/* ── Transición global suave de tema ─────────────── */
*,
*::before,
*::after {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 250ms;
  transition-timing-function: ease;
}

/* Excepciones: animaciones y transformaciones no deben heredar la transición */
.orb,
.grid-bg,
svg,
img,
.nav-item.active::before,
[class*="chart"],
canvas,
.kpi-badge,
.status-dot,
.pwd-strength-fill,
.toggle-slider {
  transition: none
}


html,
body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg)
}

/* ── FONDO ANIMADO ─────────────────────────────────── */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none
}

.bg-grad {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, .13), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 110%, rgba(16, 185, 129, .08), transparent 55%)
}

.grid-bg {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(99, 102, 241, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, .025) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: gridMove 25s linear infinite
}

@keyframes gridMove {
  to {
    background-position: 64px 64px
  }
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: orbDrift ease-in-out infinite
}

.orb1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  opacity: .08;
  top: -150px;
  left: -100px;
  animation-duration: 20s
}

.orb2 {
  width: 350px;
  height: 350px;
  background: #10b981;
  opacity: .07;
  bottom: -100px;
  right: -80px;
  animation-duration: 26s;
  animation-delay: 4s
}

.orb3 {
  width: 250px;
  height: 250px;
  background: #3b82f6;
  opacity: .06;
  top: 40%;
  left: 55%;
  animation-duration: 18s;
  animation-delay: 8s
}

@keyframes orbDrift {

  0%,
  100% {
    transform: translate(0, 0) scale(1)
  }

  33% {
    transform: translate(40px, -50px) scale(1.06)
  }

  66% {
    transform: translate(-30px, 35px) scale(.94)
  }
}

/* ── LOGIN PAGE ────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden
}

.login-wrap {
  position: relative;
  z-index: 10;
  padding: 24px;
  width: 100%;
  display: flex;
  justify-content: center
}

.login-card {
  width: 420px;
  max-width: 100%;
  background: rgba(12, 18, 32, .78);
  border: 1px solid rgba(99, 102, 241, .12);
  border-radius: 24px;
  backdrop-filter: blur(50px) saturate(1.3);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6), 0 0 0 1px rgba(99, 102, 241, .04) inset;
  padding: 44px 40px 36px;
  animation: cardIn .55s cubic-bezier(.34, 1.56, .64, 1)
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(.96)
  }

  to {
    opacity: 1;
    transform: none
  }
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, .5), transparent)
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 32px
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 8px 32px rgba(99, 102, 241, .4)
}

.logo-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.5px
}

.logo-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 1px
}

.login-heading {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: 6px;
  text-align: center
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 28px
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted2);
  letter-spacing: .03em
}

.input-wrap {
  position: relative
}

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: .45
}

input[type=text],
input[type=password] {
  width: 100%;
  padding: 12px 14px 12px 38px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(99, 102, 241, .12);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s
}

input:focus {
  border-color: rgba(99, 102, 241, .5);
  background: rgba(99, 102, 241, .05);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .1)
}

input::placeholder {
  color: var(--muted)
}

.btn-primary {
  width: 100%;
  padding: 13px;
  margin-top: 6px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(99, 102, 241, .45)
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none
}

.error-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(244, 63, 94, .08);
  border: 1px solid rgba(244, 63, 94, .2);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #f43f5e;
  margin-bottom: 4px;
  animation: shake .4s
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0)
  }

  25% {
    transform: translateX(-6px)
  }

  75% {
    transform: translateX(6px)
  }
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--muted)
}

.login-footer strong {
  color: rgba(99, 102, 241, .7)
}

/* ── DASHBOARD LAYOUT ──────────────────────────────── */
.dash-layout {
  display: flex;
  height: 100vh;
  overflow: hidden
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto
}

.sidebar-logo {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0
}

.sidebar-logo img {
  display: block
}

.logo-sub-sm {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: .02em
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 10px
}

.logo-icon-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff
}

.logo-text-sm {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.3px
}

.logo-sub-sm {
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px
}

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

.nav-section {
  margin-bottom: 20px
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 12px;
  margin-bottom: 6px
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
  color: var(--muted2);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 3px;
  text-decoration: none;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation
}

.nav-item:hover {
  background: rgba(99, 102, 241, .08);
  color: var(--text)
}

.nav-item:active {
  transform: scale(.98)
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, .18), rgba(99, 102, 241, .08));
  color: var(--indigo);
  font-weight: 600
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 22%;
  height: 56%;
  width: 3px;
  background: linear-gradient(to bottom, var(--indigo), var(--sky));
  border-radius: 0 3px 3px 0;
  box-shadow: 2px 0 8px rgba(99, 102, 241, .4)
}

.nav-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0
}

.nav-badge {
  margin-left: auto;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 20px;
  font-weight: 700
}

.badge-green {
  background: rgba(16, 185, 129, .15);
  color: var(--emerald)
}

.badge-amber {
  background: rgba(245, 158, 11, .15);
  color: var(--amber)
}

.badge-indigo {
  background: rgba(99, 102, 241, .15);
  color: var(--indigo)
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border)
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  margin-bottom: 8px
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--sky));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.user-role {
  font-size: 10px;
  color: var(--muted);
  text-transform: capitalize
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  background: rgba(244, 63, 94, .08);
  border: 1px solid rgba(244, 63, 94, .2);
  color: var(--rose);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none
}

.btn-logout:hover {
  background: rgba(244, 63, 94, .15)
}

/* MAIN AREA */
.dash-main {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-width: 0
}

.topbar {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(12, 18, 32, .85);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px)
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  letter-spacing: -.2px
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px
}

.date-badge {
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border)
}

.btn-refresh {
  padding: 8px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--indigo), #818cf8);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px
}

.btn-refresh:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, .4)
}

.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow-x: hidden
}

/* KPI CARDS */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: transform .2s, box-shadow .2s, border-color .2s
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35), 0 0 0 1px rgba(99, 102, 241, .15);
  border-color: rgba(99, 102, 241, .2)
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--kpi-accent);
  border-radius: 16px 16px 0 0
}

/* Subtle glow reflection at bottom */
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to top, rgba(99, 102, 241, .02), transparent);
  pointer-events: none
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 8px
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1;
  font-variant-numeric: tabular-nums
}

.kpi-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px
}

.kpi-icon {
  position: absolute;
  right: 14px;
  top: 14px;
  font-size: 30px;
  opacity: .12;
  filter: grayscale(.3)
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 20px
}

.kpi-badge.down {
  background: rgba(244, 63, 94, .1);
  color: var(--rose)
}

.kpi-badge.up {
  background: rgba(16, 185, 129, .1);
  color: var(--emerald)
}

/* CHART CARDS */
.charts-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  min-width: 0
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: box-shadow .2s;
  min-width: 0;
  overflow: hidden
}

.chart-card:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25)
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px
}

.card-title {
  font-size: 14px;
  font-weight: 700
}

.card-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px
}

.chart-wrap {
  position: relative;
  height: 220px;
  width: 100%;
  max-width: 100%;
  overflow: hidden
}

.chart-wrap canvas {
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important
}

/* EMPRESA CHIPS */
.empresa-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px
}

.empresa-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  transition: all .2s;
  cursor: default
}

.empresa-chip:hover {
  border-color: rgba(99, 102, 241, .3);
  background: rgba(99, 102, 241, .04);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25)
}

.empresa-name {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px
}

.empresa-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0
}

.empresa-stat {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px
}

.empresa-val {
  color: var(--text);
  font-weight: 600
}

/* TABLE */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden
}

.table-toolbar {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap
}

.search-wrap {
  flex: 1;
  position: relative;
  max-width: 320px
}

.search-wrap input {
  width: 100%;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color .15s
}

.search-wrap input:focus {
  border-color: var(--indigo)
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none
}

.filter-btn {
  padding: 7px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  color: var(--muted2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: 'Inter', sans-serif
}

.filter-btn:hover {
  border-color: var(--indigo);
  color: var(--text)
}

.filter-btn.active {
  background: rgba(99, 102, 241, .12);
  border-color: var(--indigo);
  color: var(--indigo)
}

table {
  width: 100%;
  border-collapse: collapse
}

thead th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 11px 16px;
  text-align: left;
  background: rgba(255, 255, 255, .02);
  border-bottom: 1px solid var(--border)
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, .03);
  transition: background .1s;
  cursor: pointer
}

tbody tr:hover {
  background: rgba(99, 102, 241, .04)
}

tbody td {
  padding: 12px 16px;
  font-size: 13px;
  vertical-align: middle
}

.mora-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700
}

.mora-1 {
  background: rgba(245, 158, 11, .12);
  color: var(--amber)
}

.mora-2 {
  background: rgba(249, 115, 22, .12);
  color: #f97316
}

.mora-3 {
  background: rgba(239, 68, 68, .12);
  color: #ef4444
}

.mora-4 {
  background: rgba(244, 63, 94, .15);
  color: var(--rose)
}

.arizar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px
}

.sync-yes {
  background: var(--emerald)
}

.sync-no {
  background: var(--muted)
}

/* UPLOAD DROP ZONE */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s
}

.drop-zone.active {
  border-color: var(--indigo);
  background: rgba(99, 102, 241, .04)
}

/* MISC */
.loading-row {
  text-align: center;
  color: var(--muted);
  padding: 36px;
  font-size: 13px
}

.pulse {
  animation: pulse 1.4s ease-in-out infinite
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .35
  }
}

.skeleton {
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .05) 25%, rgba(255, 255, 255, .1) 50%, rgba(255, 255, 255, .05) 75%);
  background-size: 200%;
  animation: skLoad 1.3s infinite
}

@keyframes skLoad {
  0% {
    background-position: 200%
  }

  100% {
    background-position: -200%
  }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(120px);
  opacity: 0;
  transition: all .3s
}

.toast.show {
  transform: translateY(0);
  opacity: 1
}

.toast.ok {
  border-color: rgba(16, 185, 129, .3)
}

.toast.err {
  border-color: rgba(244, 63, 94, .3)
}

/* ── Tabla botones de acción ─────────────────────── */
.tbl-btn {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: Inter, sans-serif;
  transition: all .15s;
  margin-right: 4px
}

.btn-edit {
  background: rgba(99, 102, 241, .08);
  border-color: rgba(99, 102, 241, .2);
  color: var(--indigo)
}

.btn-edit:hover {
  background: rgba(99, 102, 241, .18)
}

.btn-warn {
  background: rgba(245, 158, 11, .08);
  border-color: rgba(245, 158, 11, .2);
  color: var(--amber)
}

.btn-warn:hover {
  background: rgba(245, 158, 11, .18)
}

.btn-del {
  background: rgba(244, 63, 94, .08);
  border-color: rgba(244, 63, 94, .2);
  color: var(--rose)
}

.btn-del:hover {
  background: rgba(244, 63, 94, .18)
}

/* ── Tags de rol ──────────────────────────────────── */
.tag-rol {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(99, 102, 241, .12);
  color: var(--indigo);
  text-transform: capitalize
}

/* ── Modales ──────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px
}

.modal-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
  animation: cardIn .3s cubic-bezier(.34, 1.56, .64, 1)
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border)
}

.modal-title {
  font-size: 16px;
  font-weight: 700
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s
}

.modal-close:hover {
  background: rgba(255, 255, 255, .06);
  color: var(--text)
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px
}

/* Sections hidden by default */
.section {
  display: none
}

.section.active {
  display: flex;
  flex-direction: column
}

/* Placeholder sections */
.placeholder-section {
  text-align: center;
  padding: 60px;
  color: var(--muted)
}

.placeholder-section .ph-icon {
  font-size: 48px;
  margin-bottom: 16px
}

.placeholder-section .ph-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text)
}

.placeholder-section .ph-sub {
  font-size: 13px
}

/* ═══════════════════════════════════════════════════
   MÓDULO PREMIUM: USUARIOS Y ROLES
   ═══════════════════════════════════════════════════ */

/* Stats bar de usuarios */
.usr-stats-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px
}

.usr-stat-pill {
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .2s, transform .2s
}

.usr-stat-pill:hover {
  border-color: rgba(99, 102, 241, .4);
  transform: translateY(-1px)
}

.usp-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(99, 102, 241, .15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0
}

.usp-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1
}

.usp-lbl {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 500
}

/* Filtros de rol */
.rol-filter-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap
}

.rol-pill {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  background: transparent;
  color: var(--muted);
  font-family: Inter, sans-serif
}

.rol-pill:hover {
  border-color: rgba(99, 102, 241, .5);
  color: var(--text)
}

.rol-pill.active {
  background: rgba(99, 102, 241, .15);
  border-color: rgba(99, 102, 241, .6);
  color: #a5b4fc
}

.rol-pill.sa.active {
  background: rgba(99, 102, 241, .15);
  border-color: #6366f1;
  color: #818cf8
}

.rol-pill.ad.active {
  background: rgba(14, 165, 233, .15);
  border-color: #0ea5e9;
  color: #38bdf8
}

.rol-pill.op.active {
  background: rgba(16, 185, 129, .15);
  border-color: #10b981;
  color: #34d399
}

/* Avatar de usuario en tabla */
.usr-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0
}

.usr-avatar.sa {
  background: rgba(99, 102, 241, .2);
  color: #818cf8
}

.usr-avatar.ad {
  background: rgba(14, 165, 233, .2);
  color: #38bdf8
}

.usr-avatar.op {
  background: rgba(16, 185, 129, .2);
  color: #34d399
}

/* Tag rol con colores */
.tag-rol-sa {
  background: rgba(99, 102, 241, .15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, .3);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace
}

.tag-rol-ad {
  background: rgba(14, 165, 233, .15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, .3);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace
}

.tag-rol-op {
  background: rgba(16, 185, 129, .15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, .3);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace
}

/* Indicador online */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px
}

.status-dot.active {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, .6)
}

.status-dot.blocked {
  background: #f43f5e;
  box-shadow: 0 0 6px rgba(244, 63, 94, .6)
}

.status-dot.inactive {
  background: #475569
}

/* Permiso matrix */
.perm-matrix {
  width: 100%;
  border-collapse: collapse
}

.perm-matrix th {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border)
}

.perm-matrix td {
  padding: 9px 14px;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .03)
}

.perm-matrix tr:hover td {
  background: rgba(255, 255, 255, .015)
}

.perm-check {
  font-size: 14px
}

.perm-no {
  color: rgba(255, 255, 255, .12);
  font-size: 14px
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, .1);
  border-radius: 22px;
  transition: .3s;
  border: 1px solid var(--border)
}

.toggle-slider:before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  left: 2px;
  bottom: 2px;
  background: rgba(255, 255, 255, .4);
  transition: .3s
}

.toggle-switch input:checked+.toggle-slider {
  background: rgba(16, 185, 129, .3);
  border-color: #10b981
}

.toggle-switch input:checked+.toggle-slider:before {
  transform: translateX(16px);
  background: #10b981
}

/* Password strength */
.pwd-strength-bar {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .08);
  margin-top: 6px;
  overflow: hidden
}

.pwd-strength-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s, background .3s
}

.pwd-hint {
  font-size: 10px;
  margin-top: 3px;
  color: var(--muted)
}

/* Sesiones card */
.sesion-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  margin-bottom: 6px;
  transition: border-color .15s
}

.sesion-row:hover {
  border-color: rgba(99, 102, 241, .3)
}

.sesion-ip {
  font-family: monospace;
  font-size: 12px;
  color: var(--indigo);
  font-weight: 700
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE MOBILE-FIRST — ARIZAR IA × NEGOFIN
   Breakpoints: 360 (phone) · 768 (tablet) · 1024 (desktop)
   ══════════════════════════════════════════════════════ */

/* ── Hamburger button (oculto en desktop) ─────────────── */
.btn-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-hamburger:active {
  background: rgba(99, 102, 241, .25)
}

/* ── Overlay sidebar (backdrop mobile) ───────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ── 1100px: usr stats 3 cols ─────────────────────────── */
@media (max-width: 1100px) {
  .usr-stats-bar {
    grid-template-columns: repeat(3, 1fr)
  }
}

/* ── Tablet: ≤1024px ──────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr)
  }

  .charts-row {
    grid-template-columns: 1fr
  }

  .empresa-grid {
    grid-template-columns: repeat(2, 1fr)
  }

  .usr-stats-bar {
    grid-template-columns: repeat(3, 1fr)
  }
}

/* ── Mobile: ≤768px ───────────────────────────────────── */
@media (max-width: 768px) {

  body.sidebar-open {
    overflow: hidden
  }

  /* Sidebar = drawer deslizable desde la izquierda */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(280px, 82vw);
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 4px 0 40px rgba(0, 0, 0, .6);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.open {
    transform: translateX(0)
  }

  /* Hamburger visible */
  .btn-hamburger {
    display: flex
  }

  /* Topbar compacto */
  .topbar {
    padding: 11px 14px;
    gap: 8px
  }

  .topbar-title {
    font-size: 15px;
    font-weight: 700
  }

  .date-badge {
    display: none
  }

  /* Main área ocupa todo el ancho */
  .dash-main {
    width: 100%
  }

  .content {
    padding: 14px;
    gap: 14px
  }

  /* KPIs: 2 columnas */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px
  }

  .kpi-card {
    padding: 14px
  }

  .kpi-value {
    font-size: 22px
  }

  .kpi-icon {
    font-size: 22px
  }

  /* Charts: 1 col, contenidos sin overflow */
  .charts-row {
    grid-template-columns: 1fr;
    gap: 12px
  }

  .chart-card {
    max-width: 100%;
    overflow: hidden
  }

  .chart-wrap {
    height: 200px;
    max-width: 100%;
    overflow: hidden
  }

  .chart-wrap canvas {
    max-width: 100% !important
  }

  /* Empresa chips: 1 col */
  .empresa-grid {
    grid-template-columns: 1fr;
    gap: 10px
  }

  /* Tablas: scroll horizontal con dedo */
  .table-card {
    overflow: hidden
  }

  .table-responsive-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    border-radius: 0 0 12px 12px;
  }

  .table-responsive-wrap table {
    min-width: 580px
  }

  /* Toolbar tabla: apilado vertical */
  .table-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 14px !important;
  }

  .search-wrap {
    min-width: unset !important;
    flex: none !important
  }

  .rol-filter-bar {
    flex-wrap: wrap;
    gap: 6px
  }

  /* Stats bar usuarios */
  .usr-stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px
  }

  .usr-stat-pill {
    padding: 12px
  }

  /* Modales: pantalla casi completa */
  .modal-box {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 88dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    margin: 6vw auto;
    border-radius: 16px !important;
  }

  /* Modal 2 columnas → 1 col */
  .modal-2col {
    grid-template-columns: 1fr !important
  }

  /* Permisos matrix scroll horizontal */
  .perm-matrix-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .perm-matrix {
    min-width: 460px
  }

  /* Touch targets mínimo 44px */
  .btn-primary,
  .btn-refresh,
  .btn-logout,
  .rol-pill,
  .nav-item,
  button[onclick] {
    min-height: 44px;
  }

  .nav-item {
    padding: 11px 14px
  }

  .btn-refresh {
    padding: 8px 12px
  }

  /* Sesiones row wrap */
  .sesion-row {
    flex-wrap: wrap;
    gap: 8px
  }

  /* Íconos emoji con buen tap target */
  .nav-icon {
    width: 24px;
    text-align: center
  }
}

/* ── Phone pequeño: ≤480px ────────────────────────────── */
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px
  }

  .usr-stats-bar {
    grid-template-columns: repeat(2, 1fr)
  }

  .content {
    padding: 10px;
    gap: 10px
  }

  .kpi-card {
    padding: 12px 14px
  }

  .kpi-value {
    font-size: 24px
  }

  .empresa-chip {
    padding: 12px
  }

  .topbar-title {
    font-size: 14px
  }
}

/* ── iOS: prevenir zoom en foco de input ──────────────── */
@media (max-width: 768px) {

  input,
  select,
  textarea {
    font-size: max(16px, 1rem) !important
  }

  input::placeholder {
    font-size: 14px
  }
}

/* ══════════════════════════════════════════════════════
   MÓDULOS PREMIUM — ARIZAR IA × NEGOFIN
   Diseños basados en Stitch AI — todos los módulos
   ══════════════════════════════════════════════════════ */

/* ── UPLOAD ZONE (Ingesta) ─────────────────────────── */
.upload-zone {
  border: 2px dashed rgba(99, 102, 241, .35);
  border-radius: 20px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .25s;
  background: rgba(99, 102, 241, .03);
  position: relative;
  overflow: hidden
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(99, 102, 241, .06), transparent);
  pointer-events: none
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--indigo);
  background: rgba(99, 102, 241, .07);
  transform: scale(1.01)
}

.upload-zone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, .3))
}

.upload-zone-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px
}

.upload-zone-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px
}

.upload-format-chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px
}

.format-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px
}

.format-chip.xlsx {
  background: rgba(16, 185, 129, .12);
  color: var(--emerald)
}

.format-chip.xls {
  background: rgba(245, 158, 11, .12);
  color: var(--amber)
}

/* Upload progress bar */
.upload-progress-wrap {
  margin-top: 16px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
  display: none
}

.upload-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--indigo), var(--sky));
  transition: width .3s ease;
  width: 0%
}

/* ── ARIZAR IA SYNC HERO CARD ─────────────────────── */
.arizar-hero-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(14, 165, 233, .08));
  border: 1px solid rgba(99, 102, 241, .3);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  position: relative;
  overflow: hidden
}

.arizar-hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99, 102, 241, .15), transparent);
  pointer-events: none
}

.arizar-hero-icon {
  font-size: 52px;
  margin-bottom: 10px;
  display: block;
  filter: drop-shadow(0 8px 20px rgba(99, 102, 241, .4))
}

.arizar-hero-name {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, #fff, rgba(99, 102, 241, .9));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px
}

.arizar-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px
}

.arizar-status-pill.active {
  background: rgba(16, 185, 129, .15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, .25)
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, .5);
  animation: pulse-glow 2s ease-in-out infinite
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, .5)
  }

  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0)
  }
}

.arizar-last-sync {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px
}

.btn-sync-now {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--indigo), var(--sky));
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, .35)
}

.btn-sync-now:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, .5)
}

/* API Health grid */
.api-health-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px
}

.api-health-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color .2s
}

.api-health-card:hover {
  border-color: rgba(99, 102, 241, .2)
}

.api-health-icon {
  font-size: 20px;
  flex-shrink: 0
}

.api-health-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500
}

.api-health-val {
  font-size: 14px;
  font-weight: 700
}

.api-health-val.ok {
  color: var(--emerald)
}

.api-health-val.warn {
  color: var(--amber)
}

.api-health-val.err {
  color: var(--rose)
}

/* Sync log */
.sync-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.sync-log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid rgba(255, 255, 255, .04)
}

.sync-log-time {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
  flex-shrink: 0;
  min-width: 70px
}

.sync-log-action {
  font-size: 12px;
  font-weight: 500;
  flex: 1
}

.sync-log-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 700;
  flex-shrink: 0
}

.sync-log-badge.ok {
  background: rgba(16, 185, 129, .12);
  color: var(--emerald)
}

.sync-log-badge.warn {
  background: rgba(245, 158, 11, .12);
  color: var(--amber)
}

.sync-log-badge.err {
  background: rgba(244, 63, 94, .12);
  color: var(--rose)
}

/* ── AUDITORÍA — Timeline ───────────────────────────── */
.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 0
}

.audit-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  position: relative
}

.audit-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 11px;
  top: 36px;
  bottom: -6px;
  width: 2px;
  background: var(--border)
}

.audit-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  margin-top: 2px;
  border: 2px solid transparent
}

.audit-dot.login {
  background: rgba(16, 185, 129, .15);
  color: var(--emerald);
  border-color: rgba(16, 185, 129, .3)
}

.audit-dot.create {
  background: rgba(99, 102, 241, .15);
  color: var(--indigo);
  border-color: rgba(99, 102, 241, .3)
}

.audit-dot.update {
  background: rgba(245, 158, 11, .15);
  color: var(--amber);
  border-color: rgba(245, 158, 11, .3)
}

.audit-dot.delete {
  background: rgba(244, 63, 94, .15);
  color: var(--rose);
  border-color: rgba(244, 63, 94, .3)
}

.audit-dot.system {
  background: rgba(14, 165, 233, .15);
  color: var(--sky);
  border-color: rgba(14, 165, 233, .3)
}

.audit-dot.ingest {
  background: rgba(99, 102, 241, .12);
  color: var(--indigo);
  border-color: rgba(99, 102, 241, .2)
}

.audit-body {
  flex: 1;
  min-width: 0
}

.audit-action {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  font-family: monospace;
  color: var(--text)
}

.audit-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.audit-ts {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
  margin-top: 2px;
  white-space: nowrap
}

/* Filter bar auditoría */
.audit-filter-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px
}

.audit-filter-bar input,
.audit-filter-bar select {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px
}

.audit-search {
  grid-column: 1 / -1
}

/* ── MOROSO CARDS ───────────────────────────────────── */
.moroso-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all .2s;
  cursor: pointer
}

.moroso-card:hover {
  border-color: rgba(99, 102, 241, .25);
  transform: translateX(2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25)
}

.moroso-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0
}

.moroso-info {
  flex: 1;
  min-width: 0
}

.moroso-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.moroso-ci {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px
}

.moroso-right {
  text-align: right;
  flex-shrink: 0
}

.moroso-amount {
  font-size: 14px;
  font-weight: 800;
  color: var(--rose)
}

.moroso-dias {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 4px;
  display: inline-block
}

.moroso-dias.alta {
  background: rgba(244, 63, 94, .12);
  color: var(--rose)
}

.moroso-dias.media {
  background: rgba(245, 158, 11, .12);
  color: var(--amber)
}

.moroso-dias.baja {
  background: rgba(16, 185, 129, .12);
  color: var(--emerald)
}

/* Moroso stats scrollable */
.moroso-stats-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none
}

.moroso-stats-scroll::-webkit-scrollbar {
  display: none
}

.moroso-stat-pill {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 110px
}

.moroso-stat-val {
  font-size: 18px;
  font-weight: 800
}

.moroso-stat-lbl {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap
}

/* ── SEGURIDAD ──────────────────────────────────────── */
.security-banner {
  padding: 14px 18px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid
}

.security-banner.safe {
  background: rgba(16, 185, 129, .08);
  border-color: rgba(16, 185, 129, .2);
  color: var(--emerald)
}

.security-banner.danger {
  background: rgba(244, 63, 94, .08);
  border-color: rgba(244, 63, 94, .2);
  color: var(--rose)
}

.security-stats {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch
}

.sec-stat-pill {
  flex-shrink: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 110px
}

.sec-stat-val {
  font-size: 20px;
  font-weight: 800
}

.sec-stat-lbl {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px
}

/* IP chips whitelist */
.ip-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px
}

.ip-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(16, 185, 129, .08);
  border: 1px solid rgba(16, 185, 129, .2);
  font-family: monospace;
  font-size: 12px;
  color: var(--emerald)
}

.ip-chip-remove {
  cursor: pointer;
  opacity: .6;
  font-size: 14px;
  line-height: 1;
  transition: opacity .15s
}

.ip-chip-remove:hover {
  opacity: 1
}

/* Security log */
.sec-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 12px
}

.sec-log-ts {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
  flex-shrink: 0
}

.sec-log-action {
  flex: 1;
  font-weight: 500
}

/* ── GERENTES ───────────────────────────────────────── */
.schedule-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, .08), rgba(14, 165, 233, .05));
  border: 1px solid rgba(16, 185, 129, .2);
  border-radius: 18px;
  padding: 22px 20px
}

.schedule-time {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px
}

.schedule-badge-next {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, .12);
  color: var(--emerald);
  font-weight: 700;
  border: 1px solid rgba(16, 185, 129, .2)
}

.schedule-last {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px
}

.btn-send-report {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--emerald), var(--sky));
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(16, 185, 129, .3);
  margin: 16px 0
}

.btn-send-report:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(16, 185, 129, .45)
}

.gerente-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  margin-bottom: 8px;
  transition: border-color .15s
}

.gerente-item:hover {
  border-color: rgba(99, 102, 241, .2)
}

.gerente-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--emerald), var(--sky));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0
}

.gerente-info {
  flex: 1;
  min-width: 0
}

.gerente-nombre {
  font-size: 13px;
  font-weight: 600
}

.gerente-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.gerente-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0
}

/* ── MANUAL ACTION BUTTONS ──────────────────────────── */
.action-btns-row {
  display: flex;
  gap: 10px;
  margin-top: 12px
}

.btn-outline-sky {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(14, 165, 233, .3);
  background: rgba(14, 165, 233, .05);
  color: var(--sky);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  touch-action: manipulation
}

.btn-outline-sky:hover {
  background: rgba(14, 165, 233, .12);
  border-color: rgba(14, 165, 233, .5)
}

.btn-outline-emerald {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(16, 185, 129, .3);
  background: rgba(16, 185, 129, .05);
  color: var(--emerald);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  touch-action: manipulation
}

.btn-outline-emerald:hover {
  background: rgba(16, 185, 129, .12);
  border-color: rgba(16, 185, 129, .5)
}

/* ── ADD FORM CARD ──────────────────────────────────── */
.add-form-card {
  background: rgba(99, 102, 241, .04);
  border: 1px dashed rgba(99, 102, 241, .25);
  border-radius: 14px;
  padding: 16px
}

.add-form-card:hover {
  border-color: rgba(99, 102, 241, .4)
}

/* ── SECTIONS CARDS general improvements ───────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: visible
}

.section-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between
}

.section-card-body {
  padding: 16px 20px
}

.section-card-title {
  font-size: 14px;
  font-weight: 700
}

.section-card-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px
}

/* Export CSV btn */
.btn-export-csv {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: rgba(16, 185, 129, .08);
  border: 1px solid rgba(16, 185, 129, .25);
  color: var(--emerald);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px
}

.btn-export-csv:hover {
  background: rgba(16, 185, 129, .15);
  transform: translateY(-1px)
}

/* ── light theme para nuevos componentes ────────────── */
[data-theme="light"] .upload-zone {
  background: rgba(99, 102, 241, .02);
  border-color: rgba(99, 102, 241, .25)
}

[data-theme="light"] .upload-zone:hover {
  background: rgba(99, 102, 241, .05)
}

[data-theme="light"] .arizar-hero-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, .06), rgba(14, 165, 233, .04))
}

[data-theme="light"] .moroso-card {
  background: var(--surface)
}

[data-theme="light"] .schedule-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, .04), rgba(14, 165, 233, .02))
}

[data-theme="light"] .sec-stat-pill {
  background: var(--surface)
}

[data-theme="light"] .sync-log-item {
  background: rgba(0, 0, 0, .02);
  border-color: rgba(0, 0, 0, .06)
}

[data-theme="light"] .audit-item:not(:last-child)::after {
  background: rgba(0, 0, 0, .08)
}

[data-theme="light"] .api-health-card {
  background: var(--surface)
}

[data-theme="light"] .add-form-card {
  background: rgba(99, 102, 241, .02)
}

/* ── Toast mejoras ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), opacity .3s;
  max-width: 300px;
  backdrop-filter: blur(12px)
}

.toast.show {
  transform: translateY(0);
  opacity: 1
}

.toast.ok {
  border-color: rgba(16, 185, 129, .3);
  background: rgba(16, 185, 129, .1);
  color: var(--emerald)
}

.toast.err {
  border-color: rgba(244, 63, 94, .3);
  background: rgba(244, 63, 94, .1);
  color: var(--rose)
}

@media (max-width: 768px) {
  .toast {
    right: 12px;
    left: 12px;
    bottom: 80px;
    max-width: unset
  }

  .audit-filter-bar {
    grid-template-columns: 1fr
  }

  .audit-search {
    grid-column: 1
  }

  .action-btns-row {
    flex-direction: column
  }

  .moroso-stats-scroll {
    padding-bottom: 8px
  }

  .arizar-hero-icon {
    font-size: 40px
  }

  .arizar-hero-name {
    font-size: 18px
  }

  .btn-sync-now,
  .btn-send-report {
    padding: 13px
  }

  .api-health-grid {
    grid-template-columns: 1fr 1fr
  }

  .security-stats {
    gap: 8px
  }

  .upload-zone {
    padding: 28px 16px
  }

  .upload-zone-icon {
    font-size: 36px
  }
}

/* ══════════════════════════════════════════════════════
   BOTTOM NAVIGATION BAR — Mobile Only
   ══════════════════════════════════════════════════════ */

.bottom-nav {
  display: none;
  /* hidden on desktop */
}

@media (max-width: 768px) {

  /* ── Bottom nav visible en mobile ── */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(12, 18, 32, 0.95);
    border-top: 1px solid rgba(99, 102, 241, .15);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    gap: 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .5)
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: color .15s, transform .1s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 52px
  }

  .bottom-nav-item:active {
    transform: scale(.93)
  }

  .bottom-nav-item.active {
    color: var(--indigo)
  }

  /* Pill background on active */
  .bottom-nav-item.active .bnav-icon-wrap {
    background: rgba(99, 102, 241, .15);
    border-radius: 12px;
    padding: 4px 18px
  }

  /* Active indicator dot on top */
  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: linear-gradient(90deg, var(--indigo), var(--sky));
    border-radius: 0 0 4px 4px
  }

  .bnav-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform .15s
  }

  .bottom-nav-item.active .bnav-icon {
    transform: scale(1.1)
  }

  .bnav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .02em;
    transition: color .15s
  }

  /* Contenido del dashboard: padding inferior para no quedar tapado por el nav */
  .dash-main {
    padding-bottom: 70px
  }

  /* El toast sube para no quedar debajo del bottom nav */
  .toast {
    bottom: 90px !important
  }

  /* Ocultar el btn-refresh text en mobile para dar más espacio al topbar */
  .btn-refresh-text {
    display: none
  }

  .btn-refresh {
    padding: 8px 10px
  }
}

/* Light theme bottom nav */
[data-theme="light"] .bottom-nav {
  background: rgba(241, 245, 249, 0.95);
  border-top-color: rgba(99, 102, 241, .12);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .08)
}


/* ══════════════════════════════════════════════════════
   LIGHT THEME — FIX COMPLETO
   Corrige texto blanco invisible, fondos transparentes,
   y todos los componentes que no se adaptan al modo claro
   ══════════════════════════════════════════════════════ */

/* ── Colores base de texto para todos los contenedores ── */
[data-theme="light"] {
  color-scheme: light;
}

/* ── Cards generales ─────────────────────────────────── */
[data-theme="light"] .section-card,
[data-theme="light"] .section-card-body {
  background: var(--surface);
  color: var(--text)
}

[data-theme="light"] .section-card-header {
  background: var(--surface);
  border-bottom-color: var(--border)
}

[data-theme="light"] .section-card-title {
  color: var(--text)
}

[data-theme="light"] .section-card-sub {
  color: var(--muted)
}

/* ── ARIZAR IA Hero Card ─────────────────────────────── */
[data-theme="light"] .arizar-hero-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, .08), rgba(14, 165, 233, .05));
  border-color: rgba(99, 102, 241, .2)
}

[data-theme="light"] .arizar-hero-name {
  /* En light, el gradient clip necesita colores oscuros */
  background: linear-gradient(135deg, #1e293b, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text
}

[data-theme="light"] .arizar-last-sync {
  color: var(--muted)
}

/* ── Upload Zone ────────────────────────────────────── */
[data-theme="light"] .upload-zone-title {
  color: var(--text)
}

[data-theme="light"] .upload-zone-sub {
  color: var(--muted)
}

/* ── Moroso cards ────────────────────────────────────── */
[data-theme="light"] .moroso-card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--card-shadow)
}

[data-theme="light"] .moroso-name {
  color: var(--text)
}

[data-theme="light"] .moroso-ci {
  color: var(--muted)
}

[data-theme="light"] .moroso-stat-pill {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--card-shadow)
}

[data-theme="light"] .moroso-stat-val {
  color: var(--text)
}

[data-theme="light"] .moroso-stat-lbl {
  color: var(--muted)
}

/* ── Sync log items ─────────────────────────────────── */
[data-theme="light"] .sync-log-item {
  background: rgba(0, 0, 0, .02);
  border-color: rgba(0, 0, 0, .08)
}

[data-theme="light"] .sync-log-time {
  color: var(--muted)
}

[data-theme="light"] .sync-log-action {
  color: var(--text)
}

/* ── API Health Cards ───────────────────────────────── */
[data-theme="light"] .api-health-card {
  background: var(--surface);
  border-color: var(--border)
}

[data-theme="light"] .api-health-label {
  color: var(--muted)
}

[data-theme="light"] .api-health-val {
  color: var(--text)
}

/* ── Auditoría timeline ─────────────────────────────── */
[data-theme="light"] .audit-item:not(:last-child)::after {
  background: rgba(0, 0, 0, .1)
}

[data-theme="light"] .audit-action {
  color: var(--text)
}

[data-theme="light"] .audit-meta {
  color: var(--muted)
}

[data-theme="light"] .audit-ts {
  color: var(--muted)
}

/* ── Seguridad ──────────────────────────────────────── */
[data-theme="light"] .sec-stat-pill {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--card-shadow)
}

[data-theme="light"] .sec-stat-val {
  color: var(--text)
}

[data-theme="light"] .sec-stat-lbl {
  color: var(--muted)
}

[data-theme="light"] .sec-log-item {
  background: rgba(0, 0, 0, .02);
  border-color: var(--border)
}

[data-theme="light"] .sec-log-ts {
  color: var(--muted)
}

[data-theme="light"] .sec-log-action {
  color: var(--text)
}

/* ── Gerentes ───────────────────────────────────────── */
[data-theme="light"] .schedule-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, .05), rgba(14, 165, 233, .03));
  border-color: rgba(16, 185, 129, .2)
}

[data-theme="light"] .schedule-time {
  color: var(--text)
}

[data-theme="light"] .schedule-last {
  color: var(--muted)
}

[data-theme="light"] .gerente-item {
  background: var(--surface);
  border-color: var(--border)
}

[data-theme="light"] .gerente-nombre {
  color: var(--text)
}

[data-theme="light"] .gerente-email {
  color: var(--muted)
}

/* ── Add form card ─────────────────────────────────── */
[data-theme="light"] .add-form-card {
  background: rgba(99, 102, 241, .03);
  border-color: rgba(99, 102, 241, .2)
}

/* ── Topbar en light con buen contraste ─────────────── */
[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, .9);
  border-bottom-color: var(--border)
}

[data-theme="light"] .topbar-title {
  color: var(--text)
}

[data-theme="light"] .btn-hamburger {
  color: var(--text)
}

/* ── Bottom nav en light ────────────────────────────── */
[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, .95);
  border-top-color: var(--border)
}

[data-theme="light"] .bottom-nav-item {
  color: var(--muted)
}

[data-theme="light"] .bottom-nav-item.active {
  color: var(--indigo)
}

/* ── Tabla rows y celdas ────────────────────────────── */
[data-theme="light"] .data-table th {
  color: var(--muted);
  background: rgba(0, 0, 0, .02)
}

[data-theme="light"] .data-table td {
  color: var(--text);
  border-bottom-color: var(--border)
}

[data-theme="light"] .data-table tr:hover td {
  background: rgba(99, 102, 241, .03)
}

/* ── loading-row ─────────────────────────────────────── */
[data-theme="light"] .loading-row {
  color: var(--muted)
}

/* ── Modal en light ─────────────────────────────────── */
[data-theme="light"] .modal-header {
  color: var(--text);
  border-bottom-color: var(--border)
}

[data-theme="light"] .modal-footer {
  border-top-color: var(--border)
}

[data-theme="light"] .modal-label {
  color: var(--muted2)
}

/* ── KPI cards en light ─────────────────────────────── */
[data-theme="light"] .kpi-label {
  color: var(--muted)
}

[data-theme="light"] .kpi-value {
  color: var(--text)
}

[data-theme="light"] .kpi-sub {
  color: var(--muted)
}

[data-theme="light"] .kpi-card::after {
  display: none
}

/* no glow en light */

/* ── Chart cards en light ───────────────────────────── */
[data-theme="light"] .card-title {
  color: var(--text)
}

[data-theme="light"] .card-subtitle {
  color: var(--muted)
}

/* ── Nav items en light ─────────────────────────────── */
[data-theme="light"] .nav-label {
  color: var(--muted)
}

[data-theme="light"] .nav-item {
  color: var(--muted2)
}

[data-theme="light"] .user-name {
  color: var(--text)
}

[data-theme="light"] .user-role {
  color: var(--muted)
}

[data-theme="light"] .logo-name {
  color: var(--text)
}

[data-theme="light"] .logo-sub {
  color: var(--muted)
}

[data-theme="light"] .logo-sub-sm {
  color: var(--muted)
}

[data-theme="light"] .logo-text-sm {
  color: var(--text)
}

/* ── Empresa grid ───────────────────────────────────── */
[data-theme="light"] .empresa-name {
  color: var(--text)
}

[data-theme="light"] .empresa-stat span {
  color: var(--muted)
}

[data-theme="light"] .empresa-val {
  color: var(--text)
}

/* ── Table toolbar ─────────────────────────────────── */
[data-theme="light"] .table-toolbar {
  background: var(--surface);
  border-bottom-color: var(--border)
}

[data-theme="light"] .card-title {
  color: var(--text)
}

/* ── Filter / rol pills en light ────────────────────── */
[data-theme="light"] .filter-btn {
  background: rgba(0, 0, 0, .04);
  border-color: rgba(0, 0, 0, .12);
  color: var(--text)
}

[data-theme="light"] .filter-btn.active {
  background: var(--indigo);
  color: #fff;
  border-color: var(--indigo)
}

/* ── Search input en light ──────────────────────────── */
[data-theme="light"] .search-wrap {
  background: rgba(0, 0, 0, .04);
  border-color: rgba(0, 0, 0, .1)
}

[data-theme="light"] .search-icon {
  color: var(--muted)
}

/* ── User stat pills (usuarios) ─────────────────────── */
[data-theme="light"] .usp-lbl {
  color: var(--muted)
}

[data-theme="light"] .usr-stat-pill {
  background: var(--surface);
  border-color: var(--border)
}

/* ── Sesion row ─────────────────────────────────────── */
[data-theme="light"] .sesion-row {
  background: rgba(99, 102, 241, .03);
  border-color: var(--border)
}

[data-theme="light"] .sesion-user {
  color: var(--text)
}

[data-theme="light"] .sesion-meta {
  color: var(--muted)
}

/* ── Select en light ─────────────────────────────────── */
[data-theme="light"] select {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text)
}

/* ── Date badge en light ────────────────────────────── */
[data-theme="light"] .date-badge {
  background: rgba(0, 0, 0, .04);
  border-color: var(--border);
  color: var(--muted)
}

/* ── Perm matrix en light ───────────────────────────── */
[data-theme="light"] .perm-matrix th {
  background: rgba(0, 0, 0, .03);
  color: var(--muted)
}

[data-theme="light"] .perm-matrix td {
  color: var(--text);
  border-color: var(--border)
}

[data-theme="light"] .perm-matrix tr:nth-child(even) td {
  background: rgba(0, 0, 0, .02)
}

/* ── Toast en light ─────────────────────────────────── */
[data-theme="light"] .toast {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text)
}

[data-theme="light"] .toast.ok {
  background: rgba(16, 185, 129, .08);
  color: #065f46
}

[data-theme="light"] .toast.err {
  background: rgba(244, 63, 94, .08);
  color: #9f1239
}

/* ── Placeholder section ────────────────────────────── */
[data-theme="light"] .ph-text {
  color: var(--muted2)
}

[data-theme="light"] .ph-sub {
  color: var(--muted)
}

/* ── Ingesta stats ──────────────────────────────────── */
[data-theme="light"] .format-chip.xlsx {
  background: rgba(16, 185, 129, .08);
  color: #065f46
}

[data-theme="light"] .format-chip.xls {
  background: rgba(245, 158, 11, .08);
  color: #92400e
}

/* ── Garantiza que texto blanco hardcodeado se adapte ── */
[data-theme="light"] .btn-primary {
  color: #fff
}

[data-theme="light"] .btn-sync-now {
  color: #fff
}

[data-theme="light"] .btn-send-report {
  color: #fff
}

[data-theme="light"] .btn-refresh {
  color: #fff
}

[data-theme="light"] .btn-export-csv {
  color: #065f46;
  background: rgba(16, 185, 129, .08)
}


/* ══════════════════════════════════════════════════════
   FIX: Sidebar no tapado por bottom nav en mobile
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sidebar scroll interno para que el footer sea accesible */
  .sidebar {
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

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

  /* Footer pegado al final del sidebar, pero con margen interior */
  .sidebar-footer {
    flex-shrink: 0;
    padding-bottom: 12px;
    /* NO queda tapado por bottom nav porque sidebar tiene z-index>bnav */
  }

  /* Sidebar z-index mayor que bottom nav */
  .sidebar {
    z-index: 200 !important;
  }

  /* Overlay también encima del bottom nav */
  .sidebar-overlay {
    z-index: 199 !important;
  }

  /* Bottom nav z-index bajo para no tapar sidebar open */
  .bottom-nav {
    z-index: 150;
  }

  /* SVG icons en bottom nav */
  .bnav-svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
    transition: stroke .15s, transform .15s;
  }

  .bottom-nav-item.active .bnav-svg {
    stroke: var(--indigo);
    transform: scale(1.1);
  }

  .bottom-nav-item:not(.active) .bnav-svg {
    stroke: var(--muted);
  }

  /* Fix pointer events — todos los hijos pasan el click al botón */
  .bottom-nav-item * {
    pointer-events: none;
  }

  .bottom-nav-item {
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
  }
}

/* ══════════════════════════════════════════════════════
   Logo ARIZAR IA — estilo metálico 3D en sidebar
   ══════════════════════════════════════════════════════ */
.sidebar-logo-text-arizar {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .1em;
  background: linear-gradient(180deg,
      #ffffff 0%,
      #b8d4ff 30%,
      #4f9fff 60%,
      #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
}

/* Light theme: sidebar logo a oscuro */
[data-theme="light"] .sidebar-logo-text-arizar {
  background: linear-gradient(180deg, #1e3a8a, #2563eb, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}


/* ══════════════════════════════════════════════════════
   MEGA UPDATE v2.1 — Animaciones, colores vivos, fixes
   ══════════════════════════════════════════════════════ */

/* ── ANIMACIONES GLOBALES ─────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(.92)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0
  }

  100% {
    background-position: 200% 0
  }
}

@keyframes glow-pulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(99, 102, 241, .2)
  }

  50% {
    box-shadow: 0 0 20px rgba(99, 102, 241, .4)
  }
}

/* ── Secciones y cards con entrada animada ─────────────── */
.section {
  animation: fadeIn .35s ease-out both
}

.kpi-card {
  animation: fadeInUp .4s ease-out both;
  transition: transform .2s, box-shadow .2s, border-color .2s !important;
}

.kpi-card:nth-child(1) {
  animation-delay: .05s
}

.kpi-card:nth-child(2) {
  animation-delay: .10s
}

.kpi-card:nth-child(3) {
  animation-delay: .15s
}

.kpi-card:nth-child(4) {
  animation-delay: .20s
}

.kpi-card:nth-child(5) {
  animation-delay: .25s
}

.kpi-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3), 0 0 0 1px rgba(99, 102, 241, .2) !important;
  border-color: rgba(99, 102, 241, .3) !important;
}

.chart-card {
  animation: fadeInUp .45s ease-out both;
  animation-delay: .15s;
  transition: transform .2s, box-shadow .2s !important;
}

.chart-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
}

.table-card {
  animation: fadeInUp .5s ease-out both;
  animation-delay: .2s;
}

.section-card {
  animation: fadeInUp .4s ease-out both;
  animation-delay: .1s;
}

/* ── Empresa chips — más vivos + animación ────────────── */
.empresa-chip {
  animation: scaleIn .3s ease-out both;
  transition: all .25s cubic-bezier(.2, 0, .1, 1) !important;
  border: 1px solid rgba(99, 102, 241, .12);
  position: relative;
  overflow: hidden;
}

.empresa-chip:nth-child(1) {
  animation-delay: .1s
}

.empresa-chip:nth-child(2) {
  animation-delay: .15s
}

.empresa-chip:nth-child(3) {
  animation-delay: .2s
}

.empresa-chip:nth-child(4) {
  animation-delay: .25s
}

.empresa-chip:nth-child(5) {
  animation-delay: .3s
}

.empresa-chip:hover {
  transform: translateY(-4px) scale(1.01) !important;
  border-color: rgba(99, 102, 241, .35) !important;
  box-shadow: 0 8px 28px rgba(99, 102, 241, .15), 0 0 0 1px rgba(99, 102, 241, .2) !important;
}

/* Shimmer borde top en hover */
.empresa-chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--indigo), var(--sky), transparent);
  opacity: 0;
  transition: opacity .25s;
}

.empresa-chip:hover::before {
  opacity: 1
}

.empresa-dot {
  box-shadow: 0 0 6px currentColor;
  animation: bdot 2s ease-in-out infinite;
}

/* ── Moroso stat pills — más vibrantes ────────────────── */
.moroso-stat-pill {
  animation: fadeInUp .35s ease-out both;
  transition: transform .2s, box-shadow .2s !important;
  border: 1px solid rgba(99, 102, 241, .1);
}

.moroso-stat-pill:nth-child(1) {
  animation-delay: .05s
}

.moroso-stat-pill:nth-child(2) {
  animation-delay: .10s
}

.moroso-stat-pill:nth-child(3) {
  animation-delay: .15s
}

.moroso-stat-pill:nth-child(4) {
  animation-delay: .20s
}

.moroso-stat-pill:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
  border-color: rgba(99, 102, 241, .25);
}

.moroso-stat-val {
  font-weight: 800 !important;
  letter-spacing: -.02em;
}

/* ── Filter buttons — más interactivos ────────────────── */
.filter-btn {
  transition: all .2s !important;
  position: relative;
  overflow: hidden;
}

.filter-btn:hover {
  background: rgba(99, 102, 241, .12) !important;
  transform: translateY(-1px);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--indigo), var(--sky)) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .35);
}

/* ── Nav items — entrada animada ──────────────────────── */
.nav-item {
  transition: all .2s !important;
  position: relative;
}

.nav-item:hover {
  padding-left: 20px !important;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .15), rgba(99, 102, 241, .04)) !important;
  border-left: 3px solid var(--indigo) !important;
}

/* ── Tabla rows — hover efecto ────────────────────────── */
.moroso-row,
.user-row,
.session-row,
.audit-row,
.gerente-row,
tr {
  transition: background .15s, transform .15s !important;
}

.moroso-row:hover,
.user-row:hover,
.session-row:hover,
.audit-row:hover,
.gerente-row:hover,
tbody tr:hover {
  background: rgba(99, 102, 241, .05) !important;
}

/* ── Botones primarios — efecto shimmer ───────────────── */
.btn-primary,
button[onclick*="crear"],
button[onclick*="guardar"] {
  position: relative;
  overflow: hidden;
  transition: all .2s !important;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, .4) !important;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .1), transparent);
  transition: left .5s;
}

.btn-primary:hover::after {
  left: 150%
}

/* ── Modals — entrada premium ─────────────────────────── */
.modal-box {
  animation: scaleIn .25s cubic-bezier(.2, 0, .1, 1) both !important;
}

/* ── Badges — pulsantes ──────────────────────────────── */
.nav-badge {
  animation: bdot 3s ease-in-out infinite;
  font-weight: 700;
}

/* ── Scroll Indicators ────────────────────────────────── */
.moroso-stats-scroll::-webkit-scrollbar {
  height: 3px
}

.moroso-stats-scroll::-webkit-scrollbar-track {
  background: transparent
}

.moroso-stats-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--indigo), var(--sky));
  border-radius: 4px;
}

/* ── KPI card gradientes vivos ────────────────────────── */
.kpi-card:nth-child(1) {
  border-left: 3px solid var(--indigo)
}

.kpi-card:nth-child(2) {
  border-left: 3px solid var(--sky)
}

.kpi-card:nth-child(3) {
  border-left: 3px solid var(--emerald)
}

.kpi-card:nth-child(4) {
  border-left: 3px solid var(--amber, #f59e0b)
}

.kpi-card:nth-child(5) {
  border-left: 3px solid var(--rose)
}

/* ── Loading skeleton shimmer ─────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
      var(--surface) 25%,
      rgba(99, 102, 241, .08) 50%,
      var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

/* ── Light mode — empresa chips fix ──────────────────── */
[data-theme="light"] .empresa-chip {
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, .08) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06) !important;
}

[data-theme="light"] .empresa-chip:hover {
  box-shadow: 0 8px 24px rgba(99, 102, 241, .12) !important;
  border-color: rgba(99, 102, 241, .25) !important;
}

[data-theme="light"] .empresa-name {
  color: #1e293b !important
}

[data-theme="light"] .empresa-stat span:first-child {
  color: #64748b !important
}

[data-theme="light"] .empresa-val {
  color: #0f172a !important
}

/* Light mode — moroso pills fix */
[data-theme="light"] .moroso-stat-pill {
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, .08) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06) !important;
}

[data-theme="light"] .moroso-stat-val {
  -webkit-text-fill-color: initial
}

[data-theme="light"] .moroso-stat-lbl {
  color: #64748b !important
}

/* Light mode — table card fix */
[data-theme="light"] .table-card {
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, .08) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06) !important;
}

/* Light mode — chart card fix */
[data-theme="light"] .chart-card {
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, .08) !important;
}

/* Light mode — section card fix */
[data-theme="light"] .section-card {
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, .08) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06) !important;
}

/* Light mode — filter buttons */
[data-theme="light"] .filter-btn {
  background: rgba(0, 0, 0, .04);
  color: #475569;
  border: 1px solid rgba(0, 0, 0, .08);
}

[data-theme="light"] .filter-btn:hover {
  background: rgba(99, 102, 241, .08) !important;
}

[data-theme="light"] .filter-btn.active {
  background: linear-gradient(135deg, var(--indigo), var(--sky)) !important;
  color: #fff !important;
}

/* ── Bottom nav — FULL AREA clickeable (sin media query) ── */
.bottom-nav-item>* {
  pointer-events: none !important;
}


/* ══════════════════════════════════════════════════════
   FIX: Empresa grid chart-card — no cortar contenido
   ══════════════════════════════════════════════════════ */

/* La chart-card que contiene empresa-grid no debe recortar */
.chart-card:has(.empresa-grid) {
  overflow: visible !important;
}

/* Empresa grid: auto-fill para que se adapte */
.empresa-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 12px !important;
}

/* Empresa chip: altura auto para mostrar todo */
.empresa-chip {
  min-height: auto !important;
  overflow: visible !important;
  padding: 14px 16px !important;
}

/* En móvil: 1 columna para empresa grid */
@media (max-width: 768px) {
  .empresa-grid {
    grid-template-columns: 1fr !important;
  }

  .chart-card:has(.empresa-grid) {
    overflow: visible !important;
    max-height: none !important;
  }
}


/* ══════════════════════════════════════════════════════
   PREMIUM v2 — Mini Stat Cards + Charts Layout
   ══════════════════════════════════════════════════════ */

/* ── Mini Stats Row ───────────────────────────────────── */
.mini-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.mini-stat-card {
  background: var(--msc-gradient);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  color: #fff;
  min-height: 120px;
  display: flex;
  align-items: flex-start;
  transition: transform .25s, box-shadow .25s;
  animation: fadeInUp .4s ease-out both;
  cursor: default;
}

.mini-stat-card:nth-child(1) {
  animation-delay: .05s
}

.mini-stat-card:nth-child(2) {
  animation-delay: .10s
}

.mini-stat-card:nth-child(3) {
  animation-delay: .15s
}

.mini-stat-card:nth-child(4) {
  animation-delay: .20s
}

.mini-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
}

/* Wave decoration */
.mini-stat-card::before {
  content: '';
  position: absolute;
  bottom: -30%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, .08);
  border-radius: 50%;
}

.mini-stat-card::after {
  content: '';
  position: absolute;
  bottom: -50%;
  right: 10%;
  width: 160px;
  height: 160px;
  background: rgba(255, 255, 255, .05);
  border-radius: 50%;
}

.msc-content {
  flex: 1;
  z-index: 1;
  position: relative;
}

.msc-label {
  font-size: 12px;
  font-weight: 600;
  opacity: .85;
  letter-spacing: .03em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.msc-value {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin-bottom: 6px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

.msc-sub {
  font-size: 11px;
  opacity: .7;
  font-weight: 500;
}

.msc-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, .15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  z-index: 1;
}

.msc-chart {
  position: absolute;
  bottom: 8px;
  right: 60px;
  opacity: .4;
  z-index: 1;
}

/* ── Charts Row v2 — 60/40 split ──────────────────────── */
.charts-row-v2 {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-card-main {
  min-height: 360px;
}

.chart-card-donut {
  display: flex;
  flex-direction: column;
}

/* Period tabs en chart header */
.chart-period-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.period-tab {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
}

.period-tab.active {
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}

.period-tab:hover:not(.active) {
  background: rgba(99, 102, 241, .1);
  color: var(--text);
}

[data-theme="light"] .chart-period-tabs {
  background: rgba(0, 0, 0, .03);
  border-color: rgba(0, 0, 0, .08);
}

/* ── Donut center info ────────────────────────────────── */
.chart-wrap-donut {
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.donut-center-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}

.donut-center-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 2px;
}

/* ── Donut legend ─────────────────────────────────────── */
.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 0;
  justify-content: center;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.donut-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-legend-val {
  font-weight: 700;
  color: var(--text);
  margin-left: 2px;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .mini-stats-row {
    grid-template-columns: repeat(2, 1fr)
  }

  .charts-row-v2 {
    grid-template-columns: 1fr
  }
}

@media (max-width: 640px) {
  .mini-stats-row {
    grid-template-columns: 1fr
  }

  .mini-stat-card {
    min-height: 100px;
    padding: 16px;
  }

  .msc-value {
    font-size: 22px
  }
}