/* ==========================================================================
   Calculadora de Tamaño de Muestra — Apple Human Interface System (macOS & iOS)
   Versión V0.3 — Paleta oficial oficial de Apple HIG, sin emojis y acabado nativo
   ========================================================================== */

/* Variables de Diseño Oficiales de Apple (Light Mode por defecto) */
:root {
  /* Colores de Sistema de Apple (iOS & macOS Light) */
  --system-blue: #007aff;
  --system-blue-hover: #006ee6;
  --system-blue-active: #0062cc;
  --system-blue-tint: rgba(0, 122, 255, 0.10);
  --system-blue-glow: rgba(0, 122, 255, 0.28);

  --system-green: #34c759;
  --system-red: #ff3b30;
  --system-red-tint: rgba(255, 59, 48, 0.10);
  --system-orange: #ff9500;
  --system-yellow: #ffcc00;
  --system-gray: #8e8e93;

  /* Fondos del Sistema (Apple System Backgrounds) */
  --system-background: #ffffff;
  --system-secondary-bg: #f2f2f7;
  --system-tertiary-bg: #ffffff;
  --system-grouped-bg: #f2f2f7;
  --system-secondary-grouped-bg: #ffffff;

  /* Fondo de Escritorio macOS (Desktop Canvas) */
  --macos-desktop-canvas: radial-gradient(circle at 50% 15%, #eef3f9 0%, #dfe7f2 60%, #d2dee9 100%);
  --macos-window-bg: rgba(255, 255, 255, 0.84);
  --macos-window-border: rgba(0, 0, 0, 0.12);
  --macos-card-bg: rgba(255, 255, 255, 0.72);
  --macos-card-border: rgba(0, 0, 0, 0.07);
  --macos-card-inset: rgba(0, 0, 0, 0.03);

  /* Elementos de Relleno (Apple System Fills) */
  --system-fill: rgba(120, 120, 128, 0.20);
  --system-secondary-fill: rgba(120, 120, 128, 0.16);
  --system-tertiary-fill: rgba(118, 118, 128, 0.12);
  --system-quaternary-fill: rgba(116, 116, 128, 0.08);

  /* Jerarquía Tipográfica de Apple (Labels) */
  --label-primary: #000000;
  --label-secondary: rgba(60, 60, 67, 0.60);
  --label-tertiary: rgba(60, 60, 67, 0.35);
  --label-quaternary: rgba(60, 60, 67, 0.18);

  /* Separadores Oficiales */
  --separator: rgba(60, 60, 67, 0.15);
  --separator-opaque: #c6c6c8;
  --hairline: rgba(0, 0, 0, 0.05);

  /* Segmented Control Oficial */
  --segmented-bg: rgba(118, 118, 128, 0.12);
  --segmented-thumb: #ffffff;
  --segmented-thumb-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);

  /* Sombras de Ventana macOS */
  --window-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.18), 0 8px 24px -4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.07);
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.03), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --floating-shadow: 0 16px 40px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.06);

  /* Tipografía San Francisco */
  --font-apple-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-apple-mono: ui-monospace, "SF Mono", "SF Pro Rounded", Menlo, Monaco, Consolas, monospace;
}

/* Modo Oscuro (Apple macOS Dark Mode & iOS Deep Black) */
[data-theme="dark"] {
  /* Colores de Sistema de Apple (iOS & macOS Dark) */
  --system-blue: #0a84ff;
  --system-blue-hover: #218fff;
  --system-blue-active: #0071e3;
  --system-blue-tint: rgba(10, 132, 255, 0.16);
  --system-blue-glow: rgba(10, 132, 255, 0.35);

  --system-green: #30d158;
  --system-red: #ff453a;
  --system-red-tint: rgba(255, 69, 58, 0.18);
  --system-orange: #ff9f0a;
  --system-yellow: #ffd60a;
  --system-gray: #8e8e93;

  /* Fondos del Sistema */
  --system-background: #000000;
  --system-secondary-bg: #1c1c1e;
  --system-tertiary-bg: #2c2c2e;
  --system-grouped-bg: #000000;
  --system-secondary-grouped-bg: #1c1c1e;

  /* Fondo de Escritorio macOS Dark Canvas */
  --macos-desktop-canvas: radial-gradient(circle at 50% 15%, #151a22 0%, #0d1015 60%, #050608 100%);
  --macos-window-bg: rgba(30, 30, 32, 0.85);
  --macos-window-border: rgba(255, 255, 255, 0.15);
  --macos-card-bg: rgba(44, 44, 46, 0.65);
  --macos-card-border: rgba(255, 255, 255, 0.09);
  --macos-card-inset: rgba(255, 255, 255, 0.04);

  /* Elementos de Relleno Dark */
  --system-fill: rgba(120, 120, 128, 0.36);
  --system-secondary-fill: rgba(120, 120, 128, 0.32);
  --system-tertiary-fill: rgba(118, 118, 128, 0.24);
  --system-quaternary-fill: rgba(118, 118, 128, 0.16);

  /* Jerarquía Tipográfica Dark */
  --label-primary: #ffffff;
  --label-secondary: rgba(235, 235, 245, 0.60);
  --label-tertiary: rgba(235, 235, 245, 0.35);
  --label-quaternary: rgba(235, 235, 245, 0.16);

  /* Separadores Dark */
  --separator: rgba(84, 84, 88, 0.45);
  --separator-opaque: #38383a;
  --hairline: rgba(255, 255, 255, 0.08);

  /* Segmented Control Dark */
  --segmented-bg: rgba(118, 118, 128, 0.24);
  --segmented-thumb: rgba(99, 99, 102, 0.65);
  --segmented-thumb-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.12);

  /* Sombras Dark */
  --window-shadow: 0 32px 80px -12px rgba(0, 0, 0, 0.85), 0 12px 28px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.12);
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --floating-shadow: 0 20px 48px rgba(0, 0, 0, 0.7), 0 6px 16px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Reset y Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-apple-sans);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--label-primary);
  background: var(--macos-desktop-canvas);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.3s ease;
}

/* Fondo de escritorio estilo Apple Wallpaper */
.apple-desktop-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: transparent;
}

/* ==========================================================================
   Ventana macOS (Contenedor Maestro)
   ========================================================================== */
.macos-window {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 780px;
  background-color: var(--macos-window-bg);
  backdrop-filter: blur(40px) saturate(190%);
  -webkit-backdrop-filter: blur(40px) saturate(190%);
  border: 1px solid var(--macos-window-border);
  border-radius: 20px;
  box-shadow: var(--window-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

/* Barra de Título macOS */
.window-titlebar {
  height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--separator);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(0, 0, 0, 0.02) 100%);
  user-select: none;
}

[data-theme="dark"] .window-titlebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.15) 100%);
}

/* Botones de ventana (Traffic Lights auténticos de macOS) */
.traffic-lights {
  display: flex;
  align-items: center;
  gap: 8px;
}

.traffic-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.dot-close {
  background-color: #ff5f56;
}

.dot-minimize {
  background-color: #ffbd2e;
}

.dot-zoom {
  background-color: #27c93f;
}

.traffic-lights:hover .traffic-dot {
  filter: brightness(0.92);
}

/* Título Central de Ventana */
.window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--label-primary);
  letter-spacing: -0.015em;
}

.app-logo-icon {
  width: 16px;
  height: 16px;
  color: var(--system-blue);
}

.version-badge {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background-color: var(--system-quaternary-fill);
  color: var(--label-secondary);
  border: 1px solid var(--hairline);
}

/* Switch iOS para Modo Oscuro */
.theme-switch-container {
  display: flex;
  align-items: center;
}

.ios-switch {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background-color: var(--system-secondary-fill);
  border: 1px solid var(--macos-card-border);
  cursor: pointer;
  position: relative;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: background-color 0.28s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.28s ease;
  outline: none;
}

.ios-switch:focus-visible {
  box-shadow: 0 0 0 3px var(--system-blue-glow);
}

.switch-icons {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5px;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.switch-icon {
  width: 12px;
  height: 12px;
  color: var(--label-tertiary);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.switch-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), 0 1px 1px rgba(0, 0, 0, 0.1);
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), background-color 0.2s ease;
  z-index: 2;
}

[data-theme="dark"] .ios-switch {
  background-color: var(--system-blue);
  border-color: var(--system-blue);
}

[data-theme="dark"] .ios-switch .switch-thumb {
  transform: translateX(20px);
}

[data-theme="dark"] .switch-icon.icon-moon {
  color: #ffffff;
}

[data-theme="dark"] .switch-icon.icon-sun {
  opacity: 0.3;
}

/* Sub-encabezado descriptivo (Toolbar) */
.window-toolbar {
  padding: 12px 20px 10px;
  background-color: var(--macos-card-inset);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toolbar-nav-container {
  display: flex;
  width: 100%;
}

.macos-tabs-bar {
  display: flex;
  width: 100%;
  background-color: var(--segmented-bg);
  padding: 3px;
  border-radius: 11px;
  gap: 3px;
}

.macos-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--label-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
}

.macos-tab-btn:hover {
  color: var(--label-primary);
}

.macos-tab-btn.active {
  background-color: var(--segmented-thumb);
  color: var(--label-primary);
  font-weight: 600;
  box-shadow: var(--segmented-thumb-shadow);
}

.macos-tab-btn .tab-icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.macos-tab-btn.active .tab-icon {
  color: var(--system-blue);
}

.toolbar-caption {
  font-size: 0.82rem;
  color: var(--label-secondary);
  line-height: 1.4;
  transition: opacity 0.2s ease;
}

/* Contenedor Principal de la Ventana */
.window-content {
  padding: 20px 22px 28px;
}

/* Paneles de Pestaña */
.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: tabFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-panel[hidden] {
  display: none !important;
}

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

/* ==========================================================================
   Tarjetas Estilo Apple Inset Grouped
   ========================================================================== */
.apple-card {
  background-color: var(--macos-card-bg);
  border: 1px solid var(--macos-card-border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-group h2, .card-title-group h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--label-primary);
  letter-spacing: -0.01em;
}

.card-icon {
  width: 17px;
  height: 17px;
  color: var(--system-blue);
}

.card-sublabel {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--label-tertiary);
  background-color: var(--macos-card-inset);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
}

/* ==========================================================================
   Formulario y Controles Nativos
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.full-width-group {
  grid-column: 1 / -1;
}

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

.field-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--label-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.param-symbol {
  font-family: var(--font-apple-mono);
  font-size: 0.8rem;
  color: var(--system-blue);
  font-weight: 600;
}

.apple-input, .apple-select {
  width: 100%;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--label-primary);
  background-color: var(--system-quaternary-fill);
  border: 1px solid var(--macos-card-border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  outline: none;
}

.apple-input:hover, .apple-select:hover {
  background-color: var(--system-tertiary-fill);
}

.apple-input:focus, .apple-select:focus {
  border-color: var(--system-blue);
  background-color: var(--system-background);
  box-shadow: 0 0 0 3.5px var(--system-blue-glow);
}

.apple-input.input-invalid, .apple-textarea.input-invalid {
  border-color: var(--system-red);
  background-color: var(--system-red-tint);
}

.apple-textarea {
  width: 100%;
  font-family: var(--font-apple-mono);
  font-size: 0.88rem;
  color: var(--label-primary);
  background-color: var(--system-quaternary-fill);
  border: 1px solid var(--macos-card-border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  outline: none;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.apple-textarea:hover {
  background-color: var(--system-tertiary-fill);
}

.apple-textarea:focus {
  border-color: var(--system-blue);
  background-color: var(--system-background);
  box-shadow: 0 0 0 3.5px var(--system-blue-glow);
}

/* Presets de Datos de Ejemplo */
.presets-section {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.presets-label {
  font-size: 0.78rem;
  color: var(--label-tertiary);
  font-weight: 500;
}

.presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background-color: var(--system-quaternary-fill);
  color: var(--label-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.preset-chip:hover {
  background-color: var(--system-tertiary-fill);
  color: var(--label-primary);
}

.preset-chip.active {
  background-color: var(--system-blue-tint);
  border-color: rgba(0, 122, 255, 0.35);
  color: var(--system-blue);
  font-weight: 600;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrapper .apple-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 12px;
  width: 14px;
  height: 14px;
  color: var(--label-tertiary);
  pointer-events: none;
}

.input-suffix-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-suffix-group .apple-input {
  padding-right: 42px;
}

.suffix-pill {
  position: absolute;
  right: 10px;
  font-family: var(--font-apple-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--label-tertiary);
  background: var(--macos-card-inset);
  padding: 2px 6px;
  border-radius: 6px;
  pointer-events: none;
}

.error-message {
  font-size: 0.75rem;
  color: var(--system-red);
  min-height: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ==========================================================================
   Segmented Control Estilo Apple
   ========================================================================== */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background-color: var(--segmented-bg);
  padding: 3px;
  border-radius: 11px;
  gap: 2px;
  user-select: none;
}

.segment-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 4px;
  border: none;
  background: transparent;
  color: var(--label-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  outline: none;
}

.segment-pct {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.1;
}

.segment-z {
  font-family: var(--font-apple-mono);
  font-size: 0.7rem;
  color: var(--label-tertiary);
  margin-top: 2px;
}

.segment-btn:hover:not(.active) {
  color: var(--label-primary);
}

.segment-btn.active {
  background-color: var(--segmented-thumb);
  color: var(--label-primary);
  box-shadow: var(--segmented-thumb-shadow);
}

.segment-btn.active .segment-z {
  color: var(--system-blue);
  font-weight: 600;
}

/* ==========================================================================
   Botones Estilo Apple
   ========================================================================== */
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.apple-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.25, 1, 0.5, 1);
  outline: none;
}

.apple-btn:active {
  transform: scale(0.98);
}

.apple-btn:focus-visible {
  box-shadow: 0 0 0 3.5px var(--system-blue-glow);
}

.btn-primary {
  background-color: var(--system-blue);
  color: #ffffff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.25);
}

.btn-primary:hover {
  background-color: var(--system-blue-hover);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.35);
}

.btn-primary:active {
  background-color: var(--system-blue-active);
}

.btn-secondary {
  background-color: var(--system-secondary-fill);
  color: var(--label-primary);
  border-color: transparent;
}

.btn-secondary:hover {
  background-color: var(--system-fill);
}

.btn-action-sm {
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 7px;
  background-color: var(--system-quaternary-fill);
  border: 1px solid var(--macos-card-border);
  color: var(--label-primary);
}

.btn-action-sm:hover {
  background-color: var(--system-blue-tint);
  border-color: var(--system-blue);
  color: var(--system-blue);
}

.btn-ghost-sm {
  font-size: 0.76rem;
  padding: 4px 9px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--label-tertiary);
}

.btn-ghost-sm:hover {
  background-color: var(--system-red-tint);
  color: var(--system-red);
}

.btn-icon {
  width: 15px;
  height: 15px;
}

.btn-sm-icon {
  width: 13px;
  height: 13px;
}

/* ==========================================================================
   Panel de Resultado (Hero Card con Colores Apple)
   ========================================================================== */
.result-card {
  border: 1px solid var(--system-blue-tint);
  position: relative;
  overflow: hidden;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.result-status-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--system-green);
  box-shadow: 0 0 8px var(--system-green);
}

.status-text {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--label-secondary);
}

.result-display {
  margin: 4px 0 16px;
}

.result-number-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.result-number {
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1;
  font-family: var(--font-apple-mono);
  color: var(--system-blue);
  letter-spacing: -0.03em;
}

.result-unit {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--label-secondary);
}

.result-summary {
  font-size: 0.88rem;
  color: var(--label-primary);
  line-height: 1.45;
  margin-top: 6px;
}

/* Inset Metric Pills */
.result-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--separator);
}

.metric-card {
  background-color: var(--macos-card-inset);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--label-tertiary);
  font-weight: 500;
}

.metric-value {
  font-family: var(--font-apple-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--label-primary);
}

/* ==========================================================================
   Desglose Matemático (macOS Inspector Style)
   ========================================================================== */
.apple-disclosure {
  display: flex;
  flex-direction: column;
}

.disclosure-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 2px 0;
}

.disclosure-header::-webkit-details-marker {
  display: none;
}

.disclosure-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.disclosure-chevron {
  width: 15px;
  height: 15px;
  color: var(--label-tertiary);
  transition: transform 0.22s cubic-bezier(0.25, 1, 0.5, 1);
}

.apple-disclosure[open] .disclosure-chevron {
  transform: rotate(90deg);
}

.disclosure-header h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--label-primary);
}

.disclosure-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--label-tertiary);
  background-color: var(--macos-card-inset);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
}

.disclosure-content {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--separator);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.formula-label {
  font-size: 0.8rem;
  color: var(--label-secondary);
}

.apple-code-box {
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-apple-mono);
  font-size: 0.82rem;
  color: var(--label-primary);
  overflow-x: auto;
}

.steps-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.apple-step-card {
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  border-radius: 10px;
  padding: 10px 14px;
}

.step-card-header {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--system-blue);
  margin-bottom: 4px;
}

.step-card-math {
  font-family: var(--font-apple-mono);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--label-primary);
  word-break: break-all;
}

/* ==========================================================================
   Tabla de Sensibilidad (macOS Numbers Style)
   ========================================================================== */
.table-description {
  font-size: 0.82rem;
  color: var(--label-secondary);
  margin: -6px 0 12px;
}

.apple-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--macos-card-border);
  border-radius: 12px;
  background-color: var(--macos-card-inset);
}

.apple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: right;
}

.apple-table th, .apple-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
}

.apple-table th {
  background-color: var(--system-quaternary-fill);
  color: var(--label-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
}

.th-z {
  font-family: var(--font-apple-mono);
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.75;
}

.apple-table th.th-margin,
.apple-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.apple-table td {
  font-family: var(--font-apple-mono);
  color: var(--label-primary);
}

.apple-table tbody tr:last-child td {
  border-bottom: none;
}

.apple-table tbody tr:hover td {
  background-color: var(--system-quaternary-fill);
}

.apple-table td.cell-active {
  background-color: var(--system-blue-tint);
  color: var(--system-blue);
  font-weight: 700;
}

/* ==========================================================================
   Fundamentación Teórica
   ========================================================================== */
.theory-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theory-item {
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  border-radius: 10px;
  padding: 12px 14px;
}

.theory-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.theory-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--system-blue);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
}

.theory-item h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--label-primary);
}

.theory-item p {
  font-size: 0.82rem;
  color: var(--label-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   Historial (Apple Notes / Reminders Style)
   ========================================================================== */
.apple-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.apple-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: var(--macos-card-inset);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-size: 0.82rem;
  transition: background-color 0.15s ease;
}

.apple-history-item:hover {
  background-color: var(--system-quaternary-fill);
}

.history-details {
  color: var(--label-secondary);
}

.history-details strong {
  color: var(--label-primary);
}

.history-time {
  font-size: 0.72rem;
  color: var(--label-tertiary);
  margin-left: 6px;
}

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

.history-badge {
  font-family: var(--font-apple-mono);
  font-weight: 700;
  color: var(--system-blue);
  background-color: var(--system-blue-tint);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
}

.btn-load {
  background-color: var(--system-secondary-fill);
  border: 1px solid transparent;
  color: var(--label-primary);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-load:hover {
  background-color: var(--system-blue);
  color: #ffffff;
}

.history-empty {
  color: var(--label-tertiary);
  font-size: 0.82rem;
  font-style: italic;
  text-align: center;
  padding: 12px 0;
}

/* ==========================================================================
   Pie de Ventana (Statusbar)
   ========================================================================== */
.window-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px;
  border-top: 1px solid var(--separator);
  background-color: var(--macos-card-inset);
  font-size: 0.72rem;
  color: var(--label-tertiary);
  user-select: none;
}

.statusbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--system-green);
}

/* ==========================================================================
   Dynamic Island / HUD Toast estilo Apple
   ========================================================================== */
.apple-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-70px) scale(0.92);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.apple-toast.toast-show {
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1;
}

.toast-inner {
  display: flex;
  align-items: center;
  gap: 9px;
  background-color: rgba(30, 30, 32, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--floating-shadow);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .toast-inner {
  background-color: rgba(245, 245, 247, 0.94);
  color: #000000;
  border-color: rgba(0, 0, 0, 0.12);
}

.toast-check-icon {
  width: 14px;
  height: 14px;
  color: var(--system-green);
}

/* ==========================================================================
   Módulo de Desviación Estándar (V0.4)
   ========================================================================== */

/* Comparativa Dual de Desviación Estándar */
.desv-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 14px;
}

.desv-card-item {
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--macos-card-border);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.desv-card-sample {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.07) 0%, rgba(0, 122, 255, 0.02) 100%);
  border-color: rgba(0, 122, 255, 0.20);
}

.desv-card-pop {
  background: linear-gradient(135deg, rgba(88, 86, 214, 0.07) 0%, rgba(88, 86, 214, 0.02) 100%);
  border-color: rgba(88, 86, 214, 0.20);
}

[data-theme="dark"] .desv-card-sample {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.14) 0%, rgba(10, 132, 255, 0.04) 100%);
  border-color: rgba(10, 132, 255, 0.28);
}

[data-theme="dark"] .desv-card-pop {
  background: linear-gradient(135deg, rgba(94, 92, 230, 0.14) 0%, rgba(94, 92, 230, 0.04) 100%);
  border-color: rgba(94, 92, 230, 0.28);
}

.desv-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.desv-badge-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: -0.01em;
}

.badge-sample {
  background-color: var(--system-blue-tint);
  color: var(--system-blue);
}

.badge-pop {
  background-color: rgba(88, 86, 214, 0.14);
  color: #5856d6;
}

[data-theme="dark"] .badge-pop {
  color: #5e5ce6;
}

.desv-formula-hint {
  font-size: 0.72rem;
  color: var(--label-tertiary);
  font-family: var(--font-apple-mono);
}

.desv-val-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 6px;
}

.desv-symbol {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--label-secondary);
}

.desv-number {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--label-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.desv-desc-text {
  font-size: 0.78rem;
  color: var(--label-secondary);
  line-height: 1.35;
  margin-bottom: 12px;
}

.desv-meta-pills {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: var(--macos-card-inset);
  padding: 8px 10px;
  border-radius: 8px;
}

.meta-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
}

.meta-pill-label {
  color: var(--label-secondary);
}

.meta-pill-val {
  font-weight: 600;
  color: var(--label-primary);
  font-family: var(--font-apple-mono);
  font-size: 0.78rem;
}

/* Tarjeta de Insight Bessel */
.bessel-insight-card {
  background-color: var(--system-quaternary-fill);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.bessel-insight-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--system-orange);
}

.bessel-icon {
  width: 15px;
  height: 15px;
}

.bessel-insight-header h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--label-primary);
}

.bessel-text {
  font-size: 0.78rem;
  color: var(--label-secondary);
  line-height: 1.45;
}

.bessel-highlight {
  font-weight: 700;
  color: var(--system-orange);
}

.bessel-text code {
  font-family: var(--font-apple-mono);
  background-color: var(--system-secondary-fill);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.76rem;
}

/* Gráficos Canvas */
.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-segmented {
  margin: 0;
}

.chart-controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 12px;
  background-color: var(--macos-card-inset);
  border-radius: 10px;
  margin: 10px 0;
}

.chart-mode-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-label {
  font-size: 0.76rem;
  color: var(--label-tertiary);
  font-weight: 500;
}

.chart-pill-btn {
  padding: 3px 10px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background-color: transparent;
  color: var(--label-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-pill-btn:hover {
  background-color: var(--system-quaternary-fill);
  color: var(--label-primary);
}

.chart-pill-btn.active {
  background-color: var(--segmented-thumb);
  color: var(--label-primary);
  font-weight: 600;
  box-shadow: var(--card-shadow);
  border-color: var(--macos-card-border);
}

.chart-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--label-secondary);
  cursor: pointer;
  user-select: none;
}

.apple-checkbox {
  accent-color: var(--system-blue);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.canvas-container {
  width: 100%;
  position: relative;
  background-color: var(--macos-card-inset);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.stat-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--label-secondary);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.swatch-mean {
  background-color: #ff3b30;
}

.swatch-sample {
  background-color: #007aff;
}

.swatch-pop {
  background-color: #5856d6;
}

.swatch-sigma1 {
  background-color: rgba(0, 122, 255, 0.25);
  border: 1px dashed #007aff;
}

/* Tabla de Desviaciones */
.desv-table-box {
  margin-top: 16px;
}

.desv-table-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.desv-table-header h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--label-primary);
}

.desv-table-subtitle {
  font-size: 0.74rem;
  color: var(--label-tertiary);
}

#tabla-desviaciones th.th-index {
  width: 44px;
  text-align: center;
}

#tabla-desviaciones td:first-child {
  text-align: center;
  color: var(--label-tertiary);
  font-family: var(--font-apple-mono);
}

#tabla-desviaciones tfoot tr {
  font-weight: 600;
  background-color: var(--system-secondary-fill);
  border-top: 1.5px solid var(--separator);
}

/* ==========================================================================
   Responsive Adaptations (iOS / iPadOS)
   ========================================================================== */
@media (max-width: 580px) {
  body {
    padding: 12px 8px;
  }

  .macos-window {
    border-radius: 16px;
  }

  .window-content {
    padding: 14px 14px 20px;
    gap: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .desv-dual-grid {
    grid-template-columns: 1fr;
  }

  .chart-controls-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-metrics-grid {
    grid-template-columns: 1fr;
  }

  .result-number {
    font-size: 2.5rem;
  }

  .desv-number {
    font-size: 2rem;
  }

  .window-statusbar {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  .interp-fields-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .interp-segmented-rounding {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   Módulo de Interpolación Lineal (V0.5 — macOS & iOS Style)
   ========================================================================== */
.interp-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.interp-point-card {
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.interp-point-card:focus-within {
  border-color: rgba(0, 122, 255, 0.38);
}

.interp-target-card {
  border-color: rgba(255, 149, 0, 0.28);
  background-color: rgba(255, 149, 0, 0.03);
}

[data-theme="dark"] .interp-target-card {
  border-color: rgba(255, 159, 10, 0.32);
  background-color: rgba(255, 159, 10, 0.05);
}

.interp-point-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.interp-point-badge {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--system-blue);
}

.interp-badge-target {
  color: var(--system-orange);
}

.interp-point-coords {
  font-family: var(--font-apple-mono);
  font-size: 0.78rem;
  color: var(--label-secondary);
}

.interp-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.interp-segmented-rounding {
  grid-template-columns: repeat(4, 1fr);
}

.apple-alert-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 500;
  margin-bottom: 14px;
  animation: appleShake 0.35s ease;
}

.apple-alert-box.error {
  background-color: var(--system-red-tint);
  border: 1px solid rgba(255, 59, 48, 0.3);
  color: var(--system-red);
}

.apple-alert-box .alert-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

@keyframes appleShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.status-dot-interp {
  background-color: var(--system-orange);
  box-shadow: 0 0 8px rgba(255, 149, 0, 0.45);
}

.plain-text-procedure-wrapper {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.procedure-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.procedure-box-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--label-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.plain-text-code {
  white-space: pre-wrap;
  font-family: var(--font-apple-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  border-radius: 8px;
  padding: 12px 14px;
  max-height: 250px;
  overflow-y: auto;
  color: var(--label-primary);
}

.swatch-p1 {
  background-color: var(--system-blue);
}

.swatch-target {
  background-color: var(--system-orange);
}

.swatch-p2 {
  background-color: var(--system-green);
}

/* ==========================================================================
   Módulo 4: Pruebas de Hipótesis (V1.0 — macOS & iOS Inferencia)
   ========================================================================== */

/* Subpestañas del Módulo de Hipótesis */
.hipo-nav-card {
  margin-bottom: 14px;
}

.hipo-subtabs-wrapper {
  margin-bottom: 12px;
}

.hipo-segmented-subtabs {
  display: flex;
  gap: 4px;
  background-color: var(--system-secondary-fill);
  padding: 4px;
  border-radius: 12px;
}

.hipo-segmented-subtabs .segment-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
}

.hipo-segmented-subtabs .segment-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--label-primary);
}

.hipo-segmented-subtabs .segment-subtitle {
  font-size: 0.71rem;
  color: var(--label-secondary);
}

.hipo-segmented-subtabs .segment-btn.active .segment-title {
  color: var(--system-blue);
}

/* Presets de Hipótesis */
.hipo-presets-section {
  border-top: 1px solid var(--separator);
  padding-top: 10px;
  margin-top: 4px;
}

/* Sección de Configuración de Criterio */
.hipo-config-section {
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
}

.hipo-section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.hipo-step-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: var(--system-blue-tint);
  color: var(--system-blue);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 122, 255, 0.2);
}

.hipo-section-title-row h3 {
  font-size: 0.90rem;
  font-weight: 600;
  color: var(--label-primary);
}

.hipo-config-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Control de Cola en Lenguaje Cotidiano */
.hipo-cola-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background-color: var(--segmented-bg);
  padding: 4px;
  border-radius: 12px;
}

.hipo-cola-control .segment-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 8px;
  border-radius: 8px;
  text-align: center;
}

.hipo-cola-control .segment-headline {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--label-primary);
}

.hipo-cola-control .segment-desc {
  font-size: 0.71rem;
  color: var(--label-secondary);
  line-height: 1.25;
}

.hipo-cola-control .segment-btn.active .segment-headline {
  color: var(--system-blue);
}

/* Controles Enlazados de Confianza y Significancia */
.field-label-split {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.field-hint-linked {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--system-blue);
}

.hipo-linked-alpha-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.prefix-pill {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--label-secondary);
  padding: 0 10px;
  background-color: var(--system-secondary-fill);
  display: flex;
  align-items: center;
  border-radius: 8px 0 0 8px;
  border: 1px solid var(--macos-card-border);
  border-right: none;
  white-space: nowrap;
}

.hipo-linked-alpha-row .input-suffix-group .apple-input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Callouts Informativos Inteligentes */
.apple-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  background-color: var(--system-blue-tint);
  border: 1px solid rgba(0, 122, 255, 0.22);
  transition: all 0.2s ease;
}

.callout-icon-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.callout-icon {
  width: 18px;
  height: 18px;
  color: var(--system-blue);
  stroke-width: 2.2;
}

.callout-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.callout-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--label-primary);
}

.callout-text {
  font-size: 0.79rem;
  color: var(--label-secondary);
  line-height: 1.4;
}

/* Tarjeta de Complemento de Proporciones */
.hipo-complemento-card {
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ios-switch-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.switch-text-label {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--label-primary);
}

.custom-switch-slider {
  position: relative;
  width: 44px;
  height: 26px;
  background-color: var(--system-fill);
  border-radius: 20px;
  transition: background-color 0.25s ease;
  flex-shrink: 0;
}

.custom-switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

input:checked + .custom-switch-slider {
  background-color: var(--system-green);
}

input:checked + .custom-switch-slider::after {
  transform: translateX(18px);
}

.complemento-feedback {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.77rem;
  color: var(--label-secondary);
  line-height: 1.35;
}

.comp-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--system-blue);
}

/* Tarjetas de A/B Testing (Dos Medias) */
.hipo-two-groups-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 10px;
}

.hipo-group-card {
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.group-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
}

.group-badge-a {
  background-color: var(--system-blue-tint);
  color: var(--system-blue);
  border: 1px solid rgba(0, 122, 255, 0.2);
}

.group-badge-b {
  background-color: rgba(175, 82, 222, 0.15);
  color: #af52de;
  border: 1px solid rgba(175, 82, 222, 0.25);
}

.group-sub {
  font-size: 0.72rem;
  color: var(--label-tertiary);
}

/* ==========================================================================
   Panel de Resultados de Hipótesis (Dictamen Ejecutivo y Métricas)
   ========================================================================== */
.hipo-result-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-dot-hipo {
  background-color: var(--system-blue);
  box-shadow: 0 0 8px rgba(0, 122, 255, 0.45);
}

/* Gran Dictamen Ejecutivo */
.hipo-verdict-banner {
  border-radius: 14px;
  padding: 16px;
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
}

.verdict-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.verdict-pill-badge {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.verdict-pill-badge.reject {
  background-color: var(--system-red);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--system-red-tint);
}

.verdict-pill-badge.accept {
  background-color: var(--system-green);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(52, 199, 89, 0.3);
}

.verdict-significance-tag {
  font-size: 0.80rem;
  font-weight: 500;
  color: var(--label-secondary);
}

.verdict-statements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.verdict-statement-box {
  background-color: var(--macos-card-bg);
  border: 1px solid var(--macos-card-border);
  border-radius: 10px;
  padding: 12px 14px;
}

.statement-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.statement-icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.technical-box .statement-icon {
  color: var(--system-blue);
}

.business-box .statement-icon {
  color: var(--system-orange);
}

.statement-header h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--label-primary);
}

.statement-text {
  font-size: 0.81rem;
  color: var(--label-secondary);
  line-height: 1.45;
}

/* Cuadrícula de Métricas Clave de Decisión */
.hipo-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.status-highlight-val {
  font-weight: 700 !important;
}

.status-highlight-val.reject {
  color: var(--system-red) !important;
}

.status-highlight-val.accept {
  color: var(--system-green) !important;
}

/* Gráfico de la Campana Dinámica */
.hipo-chart-container {
  border-radius: 14px;
  padding: 14px 16px;
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
}

.hipo-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chart-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-title-icon {
  width: 16px;
  height: 16px;
  color: var(--system-blue);
}

.chart-title-group h3 {
  font-size: 0.90rem;
  font-weight: 600;
  color: var(--label-primary);
}

.chart-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background-color: var(--system-secondary-fill);
  color: var(--label-secondary);
}

#canvas-hipotesis {
  width: 100%;
  height: 340px;
  display: block;
  border-radius: 8px;
}

.hipo-chart-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.swatch-acceptance {
  background-color: var(--system-blue);
}

.swatch-rejection {
  background-color: var(--system-red);
}

.swatch-calculated {
  background-color: var(--system-orange);
}

/* Lista de Pasos Inferenciales */
.hipo-steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.hipo-step-card {
  background-color: var(--macos-card-inset);
  border: 1px solid var(--macos-card-border);
  border-radius: 10px;
  padding: 12px 14px;
}

.hipo-step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.step-num-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--system-blue);
  color: #ffffff;
  font-size: 0.73rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hipo-step-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--label-primary);
}

.hipo-step-body {
  font-size: 0.81rem;
  color: var(--label-secondary);
  line-height: 1.45;
}

.math-eq-callout {
  font-family: var(--font-apple-mono);
  font-size: 0.81rem;
  background-color: var(--system-fill);
  padding: 7px 11px;
  border-radius: 6px;
  margin-top: 6px;
  color: var(--label-primary);
  line-height: 1.4;
  overflow-x: auto;
}

/* Responsive queries para Hipótesis */
@media (max-width: 680px) {
  .macos-tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }

  .macos-tabs-bar::-webkit-scrollbar {
    display: none;
  }

  .macos-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 7px 11px;
    font-size: 0.81rem;
  }

  .hipo-segmented-subtabs {
    flex-direction: column;
  }

  .hipo-cola-control {
    grid-template-columns: 1fr;
  }

  .hipo-linked-alpha-row {
    grid-template-columns: 1fr;
  }

  .hipo-two-groups-grid {
    grid-template-columns: 1fr;
  }

  .verdict-statements-grid {
    grid-template-columns: 1fr;
  }

  .hipo-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #canvas-hipotesis {
    height: 280px;
  }
}


/* Derechos de autor (V1.1) */
.copyright-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--label-secondary, #8e8e93);
  padding: 12px 16px 16px;
  margin: 0;
}
