/* =========================================================================
   ui.css — sistema de diseño de xhanni / Allmighty
   Base común de todas las páginas. Apariencia clara por defecto y oscura
   cuando el sistema lo pide (prefers-color-scheme). Sin degradados en el
   texto, sin brillos: color, tipografía y espacio hacen la jerarquía.
   Contrastes (texto normal >= 4.5:1):
     claro  #1d1d1f / #f5f5f7 16.4:1 · #6e6e73 / #fff 5.1:1 · #0066cc / #fff 5.6:1
     oscuro #f5f5f7 / #000 19.3:1 · #a1a1a6 / #1c1c1e 6.9:1 · #2997ff / #1c1c1e 5.9:1
     botón  #fff / #0071e3 4.6:1 (en ambos modos)
   ========================================================================= */

:root {
  color-scheme: light dark;

  /* superficies */
  --bg: #f5f5f7;
  --bg-alt: #ffffff;
  --card: #ffffff;
  --card-2: #f5f5f7;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-hover: rgba(120, 120, 128, 0.2);
  --sep: rgba(60, 60, 67, 0.16);
  --sep-strong: rgba(60, 60, 67, 0.28);
  --material: rgba(251, 251, 253, 0.8);
  --scrim: rgba(0, 0, 0, 0.32);

  /* texto */
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #86868b;
  --link: #0066cc;

  /* acento y estados */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-press: #006edb;
  --on-accent: #ffffff;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --green: #1d8a3a;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #b54d00;
  --orange-soft: rgba(255, 149, 0, 0.16);
  --red: #d70015;
  --red-soft: rgba(255, 59, 48, 0.12);
  --purple: #8944ab;
  --purple-soft: rgba(175, 82, 222, 0.12);

  /* sombras: solo para separar capas flotantes */
  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.02), 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.05);

  /* forma */
  --r-xs: 6px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --pill: 980px;

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

  /* medidas */
  --nav-h: 52px;
  --page: 1080px;
  --page-wide: 1240px;
  --gutter: clamp(16px, 4vw, 32px);

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #0b0b0c;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-hover: rgba(118, 118, 128, 0.36);
    --sep: rgba(84, 84, 88, 0.55);
    --sep-strong: rgba(84, 84, 88, 0.8);
    --material: rgba(22, 22, 23, 0.78);
    --scrim: rgba(0, 0, 0, 0.6);

    --label: #f5f5f7;
    --label-2: #a1a1a6;
    --label-3: #8e8e93;
    --link: #2997ff;

    --accent-soft: rgba(41, 151, 255, 0.16);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.16);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.16);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, 0.16);
    --purple: #bf5af2;
    --purple-soft: rgba(191, 90, 242, 0.16);

    --shadow-card: none;
    --shadow-float: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
}
  :root[data-theme="dark"] {
    --bg: #000000;
    --bg-alt: #0b0b0c;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-hover: rgba(118, 118, 128, 0.36);
    --sep: rgba(84, 84, 88, 0.55);
    --sep-strong: rgba(84, 84, 88, 0.8);
    --material: rgba(22, 22, 23, 0.78);
    --scrim: rgba(0, 0, 0, 0.6);

    --label: #f5f5f7;
    --label-2: #a1a1a6;
    --label-3: #8e8e93;
    --link: #2997ff;

    --accent-soft: rgba(41, 151, 255, 0.16);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.16);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.16);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, 0.16);
    --purple: #bf5af2;
    --purple-soft: rgba(191, 90, 242, 0.16);

    --shadow-card: none;
    --shadow-float: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }


@media (prefers-contrast: more) {
  :root:not([data-theme="dark"]) {
    --label-2: #3a3a3c;
    --sep: rgba(60, 60, 67, 0.4);
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --label-2: #d1d1d6;
    --sep: rgba(255, 255, 255, 0.35);
  }
}
@media (prefers-contrast: more) {
  :root[data-theme="dark"] {
    --label-2: #d1d1d6;
    --sep: rgba(255, 255, 255, 0.35);
  }
}

/* ------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 1.0625rem; /* 17px */
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.18em; }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

code, kbd, samp, .mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }

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

/* ------------------------------------------------------------- tipo */

.t-hero {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.t-large {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3.5rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.t-title1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.125rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.026em;
}
.t-title2 { font-size: 1.375rem; line-height: 1.25; font-weight: 650; letter-spacing: -0.022em; }
.t-title3 { font-size: 1.1875rem; line-height: 1.3; font-weight: 600; letter-spacing: -0.02em; }
.t-headline { font-size: 1.0625rem; font-weight: 600; }
.t-lead {
  font-size: clamp(1.125rem, 1.9vw, 1.3125rem);
  line-height: 1.42;
  color: var(--label-2);
  letter-spacing: -0.016em;
}
.t-sub { font-size: 0.9375rem; color: var(--label-2); line-height: 1.45; letter-spacing: -0.01em; }
.t-caption { font-size: 0.8125rem; color: var(--label-2); line-height: 1.4; letter-spacing: -0.006em; }
.t-eyebrow { font-size: 0.9375rem; font-weight: 600; color: var(--label-2); letter-spacing: -0.01em; }
.t-num { font-variant-numeric: tabular-nums; }
.muted { color: var(--label-2); }

/* ------------------------------------------------------------- botones
   Pill de Apple: 44px de alto en táctil, 36px en controles compactos.   */

.btn {
  --_bg: var(--fill);
  --_fg: var(--label);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--pill);
  background: var(--_bg);
  color: var(--_fg);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.016em;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease), opacity 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--fill-hover); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; transform: none; }

.btn-primary { --_bg: var(--accent); --_fg: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }

.btn-tinted { --_bg: var(--accent-soft); --_fg: var(--link); }
.btn-tinted:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.btn-plain { --_bg: transparent; --_fg: var(--link); padding-inline: 4px; }
.btn-plain:hover { background: transparent; text-decoration: underline; text-underline-offset: 0.18em; }

.btn-danger { --_bg: var(--red-soft); --_fg: var(--red); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 22%, transparent); }

.btn-sm { min-height: 32px; padding: 0 14px; font-size: 0.875rem; }
.btn-lg { min-height: 52px; padding: 0 30px; font-size: 1.125rem; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }

.link-arrow { font-weight: 500; white-space: nowrap; }
.link-arrow::after { content: " ›"; }

/* ------------------------------------------------------------- campos */

.field { display: grid; gap: 6px; }
.field > label, .label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--label-2);
  letter-spacing: -0.006em;
}

.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
.field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--sep-strong);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--label);
  font-size: 1.0625rem;
  line-height: 1.3;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.field textarea, textarea.input { min-height: 96px; resize: vertical; }
.field select, select.input {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--label-3); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field input[readonly] { background: var(--card-2); color: var(--label-2); }
.field-hint { font-size: 0.8125rem; color: var(--label-2); }

/* ------------------------------------------------------------- superficies */

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: clamp(20px, 3vw, 28px); }

/* lista agrupada estilo Ajustes */
.group {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.group > * + * { border-top: 1px solid var(--sep); }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 16px;
}
.row > :first-child { flex: 1; min-width: 0; }
.group-title {
  margin: 0 0 8px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--label-2);
}

/* ------------------------------------------------------------- insignias */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: var(--pill);
  background: var(--fill);
  color: var(--label-2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.004em;
  white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--accent-soft); color: var(--link); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ------------------------------------------------------------- control segmentado */

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--fill);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented > * {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--label);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
.segmented > *:hover { text-decoration: none; background: var(--fill); }
.segmented > .is-active, .segmented > [aria-selected="true"], .segmented > .active {
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .segmented > .is-active, :root:not([data-theme="light"]) .segmented > [aria-selected="true"], :root:not([data-theme="light"]) .segmented > .active { background: #636366; }
}
  :root[data-theme="dark"] .segmented > .is-active, :root[data-theme="dark"] .segmented > [aria-selected="true"], :root[data-theme="dark"] .segmented > .active { background: #636366; }


/* ------------------------------------------------------------- interruptor */

.switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: var(--pill);
  background: var(--fill-hover);
  transition: background 0.2s var(--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.16);
  transition: transform 0.25s var(--spring);
}
.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) 60%, transparent); outline-offset: 2px; }

/* ------------------------------------------------------------- barra global
   Material translúcido, como la barra de apple.com.                     */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--sep);
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
  max-width: var(--page-wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--label);
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.wordmark:hover { text-decoration: none; }
.wordmark small {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--label-2);
  padding: 2px 7px;
  border-radius: var(--pill);
  background: var(--fill);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
}
.nav-links a {
  padding: 6px 12px;
  border-radius: var(--pill);
  color: var(--label);
  font-size: 0.875rem;
  opacity: 0.8;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
}
.nav-links a:hover { opacity: 1; text-decoration: none; }
.nav-links a.is-active, .nav-links a[aria-current="page"] { opacity: 1; font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-links + .nav-actions { margin-left: 0; }

.nav-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--label);
}
.nav-icon-btn:hover { background: var(--fill); }
.nav-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  letter-spacing: 0;
}
.nav-badge:empty, .nav-badge[data-zero="true"] { display: none; }

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--label);
}
.nav-toggle span { display: block; width: 16px; height: 1.5px; margin: 4px auto; background: currentColor; border-radius: 2px; transition: transform 0.25s var(--ease), opacity 0.2s; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-block; order: 3; }
  .nav-links + .nav-actions { margin-left: auto; }
  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px var(--gutter) 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--sep);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), transform 0.25s var(--ease), visibility 0s 0.25s;
  }
  .nav-links.is-open { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
  .nav-links a {
    padding: 14px 4px;
    border-radius: 0;
    border-bottom: 1px solid var(--sep);
    font-size: 1.0625rem;
    opacity: 1;
  }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(5.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-5.5px) rotate(-45deg); }
}

/* ------------------------------------------------------------- hoja / diálogo */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  visibility: hidden;
  pointer-events: none;
}
.sheet.is-open { visibility: visible; pointer-events: auto; }
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.sheet.is-open .sheet-scrim { opacity: 1; }
.sheet-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(860px, calc(100dvh - 32px));
  overflow: auto;
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  transition: transform 0.35s var(--spring), opacity 0.2s var(--ease);
}
.sheet.is-open .sheet-panel { transform: none; opacity: 1; }
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--sep);
}
.sheet-head > :first-child { flex: 1; min-width: 0; }
.sheet-body { padding: 20px; }
.close-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--label-2);
}
.close-btn:hover { background: var(--fill-hover); color: var(--label); }
@media (max-width: 640px) {
  .sheet { place-items: end stretch; padding: 0; }
  .sheet-panel {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(40px);
  }
}

/* ------------------------------------------------------------- aviso flotante */

.toast-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(520px, calc(100% - 32px));
  padding: 12px 12px 12px 18px;
  border-radius: var(--r);
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
  font-size: 0.875rem;
  color: var(--label-2);
}
.toast-bar > :first-child { flex: 1; }
.toast-bar strong { color: var(--label); }
.toast-bar.is-hidden { display: none; }

/* ------------------------------------------------------------- pie */

.footer {
  border-top: 1px solid var(--sep);
  background: var(--bg);
  color: var(--label-2);
  font-size: 0.8125rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr));
  gap: 32px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 40px var(--gutter) 28px;
}
.footer h3 { margin-bottom: 10px; font-size: 0.8125rem; font-weight: 600; color: var(--label); }
.footer a { display: block; padding: 3px 0; color: var(--label-2); }
.footer a:hover { color: var(--label); }
.footer-brand p { max-width: 34ch; margin-top: 8px; }
.footer-social { display: flex; gap: 6px; margin-top: 14px; }
.footer-social a {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--label);
}
.footer-social svg { width: 16px; height: 16px; }
.footer-legal {
  max-width: var(--page);
  margin: 0 auto;
  padding: 16px var(--gutter) 32px;
  border-top: 1px solid var(--sep);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------- movimiento */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .navbar, .toast-bar { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* =========================================================================
   Menús desplegables y selector de color propios (assets/js/controls.js).
   El <select> / <input type="color"> original queda escondido dentro de
   .xs / .xc y sigue siendo el que guarda el valor.
   ========================================================================= */

.xs, .xc { position: relative; display: inline-flex; min-width: 0; vertical-align: middle; }
.xs[hidden] { display: none; }
.xs-native {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.xs-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px 0 14px;
  border: 1px solid var(--sep-strong);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--label);
  font-size: 1.0625rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s var(--ease);
}
.xs-trigger:hover:not(:disabled) { background: color-mix(in srgb, var(--card) 94%, var(--label)); }
.xs-trigger:focus-visible, .xs.is-open .xs-trigger,
.xc-trigger:focus-visible, .xc.is-open .xc-trigger {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.xs-trigger:disabled, .xc-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
.xs-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xs-trigger.is-placeholder .xs-value { color: var(--label-3); }
.xs-chevron { flex: none; width: 14px; height: 14px; color: var(--label-3); }

/* tamaños según dónde vive */
.field .xs, .form-group .xs, .role-picker .xs, .dash-switch .xs { display: flex; width: 100%; }
.form-group .xs-trigger { min-height: 40px; padding-left: 12px; font-size: 0.9375rem; }
.dash-switch .xs-trigger { min-height: 36px; font-size: 0.9375rem; }
.set-row .xs { width: min(260px, 48%); flex: none; }
.set-row .xs-trigger { min-height: 34px; padding: 0 8px 0 10px; border-radius: 8px; font-size: 0.875rem; }
@media (max-width: 560px) { .set-row .xs { width: 100%; } }

/* menú flotante */
.xs-menu {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 5px;
  border: 1px solid var(--sep);
  border-radius: 12px;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow-float);
  color: var(--label);
  font-size: 0.875rem;
  transform-origin: top center;
  animation: xs-in 0.16s var(--spring);
}
.xs-menu.is-up { transform-origin: bottom center; animation-name: xs-in-up; }
.xs-menu.is-closing { animation: xs-out 0.1s var(--ease) forwards; pointer-events: none; }
@keyframes xs-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }
@keyframes xs-in-up { from { opacity: 0; transform: scale(0.97) translateY(4px); } }
@keyframes xs-out { to { opacity: 0; transform: scale(0.98); } }

.xs-search-wrap { position: relative; flex: none; padding: 3px 3px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--sep); }
.xs-search-wrap::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 12px;
  width: 13px;
  height: 13px;
  background: var(--label-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 1.5a5.5 5.5 0 0 1 4.38 8.83l3.4 3.4-1.06 1.06-3.4-3.4A5.5 5.5 0 1 1 7 1.5Zm0 1.5a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 1.5a5.5 5.5 0 0 1 4.38 8.83l3.4 3.4-1.06 1.06-3.4-3.4A5.5 5.5 0 1 1 7 1.5Zm0 1.5a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.xs-search {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 30px;
  border: 0;
  border-radius: 8px;
  background: var(--fill);
  color: var(--label);
  font-size: 0.875rem;
  -webkit-appearance: none;
  appearance: none;
}
.xs-search::placeholder { color: var(--label-3); }
.xs-search:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }
.xs-search::-webkit-search-cancel-button { display: none; }

.xs-list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; outline: none; scrollbar-width: thin; }
.xs-option {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 4px 10px 4px 6px;
  border-radius: 7px;
  cursor: default;
  user-select: none;
}
.xs-option[hidden] { display: none; }
.xs-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xs-check { flex: none; width: 16px; height: 16px; margin-right: 2px; visibility: hidden; }
.xs-option[aria-selected="true"] .xs-check { visibility: visible; }
.xs-hash { flex: none; width: 12px; color: var(--label-3); font-weight: 600; }
.xs-value .xs-hash { margin-right: 3px; }
.xs-option.is-placeholder .xs-text { color: var(--label-2); }
.xs-option.is-active { background: var(--accent); color: var(--on-accent); }
.xs-option.is-active .xs-text, .xs-option.is-active .xs-hash { color: inherit; }
.xs-option.is-active .xs-hash { opacity: 0.75; }
.xs-option[aria-disabled="true"] { opacity: 0.4; }
.xs-group { padding: 8px 10px 3px 28px; color: var(--label-2); font-size: 0.75rem; font-weight: 600; }
.xs-group[hidden], .xs-empty[hidden] { display: none; }
.xs-empty { padding: 12px 10px; color: var(--label-2); text-align: center; }

@media (pointer: coarse) {
  .xs-option { min-height: 42px; font-size: 0.9375rem; }
  .xs-search { height: 38px; font-size: 1rem; }
}

/* selector de color */
.xc-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px 0 5px;
  border: 1px solid var(--sep-strong);
  border-radius: var(--pill);
  background: var(--card);
  color: var(--label);
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.xc-dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }

.xc-pop { gap: 14px; padding: 14px; }
.xc-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.xc-swatch {
  aspect-ratio: 1;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.15s var(--spring);
}
.xc-swatch:hover { transform: scale(1.08); }
.xc-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.xc-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--swatch); }
.xc-custom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--sep); color: var(--label-2); font-size: 0.8125rem; }
.xc-field { display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 0 8px 0 5px; border-radius: 8px; background: var(--fill); font-family: var(--mono); }
.xc-field.is-invalid { box-shadow: 0 0 0 2px var(--red); }
.xc-preview { width: 20px; height: 20px; margin-right: 6px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.xc-prefix { color: var(--label-3); }
.xc-field input { width: 7ch; padding: 0; border: 0; background: transparent; color: var(--label); font: inherit; font-size: 0.8125rem; text-transform: uppercase; }
.xc-field input:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .xs-menu, .xs-menu.is-up, .xs-menu.is-closing { animation: none; }
  .xc-swatch { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .xs-menu { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ------------------------------------------------------------- tema e idioma (prefs.js) */

.xh-i18n-pending body { visibility: hidden; }
.xh-prefs { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.xh-prefs + .nav-actions, .navbar-inner .xh-prefs + .nav-end { margin-left: 0; }
.nav-links + .xh-prefs { margin-left: 0; }
.xh-pref {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--label);
  font: 600 0.8125rem/1 var(--font);
  letter-spacing: 0.02em;
  cursor: pointer;
}
.xh-pref:hover { background: var(--fill); }
.xh-pref:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.console-side-foot .xh-prefs { margin: 0 0 8px; }
.xh-legal-note { margin: 0 0 20px; padding: 12px 16px; border-radius: var(--r); background: var(--accent-soft); color: var(--label); font-size: 0.9375rem; }
@media (max-width: 760px) {
  .nav-links + .xh-prefs { margin-left: auto; }
  .xh-prefs { gap: 0; }
  .xh-pref { min-width: 32px; padding: 0 6px; }
}

/* ------------------------------------------------------------- barra en isla (páginas públicas)
   La barra flota como una píldora de vidrio. Al bajar se compacta (.is-compact) y un resaltado
   se desliza entre los enlaces (.island-glow). Lo maneja prefs.js. Clase "island" en el <header>. */

:root {
  --island-bg: rgba(255, 255, 255, 0.72);
  --island-menu: rgba(255, 255, 255, 0.94);
  --island-line: rgba(0, 0, 0, 0.08);
  --island-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.18), 0 2px 6px -2px rgba(0, 0, 0, 0.06);
  --island-shadow-up: 0 18px 44px -14px rgba(0, 0, 0, 0.26), 0 2px 8px -2px rgba(0, 0, 0, 0.08);
  --island-spring: cubic-bezier(0.34, 1.36, 0.64, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --island-bg: rgba(30, 30, 32, 0.68);
    --island-menu: rgba(30, 30, 32, 0.95);
    --island-line: rgba(255, 255, 255, 0.1);
    --island-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7), 0 0 0 0.5px rgba(255, 255, 255, 0.04);
    --island-shadow-up: 0 18px 44px -14px rgba(0, 0, 0, 0.85), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
  }
}
:root[data-theme="dark"] {
  --island-bg: rgba(30, 30, 32, 0.68);
  --island-menu: rgba(30, 30, 32, 0.95);
  --island-line: rgba(255, 255, 255, 0.1);
  --island-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7), 0 0 0 0.5px rgba(255, 255, 255, 0.04);
  --island-shadow-up: 0 18px 44px -14px rgba(0, 0, 0, 0.85), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
}

html:has(.navbar.island) { scroll-padding-top: calc(var(--nav-h) + 40px); }
@media (prefers-reduced-motion: no-preference) { html:has(.navbar.island) { scroll-behavior: smooth; } }
.navbar.island {
  top: 12px;
  width: min(1040px, calc(100% - 24px));
  height: 56px;
  margin: 12px auto 0;
  border: 0;
  border-radius: 999px;
  background: var(--island-bg);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: inset 0 0 0 1px var(--island-line), var(--island-shadow);
  transition: width 0.42s var(--island-spring), height 0.32s var(--island-spring), top 0.32s var(--island-spring), box-shadow 0.3s var(--ease);
}
.navbar.island.is-compact { top: 10px; width: min(820px, calc(100% - 24px)); height: 50px; box-shadow: inset 0 0 0 1px var(--island-line), var(--island-shadow-up); }
.navbar.island .navbar-inner { max-width: none; gap: 14px; padding: 0 8px 0 22px; }
.navbar.island .nav-links { position: relative; isolation: isolate; }
.navbar.island .nav-links a { position: relative; transition: opacity 0.2s, color 0.2s; }
.navbar.island .nav-links a:hover { background: transparent; }
.island-glow {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: -1;
  height: 32px;
  width: 0;
  margin-top: -16px;
  border-radius: 999px;
  background: var(--fill);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s var(--island-spring), width 0.32s var(--island-spring), opacity 0.18s var(--ease);
}
.island-glow.is-on { opacity: 1; }
.navbar.island .btn { transition: transform 0.4s var(--island-spring), background 0.2s, box-shadow 0.2s; }
.navbar.island .btn:active, .navbar.island .xh-pref:active, .navbar.island .nav-icon-btn:active { transform: scale(0.94); }

@media (max-width: 760px) {
  .navbar.island { width: calc(100% - 16px); height: 52px; top: 8px; margin-top: 8px; }
  .navbar.island.is-compact { width: calc(100% - 16px); height: 52px; top: 8px; }
  .navbar.island .navbar-inner { padding: 0 6px 0 18px; gap: 8px; }
  .navbar.island .nav-links {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    gap: 2px;
    padding: 8px;
    border: 0;
    border-radius: 28px;
    background: var(--island-menu);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
    box-shadow: inset 0 0 0 1px var(--island-line), var(--island-shadow-up);
    transform-origin: 50% 0;
    transform: translateY(-10px) scale(0.94);
    transition: opacity 0.2s var(--ease), transform 0.5s var(--island-spring), visibility 0s 0.25s;
  }
  .navbar.island .nav-links.is-open { transform: none; transition-delay: 0s; }
  .navbar.island .nav-links a { padding: 14px 16px; border: 0; border-radius: 20px; font-size: 1.0625rem; }
  .navbar.island .nav-links a:hover, .navbar.island .nav-links a:active { background: var(--fill); }
  .island-glow { display: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .navbar.island, .navbar.island .nav-links { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .navbar.island, .island-glow, .navbar.island .nav-links { transition: none; }
}

/* ------------------------------------------------------------- islas en el panel, la cuenta y la consola
   Las barras laterales del panel (.client-tab-nav, en panel.css) y de la consola (.console-side, en
   console.css) flotan como islas de vidrio. Un resaltado (.side-glow, lo pone prefs.js) se desliza a la
   sección activa. Las pestañas entran con un fundido corto y sus tarjetas en cascada; las páginas con
   .xh-enter (acceso, cuenta) igual. Con "reducir movimiento" no se anima. */

.has-side-glow { position: relative; isolation: isolate; }
.side-glow {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 0;
  height: 0;
  border-radius: 10px;
  background: var(--accent);
  box-shadow: 0 6px 16px -6px rgba(0, 113, 227, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.38s var(--island-spring), width 0.38s var(--island-spring), height 0.38s var(--island-spring), opacity 0.2s var(--ease);
}
.side-glow.is-on { opacity: 1; }
.navbar.island .notification-popover { top: calc(100% + 10px); right: 8px; }

@media (prefers-reduced-motion: no-preference) {
  .owner-tab-panel.is-active > *, .client-tab-panel.is-active > *, .xh-enter > *, .xh-enter .auth-box > * {
    animation: xh-item-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .owner-tab-panel.is-active > :nth-child(2), .client-tab-panel.is-active > :nth-child(2), .xh-enter > :nth-child(2), .xh-enter .auth-box > :nth-child(2) { animation-delay: 0.05s; }
  .owner-tab-panel.is-active > :nth-child(3), .client-tab-panel.is-active > :nth-child(3), .xh-enter > :nth-child(3), .xh-enter .auth-box > :nth-child(3) { animation-delay: 0.1s; }
  .owner-tab-panel.is-active > :nth-child(4), .client-tab-panel.is-active > :nth-child(4), .xh-enter > :nth-child(4), .xh-enter .auth-box > :nth-child(4) { animation-delay: 0.15s; }
  .owner-tab-panel.is-active > :nth-child(n+5), .client-tab-panel.is-active > :nth-child(n+5), .xh-enter > :nth-child(n+5), .xh-enter .auth-box > :nth-child(n+5) { animation-delay: 0.2s; }
  .xh-enter .auth-mark { animation: xh-mark-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
  .btn:active { transform: scale(0.96); }
}
@keyframes xh-item-in { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } }
@keyframes xh-mark-in { from { opacity: 0; transform: scale(0.6) rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) { .side-glow { transition: none; } }
