/*
  Tribu Máquinas 360 · Sistema visual
  Adaptado del sistema de la plantilla "Smart home" de 8B (MIT): mismas capas,
  tipografía Stack Sans, botones con barrido y lámpara, líneas finas y tierras alternas.
  Colores tomados de los logos de Tribu Máquinas y Evolution 360. Ver docs/DESIGN.md.
*/
@font-face { font-family: 'Stack Sans Headline'; font-style: normal; font-weight: 500 600; font-display: swap; src: url(https://fonts.gstatic.com/s/stacksansheadline/v1/1Ptyg9jZXvmMnkLnuURbaukKZJTyrDV38aevGw.woff2) format('woff2'); }
@font-face { font-family: 'Stack Sans Text'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(https://fonts.gstatic.com/s/stacksanstext/v1/kJErBuAJ-Q0hiGPmzHEu345X1JJnCry4.woff2) format('woff2'); }
@font-face { font-family: "Stack Sans Headline Fallback"; src: local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Bold"); font-weight: 550 799; size-adjust: 96.9%; ascent-override: 103.2%; descent-override: 31%; line-gap-override: 0%; }
@font-face { font-family: "Stack Sans Headline Fallback"; src: local("Arial"), local("ArialMT"), local("Helvetica"); font-weight: 100 549; size-adjust: 100.9%; ascent-override: 99.1%; descent-override: 29.7%; line-gap-override: 0%; }
@font-face { font-family: "Stack Sans Text Fallback"; src: local("Arial"), local("ArialMT"), local("Helvetica"); font-weight: 100 549; size-adjust: 109.5%; ascent-override: 91.3%; descent-override: 27.4%; line-gap-override: 0%; }

@layer tokens, base, atoms, layout, pages;

@layer tokens {
  :root {
    /* Marca */
    --ink: #0a0908;          /* Negro Tribu: tierras oscuras */
    --carbon: #302b29;       /* Carbón Evolution 360: texto, botones */
    --koi: #fc5f00;          /* Naranja Koi: acento principal, rellenos */
    --flame: #f05535;        /* Naranja Trainer: acento secundario, cintas */
    --white: #ffffff;
    /* Neutros cálidos */
    --paper: #f6f3f0;        /* tierra clara alterna */
    --stone: #6b625d;        /* texto secundario (5.9:1 sobre blanco) */
    --line: #e7e1dc;         /* líneas finas, bordes */
    --koi-soft: #fff0e6;     /* fondo de avisos y selección */
    /* Estados */
    --ok: #1d7a46;  --ok-soft: #e6f4ec;
    --warn: #9a6400; --warn-soft: #fbf1dc;
    --bad: #b8321c;  --bad-soft: #fbe9e5;

    --font-1: "Stack Sans Headline", "Stack Sans Headline Fallback", Arial, sans-serif;
    --font-2: "Stack Sans Text", "Stack Sans Text Fallback", Arial, sans-serif;
    --radius-1: 22px;
    --radius-2: 10px;
    --radius-3: 4px;
    --space-1: clamp(16px, 2.5vw, 32px);
    --shadow-1: 0 30px 60px -24px color-mix(in oklab, var(--koi) 45%, transparent), 0 18px 40px -28px color-mix(in oklab, var(--ink) 60%, transparent);
    --ease: cubic-bezier(.6, 0, .2, 1);
    --max: 1240px;
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
  body { margin: 0; background: var(--white); color: var(--carbon); font-family: var(--font-2); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100vh; display: flex; flex-direction: column; }
  main { flex: 1; }
  img { display: block; max-width: 100%; height: auto; }
  a { color: inherit; text-decoration: none; }
  button, input, select, textarea { font: inherit; color: inherit; }
  h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
  ul[role="list"] { list-style: none; padding: 0; }
  :focus-visible { outline: 2px solid var(--koi); outline-offset: 3px; border-radius: 2px; }
  ::selection { background: var(--koi); color: var(--ink); }
  .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; }
  .skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--koi); color: var(--ink); font-weight: 600; border-radius: var(--radius-3); }
  .skip:focus { top: 12px; }
}

@layer atoms {
  /* Tipografía */
  .t-display { font-family: var(--font-1); font-size: clamp(40px, 6.4vw, 92px); font-weight: 600; line-height: .96; letter-spacing: -0.055em; }
  .t-h1 { font-family: var(--font-1); font-size: clamp(32px, 4.2vw, 56px); font-weight: 600; line-height: 1.02; letter-spacing: -0.045em; }
  .t-h2 { font-family: var(--font-1); font-size: clamp(26px, 3vw, 40px); font-weight: 500; line-height: 1.1; letter-spacing: -0.035em; }
  .t-h3 { font-family: var(--font-1); font-size: 21px; font-weight: 600; line-height: 1.2; letter-spacing: -0.025em; }
  .t-eyebrow { font-size: 12.5px; font-weight: 600; line-height: 1.3; letter-spacing: .12em; text-transform: uppercase; color: var(--stone); }
  .t-eyebrow--koi { color: var(--koi); }
  .t-lead { font-size: clamp(17px, 1.4vw, 19px); line-height: 1.55; color: var(--stone); max-width: 58ch; }
  .t-small { font-size: 14px; line-height: 1.5; color: var(--stone); }
  .t-num { font-family: var(--font-1); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }

  /* Botones: barrido naranja desde la lámpara (patrón 8B) */
  .btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 48px; padding: 0 20px; border: 0; border-radius: var(--radius-3); background: var(--carbon); color: var(--white); font-family: var(--font-2); font-size: 14px; font-weight: 600; line-height: 1; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; cursor: pointer; isolation: isolate; overflow: hidden; }
  .btn:has(.btn__lamp) { padding-right: 8px; }
  .btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--koi); clip-path: circle(0px at calc(100% - 24px) 50%); transition: clip-path .55s var(--ease); }
  .btn__label { position: relative; transition: color .35s ease; }
  .btn__lamp { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--koi); color: var(--ink); transition: background-color .35s ease, color .35s ease; }
  .btn__lamp svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  @media (hover: hover) {
    .btn:hover::before { clip-path: circle(150% at calc(100% - 24px) 50%); }
    .btn:hover .btn__label { color: var(--ink); }
    .btn:hover .btn__lamp { background: var(--ink); color: var(--koi); }
  }
  .btn--light { background: var(--white); color: var(--carbon); }
  .btn--ghost { background: transparent; color: var(--carbon); box-shadow: inset 0 0 0 1px var(--line); }
  .btn--ghost-dark { background: transparent; color: var(--white); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--white) 34%, transparent); }
  .btn--sm { min-height: 38px; padding: 0 14px; font-size: 12.5px; gap: 10px; }
  .btn--sm:has(.btn__lamp) { padding-right: 5px; }
  .btn--sm .btn__lamp { width: 28px; height: 28px; }
  .btn--danger { background: var(--bad); }
  .btn--block { width: 100%; }
  .btn[disabled] { opacity: .5; cursor: not-allowed; }

  .link { background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 2px; font-weight: 500; }
  @media (hover: hover) { .link:hover { animation: link-sweep .7s var(--ease); } }
  @keyframes link-sweep { 0% { background-position: 100% 100%; background-size: 100% 1px; } 45% { background-position: 100% 100%; background-size: 0% 1px; } 46% { background-position: 0 100%; background-size: 0% 1px; } 100% { background-position: 0 100%; background-size: 100% 1px; } }

  /* Insignias */
  .badge { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: var(--radius-3); border: 1px solid var(--line); color: var(--stone); font-size: 13px; font-weight: 500; line-height: 1.2; white-space: nowrap; }
  .badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .badge--plain::before { display: none; }
  .badge--ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
  .badge--warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
  .badge--bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
  .badge--muted { color: var(--stone); background: var(--paper); border-color: transparent; }
  .badge--koi { color: var(--ink); background: var(--koi); border-color: transparent; }

  /* Superficies */
  .card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-2); padding: clamp(18px, 2vw, 28px); }
  .card--paper { background: var(--paper); border-color: transparent; }
  .card--dark { background: var(--ink); color: var(--white); border-color: transparent; }
  .card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }

  /* Formularios */
  .form { display: grid; gap: 18px; }
  .form__row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .field { display: grid; gap: 7px; }
  .field > label, .label { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--carbon); }
  .input { display: block; width: 100%; min-height: 50px; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius-3); background: var(--white); color: var(--carbon); font-size: 15px; line-height: 1.4; transition: border-color .25s ease, box-shadow .25s ease; }
  .input:hover { border-color: color-mix(in oklab, var(--carbon) 30%, var(--line)); }
  .input:focus { outline: none; border-color: var(--koi); box-shadow: 0 0 0 3px color-mix(in oklab, var(--koi) 22%, transparent); }
  textarea.input { min-height: 110px; resize: vertical; }
  select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--stone) 50%), linear-gradient(-45deg, transparent 50%, var(--stone) 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 44px; }
  .input.input-validation-error { border-color: var(--bad); }
  .field-validation-error, .validation-summary-errors { color: var(--bad); font-size: 13.5px; }
  .validation-summary-errors ul { margin: 0; padding-left: 18px; }
  .validation-summary-valid { display: none; }
  .check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
  .check input { width: 18px; height: 18px; accent-color: var(--koi); }

  /* Avisos */
  .alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius-2); font-size: 15px; border-left: 4px solid var(--koi); background: var(--koi-soft); }
  .alert--ok { background: var(--ok-soft); border-color: var(--ok); }
  .alert--bad { background: var(--bad-soft); border-color: var(--bad); }

  /* Tablas */
  .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-2); }
  .table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
  .table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--stone); background: var(--paper); padding: 12px 16px; white-space: nowrap; }
  .table td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
  .table tr:hover td { background: color-mix(in oklab, var(--paper) 55%, transparent); }
  .table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .table .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

  .mfa-setup { display: grid; gap: 28px; grid-template-columns: minmax(200px, 300px) 1fr; align-items: start; }
  .mfa-setup__qr { padding: 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-2); }
  .mfa-setup__qr svg { display: block; width: 100%; height: auto; }
  .mfa-key { display: inline-block; padding: 10px 14px; border-radius: var(--radius-3); background: var(--paper); font-size: 17px; letter-spacing: .06em; word-spacing: .2em; overflow-wrap: normal; }
  .mfa-badge { width: min(60%, 260px); height: auto; position: relative; }
  .input--code { font-family: ui-monospace, Consolas, monospace; font-size: 22px; letter-spacing: .3em; }
  .codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 0; list-style: none; }
  .codes code { display: block; padding: 10px 12px; border-radius: var(--radius-3); background: var(--white); border: 1px solid var(--line); font-size: 15px; text-align: center; }
  @media (max-width: 720px) { .mfa-setup { grid-template-columns: 1fr; } }
  .notice-list { display: grid; gap: 10px; }
  .notice__btn { display: grid; gap: 4px; width: 100%; padding: 16px 18px; text-align: left; font: inherit; color: inherit; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-2); cursor: pointer; }
  .notice__btn:hover { border-color: var(--koi); }
  .notice--new .notice__btn { border-left: 4px solid var(--koi); background: var(--koi-soft); }
  .notice__title { font-weight: 600; }
  .notice__body { color: var(--carbon); }
  .empty { padding: 36px 20px; text-align: center; color: var(--stone); border: 1px dashed var(--line); border-radius: var(--radius-2); }
  .divider { height: 1px; background: var(--line); border: 0; margin: 0; }
}

@layer layout {
  .wrap { width: min(100% - 2 * var(--space-1), var(--max)); margin-inline: auto; }
  .section { padding-block: clamp(56px, 8vw, 112px); }
  .section--paper { background: var(--paper); }
  .section--dark { background: var(--ink); color: var(--white); }
  .section--dark .t-lead, .section--dark .t-small, .section--dark .t-eyebrow { color: color-mix(in oklab, var(--white) 72%, transparent); }
  .stack { display: grid; gap: var(--gap, 16px); align-content: start; }
  .cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 12px); }
  .split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; }
  .grid { display: grid; gap: var(--gap, 20px); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 260px)), 1fr)); }
  .cols-2 { display: grid; gap: 28px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  @media (max-width: 900px) { .cols-2 { grid-template-columns: 1fr; } }

  /* Barra de navegación */
  .nav { position: sticky; top: 0; z-index: 50; background: color-mix(in oklab, var(--white) 92%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
  .nav__bar { display: flex; align-items: center; gap: 24px; min-height: 72px; }
  .nav__brand { display: inline-flex; align-items: center; gap: 12px; font-family: var(--font-1); font-size: 19px; font-weight: 600; letter-spacing: -0.035em; }
  .nav__brand img { width: 44px; height: 44px; }
  .nav__brand span b { color: var(--koi); font-weight: 600; }
  .nav__links { display: flex; align-items: center; gap: 26px; margin-left: auto; font-size: 15px; font-weight: 500; }
  .nav__links a[aria-current="page"] { color: var(--koi); }
  .nav__links a:not(.btn):hover { color: var(--koi); }
  .nav__user { display: flex; align-items: center; gap: 12px; }
  .bell { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); color: var(--ink); }
  .bell:hover { color: var(--koi); border-color: var(--koi); }
  .bell__count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--koi); color: var(--ink); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
  .nav__menu { display: none; margin-left: auto; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius-3); background: var(--white); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
  @media (max-width: 960px) {
    .nav__menu { display: inline-flex; align-items: center; }
    .nav__links { display: none; position: absolute; inset: 72px 0 auto; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 12px var(--space-1) 24px; background: var(--white); border-bottom: 1px solid var(--line); }
    .nav__links a:not(.btn) { padding: 14px 0; border-bottom: 1px solid var(--line); font-family: var(--font-1); font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
    .nav__links .btn { margin-top: 14px; }
    .nav__user { flex-direction: column; align-items: stretch; margin-top: 8px; }
    .nav__links a.bell { width: auto; height: auto; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; justify-content: start; grid-auto-flow: column; gap: 10px; }
    .nav__links a.bell::after { content: "Avisos"; font-family: var(--font-1); font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
    .nav__links .bell__count { position: static; }
    .nav[data-open] .nav__links { display: flex; }
  }

  /* Encabezado de páginas internas */
  .page-head { padding-block: clamp(32px, 4vw, 52px) clamp(22px, 3vw, 32px); border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--paper), var(--white)); }
  .page-head .t-h1 { margin-top: 10px; }
  .page-head .t-lead { margin-top: 10px; }
  .tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 22px; }
  .tabs a { position: relative; min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: var(--radius-3); font-size: 14px; font-weight: 600; color: var(--stone); isolation: isolate; overflow: hidden; }
  .tabs a::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--koi); transform: translateY(101%); transition: transform .35s var(--ease); }
  .tabs a:hover { color: var(--ink); }
  .tabs a:hover::before { transform: none; }
  .tabs a[aria-current="page"] { color: var(--white); background: var(--carbon); }
  .page-body { padding-block: clamp(28px, 4vw, 48px) clamp(56px, 7vw, 96px); }

  /* Pie */
  .footer { background: var(--ink); color: color-mix(in oklab, var(--white) 78%, transparent); padding-block: 56px 28px; }
  .footer__grid { display: grid; gap: 32px; grid-template-columns: 1.4fr repeat(2, 1fr); align-items: start; }
  .footer__brand img { width: 220px; }
  .footer h2 { color: var(--white); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 14px; }
  .footer ul { list-style: none; padding: 0; display: grid; gap: 8px; font-size: 15px; }
  .footer a:hover { color: var(--koi); }
  .footer__mark { margin-top: 44px; padding-bottom: .08em; font-family: var(--font-1); font-weight: 600; letter-spacing: -0.06em; line-height: .95; font-size: clamp(56px, 12.5vw, 180px); color: var(--white); white-space: nowrap; overflow: hidden; }
  .footer__mark span { color: var(--koi); }
  .footer__legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid color-mix(in oklab, var(--white) 14%, transparent); font-size: 13.5px; }
  @media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr; } }
}

@layer pages {
  /* Portada */
  .hero { position: relative; overflow: hidden; background: var(--ink); color: var(--white); padding-block: clamp(56px, 8vw, 104px) clamp(48px, 7vw, 88px); isolation: isolate; }
  .hero__glow { position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none; }
  .hero__glow--1 { width: 46vw; height: 46vw; right: -10vw; top: -14vw; background: radial-gradient(circle, var(--koi), transparent 65%); }
  .hero__glow--2 { width: 34vw; height: 34vw; left: -12vw; bottom: -16vw; background: radial-gradient(circle, var(--flame), transparent 65%); }
  .hero__grid { display: grid; gap: clamp(28px, 4vw, 56px); grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; }
  .hero__title { max-width: 13ch; }
  .hero__title em { font-style: normal; color: var(--koi); }
  .hero .t-lead { color: color-mix(in oklab, var(--white) 74%, transparent); margin-top: 22px; }
  .hero__cta { margin-top: 32px; }
  .hero__logo { position: relative; justify-self: center; width: min(100%, 460px); }
  .hero__logo::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, color-mix(in oklab, var(--white) 10%, transparent) 0 2px, transparent 2px clamp(22px, 3.4vw, 46px)); mask-image: linear-gradient(90deg, #000 0 38%, transparent 38%); pointer-events: none; }
  .hero__chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 40px; }
  .chip { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: var(--radius-2); background: color-mix(in oklab, var(--white) 7%, transparent); border: 1px solid color-mix(in oklab, var(--white) 14%, transparent); font-size: 14px; }
  .chip i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--koi); color: var(--ink); font-style: normal; font-weight: 700; font-size: 13px; }
  @media (max-width: 860px) { .hero__grid { grid-template-columns: 1fr; } .hero__logo { width: min(80%, 340px); order: -1; } }

  .feature { display: grid; gap: 12px; align-content: start; padding: 26px; border-radius: var(--radius-2); background: var(--white); border: 1px solid var(--line); transition: transform .4s var(--ease), box-shadow .4s var(--ease); }
  .feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-1); }
  .feature__icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: var(--radius-3); background: var(--ink); color: var(--koi); }
  .feature__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .feature .t-small { font-size: 15px; }

  .steps { counter-reset: step; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .step { position: relative; padding: 26px 22px 22px; border-top: 2px solid var(--carbon); }
  .step::before { counter-increment: step; content: counter(step, decimal-leading-zero); display: block; font-family: var(--font-1); font-size: 44px; font-weight: 600; letter-spacing: -0.05em; color: var(--koi); line-height: 1; margin-bottom: 14px; }

  .post { display: grid; gap: 10px; align-content: start; padding: 24px; border-radius: var(--radius-2); background: var(--white); border: 1px solid var(--line); }
  .post__date { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--stone); letter-spacing: .04em; text-transform: uppercase; }
  .post__date::before { content: ""; width: 10px; height: 10px; background: var(--koi); }

  /* Tarjetas de entrenador: misma estructura en todas (encabezado, días, bio flexible, pie abajo). */
  .trainer { display: flex; flex-direction: column; gap: 16px; height: 100%; container-type: inline-size; }
  .trainer__head { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; }
  .trainer__id { display: grid; gap: 2px; min-width: 0; }
  .trainer__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .trainer__meta { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; min-height: calc(2 * 1.5em); line-height: 1.5; }
  .trainer__bio { flex: 1; margin: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
  .trainer__bio:empty { flex: 1; min-height: 0; }
  .trainer__foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
  .trainer__next { display: grid; gap: 4px; min-width: 0; }
  .trainer__slot { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .trainer__slot::first-letter { text-transform: uppercase; }
  .trainer .btn { white-space: nowrap; }
  /* Tarjeta angosta (móvil): el botón pasa debajo de la fecha en vez de recortarla. */
  @container (max-width: 330px) {
    .trainer__foot { grid-template-columns: 1fr; }
    .trainer__foot .btn { justify-self: start; }
  }
  .avatar { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--ink); color: var(--koi); font-family: var(--font-1); font-weight: 600; font-size: 20px; letter-spacing: -0.03em; flex: none; }
  .avatar--sm { width: 40px; height: 40px; font-size: 15px; }
  .week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
  .week__day { padding: 8px 4px; border-radius: var(--radius-3); text-align: center; font-size: 12px; background: var(--paper); color: var(--stone); }
  .week__day b { display: block; font-family: var(--font-1); font-size: 16px; color: var(--carbon); }
  .week__day--on { background: var(--carbon); color: color-mix(in oklab, var(--white) 70%, transparent); }
  .week__day--on b { color: var(--koi); }

  /* Reserva */
  .daypicker { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
  .daypicker a { flex: none; display: grid; gap: 2px; min-width: 74px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-2); text-align: center; font-size: 12.5px; color: var(--stone); text-transform: capitalize; transition: border-color .25s ease; }
  .daypicker a b { font-family: var(--font-1); font-size: 22px; color: var(--carbon); letter-spacing: -0.03em; }
  .daypicker a:hover { border-color: var(--koi); }
  .daypicker a[aria-current="date"] { background: var(--ink); border-color: var(--ink); color: color-mix(in oklab, var(--white) 70%, transparent); }
  .daypicker a[aria-current="date"] b { color: var(--koi); }
  .slots { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .slot { position: relative; }
  .slot input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
  .slot span { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-2); font-family: var(--font-1); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; transition: all .25s ease; }
  .slot small { font-family: var(--font-2); font-size: 12.5px; font-weight: 500; color: var(--stone); letter-spacing: 0; }
  .slot input:hover + span { border-color: var(--koi); }
  .slot input:checked + span { background: var(--koi); border-color: var(--koi); color: var(--ink); }
  .slot input:checked + span small { color: var(--ink); }
  .slot input:focus-visible + span { outline: 2px solid var(--koi); outline-offset: 2px; }

  /* Panel */
  .kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .kpi { position: relative; padding: 20px 22px; border-radius: var(--radius-2); background: var(--white); border: 1px solid var(--line); overflow: hidden; }
  .kpi__label { font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--stone); }
  .kpi__value { margin-top: 8px; font-family: var(--font-1); font-size: clamp(28px, 2.6vw, 38px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
  .kpi__hint { margin-top: 8px; font-size: 13.5px; color: var(--stone); }
  .kpi--dark { background: var(--ink); border-color: transparent; color: var(--white); }
  .kpi--dark .kpi__label, .kpi--dark .kpi__hint { color: color-mix(in oklab, var(--white) 65%, transparent); }
  .kpi--dark .kpi__value { color: var(--koi); }
  .kpi--accent::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--koi); }
  .bar { height: 8px; border-radius: 99px; background: var(--paper); overflow: hidden; }
  .bar > i { display: block; height: 100%; background: var(--koi); border-radius: inherit; }
  .meter-list { display: grid; gap: 14px; }
  .meter-list li { display: grid; gap: 6px; }
  .meter-list .split { align-items: center; font-size: 14.5px; }

  .agenda { display: grid; gap: 10px; }
  .agenda__item { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-2); background: var(--white); }
  .agenda__time { font-family: var(--font-1); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
  .agenda__time small { display: block; font-family: var(--font-2); font-size: 12.5px; font-weight: 500; color: var(--stone); letter-spacing: 0; text-transform: capitalize; }
  @media (max-width: 640px) { .agenda__item { grid-template-columns: 1fr; } }

  .clock { display: grid; gap: 18px; justify-items: start; }
  .clock__time { font-family: var(--font-1); font-size: clamp(48px, 7vw, 84px); font-weight: 600; letter-spacing: -0.06em; line-height: .9; font-variant-numeric: tabular-nums; }

  .auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 73px); }
  .auth__art { position: relative; display: grid; place-items: center; padding: 48px; background: var(--ink); overflow: hidden; isolation: isolate; }
  .auth__art img { width: min(80%, 420px); }
  .auth__panel { display: grid; place-items: center; padding: 48px var(--space-1); }
  .auth__box { width: min(100%, 420px); display: grid; gap: 22px; }
  @media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth__art { min-height: 240px; } }

  .status-page { text-align: center; display: grid; justify-items: center; gap: 16px; padding-block: 96px; }
  .status-page .t-display { color: var(--koi); }
}

/* ===== Movimiento =====
   Adaptado del kit de la plantilla smart-home de 8B (MIT): mismas curvas, tiempos y efectos.
   - Sin data-live (navegador sin animaciones por scroll o movimiento reducido) todo se ve completo y quieto.
   - La barra que se oculta y los rellenos de botones siguen funcionando siempre, como en la plantilla. */
:root {
  --ease-op: cubic-bezier(.2, .7, .1, 1);
  --ease-power2-inout: linear(0, 0.0001, 0.0005, 0.0017, 0.004, 0.0078, 0.0135, 0.0214, 0.032, 0.0456, 0.0625, 0.0832, 0.108, 0.1373, 0.1715, 0.2109, 0.256, 0.3071, 0.3645, 0.4287, 0.5, 0.5713, 0.6355, 0.6929, 0.744, 0.7891, 0.8285, 0.8627, 0.892, 0.9168, 0.9375, 0.9544, 0.968, 0.9786, 0.9865, 0.9922, 0.996, 0.9983, 0.9995, 0.9999, 1);
  --ease-expo-out: linear(0, 0.1591, 0.2929, 0.4054, 0.5, 0.5796, 0.6464, 0.7027, 0.75, 0.7898, 0.8232, 0.8513, 0.875, 0.8949, 0.9116, 0.9257, 0.9375, 0.9474, 0.9558, 0.9628, 0.9688, 0.9737, 0.9779, 0.9814, 0.9844, 0.9869, 0.989, 0.9907, 0.9922, 0.9934, 0.9945, 0.9954, 0.9961, 0.9967, 0.9972, 0.9977, 0.998, 0.9984, 0.9986, 0.9988, 1);
}

/* Barra: sale al bajar y vuelve al subir (motion.js pone data-hidden). */
.nav { transition: transform .5s cubic-bezier(.6, 0, .2, 1); }
.nav[data-hidden] { transform: translateY(-101%); }

@media (prefers-reduced-motion: no-preference) {
  /* Portada: brillos que derivan (op-drift) y entrada escalonada (op-rise, op-slide, op-up). */
  .hero__glow { animation: op-drift 9s ease-in-out infinite alternate; }
  .hero__glow--2 { animation-duration: 11s; animation-direction: alternate-reverse; }
  .hero__glow[data-off] { animation-play-state: paused; }
  .hero .t-eyebrow, .hero__title { animation: op-rise .95s var(--ease-op) backwards; }
  .hero__logo { animation: op-slide .8s .15s var(--ease-op) backwards; }
  .hero .t-lead, .hero__cta { animation: op-up .8s .2s var(--ease-op) backwards; }
  .hero__chips { animation: op-up .8s .32s var(--ease-op) backwards; }
  /* Encabezado de las páginas internas: misma entrada que la portada. */
  .page-head .t-eyebrow, .page-head .t-h1 { animation: op-rise .95s var(--ease-op) backwards; }
  .page-head .t-lead { animation: op-up .8s .2s var(--ease-op) backwards; }
  .page-head .tabs { animation: op-up .8s .32s var(--ease-op) backwards; }
}
@keyframes op-drift { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(-16%, 12%) scale(1.14); } }
@keyframes op-rise { from { transform: translateY(22%); } }
@keyframes op-slide { from { transform: translateX(36px); } }
@keyframes op-up { from { transform: translateY(28px); } }

/* rise: el título sube desde una máscara al cruzar el 88 % de la pantalla. */
[data-live] [data-motion~="rise"] { animation: motion-rise .9s var(--ease-expo-out) backwards paused; }
[data-live] [data-motion~="rise"].is-in { animation-play-state: running; }
@keyframes motion-rise { 0% { translate: 0 55%; clip-path: inset(0% 0% 100% 0%); } 100% { translate: 0 0; clip-path: inset(0% 0% -20% 0%); } }

/* glow: cada palabra pasa de 20 % a 100 % de opacidad según avanza el scroll. */
[data-live] [data-motion~="glow"] { view-timeline: --motion-glow block; view-timeline-inset: 0; }
[data-live] [data-motion~="glow"] .w { --at: calc(.8 * var(--i) / max(1, var(--n) - 1)); animation: motion-glow linear both; animation-timeline: --motion-glow; animation-range: cover calc(15vh + (50% - 21vh) * var(--at)) cover calc(15vh + (50% - 21vh) * (var(--at) + .2)); }
@keyframes motion-glow { 0% { opacity: .2; } 100% { opacity: 1; } }

/* Grupos escalonados: cada elemento sube 70 ms después del anterior. */
[data-live] [data-items].is-in > * { animation: op-up .8s var(--ease-op) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
[data-live] [data-items]:not(.is-in) > * { opacity: 0; }

/* clear: la imagen se descubre de izquierda a derecha (systems-photo). */
[data-live] [data-motion~="clear"] { animation: systems-photo 1s var(--ease-power2-inout) both paused; }
[data-live] [data-motion~="clear"].is-in { animation-play-state: running; }
@keyframes systems-photo { 0% { clip-path: inset(0% 82% 0% 0% round 10px); } 99.998% { clip-path: inset(0% 0% 0% 0% round 10px); } 100% { clip-path: none; } }

/* Pasos en escalera (process-step): cada paso llega desde abajo y a la izquierda según el scroll. */
[data-live] .steps > .step { view-timeline: --process-cell block; view-timeline-inset: 0; }
[data-live] .steps > .step + .step { --process-x: -24px; --process-y: 48px; animation: process-step linear both; animation-timeline: --process-cell; animation-range: cover 4vh cover 50vh; animation-timing-function: cubic-bezier(0.3333, 1, 0.6667, 1); }
@keyframes process-step { 0% { translate: var(--process-x, 0px) var(--process-y, 0px); } 100% { translate: 0px 0px; } }

/* fill: barras que se llenan al entrar (care-fill), escalonadas. */
[data-live] [data-motion~="fill"] .bar > i { transform-origin: left; animation: care-fill .9s var(--ease-expo-out) both paused; animation-delay: calc(var(--i, 0) * 80ms); }
[data-live] [data-motion~="fill"].is-in .bar > i { animation-play-state: running; }
@keyframes care-fill { 0% { scale: 0 1; } 100% { scale: 1 1; } }

/* Respaldo de las entradas por scroll de la versión anterior (.reveal), con la curva de la plantilla. */
[data-live] .reveal { animation: reveal-up linear both; animation-timeline: view(); animation-range: entry 0% cover 28%; }
@keyframes reveal-up { from { opacity: 0; translate: 0 28px; } to { opacity: 1; translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Horario semanal de clases */
@layer pages {
  .classweek { display: grid; gap: 12px; grid-template-columns: repeat(7, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
  .classweek__day { display: grid; gap: 10px; align-content: start; min-width: 150px; }
  .classweek__head { display: flex; align-items: baseline; gap: 8px; padding: 10px 12px; border-radius: var(--radius-2); background: var(--ink); color: color-mix(in oklab, var(--white) 70%, transparent); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
  .classweek__head b { font-family: var(--font-1); font-size: 22px; color: var(--koi); letter-spacing: -0.03em; }
  .classweek__none { padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius-2); }
  .classcard { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-2); background: var(--white); }
  .classcard__time { font-family: var(--font-1); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
  .classcard__time span { font-family: var(--font-2); font-size: 12.5px; font-weight: 500; color: var(--stone); letter-spacing: 0; }
  .classcard__name { font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--koi); }
  .classcard--mine { border-color: var(--koi); box-shadow: inset 4px 0 0 var(--koi); }
  .classcard--full { background: var(--paper); }
  .classcard--full .bar > i { background: var(--stone); }
  @media (max-width: 1100px) { .classweek { grid-template-columns: repeat(7, minmax(170px, 1fr)); } }
  .roster { display: grid; gap: 8px; }
  .roster li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
  .roster li.stack { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .bday { display: flex; align-items: center; gap: 12px; }
  .bday__date { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--radius-2); background: var(--koi); color: var(--ink); font-family: var(--font-1); font-weight: 600; line-height: 1; text-align: center; font-size: 20px; }
  .bday__date small { display: block; font-family: var(--font-2); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
  .pinned { border-left: 4px solid var(--koi); }
}
