/* =====================================================
   Sky Balloons Connect — Hoja de Estilos Unificada v4
   UX/UI profesional · Animaciones · Todas las pantallas
   ===================================================== */

:root {
  /* Brand palette */
  --sbc-sky: #0099FF;
  --sbc-deep: #0056B3;
  --sbc-deepest: #04316b;
  --sbc-orange: #FF8C00;
  --sbc-yellow: #FFD54A;

  /* Neutrals */
  --sbc-white: #FFFFFF;
  --sbc-bg: #F5F7FA;
  --sbc-border: #D6DCE5;
  --sbc-muted: #6B7480;
  --sbc-dark: #343A40;
  --sbc-ink: #0B1F3A;

  /* Status */
  --sbc-success: #28A745;
  --sbc-warning: #FFC107;
  --sbc-danger:  #DC3545;
  --sbc-info:    #17A2B8;

  /* Typography */
  --font-display: 'Poppins', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(11,31,58,.06), 0 1px 3px rgba(11,31,58,.04);
  --shadow-md: 0 6px 16px -4px rgba(11,31,58,.10), 0 2px 6px rgba(11,31,58,.06);
  --shadow-lg: 0 24px 60px -20px rgba(11,31,58,.25), 0 8px 20px -8px rgba(11,31,58,.12);
  --shadow-glow: 0 0 0 4px rgba(0,153,255,.15);
  --shadow-orange: 0 10px 24px -10px rgba(255,140,0,.55);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-bounce: cubic-bezier(.34,1.56,.64,1);
  --ease-out-cubic: cubic-bezier(0.33, 1, 0.68, 1);

  /* Layout */
  --sidebar-w: 272px;
  --topbar-h: 64px;

  /* Bootstrap overrides */
  --bs-primary: var(--sbc-deep);
  --bs-primary-rgb: 0,86,179;
  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--sbc-ink);
  --bs-body-bg: var(--sbc-bg);
  --bs-border-color: var(--sbc-border);
  --bs-border-radius: var(--r-md);
}

/* =============================================
   RESET & BASE (mobile-first)
   ============================================= */
*,
*::before,
*::after { box-sizing: border-box; }

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--sbc-ink);
  background-color: var(--sbc-bg);
  letter-spacing: -0.005em;
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
.display-1, .display-2, .display-3, .display-4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--sbc-ink);
  line-height: 1.15;
}

.text-muted-2 { color: var(--sbc-muted) !important; }

a {
  color: var(--sbc-deep);
  text-decoration: none;
  transition: color .2s var(--ease);
}
a:hover { color: var(--sbc-sky); }

::selection {
  background: rgba(0,153,255,.20);
  color: var(--sbc-ink);
}

img, svg { max-width: 100%; height: auto; display: block; }

/* Focus visible global */
:focus-visible {
  outline: 2px solid var(--sbc-sky);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* =============================================
   REDUCED MOTION
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =============================================
   BUTTONS — touch-friendly, responsive + ripple
   ============================================= */
.btn {
  font-family: var(--font-display);
  font-weight: 500;
  border-radius: var(--r-md);
  padding: .72rem 1.15rem;
  letter-spacing: .005em;
  transition:
    transform .25s var(--ease-bounce),
    box-shadow .25s var(--ease),
    background-color .2s var(--ease),
    color .2s var(--ease);
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn:focus-visible {
  box-shadow: var(--shadow-glow);
  outline: none;
}
.btn:active { transform: scale(.96); }

/* Ripple effect */
.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}
.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background-color: var(--sbc-deep);
  border-color: var(--sbc-deep);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--sbc-deepest);
  border-color: var(--sbc-deepest);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:active { transform: scale(.96) translateY(0); }

.btn-accent {
  background: linear-gradient(135deg, #FF8C00, #FF6A00);
  border: none;
  color: #fff;
  box-shadow: var(--shadow-orange);
}
.btn-accent:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -10px rgba(255,140,0,.65);
}
.btn-accent:active { transform: scale(.96) translateY(0); }

.btn-outline-light-2 {
  background: transparent;
  border: 1px solid var(--sbc-border);
  color: var(--sbc-ink);
}
.btn-outline-light-2:hover {
  background: var(--sbc-white);
  border-color: var(--sbc-sky);
  color: var(--sbc-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--sbc-deep);
}
.btn-ghost:hover {
  background: rgba(0,153,255,.08);
  color: var(--sbc-deep);
}

.btn[disabled],
.btn.is-loading {
  opacity: .7;
  pointer-events: none;
  cursor: not-allowed;
}

.btn.is-loading {
  position: relative;
  color: transparent !important;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  animation: sbc-spin .7s linear infinite;
}

@keyframes sbc-spin { to { transform: rotate(360deg); } }

/* Botones full-width en móvil */
@media (max-width: 575.98px) {
  .btn-mobile-block {
    width: 100%;
  }
}

/* =============================================
   FORM CONTROLS — accesibles y adaptables
   ============================================= */
.form-control,
.form-select {
  min-height: 48px;
  border-radius: var(--r-md);
  border: 1px solid var(--sbc-border);
  background-color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: .7rem .9rem;
  transition:
    border-color .2s var(--ease),
    box-shadow .2s var(--ease),
    background-color .2s var(--ease);
  width: 100%;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--sbc-sky);
  box-shadow: 0 0 0 4px rgba(0,153,255,.18);
}

.form-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: .88rem;
  color: var(--sbc-dark);
  margin-bottom: .35rem;
  display: block;
}

/* Custom checkbox / radio */
.form-check-input {
  width: 1.15em;
  height: 1.15em;
  border: 1.5px solid var(--sbc-border);
  border-radius: 6px;
  transition: all .2s var(--ease);
  cursor: pointer;
}
.form-check-input:checked {
  background-color: var(--sbc-deep);
  border-color: var(--sbc-deep);
}
.form-check-input:focus {
  box-shadow: 0 0 0 4px rgba(0,153,255,.18);
  border-color: var(--sbc-sky);
}
.form-check-label {
  font-size: .9rem;
  color: var(--sbc-dark);
  padding-left: .25rem;
  cursor: pointer;
}

/* =============================================
   CARDS & SURFACES
   ============================================= */
.card {
  border: 1px solid var(--sbc-border);
  border-radius: var(--r-lg);
  background-color: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease-bounce), box-shadow .3s var(--ease);
}
.card-elevated { box-shadow: var(--shadow-md); }
.card-interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.card-interactive:active {
  transform: translateY(-1px);
}

.glass {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-radius: var(--r-lg);
}
.glass-light {
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-radius: var(--r-lg);
}

/* =============================================
   PRELOADER mejorado
   ============================================= */
#sbc-preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  opacity: 1;
  visibility: visible;
}
#sbc-preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.preloader-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.preloader-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  animation: preloader-pulse 2s ease-in-out infinite;
}
.preloader-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid var(--sbc-border);
  border-top-color: var(--sbc-deep);
  animation: sbc-spin 0.8s linear infinite;
}
.preloader-text {
  font-size: 0.85rem;
  color: var(--sbc-muted);
  font-weight: 500;
  animation: fadeInUp 0.6s ease both;
}

@keyframes preloader-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================
   AUTH LAYOUT — responsive 2-column → single
   ============================================= */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}

.auth-hero {
  position: relative;
  display: flex;
  color: #fff;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(0,153,255,.35), transparent 60%),
    radial-gradient(900px 500px at 90% 90%, rgba(255,140,0,.18), transparent 60%),
    linear-gradient(160deg, #021a3a 0%, #0056B3 60%, #0099FF 130%);
  overflow: hidden;
  padding: 2.5rem 1.5rem;
  min-height: 280px;
  order: 1;
}
.auth-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .35;
  pointer-events: none;
}
.auth-hero .hero-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 2;
  width: 100%;
}
.auth-hero h1 {
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -.03em;
}
.auth-hero h1 .accent { color: var(--sbc-yellow); }
.auth-hero p.lead {
  color: rgba(255,255,255,.78);
  font-size: clamp(.9rem, 2vw, 1.05rem);
  max-width: 36ch;
}
.auth-hero .hero-card {
  margin-top: 1.5rem;
  padding: 1.25rem 1.4rem;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.auth-hero .hero-card small {
  color: rgba(255,255,255,.65);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
}
.auth-hero .floating-balloon {
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 320px;
  max-width: 65%;
  opacity: .35;
  filter: drop-shadow(0 30px 40px rgba(0,0,0,.4));
  animation: floaty 9s ease-in-out infinite;
  pointer-events: none;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-18px) rotate(2deg); }
}

/* Auth pane */
.auth-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--sbc-bg);
  order: 2;
}
.auth-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border: 1px solid var(--sbc-border);
  border-radius: var(--r-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}
.auth-card .brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.auth-card .brand-row img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}
.auth-card h2 {
  font-size: 1.5rem;
  margin-bottom: .25rem;
}
.auth-card .subtitle {
  color: var(--sbc-muted);
  font-size: .9rem;
  margin-bottom: 1.25rem;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--sbc-muted);
  font-size: .8rem;
  margin: 1.25rem 0;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sbc-border);
}

/* Tablet+ : layout a 2 columnas */
@media (min-width: 768px) {
  .auth-shell {
    grid-template-columns: 1fr 1fr;
  }
  .auth-hero {
    order: 0;
    padding: 3rem;
    min-height: auto;
  }
  .auth-hero .floating-balloon {
    right: -60px;
    bottom: -60px;
    width: 480px;
  }
  .auth-pane {
    order: 0;
    padding: 2rem;
  }
  .auth-card {
    padding: 2.25rem;
  }
  .auth-card .brand-row img {
    width: 88px;
    height: 88px;
  }
  .auth-card h2 {
    font-size: 1.65rem;
  }
}

@media (min-width: 1024px) {
  .auth-shell {
    grid-template-columns: 45fr 55fr;
  }
}

/* =============================================
   DASHBOARD APP SHELL
   ============================================= */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--sbc-bg);
}

/* =============================================
   SIDEBAR — off-canvas en móvil, fija en desktop
   ============================================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, #04316b 0%, #0056B3 100%);
  color: #fff;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
  z-index: 1040;
  transform: translateX(-100%);
  transition: transform .35s var(--ease-out-cubic);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sidebar.open {
  transform: translateX(0);
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .25rem .5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.sidebar .brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
}
.sidebar .brand .title {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
}
.sidebar .brand .title small {
  display: block;
  color: rgba(255,255,255,.6);
  font-weight: 400;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.nav-section {
  color: rgba(255,255,255,.45);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .7rem;
  margin: .75rem .75rem .3rem;
  flex-shrink: 0;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: .8rem;
  color: rgba(255,255,255,.78);
  padding: .7rem .85rem;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: .92rem;
  transition:
    background .2s var(--ease),
    color .2s var(--ease),
    transform .2s var(--ease);
  min-height: 48px;
  text-decoration: none;
}
.sidebar .nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.07);
  transform: translateX(4px);
}
.sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(0,153,255,.35), rgba(0,153,255,.18));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
}
.sidebar .nav-link.danger:hover {
  color: #ffb4b4;
  background: rgba(220,53,69,.15);
}
.sidebar .spacer { flex: 1; min-height: 1rem; }

/* Sidebar backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4,15,30,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1035;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* Submenú */
.sidebar .nav-link[data-bs-toggle="collapse"] {
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.submenu-arrow {
  flex-shrink: 0;
  transition: transform 0.35s var(--ease);
}
.sidebar .nav-link[aria-expanded="true"] .submenu-arrow {
  transform: rotate(180deg);
}
.submenu-items {
  padding-left: 1.25rem;
  margin: 0.15rem 0 0.5rem 0;
  border-left: 1px solid rgba(255,255,255,0.12);
}
.sidebar .sub-link {
  font-size: 0.85rem;
  font-weight: 450;
  padding: 0.6rem 0.85rem 0.6rem 0.75rem;
  min-height: 44px;
  opacity: 0.85;
  border-radius: var(--r-sm);
}
.sidebar .sub-link:hover {
  opacity: 1;
  background: rgba(255,255,255,0.06);
  transform: translateX(2px);
}
.sidebar .sub-link.active {
  color: #fff;
  background: rgba(0,153,255,0.2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

/* =============================================
   TOPBAR
   ============================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--sbc-border);
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: var(--topbar-h);
  flex-wrap: wrap;
}
.topbar .menu-btn {
  display: inline-flex;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--sbc-border);
  background: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .2s, color .2s, transform .2s var(--ease-bounce);
}
.topbar .menu-btn:hover {
  border-color: var(--sbc-sky);
  color: var(--sbc-deep);
}
.topbar .menu-btn:active {
  transform: scale(.9);
}
.topbar .page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  white-space: nowrap;
}
.topbar .breadcrumb {
  margin: 0;
  font-size: .8rem;
  flex-wrap: wrap;
}
.topbar .spacer { flex: 1; min-width: 1rem; }
.topbar .icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--sbc-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--sbc-dark);
  flex-shrink: 0;
  transition:
    border-color .2s var(--ease),
    color .2s var(--ease),
    transform .2s var(--ease-bounce);
}
.topbar .icon-btn:hover {
  border-color: var(--sbc-sky);
  color: var(--sbc-deep);
}
.topbar .icon-btn:active {
  transform: scale(.92);
}
.topbar .icon-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--sbc-orange);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
}
.badge-dot.pulse {
  animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 140, 0, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(255, 140, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 140, 0, 0); }
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  padding: .35rem .7rem .35rem .35rem;
  border: 1px solid var(--sbc-border);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  transition:
    border-color .2s var(--ease),
    box-shadow .2s var(--ease);
  flex-shrink: 0;
}
.profile-chip:hover {
  border-color: var(--sbc-sky);
  box-shadow: var(--shadow-sm);
}
.profile-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sbc-deep), var(--sbc-sky));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}
.profile-chip .name {
  font-size: .88rem;
  font-weight: 500;
  color: var(--sbc-dark);
  display: none;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.app-main {
  padding: 1rem 1rem 3rem;
  min-width: 0;
  animation: fadeInUp 0.5s ease both;
}

/* =============================================
   KPI CARDS — responsive + interacción
   ============================================= */
.kpi-card {
  background: #fff;
  border: 1px solid var(--sbc-border);
  border-radius: var(--r-lg);
  padding: 1.15rem;
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  transition:
    transform .3s var(--ease-bounce),
    box-shadow .3s var(--ease);
  position: relative;
  overflow: hidden;
  cursor: default;
}
.kpi-card::before {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(closest-side, rgba(0,153,255,.10), transparent);
  border-radius: 50%;
  pointer-events: none;
}
.kpi-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}
.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.kpi-icon.sky    { background: linear-gradient(135deg, #0099FF, #0056B3); }
.kpi-icon.orange { background: linear-gradient(135deg, #FFA94D, #FF6A00); }
.kpi-icon.green  { background: linear-gradient(135deg, #34d399, #16a34a); }
.kpi-icon.purple { background: linear-gradient(135deg, #8b5cf6, #5b21b6); }

.kpi-card .label {
  font-size: .8rem;
  color: var(--sbc-muted);
  margin-bottom: .1rem;
  font-weight: 500;
}
.kpi-card .value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.1;
}
.kpi-card .delta {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  margin-top: .3rem;
}
.kpi-card .delta.up   { color: var(--sbc-success); }
.kpi-card .delta.down { color: var(--sbc-danger); }

/* =============================================
   PANELS & CHARTS
   ============================================= */
.panel {
  background: #fff;
  border: 1px solid var(--sbc-border);
  border-radius: var(--r-lg);
  padding: 1.15rem;
  transition: box-shadow .3s var(--ease);
}
.panel:hover {
  box-shadow: var(--shadow-md);
}
.panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
  flex-wrap: wrap;
}
.panel .panel-head h5 {
  font-size: .95rem;
  margin: 0;
}
.chart-wrap {
  position: relative;
  height: 240px;
  min-height: 200px;
  width: 100%;
}

/* =============================================
   TABLE — scroll horizontal + mejoras visuales
   ============================================= */
.table-responsive-wrap,
.table-responsive-clean {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
}
.table-clean {
  min-width: 600px;
  width: max-content;
  border-collapse: collapse;
}
.table-clean thead th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sbc-muted);
  border-bottom: 1px solid var(--sbc-border);
  padding: .75rem .85rem;
  background: transparent;
  white-space: nowrap;
  text-align: left;
}
.table-clean tbody td {
  padding: .8rem .85rem;
  vertical-align: middle;
  font-size: .9rem;
  border-bottom: 1px solid var(--sbc-border);
}
.table-clean tbody tr {
  transition: background .15s var(--ease);
}
.table-clean tbody tr:hover td {
  background: rgba(0,153,255,.03);
}
.table-clean tbody tr:last-child td {
  border-bottom: none;
}

/* =============================================
   BADGES
   ============================================= */
.badge-status {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: .72rem;
  padding: .35em .7em;
  border-radius: 999px;
  letter-spacing: .02em;
  white-space: nowrap;
  display: inline-block;
}
.badge-status.success { background: rgba(40,167,69,.12); color: #1f7a35; }
.badge-status.warning { background: rgba(255,193,7,.18); color: #946200; }
.badge-status.danger  { background: rgba(220,53,69,.12); color: #a4202d; }
.badge-status.info    { background: rgba(23,162,184,.14); color: #0f6577; }

/* =============================================
   SEARCH BAR
   ============================================= */
.search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--sbc-bg);
  border: 1px solid var(--sbc-border);
  border-radius: var(--r-md);
  padding: .35rem .75rem;
  min-width: 0;
  width: 100%;
  max-width: 320px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search-bar:focus-within {
  border-color: var(--sbc-sky);
  box-shadow: 0 0 0 3px rgba(0,153,255,.1);
}
.search-bar input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: .9rem;
  padding: .4rem 0;
  font-family: var(--font-body);
}
.search-bar svg {
  color: var(--sbc-muted);
  flex-shrink: 0;
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
  flex-wrap: wrap;
  gap: .25rem;
}
.pagination .page-link {
  color: var(--sbc-deep);
  border-radius: 10px;
  margin: 0 2px;
  border: 1px solid var(--sbc-border);
  min-width: 40px;
  text-align: center;
  transition: all .2s var(--ease);
}
.pagination .page-link:hover {
  background: rgba(0,153,255,.06);
  border-color: var(--sbc-sky);
}
.pagination .page-item.active .page-link {
  background: var(--sbc-deep);
  border-color: var(--sbc-deep);
  color: #fff;
}

/* =============================================
   404 ERROR PAGE
   ============================================= */
.err-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(800px 500px at 20% 20%, rgba(0,153,255,.18), transparent 60%),
    radial-gradient(700px 500px at 90% 80%, rgba(255,140,0,.14), transparent 60%),
    linear-gradient(180deg, #eaf4ff 0%, #fdfbf6 100%);
  position: relative;
  overflow: hidden;
}
.err-card {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 620px;
  width: 100%;
}
.err-card .err-code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(6rem, 16vw, 12rem);
  line-height: 1;
  background: linear-gradient(135deg, #0099FF, #0056B3 60%, #FF8C00);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -.06em;
  margin-bottom: .5rem;
}
.err-card h2 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  margin-bottom: .5rem;
}
.err-card p {
  color: var(--sbc-muted);
  max-width: 46ch;
  margin: 0 auto 1.5rem;
  font-size: .95rem;
}
.err-shell .balloon {
  position: absolute;
  right: 6%;
  bottom: 8%;
  width: 180px;
  opacity: .45;
  animation: floaty 8s ease-in-out infinite;
  filter: drop-shadow(0 30px 40px rgba(11,31,58,.25));
  pointer-events: none;
}
.err-shell .balloon.left {
  left: 4%;
  top: 8%;
  right: auto;
  bottom: auto;
  width: 120px;
  opacity: .3;
  animation-duration: 11s;
}

/* =============================================
   🆕 FORMULARIOS DE CREACIÓN/EDICIÓN
   ============================================= */
.form-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 576px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.form-grid .span-2 {
  grid-column: 1 / -1;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--sbc-border);
  font-family: var(--font-display);
  color: var(--sbc-ink);
}

.form-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* Upload de imagen / archivo */
.upload-area {
  border: 2px dashed var(--sbc-border);
  border-radius: var(--r-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--sbc-sky);
  background: rgba(0,153,255,.04);
}
.upload-area .icon {
  color: var(--sbc-muted);
  margin-bottom: .75rem;
}
.upload-area .text {
  font-size: .9rem;
  color: var(--sbc-muted);
}

/* =============================================
   🆕 PÁGINA DE DETALLE (SHOW)
   ============================================= */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .detail-grid {
    grid-template-columns: 180px 1fr;
  }
}
.detail-avatar {
  width: 100%;
  max-width: 160px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-lg);
  border: 1px solid var(--sbc-border);
}
.dl-inline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem 1.5rem;
  margin-bottom: 0;
}
.dl-inline dt {
  font-size: .8rem;
  color: var(--sbc-muted);
  font-weight: 500;
}
.dl-inline dd {
  font-size: .95rem;
  font-weight: 500;
  color: var(--sbc-ink);
}

/* Timeline de actividad */
.activity-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--sbc-border);
}
.activity-timeline li {
  padding: 0 0 1.5rem 1.5rem;
  position: relative;
}
.activity-timeline li::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sbc-sky);
  border: 2px solid #fff;
}

/* =============================================
   🆕 FILTROS AVANZADOS
   ============================================= */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.filters-bar .form-select,
.filters-bar .form-control {
  width: auto;
  min-width: 150px;
}

/* =============================================
   🆕 MODALES PERSONALIZADOS
   ============================================= */
.modal-sbc .modal-content {
  border: none;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.modal-sbc .modal-header {
  border-bottom: 1px solid var(--sbc-border);
  padding: 1.25rem 1.5rem;
}
.modal-sbc .modal-footer {
  border-top: 1px solid var(--sbc-border);
  padding: 1rem 1.5rem;
}
.modal-sbc .btn-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  opacity: .5;
  transition: opacity .2s;
}
.modal-sbc .btn-close:hover {
  opacity: 1;
}

/* =============================================
   🆕 ESTADOS VACÍOS (EMPTY STATES)
   ============================================= */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--sbc-muted);
}
.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: .5;
}
.empty-state h5 {
  color: var(--sbc-dark);
  margin-bottom: .5rem;
}
.empty-state p {
  max-width: 320px;
  margin: 0 auto 1.5rem;
}

/* =============================================
   🆕 TABS
   ============================================= */
.tabs-sbc {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--sbc-border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabs-sbc .tab-item {
  padding: .65rem 1rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--sbc-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.tabs-sbc .tab-item:hover {
  color: var(--sbc-ink);
}
.tabs-sbc .tab-item.active {
  color: var(--sbc-deep);
  border-bottom-color: var(--sbc-sky);
}

/* =============================================
   🆕 CONTENT LOADER (SKELETON)
   ============================================= */
.skeleton {
  background: linear-gradient(90deg, #e2e6ea 25%, #f0f2f5 50%, #e2e6ea 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text {
  height: 1em;
  margin-bottom: .5em;
}
.skeleton-text.long { width: 80%; }
.skeleton-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* =============================================
   🆕 OTROS AJUSTES RESPONSIVE
   ============================================= */
@media (max-width: 767.98px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-avatar {
    margin: 0 auto 1rem;
  }
}

@media (min-width: 1600px) {
  .app-main {
    padding: 2.5rem 3rem 3rem;
  }
  .kpi-card .value {
    font-size: 2rem;
  }
  .chart-wrap {
    height: 340px;
  }
}

/* =============================================
   HELPERS & UTILIDADES
   ============================================= */
.divider {
  height: 1px;
  background: var(--sbc-border);
  width: 100%;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}
.gap-responsive {
  gap: .75rem;
}
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* =============================================
   ANIMACIONES EXTRA (AOS + personalizadas)
   ============================================= */
[data-aos] {
  transition-timing-function: var(--ease-out-cubic);
}

/* =============================================
   RESPONSIVE FINE-TUNING
   ============================================= */
@media (min-width: 576px) {
  .topbar {
    padding: .75rem 1.25rem;
    gap: 1rem;
  }
  .topbar .page-title { font-size: 1.05rem; }
  .profile-chip .name { display: inline; }

  .app-main { padding: 1.25rem 1.25rem 3rem; }

  .kpi-card { padding: 1.25rem; }
  .kpi-card .value { font-size: 1.6rem; }
  .kpi-icon { width: 48px; height: 48px; }

  .panel { padding: 1.25rem; }
  .chart-wrap { height: 260px; }

  .auth-card { padding: 2rem; }
  .gap-responsive { gap: 1rem; }
}

@media (min-width: 768px) {
  .app-shell {
    grid-template-columns: var(--sidebar-w) 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(0);
    padding: 1.25rem 1rem;
  }
  .topbar .menu-btn { display: none; }
  .sidebar-backdrop { display: none !important; }
  .app-main { padding: 1.5rem 1.5rem 3rem; }
  .section-title { font-size: 1.1rem; }
  .panel .panel-head h5 { font-size: 1rem; }
}

@media (min-width: 1024px) {
  :root { --sidebar-w: 280px; }
  .search-bar { max-width: 360px; }
  .chart-wrap { height: 280px; }
}

@media (min-width: 1280px) {
  .app-main { padding: 2rem 2rem 3rem; }
  .kpi-card .value { font-size: 1.75rem; }
  .chart-wrap { height: 300px; }
}

/* ========== TOUCH OPTIMIZATIONS ========== */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 50px; }
  .sidebar .nav-link { min-height: 50px; }
  .kpi-card:hover { transform: none; }
  .card-interactive:hover { transform: none; }
  .card-interactive:active { transform: scale(.98); }
}

/* ========== FIXES ADICIONALES ========== */
@media (max-width: 480px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    min-height: 56px;
  }
  .topbar .spacer { display: none; }
  .topbar .icon-btn.d-none.d-sm-inline-flex { display: none !important; }
  .profile-chip .name { display: none; }
  .profile-chip { padding: 0.25rem 0.5rem 0.25rem 0.25rem; }
  .topbar .brand-logo .brand-mark { width: 32px; height: 32px; }
  .topbar .page-title {
    font-size: 0.85rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .panel .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .panel .panel-head .search-bar { width: 100%; max-width: 100%; }
}

@media (max-width: 360px) {
  .app-main { padding: 0.75rem; }
  .kpi-card { padding: 0.75rem; gap: 0.65rem; }
  .kpi-icon { width: 40px; height: 40px; border-radius: 12px; }
  .kpi-card .value { font-size: 1.25rem; }
  .kpi-card .label { font-size: 0.75rem; }
}