body {
  min-height: 100vh;
  zoom: 0.73; /* Esto aplica el zoom al 70% en toda la interfaz */
}

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

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--app-sidebar-width);
  background: var(--app-sidebar-bg);
  color: var(--app-sidebar-color);
  z-index: 1030;
  display: flex;
  flex-direction: column;
  box-shadow: var(--app-shadow);
}

.sidebar-brand {
  min-height: 92px;
  display: flex;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand-logo {
  max-width: 178px;
  height: auto;
  object-fit: contain;
}

.brand-subtitle {
  color: var(--app-sidebar-muted);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 18px 14px;
  overflow-y: auto;
}

.sidebar-group {
  margin-bottom: 14px;
}

.sidebar-group-title {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--app-sidebar-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 12px;
}

.sidebar-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--app-sidebar-active-color);
  background: var(--app-sidebar-active-bg);
  font-size: 0.75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  color: var(--app-sidebar-color);
  text-decoration: none;
  padding: 10px 14px 10px 48px;
  border-radius: 12px;
  margin: 2px 0;
  font-size: 0.95rem;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: var(--app-sidebar-active-color);
  background: var(--app-sidebar-active-bg);
}

.app-content {
  margin-left: var(--app-sidebar-width);
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--app-topbar-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--bs-border-color);
}

.topbar-title {
  font-weight: 800;
  line-height: 1;
}

.topbar-subtitle {
  color: var(--bs-secondary-color);
  font-size: 0.82rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-label {
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
}

.theme-select {
  width: 120px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-header h1 {
  font-weight: 800;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--bs-secondary-color);
  margin-bottom: 0;
}

.app-card,
.metric-card {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
}

.metric-card {
  background: var(--bs-card-bg);
  padding: 22px;
  min-height: 126px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card span {
  color: var(--bs-secondary-color);
  font-weight: 600;
}

.metric-card strong {
  font-size: 2.2rem;
  line-height: 1;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.choice-pill {
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  padding: 9px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bs-card-bg);
  cursor: pointer;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.26rem 0.58rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-success { background: rgba(25, 135, 84, .15); color: #198754; }
.status-error { background: rgba(220, 53, 69, .15); color: #dc3545; }
.status-timeout { background: rgba(255, 193, 7, .2); color: #9a6a00; }
.status-running { background: rgba(13, 110, 253, .14); color: #0d6efd; }
.status-queued { background: rgba(108, 117, 125, .16); color: #6c757d; }

.code-block,
.log-block {
  background: var(--app-code-bg);
  color: var(--app-code-color);
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-block {
  max-height: 460px;
  min-height: 160px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(var(--bs-primary-rgb), .22), transparent 34rem),
    var(--bs-body-bg);
}

.auth-card-wrap {
  width: min(440px, 100%);
}

.auth-card {
  border-radius: 22px;
  border: 1px solid var(--bs-border-color);
}

.auth-logo {
  display: flex;
  align-items: end;
  gap: 10px;
}

.auth-logo img {
  max-width: 170px;
}

.auth-logo span {
  color: var(--bs-secondary-color);
  font-weight: 700;
}

.max-w-lg {
  max-width: 680px;
}

.flash-stack {
  margin-bottom: 20px;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
  }

  .app-sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1025;
  }

  .app-content {
    margin-left: 0;
  }

  .topbar-actions {
    gap: 6px;
  }

  .theme-label {
    display: none;
  }

  .page-header {
    flex-direction: column;
  }
}

/* Dashboard principal: iframe externo y HTML local */
.dashboard-frame-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
}

.dashboard-frame {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
}

.embedded-html-wrap {
  width: 100%;
  overflow-x: auto;
}

.embedded-html-wrap table {
  max-width: 100%;
}

.embedded-html-wrap img,
.embedded-html-wrap iframe {
  max-width: 100%;
}
