/* =========================================================================
   Tema "iOS Admin" — tokens de diseño
   Inspirado en el lenguaje visual de iOS/macOS (Ajustes, widgets, tab bar),
   con la estructura de un panel de administracion (sidebar + topbar + contenido).
   ========================================================================= */

:root {
  /* Color */
  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --surface-translucent: rgba(255, 255, 255, 0.72);
  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #AEAEB2;
  --accent: #0A84FF;
  --accent-soft: #E8F2FF;
  --accent-press: #0870DB;
  --success: #30D158;
  --success-soft: #E6FBEC;
  --danger: #FF453A;
  --danger-soft: #FFECEB;
  --warning: #FF9F0A;
  --warning-soft: #FFF3E0;
  --border: #E5E5EA;
  --border-strong: #D1D1D6;

  --sidebar-bg: #1C1C1E;
  --sidebar-bg-elevated: #242426;
  --sidebar-text: #F2F2F7;
  --sidebar-text-muted: #98989D;
  --sidebar-active-bg: rgba(10, 132, 255, 0.18);
  --sidebar-border: rgba(255, 255, 255, 0.08);

  /* Tipografia */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Radios y sombras: iOS usa esquinas muy redondeadas y sombras suaves y difusas */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.05);

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --tabbar-height: 64px;

  --sys-blue: #007AFF;
  --sys-gray-bg: #F2F2F7;
  --sys-gray-6: #F2F2F7;
  --sys-gray-5: #E5E5EA;
  --sys-gray-4: #D1D1D6;
  --sys-gray-label: #8E8E93;
  --sys-red: #FF3B30;
  --sys-green: #34C759;
  --card-radius: 14px;
  --sep-color: rgba(60, 60, 67, 0.29);
}

/* =========================================================================
   Reset ligero
   ========================================================================= */

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-system);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 4px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

p {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Foco visible accesible, consistente con el resto del sistema */
a:focus-visible,
button:focus-visible,
input:focus-visible,
.app-nav__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================================
   Shell de la aplicacion: sidebar + topbar + contenido
   ========================================================================= */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar (estilo lista agrupada de Ajustes de iOS, en modo oscuro) --- */

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 22px;
}

.app-brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(155deg, #0A84FF, #5AC8FA);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.app-brand__name {
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.app-nav__group-label {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-text-muted);
  padding: 14px 12px 6px;
}

.app-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--sidebar-bg-elevated);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.app-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  color: var(--sidebar-text);
  border-bottom: 1px solid var(--sidebar-border);
  font-size: 14.5px;
  font-weight: 500;
  transition: background-color 0.15s ease;
}

.app-nav__list .app-nav__item:last-child {
  border-bottom: none;
}

.app-nav__item:hover {
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.app-nav__item.is-active {
  background: var(--sidebar-active-bg);
  color: #fff;
}

.app-nav__icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.app-nav__icon svg {
  width: 15px;
  height: 15px;
}

.app-nav__icon--blue {
  background: #0A84FF;
}

.app-nav__icon--gray {
  background: #8E8E93;
}

.app-nav__icon--green {
  background: #30D158;
}

.app-nav__icon--red {
  background: #FF453A;
}

.app-nav__icon--orange {
  background: #FF9F0A;
}

.app-nav__chevron {
  margin-left: auto;
  color: var(--sidebar-text-muted);
  opacity: 0.7;
}

/* --- Submenu desplegable (acordeon), usando <details>/<summary> nativo:
   funciona sin JavaScript y es accesible por teclado por defecto. --- */

.app-nav__submenu summary {
  cursor: pointer;
  list-style: none;
}

.app-nav__submenu summary::-webkit-details-marker {
  display: none;
}

.app-nav__submenu summary::marker {
  content: "";
}

.app-nav__chevron--submenu {
  transition: transform 0.18s ease;
}

.app-nav__submenu[open]>summary .app-nav__chevron--submenu {
  transform: rotate(90deg);
}

.app-nav__submenu-list {
  background: rgba(0, 0, 0, 0.14);
}

.app-nav__subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 48px;
  color: var(--sidebar-text-muted);
  border-bottom: 1px solid var(--sidebar-border);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.app-nav__submenu-list .app-nav__subitem:last-child {
  border-bottom: none;
}

.app-nav__subitem::before {
  content: "";
  position: absolute;
  left: 30px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--sidebar-border);
}

.app-nav__subitem:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text);
  text-decoration: none;
}

.app-nav__subitem.is-active {
  color: #fff;
  background: var(--sidebar-active-bg);
}

.app-nav__subitem.is-active::after {
  content: "";
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.app-sidebar__footer {
  margin-top: 18px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--sidebar-bg-elevated);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Topbar (translucida, efecto vidrio de iOS) --- */

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--surface-translucent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-topbar__title {
  font-size: 17px;
  font-weight: 650;
  margin: 0;
}

.app-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(118, 118, 128, 0.12);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  color: var(--text-secondary);
  font-size: 14px;
  width: 240px;
}

.app-search svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.app-menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text-primary);
}

.app-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(155deg, #0A84FF, #BF5AF2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  font-size: 13px;
  flex-shrink: 0;
}

.app-content {
  padding: 24px;
  flex: 1;
}

.app-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.app-page-header-publico {
  display: flex;
  align-items: flex-end;
  justify-content:center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* =========================================================================
   Tab bar inferior (solo movil) — el guiño mas directo a iOS
   ========================================================================= */

.app-tabbar {
  display: none;
}

@media (max-width: 880px) {
  .app-sidebar {
    display: none;
  }

  .app-tabbar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tabbar-height);
    background: var(--surface-translucent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
    z-index: 20;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-tertiary);
    font-size: 10.5px;
    font-weight: 550;
  }

  .app-tabbar__item svg {
    width: 22px;
    height: 22px;
  }

  .app-tabbar__item.is-active {
    color: var(--accent);
  }

  .app-tabbar__item:hover {
    text-decoration: none;
  }

  .app-content {
    padding-bottom: calc(var(--tabbar-height) + 24px);
  }
}

/* =========================================================================
   Sheet "Mas" (movil) — hoja que sube desde abajo con el resto del menu.
   Implementada con el truco de checkbox en CSS puro (sin JavaScript),
   igual filosofia que el submenu <details>/<summary>.
   ========================================================================= */

.app-sheet-checkbox {
  display: none;
}

.app-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
}

@media (max-width: 880px) {
  .app-sheet-checkbox:checked~.app-sheet {
    display: block;
  }

  .app-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    cursor: pointer;
  }

  .app-sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 82vh;
    overflow-y: auto;
    background: var(--bg);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
    padding: 10px 16px calc(24px + env(safe-area-inset-bottom));

    /* Entrada deslizante: sin JS para animar el toggle en si (el checkbox
       cambia display de golpe), pero la transicion suaviza cualquier
       repintado y da sensacion de "hoja" al usuarios con reduce-motion off. */
    animation: app-sheet-slide-up 0.22s ease;
  }

  @keyframes app-sheet-slide-up {
    from {
      transform: translateY(16px);
      opacity: 0;
    }

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

  .app-sheet__handle {
    width: 36px;
    height: 5px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    margin: 6px auto 14px;
  }

  .app-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .app-sheet__header h2 {
    margin: 0;
  }

  .app-sheet__close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(118, 118, 128, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
  }

  /* Reutiliza .grouped-list para las filas del sheet, en superficie clara */
  .app-sheet .grouped-list {
    margin-bottom: 14px;
  }

  .app-sheet .grouped-list__row {
    display: flex;
    align-items: center;
    gap: 12px;
    grid-template-columns: none;
  }

  /* Submenu de Automatizados reutilizado dentro del sheet, con paleta clara */
  .app-sheet .app-nav__submenu {
    border-top: 1px solid var(--border);
  }

  .app-sheet .app-nav__submenu summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: var(--text-primary);
    font-weight: 500;
  }

  .app-sheet .grouped-list__row.is-active {
    color: var(--accent);
  }

  .app-sheet .app-nav__submenu-list {
    background: rgba(118, 118, 128, 0.06);
  }

  .app-sheet .app-nav__subitem {
    padding: 12px 18px 12px 54px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
  }

  .app-sheet .app-nav__subitem::before {
    left: 36px;
    background: var(--border);
  }

  .app-sheet .app-nav__subitem.is-active {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .app-sheet .app-nav__chevron--submenu {
    color: var(--text-tertiary);
    margin-left: auto;
  }

  .app-sheet__signout {
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 14px 18px;
    color: var(--danger);
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
  }
}

/* =========================================================================
   Componentes: cards, widgets, listas agrupadas, formularios, botones
   ========================================================================= */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 20px;
}

.card+.card {
  margin-top: 16px;
}

/* Widgets tipo "home screen" para metricas del dashboard */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.widget {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 18px;
  text-align: center;
}

.widget__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 12px;
  margin: auto;
}

.widget__icon svg {
  width: 18px;
  height: 18px;
  margin: auto;
}

.widget__value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.widget__label {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Lista agrupada (estilo tabla de Ajustes de iOS) para reemplazar <table> planas */
.grouped-list {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.grouped-list__header {
  display: grid;
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
}

.grouped-list__row {
  display: grid;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.grouped-list__row:last-child {
  border-bottom: none;
}

a.grouped-list__row:hover {
  background: rgba(118, 118, 128, 0.06);
  text-decoration: none;
}

.grouped-list__empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--text-secondary);
}

.cell-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.cell-primary {
  font-weight: 600;
}

/* Avatares con iniciales para filas de usuarios */
.row-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  font-size: 12.5px;
  flex-shrink: 0;
}

/* Badges / pills de estado */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

.badge--success {
  background: var(--success-soft);
  color: #1E8A3B;
}

.badge--danger {
  background: var(--danger-soft);
  color: #C6231A;
}

.badge--warning {
  background: var(--warning-soft);
  color: #B5710A;
}

.badge--neutral {
  background: rgba(118, 118, 128, 0.12);
  color: var(--text-secondary);
}

/* Botones estilo iOS: pill-shaped, sin bordes, color solido o "tinted" */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.05s ease, background-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-press);
}

.btn--tinted {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn--tinted:hover {
  background: #DBEBFF;
}

.btn--danger {
  background: var(--danger-soft);
  color: #C6231A;
}

.btn--danger:hover {
  background: #FFDEDC;
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn--ghost:hover {
  background: rgba(118, 118, 128, 0.10);
}

.btn--block {
  width: 100%;
}

/* Formularios estilo iOS: inputs redondeados sobre fondo agrupado */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 15px;
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.alert {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}

.alert--danger {
  background: var(--danger-soft);
  color: #C6231A;
}

.alert ul {
  margin: 0;
  padding-left: 18px;
}

/* =========================================================================
   Pantalla de login: tarjeta centrada sobre fondo con "orbes" de color,
   al estilo de la pantalla de inicio de sesion de Apple ID / macOS
   ========================================================================= */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, #EAF4FF 0%, transparent 45%),
    radial-gradient(circle at 85% 75%, #F3E8FF 0%, transparent 45%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  position: relative;
  z-index: 1;
}

.auth-card__mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(155deg, #0A84FF, #5AC8FA);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  margin: 0 auto 18px;
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 4px;
}

.auth-card p.auth-sub {
  text-align: center;
  margin-bottom: 22px;
  font-size: 14px;
}

.auth-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Utilidades minimas de layout */
.u-flex {
  display: flex;
  align-items: center;
}

.u-gap-8 {
  gap: 8px;
}

.u-gap-12 {
  gap: 12px;
}

.u-mt-0 {
  margin-top: 0;
}

.u-text-secondary {
  color: var(--text-secondary);
}

/* =========================================================================
   Modal — mismo lenguaje visual que el resto (cards redondeadas, sombra
   suave, botones pill). Usa la apertura/cierre de Bootstrap JS, que ya
   esta vendorizado en public/assets/vendor/bootstrap/js/bootstrap.bundle.min.js
   (data-bs-toggle="modal" / data-bs-dismiss="modal"); esto solo redefine
   el ASPECTO, no la logica de mostrar/ocultar.
   ========================================================================= */

.modal-backdrop {
  background: rgba(0, 0, 0, 0.32);
}

.modal-backdrop.show {
  opacity: 1;
}

.modal-content {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 22px;
}

.modal-header .modal-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}

.modal-body {
  padding: 20px 22px;
}

.modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 22px;
  gap: 10px;
}

/* Boton de cerrar (la "x"): mismo circulo gris que ya usa el sheet movil */
.btn-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(118, 118, 128, 0.16) !important;
  opacity: 1;
  box-shadow: none;
  background-image: none !important;
  position: relative;
}

.btn-close::before,
.btn-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
}

.btn-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.btn-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.btn-close:hover {
  background: rgba(118, 118, 128, 0.26) !important;
}

/* Si tu modal trae <input>/<select> dentro (formularios), reutiliza .field
   del resto del sitio para que hereden el mismo estilo:
   <div class="field"><label>...</label><input ...></div>            */
/* Styles tables bootstrap */

.dt-paging .pagination {

  gap: 6px;

}

.dt-paging .page-link {

  border: none;

  border-radius: 12px;

  color: var(--text-primary);

  background: var(--surface);

  box-shadow: var(--shadow-sm);

}

.dt-paging .active .page-link {

  background: var(--accent);

  color: #fff;

}

/* Estilos para arbol de menus */

.page-wrap {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 16px 80px;
}

/* ---------- Header de sección estilo iOS ---------- */
.ios-section-title {
  font-size: 13px;
  font-weight: 590;
  color: var(--sys-gray-label);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0 16px 6px;
}

/* ---------- Card agrupada estilo Settings.app ---------- */
.ios-card {
  background: #ffffff;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ios-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 52px;
  border-bottom: 0.5px solid var(--sep-color);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.ios-row:last-child {
  border-bottom: none;
}

.ios-row:active {
  background: rgba(60, 60, 67, 0.06);
}

.ios-row .chevron {
  transition: transform 0.2s ease;
  color: var(--sys-gray-4);
  font-size: 14px;
}

.ios-row.expanded .chevron {
  transform: rotate(90deg);
}

.ios-icon-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}

.ios-row-title {
  font-size: 15px;
  font-weight: 400;
  flex: 1;
}

.ios-row-count {
  font-size: 13px;
  color: var(--sys-gray-label);
}

.ios-row-count.partial {
  color: var(--sys-blue);
  font-weight: 500;
}

/* submenu list, indented like grouped table view */
.ios-sublist {
  background: #fbfbfd;
}

.ios-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 56px;
  border-bottom: 0.5px solid var(--sep-color);
  font-size: 14px;
}

.ios-sub-row:last-child {
  border-bottom: none;
}

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

.status-dot.on {
  background: var(--sys-green);
}

.status-dot.off {
  background: var(--sys-gray-4);
}

.ios-sub-row.off {
  color: var(--sys-gray-label);
}

.collapse-region {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.collapse-region.open {
  max-height: 600px;
}

/* ---------- Botón editar, estilo iOS text-button ---------- */
.ios-text-btn {
  color: var(--sys-blue);
  font-size: 16px;
  font-weight: 400;
  background: none;
  border: none;
  padding: 4px 2px;
}

.ios-text-btn:hover {
  opacity: 0.7;
}

/* ---------- Buscador tipo Spotlight ---------- */
.ios-search {
  background: var(--sys-gray-5);
  border: none;
  border-radius: 10px;
  padding: 8px 12px 8px 34px;
  font-size: 15px;
  width: 100%;
}

.ios-search:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
  background: #fff;
}

.search-wrap {
  position: relative;
}

.search-wrap i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sys-gray-label);
  font-size: 14px;
}

/* ---------- Switch iOS (reemplaza checkbox cuadrado) ---------- */
.ios-switch {
  --w: 44px;
  --h: 26px;
}

.ios-switch .form-check-input {
  width: var(--w);
  height: var(--h);
  background-color: var(--sys-gray-4);
  border: none;
  border-radius: 100px;
  background-image: none;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ios-switch .form-check-input:checked {
  background-color: var(--sys-green);
  border-color: var(--sys-green);
}

.ios-switch .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.25);
}

.ios-switch .form-check-input:indeterminate {
  background-color: var(--sys-gray-4);
}

/* ---------- Modal estilo macOS: fondo blur, esquinas grandes ---------- */
.modal-content.ios-sheet {
  border-radius: 20px;
  border: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.modal-backdrop.show {
  opacity: 0.35;
}

.ios-modal-header {
  padding: 16px 20px 12px;
  border-bottom: 0.5px solid var(--sep-color);
}

.ios-modal-header .title {
  font-size: 17px;
  font-weight: 590;
  margin: 0;
}

.ios-modal-header .subtitle {
  font-size: 13px;
  color: var(--sys-gray-label);
  margin: 1px 0 0;
}

.btn-close-ios {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sys-gray-5);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b6b70;
  font-size: 14px;
}

.ios-modal-body {
  padding: 14px 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.ios-modal-footer {
  padding: 12px 20px 16px;
  border-top: 0.5px solid var(--sep-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pending-badge {
  font-size: 13px;
  color: #b8860b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pending-badge.hidden {
  visibility: hidden;
}

.btn-ios-primary {
  background: var(--sys-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 500;
}

.btn-ios-primary:hover {
  background: #0069d9;
  color: #fff;
}

.btn-ios-secondary {
  background: var(--sys-gray-5);
  color: #1c1c1e;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-right: 8px;
}
