/* Cristal claro tipo Apple (Liquid Glass): el cristal solo en controles y paneles; el contenido, nítido. */
:root {
  --accent: #0071e3;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --ink: #1d1d1f;
  --ink-2: #515154;
  --ink-3: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --ok: #1f8a3b;
  --ok-soft: rgba(52, 199, 89, 0.14);
  --warn: #b25000;
  --warn-soft: rgba(255, 159, 10, 0.16);
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 8px 28px rgba(28, 42, 74, 0.09);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #eef1f6;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
}
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* Fondo: una pista de pádel desenfocada para que el cristal tenga algo que refractar */
.fondo { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.fondo::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(40% 50% at 18% 22%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(36% 42% at 82% 18%, rgba(110, 170, 255, 0.40), transparent 70%),
    radial-gradient(42% 46% at 72% 86%, rgba(40, 100, 230, 0.20), transparent 72%),
    radial-gradient(38% 40% at 12% 88%, rgba(255, 255, 255, 0.9), transparent 70%);
  filter: blur(30px);
}
.fondo svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.35; filter: blur(2px); }

.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-radius: var(--r-lg);
}
.glass::before { /* brillo especular del borde superior */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 38%);
  mix-blend-mode: soft-light;
}
@media (prefers-reduced-transparency: reduce) {
  .glass { background: #fbfbfd; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform 160ms var(--ease), background-color 200ms ease, opacity 200ms ease, box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-primario { background: var(--accent); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primario:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-cristal { background: rgba(255, 255, 255, 0.65); border: 1px solid var(--glass-edge); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.btn-cristal:hover:not(:disabled) { background: rgba(255, 255, 255, 0.9); }
.btn-ok { background: var(--ok); color: #fff; }
.btn svg { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Control segmentado tipo iOS */
.seg {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: relative;
  padding: 3px; border-radius: 11px; background: rgba(118, 118, 128, 0.12);
}
.seg button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer; padding: 6px 12px;
  border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); min-height: 32px;
  transition: color 200ms ease;
}
.seg button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.seg .pastilla {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; border-radius: 8px; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.04);
  transition: transform 260ms var(--ease), width 260ms var(--ease);
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.6); cursor: pointer;
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--ink-2);
  min-height: 32px; transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 160ms var(--ease);
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Interruptor iOS */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: rgba(120, 120, 128, 0.18);
  transition: background-color 220ms ease;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.06);
  transition: transform 260ms var(--ease);
}
.switch input:checked + span { background: #34c759; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Etiquetas de estado */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-abierto { background: var(--accent-soft); color: var(--accent); }
.pill-prog { background: var(--warn-soft); color: var(--warn); }
.pill-gris { background: rgba(118, 118, 128, 0.12); color: var(--ink-2); }
.punto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.punto.vivo { animation: latido 1.6s ease-in-out infinite; }
@keyframes latido { 50% { opacity: 0.35; } }

/* Modal propio (nada de alert/prompt/confirm) */
.velo {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: rgba(20, 24, 33, 0.28); opacity: 0; pointer-events: none; transition: opacity 200ms ease;
}
.velo.abierto { opacity: 1; pointer-events: auto; }
.velo > .glass {
  background: var(--glass-strong); max-width: 440px; width: 100%; padding: 24px;
  transform: scale(0.96); opacity: 0; transition: transform 260ms var(--ease), opacity 200ms ease;
}
.velo.abierto > .glass { transform: none; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation: none !important; }
}
