:root {
  --surface: rgba(10, 14, 28, 0.84);
  --surface-strong: rgba(16, 22, 38, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eef2ff;
  --muted: #a4b2d6;
  --accent: #7dd3fc;
  --accent-2: #fbbf24;
}

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(251, 191, 36, 0.12), transparent 28%),
    linear-gradient(160deg, #09111f 0%, #11192b 42%, #151d2c 100%);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 1.5rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5, 8, 15, 0.88), rgba(11, 15, 24, 0.9));
  backdrop-filter: blur(12px);
}

.brand-block {
  padding: 1rem 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 1.25rem;
}

.brand-kicker, .hero-eyebrow, .card-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav-shell .nav-link {
  display: block;
  padding: 0.9rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 14px;
  color: var(--muted);
  border: 1px solid transparent;
  background: transparent;
}

.nav-shell .nav-link.active {
  color: var(--text);
  border-color: rgba(125, 211, 252, 0.35);
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.14), rgba(14, 165, 233, 0.08));
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.12);
}

.nav-shell .nav-link:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.nav-section {
  margin-bottom: 1rem;
}

.nav-section-label {
  margin: 0 0 0.4rem 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(164, 178, 214, 0.75);
}

.sidebar-status {
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 0.35rem rgba(34, 197, 94, 0.14);
}

.sidebar-status-text {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.workspace {
  padding: 1.5rem;
}

.hero-bar {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  margin-bottom: 1.5rem;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  min-width: 360px;
}

.hero-metrics div {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.hero-metrics span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.hero-metrics strong {
  font-size: 0.95rem;
}

.hero-bar h1, .page-heading h1, .card-surface h2, .card-surface h3, .nested-card h3, .nested-card h4 {
  margin-bottom: 0.5rem;
}

.hero-bar p, .page-heading p, .card-surface p, .nested-card p {
  color: var(--muted);
}

.content-panel, .card-surface, .not-found-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16);
}

/* El desenfoque se aplica solo a los paneles hoja. NUNCA a .content-panel: contiene el @Body
   de MainLayout y backdrop-filter convierte al elemento en bloque contenedor de los hijos
   position:fixed, con lo que la capa de los modales dejaria de cubrir toda la ventana. */
.card-surface,
.not-found-panel {
  backdrop-filter: blur(12px);
}

.content-panel {
  padding: 1.5rem;
}

.card-surface {
  padding: 1.25rem;
}

.page-stack {
  display: grid;
  gap: 1rem;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.dashboard-grid, .grid-two {
  display: grid;
  gap: 1rem;
}

.dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.accent-warm { border-top: 3px solid var(--accent-2); }
.accent-ink { border-top: 3px solid var(--accent); }
.accent-sand { border-top: 3px solid #c4b5fd; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.summary-grid div {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.summary-grid span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.summary-grid strong {
  font-size: 1rem;
}

.nested-card {
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
}

.btn {
  border-radius: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  border-color: transparent;
}

.btn-outline-light,
.btn-outline-secondary {
  border-color: var(--line);
  color: var(--text);
}

.form-label,
.table,
.table th,
.table td,
.text-muted {
  color: var(--muted) !important;
}

.form-control,
.form-select {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  border-radius: 14px;
}

.form-control:focus,
.form-select:focus {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(125, 211, 252, 0.55);
  box-shadow: 0 0 0 0.2rem rgba(125, 211, 252, 0.15);
}

/* El desplegable nativo se dibuja sobre el fondo claro del sistema, no sobre el tema oscuro: los
   items necesitan texto oscuro o quedan ilegibles. */
.form-select option,
.form-select optgroup {
  color: #0b1220;
  background-color: #ffffff;
}

/* Paginador de tablas */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.pager-info,
.pager-page {
  font-size: 0.8rem;
  color: var(--muted);
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pager-size {
  width: auto;
  max-width: 10rem;
  font-size: 0.8rem;
}

/* Secciones plegables */
.section-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}

.section-toggle .bi {
  color: var(--accent);
  font-size: 0.85rem;
}

.section-toggle h2,
.section-toggle h3,
.section-toggle h4 {
  margin: 0;
}

.section-head:last-child {
  margin-bottom: 0;
}

/* Detalle de un registro (sustituye a las tablas de una unica fila) */
.detail-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

/* Codigo QR mostrado en el modal (la imagen ya viene con fondo blanco) */
.qr-image {
  width: 100%;
  max-width: 320px;
  border-radius: 16px;
  background: #ffffff;
}

.detail-list dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  border-bottom-color: var(--line);
}

.table > :not(caption) > * > * {
  background: transparent;
  border-bottom-color: var(--line);
}

.alert {
  border-radius: 18px;
}

.not-found-panel {
  padding: 2rem;
}

.login-shell {
  min-height: 100vh;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-box {
  max-width: 400px;
  width: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background-color: var(--surface-strong);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.24);
}

.login-title {
  text-align: center;
  margin-bottom: 1rem;
}

.login-actions {
  text-align: center;
}

.login-version {
  font-size: 0.72rem;
  margin-top: 0.75rem;
  margin-bottom: 0;
  color: var(--muted);
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 0.75rem;
}

.login-logo {
  width: 90px;
  max-width: 40%;
}

/* Botones de accion con icono (sin texto) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  line-height: 1;
  font-size: 0.95rem;
}

.icon-btn.btn-sm {
  width: 2rem;
  height: 2rem;
  font-size: 0.85rem;
}

/* Encabezado de seccion con acciones alineadas a la derecha */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2,
.section-head h3 {
  margin-bottom: 0;
}

/* Ventana modal */
.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  overflow-y: auto;
  background: rgba(3, 6, 14, 0.66);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-strong);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
  animation: modal-in 160ms ease-out;
}

.modal-panel-sm { max-width: 460px; }
.modal-panel-lg { max-width: 920px; }

.modal-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.modal-panel-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-panel-body {
  padding: 1.25rem;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

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

@media (prefers-reduced-motion: reduce) {
  .modal-panel {
    animation: none;
  }
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-grid,
  .grid-two,
  .summary-grid,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .hero-bar {
    flex-direction: column;
  }

  .hero-metrics {
    min-width: 0;
    width: 100%;
  }

  .modal-shell {
    padding: 1.25rem 0.75rem;
  }
}