/* CENAMAD · base: reset, page shell, primitives, workspace shell, fallback renderer.
 * Uses only tokens from tokens.css. Breakpoints (consolidated): phones ≤ 600 px, tablets ≤ 1024 px, desktop > 1024 px.
 */

/* ------------------------------------------------------------------ reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-width: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font: 400 var(--fs-base) / var(--lh-base) var(--f-text);
  -webkit-font-smoothing: antialiased;
}
img,
svg,
video,
canvas {
  max-width: 100%;
}
img {
  height: auto;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
a {
  color: var(--c-accent-text);
  text-underline-offset: 0.18em;
}
h1,
h2,
h3,
h4 {
  font-family: var(--f-heading);
  font-weight: var(--fw-heading);
  letter-spacing: var(--ls-heading);
  line-height: var(--lh-tight);
  margin: 0 0 var(--sp-3);
}
h4 {
  font-family: var(--f-text);
  font-size: var(--fs-md);
  margin-top: var(--sp-4);
}
p {
  margin: 0 0 var(--sp-3);
}
code {
  font-family: var(--f-mono);
  font-size: 0.92em;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}
[tabindex="-1"]:focus:not(:focus-visible) {
  outline: none;
}
::selection {
  background: var(--c-accent-soft);
}

/* ------------------------------------------------------------------ helpers */
.cen-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  left: 0;
  top: 0;
}
.cen-num,
.cen-table td,
.cen-table th {
  font-variant-numeric: tabular-nums;
}
.cen-kicker {
  margin: 0 0 var(--sp-2);
  color: var(--c-muted);
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cen-page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-7) clamp(var(--gutter), 4vw, var(--sp-8));
}
/* UC's heading pattern: a heading followed by a short yellow rule (uc-heading-decoration). */
.uc-heading {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-width: 0;
}
.uc-heading h2 {
  margin: 0;
  font-family: var(--uc-font-slab);
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--uc-azul-2);
  letter-spacing: -0.005em;
}
.uc-rule {
  flex: none;
  width: 36px;
  height: 4px;
  background: var(--uc-amarillo);
}
.cen-stale-val {
  color: var(--c-muted);
  text-decoration: line-through;
  text-decoration-color: var(--c-warn-line, currentColor);
}

/* ==================================================================== UC shell (Kit Digital)
 * Top strip (dark blue, uc.cl links) → white header with the UC lockup → navbar with the «Calculadoras»
 * dropdown → page → dark-blue footer. Inside a calculator (<html data-ruta="espacio">) the strip is dropped and
 * the header and navbar collapse into one 56 px bar so the workspace keeps its one-screen budget.
 * ------------------------------------------------------------------ */
.skip {
  position: absolute;
  left: var(--sp-3);
  top: -100px;
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--uc-azul);
  color: #fff;
  font-weight: 600;
  border-radius: var(--r-2);
  box-shadow: var(--sh-2);
}
.skip:focus {
  top: var(--sp-3);
}
.cen-shell-ancho {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding-inline: clamp(var(--gutter), 4vw, var(--sp-8));
}

/* ---------------------------------------------- UC top strip */
.uc-strip {
  background: var(--uc-azul-2);
  color: #fff;
  font-size: var(--fs-sm);
}
.uc-strip-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  min-height: var(--uc-topbar-h);
  padding: var(--sp-1) clamp(var(--gutter), 4vw, var(--sp-8));
}
.uc-strip a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
}
.uc-strip a:hover {
  box-shadow: inset 0 -1px 0 #fff;
}
.uc-strip :focus-visible {
  outline-color: var(--c-focus-dark);
}
/* As in the UC Kit Digital, the strip carries the UC mark on phones and the header carries it on desktop:
   it never appears twice at the same width. */
.uc-strip-uc {
  display: none;
  align-items: center;
  min-height: 28px;
}
.uc-strip-uc img {
  display: block;
  height: 19px;
  width: auto;
}
.uc-strip-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.uc-strip-links li + li {
  border-left: 1px solid #8b9fc4;
}
.uc-strip-links a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 var(--sp-3);
}
.uc-strip-links li:last-child a {
  padding-right: 0;
}
.uc-strip-links--izq a {
  padding-left: 0;
}

/* ---------------------------------------------- white header + lockup */
.mast {
  position: relative;
  z-index: 40;
  background: var(--c-surface);
  border-bottom: 1px solid var(--uc-gris-a);
  box-shadow: var(--uc-sombra);
}
.mast-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  max-width: var(--page-max);
  margin: 0 auto;
  min-height: 72px;
  padding: var(--sp-2) clamp(var(--gutter), 4vw, var(--sp-8));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: var(--tap);
  color: var(--c-ink);
  text-decoration: none;
  min-width: 0;
}
.brand-uc {
  display: block;
  flex: none;
  height: 23px;
  width: auto;
}
.brand-rule {
  flex: none;
  width: 1px;
  align-self: stretch;
  margin-block: 2px;
  background: var(--uc-gris-a);
}
.brand-txt {
  display: grid;
  min-width: 0;
}
.brand-centro {
  font-family: var(--uc-font-slab);
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: 1.18;
  color: var(--uc-azul-2);
  letter-spacing: -0.005em;
}
.brand-sub {
  color: var(--c-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mast-burger {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border: 1px solid var(--uc-gris-a);
  border-radius: var(--r-2);
  background: var(--c-surface);
  color: var(--uc-azul-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.mast-burger-ico {
  display: grid;
  gap: 4px;
  width: 20px;
}
.mast-burger-ico i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition:
    transform var(--t-fast) var(--ease),
    opacity var(--t-fast) var(--ease);
}
[data-menu="abierto"] .mast-burger-ico i:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
[data-menu="abierto"] .mast-burger-ico i:nth-child(2) {
  opacity: 0;
}
[data-menu="abierto"] .mast-burger-ico i:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------------------------------------------- navbar */
.navbar {
  background: var(--c-surface);
  border-top: 1px solid var(--uc-gris-a);
}
.navbar-in {
  display: flex;
  align-items: stretch;
  gap: var(--sp-4);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 clamp(var(--gutter), 4vw, var(--sp-8));
}
.navbar-movil-tit,
.navbar-cerrar {
  display: none;
}
.mast-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}
.nav-item {
  display: flex;
  border-right: 1px solid var(--uc-gris-a);
}
.nav-item:first-child {
  border-left: 1px solid var(--uc-gris-a);
}
.mast-nav a,
.nav-drop-btn {
  display: inline-grid;
  align-content: center;
  justify-items: start;
  gap: 1px;
  text-align: left;
}
.nav-lbl {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.mast-nav a,
.nav-drop-btn,
.mast-account {
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--uc-azul-2);
  text-decoration: none;
  font-size: var(--fs-md);
  font-weight: 500;
  white-space: nowrap;
  transition:
    background-color var(--t-fast) var(--ease),
    border-bottom-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
.mast-nav > .nav-item > a,
.nav-drop-btn {
  min-height: 52px;
}
.mast-nav a:hover,
.nav-drop-btn:hover {
  background: var(--uc-gris-c);
  border-bottom-color: var(--uc-azul);
}
.mast-nav a[aria-current="page"],
.nav-drop-btn[aria-current="page"] {
  color: var(--uc-azul);
  border-bottom-color: var(--uc-azul);
  font-weight: 700;
}
.nav-hint {
  color: var(--c-muted);
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.mast-nav a:hover .nav-hint,
.nav-drop-btn:hover .nav-hint,
.mast-nav a[aria-current="page"] .nav-hint,
.nav-drop-btn[aria-current="page"] .nav-hint {
  color: var(--c-ink-2);
}
.nav-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform var(--t-fast) var(--ease);
}
.nav-drop-btn[aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}
.nav-drop-btn[aria-expanded="true"] {
  background: var(--uc-gris-c);
  border-bottom-color: var(--uc-azul);
}
.mast-account {
  margin-left: auto;
  align-self: center;
  border: 1px solid var(--uc-azul);
  border-radius: var(--r-2);
  color: var(--uc-azul);
  font-weight: 500;
}
.mast-account:hover {
  background: var(--uc-azul);
  color: #fff;
}

/* ---------------------------------------------- Calculadoras dropdown */
.nav-drop {
  position: relative;
}
.nav-drop-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  min-width: 332px;
  margin: 0;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  list-style: none;
  background: var(--c-surface);
  border-radius: var(--r-2);
  box-shadow: 0 0 25px rgb(0 0 0 / 0.3);
  opacity: 0;
  transform: translateY(-6px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    visibility var(--t-fast) step-end;
}
.nav-drop[data-open="1"] .nav-drop-menu {
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  transition-timing-function: var(--ease), var(--ease), step-start;
}
.nav-drop-sep {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 2px solid var(--uc-gris-a);
}
.nav-drop-menu a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-2);
  border: 0;
  border-bottom: 1px solid var(--uc-gris-a);
  color: #000;
  font-weight: 400;
  white-space: normal;
}
.nav-drop-menu a:hover {
  background: var(--uc-gris-c);
  color: var(--uc-azul-2);
}
.nav-drop-menu a[aria-current="page"] {
  color: var(--uc-azul);
  font-weight: 700;
  border-bottom-color: var(--uc-azul);
}
.nav-drop-n {
  min-width: 0;
}
.nav-drop-v {
  flex: none;
  padding: 2px var(--sp-2);
  border-radius: var(--r-2);
  background: var(--uc-gris-b);
  color: var(--uc-azul-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-drop-menu a:hover .nav-drop-v,
.nav-drop-menu a[aria-current="page"] .nav-drop-v {
  background: var(--uc-azul);
  color: #fff;
}
.nav-drop-pie {
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 2px solid var(--uc-amarillo);
  color: var(--c-muted);
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  max-width: 34ch;
}
.navbar-backdrop {
  display: none;
}

#app {
  display: block;
  min-height: 60vh;
  outline: none;
}
/* route transition: the new page fades up once (never on a step change inside a calculator) */
@keyframes cen-entra {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
#app > * {
  animation: cen-entra var(--t-base) var(--ease) both;
}
@media (prefers-reduced-motion: reduce) {
  #app > * {
    animation: none;
  }
}

/* ---------------------------------------------- UC footer */
.footer {
  margin-top: var(--sp-8);
  background: var(--uc-azul-osc);
  color: #fff;
  font-size: var(--fs-md);
}
.footer a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.footer :focus-visible {
  outline-color: var(--c-focus-dark);
}
.uc-footer-in {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-7) var(--sp-8);
  align-items: flex-start;
  justify-content: space-between;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-8) clamp(var(--gutter), 4vw, var(--sp-8)) var(--sp-7);
}
.uc-footer-marca {
  flex: 1 1 320px;
  min-width: 0;
}
.uc-footer-logo {
  display: block;
  height: 28px;
  width: auto;
  margin-bottom: var(--sp-4);
}
.uc-footer-centro {
  margin: 0 0 var(--sp-2);
  font-family: var(--uc-font-slab);
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: var(--lh-snug);
}
.uc-footer-dir {
  margin: 0;
  color: #cfd8e6;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}
.uc-footer-cols {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-7) var(--sp-8);
}
.uc-footer-col {
  min-width: 150px;
}
.uc-footer-tit {
  margin: 0 0 var(--sp-3);
  font-family: var(--uc-font);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.uc-footer-tit::after {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin-top: var(--sp-2);
  background: var(--uc-amarillo);
}
.uc-footer-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
}
.uc-footer-list a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}
.uc-footer-estado {
  border-top: 1px solid rgb(255 255 255 / 0.18);
}
.uc-footer-estado > * {
  max-width: var(--page-max);
  margin: 0 auto;
  padding-inline: clamp(var(--gutter), 4vw, var(--sp-8));
}
.uc-footer-aviso {
  padding-top: var(--sp-4);
  font-weight: 700;
  font-size: var(--fs-sm);
}
.uc-footer-aviso::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: var(--sp-2);
  border-radius: 50%;
  background: var(--uc-amarillo);
}
.uc-footer-meta {
  padding-bottom: var(--sp-6);
  color: #cfd8e6;
  font-size: var(--fs-sm);
}
.uc-footer-meta a {
  min-height: var(--tap-min);
}

/* ---------------------------------------------- condensed shell inside a calculator
 * The workspace must stay one screen tall on desktop: no strip, one 56 px bar, a one-line footer. */
[data-ruta="espacio"] .uc-strip,
[data-ruta="espacio"] .brand-sub,
[data-ruta="espacio"] .nav-hint,
[data-ruta="espacio"] .uc-footer-in {
  display: none;
}
[data-ruta="espacio"] .mast {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 var(--sp-4);
  max-width: var(--page-max);
  margin: 0 auto;
  padding-inline: clamp(var(--gutter), 4vw, var(--sp-8));
  box-shadow: none;
}
[data-ruta="espacio"] .mast-inner {
  flex: 0 1 auto;
  min-height: 56px;
  padding-inline: 0;
}
[data-ruta="espacio"] .brand-centro {
  font-size: var(--fs-base);
}
[data-ruta="espacio"] .brand-uc {
  height: 19px;
}
[data-ruta="espacio"] .navbar {
  flex: 0 1 auto;
  border-top: 0;
}
[data-ruta="espacio"] .navbar-in {
  padding-inline: 0;
}
[data-ruta="espacio"] .mast-nav > .nav-item > a,
[data-ruta="espacio"] .nav-drop-btn {
  min-height: 44px;
  padding-inline: var(--sp-3);
  font-size: var(--fs-sm);
}
[data-ruta="espacio"] .nav-item,
[data-ruta="espacio"] .nav-item:first-child {
  border: 0;
}
[data-ruta="espacio"] .nav-drop-menu {
  left: auto;
  right: 0;
}
[data-ruta="espacio"] .footer {
  margin-top: var(--sp-6);
}
[data-ruta="espacio"] .uc-footer-estado {
  border-top: 0;
}
[data-ruta="espacio"] .uc-footer-aviso {
  padding-top: var(--sp-3);
}
[data-ruta="espacio"] .uc-footer-meta {
  padding-bottom: var(--sp-3);
}

.cen-cargando {
  padding: var(--sp-8) var(--gutter);
  text-align: center;
  color: var(--c-muted);
}
/* skeleton used while a lazy route (admin, review sheet) loads */
.cen-skel {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-7) clamp(var(--gutter), 4vw, var(--sp-8));
}
.cen-skel span {
  display: block;
  height: 14px;
  margin-bottom: var(--sp-3);
  border-radius: var(--r-2);
  background: linear-gradient(90deg, var(--uc-gris-b) 25%, var(--uc-gris-c) 37%, var(--uc-gris-b) 63%);
  background-size: 400% 100%;
  animation: cen-skel 1.3s linear infinite;
}
.cen-skel span:nth-child(1) {
  height: 32px;
  max-width: 340px;
}
.cen-skel span:nth-child(2) {
  max-width: 620px;
}
.cen-skel span:nth-child(3) {
  height: 120px;
}
.cen-skel span:nth-child(4) {
  height: 120px;
  max-width: 70%;
}
@keyframes cen-skel {
  to {
    background-position: -400% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cen-skel span {
    animation: none;
  }
}

/* ------------------------------------------------------------------ mobile navigation (≤ 900 px)
 * The same list becomes a slide-in panel; «Calculadoras» becomes an always-open accordion group. */
@media (max-width: 900px) {
  .uc-strip-links,
  .uc-strip-links--izq {
    display: none;
  }
  .uc-strip-uc {
    display: inline-flex;
  }
  .uc-strip-in {
    justify-content: center;
  }
  .brand-uc,
  .brand-rule {
    display: none;
  }
  .mast-inner {
    min-height: 64px;
  }
  .mast-burger {
    display: inline-flex;
  }
  /* The closed panel stays inside the viewport and clips its own content: a fixed box translated past the right
     edge still counts towards the document's scrollable overflow in Chrome (tests/ui-foundation.cjs checks it). */
  .navbar {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    width: min(360px, 88vw);
    max-width: 100vw;
    border-top: 0;
    border-left: 1px solid var(--uc-gris-a);
    background: transparent;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  /* `abierto` and `cerrando`: present only while the panel is on screen or sliding out (app.js). */
  [data-menu] .navbar {
    display: block;
  }
  .navbar-in {
    display: block;
    min-height: 100%;
    padding: var(--sp-5) var(--sp-4) var(--sp-8);
    background: var(--c-surface);
    box-shadow: var(--uc-sombra-alta);
    transform: translateX(101%);
    transition: transform var(--t-slow) var(--ease);
  }
  [data-menu="abierto"] .navbar-in {
    transform: none;
  }
  .navbar-movil-tit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin: 0 0 var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 4px solid var(--uc-amarillo);
  }
  .navbar-movil-tit p {
    margin: 0;
    font-family: var(--uc-font-slab);
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--uc-azul-2);
  }
  .navbar-cerrar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: var(--tap);
    height: var(--tap);
    border: 1px solid var(--uc-gris-a);
    border-radius: var(--r-2);
    background: var(--c-surface);
    color: var(--uc-azul-2);
    font-size: var(--fs-xl);
    line-height: 1;
  }
  .navbar-cerrar:hover {
    background: var(--uc-gris-c);
  }
  .mast-nav {
    display: block;
  }
  .nav-item,
  .nav-item:first-child {
    display: block;
    border: 0;
    border-bottom: 1px solid var(--uc-gris-a);
  }
  .mast-nav a,
  .nav-drop-btn,
  .mast-nav > .nav-item > a {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
    width: 100%;
    min-height: var(--tap);
    padding: var(--sp-2) 0;
    border-bottom: 0;
    white-space: normal;
    font-size: var(--fs-lg);
    font-weight: 500;
  }
  .nav-lbl {
    justify-content: space-between;
    width: 100%;
  }
  .nav-hint {
    font-size: var(--fs-sm);
  }
  .mast-nav a[aria-current="page"],
  .nav-drop-btn[aria-current="page"] {
    border-bottom: 0;
    box-shadow: inset 3px 0 0 var(--uc-azul);
    padding-left: var(--sp-3);
  }
  .nav-drop-menu {
    position: static;
    min-width: 0;
    padding: 0 0 var(--sp-3) var(--sp-3);
    box-shadow: none;
    opacity: 1;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    border-left: 2px solid var(--uc-gris-a);
    overflow: hidden;
  }
  .nav-drop:not([data-open="1"]) .nav-drop-menu {
    display: none;
  }
  .nav-drop-menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: var(--sp-2);
    font-size: var(--fs-md);
    font-weight: 400;
  }
  .mast-account {
    display: flex;
    width: 100%;
    margin: var(--sp-5) 0 0;
    justify-content: center;
    background: var(--uc-azul);
    color: #fff;
    border-radius: var(--r-2);
  }
  .navbar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--c-overlay);
    opacity: 0;
    transition: opacity var(--t-slow) var(--ease);
  }
  [data-menu="abierto"] .navbar-backdrop {
    opacity: 1;
  }
  [data-menu="abierto"] {
    overflow: hidden;
  }
  [data-ruta="espacio"] .mast {
    display: block;
    padding-inline: 0;
  }
  [data-ruta="espacio"] .mast-inner {
    padding-inline: clamp(var(--gutter), 4vw, var(--sp-8));
  }
  [data-ruta="espacio"] .navbar-in {
    padding: var(--sp-5) var(--sp-4) var(--sp-8);
  }
  [data-ruta="espacio"] .brand-sub {
    display: block;
  }
  [data-ruta="espacio"] .mast-nav > .nav-item > a,
  [data-ruta="espacio"] .nav-drop-btn {
    font-size: var(--fs-md);
    padding-inline: 0;
  }
}

/* ------------------------------------------------------------------ buttons (UC Kit Digital) */
.cen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--c-ink);
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
.cen-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.cen-btn--primario {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-ink);
  box-shadow: var(--uc-sombra);
}
.cen-btn--primario:hover {
  background: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
}
.cen-btn--secundario {
  background: var(--c-surface);
  border-color: var(--uc-gris-a);
  color: var(--c-accent-text);
  box-shadow: var(--uc-sombra);
}
.cen-btn--secundario:hover {
  border-color: var(--c-accent);
}
/* UC's inline arrow affordance: a round blue chevron that turns yellow on hover */
.cen-btn--flecha::after {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c-accent)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M12 4l-1.4 1.4L16.2 11H4v2h12.2l-5.6 5.6L12 20l8-8z'/%3E%3C/svg%3E")
    center / 12px no-repeat;
  transition:
    background-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
.cen-btn--primario.cen-btn--flecha::after {
  background-color: rgb(255 255 255 / 0.22);
}
.cen-btn--flecha:hover::after {
  background-color: var(--uc-amarillo);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2303122e'%3E%3Cpath d='M12 4l-1.4 1.4L16.2 11H4v2h12.2l-5.6 5.6L12 20l8-8z'/%3E%3C/svg%3E");
  transform: translateX(2px);
}
.cen-btn--texto {
  padding: 0 var(--sp-2);
  color: var(--c-accent-text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  font-weight: 550;
}
.cen-btn--peligro {
  background: var(--c-surface);
  border-color: var(--c-danger-line);
  color: var(--c-danger);
}
.cen-btn:disabled,
.cen-btn[aria-disabled="true"] {
  opacity: 0.5;
}
.cen-btn[aria-pressed="true"] {
  background: var(--c-accent-soft);
  border-color: var(--c-accent);
  color: var(--c-accent-text);
}

/* segmented control: buttons (aria-pressed) or links (aria-current) */
.cen-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-2);
  background: var(--c-surface);
  box-shadow: var(--uc-sombra);
  max-width: 100%;
}
.cen-seg > a,
.cen-seg > button {
  transition:
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
.cen-seg > a,
.cen-seg > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: calc(var(--r-2) - 2px);
  background: transparent;
  color: var(--c-ink-2);
  font-size: var(--fs-md);
  font-weight: 600;
  text-decoration: none;
}
.cen-seg > a:hover,
.cen-seg > button:hover {
  background: var(--c-sunken);
}
.cen-seg > [aria-pressed="true"],
.cen-seg > [aria-current="page"] {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}

/* ------------------------------------------------------------------ fields */
.cen-field {
  display: grid;
  gap: var(--sp-1);
  min-width: 0;
}
.cen-field > label,
.cen-field > .cen-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-ink-2);
}
.cen-field small {
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-2);
  background: var(--c-surface-2);
  color: var(--c-ink);
}
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--c-accent);
}
input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 1px var(--c-danger);
}
.cen-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
label:has(> .cen-file) {
  position: relative;
  cursor: pointer;
}
label:has(> .cen-file:focus-visible) {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ tables (stacked on phones) */
.cen-table-wrap {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  margin: var(--sp-3) 0;
}
.cen-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
.cen-table th,
.cen-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--c-line);
  text-align: left;
  vertical-align: top;
}
.cen-table thead th {
  color: var(--c-muted);
  font-size: var(--fs-sm);
  font-weight: 650;
  border-bottom-color: var(--c-line-strong);
}
.cen-table td.cen-num,
.cen-table th.cen-num {
  text-align: right;
}

/* ------------------------------------------------------------------ badges, state pill, notices, toast */
.cen-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  max-width: 100%;
  padding: 2px var(--sp-2);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
}
.cen-badge[data-tipo="prevalidacion"],
.cen-badge[data-tipo="pendiente"] {
  border-color: var(--c-warn-line);
  background: var(--c-warn-soft);
  color: var(--c-warn);
}
.cen-badge[data-tipo="info"] {
  border-color: var(--c-info-line);
  background: var(--c-info-soft);
  color: var(--c-info);
}
.cen-badge[data-tipo="error"] {
  border-color: var(--c-danger-line);
  background: var(--c-danger-soft);
  color: var(--c-danger);
}
.cen-estado {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 28px;
  padding: 2px var(--sp-3) 2px var(--sp-2);
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line-strong);
  background: var(--c-surface);
  color: var(--c-ink-2);
  font-size: var(--fs-sm);
  font-weight: 650;
  white-space: nowrap;
}
.cen-estado::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--c-line-strong);
}
.cen-estado[data-estado="vigente"] {
  border-color: var(--c-accent);
  color: var(--c-ok);
}
.cen-estado[data-estado="vigente"]::before {
  background: var(--c-ok);
}
.cen-estado[data-estado="calculando"]::before,
.cen-estado[data-estado="cargando"]::before {
  background: var(--c-info);
  animation: cen-pulso 1s var(--ease) infinite alternate;
}
.cen-estado[data-estado="desactualizado"],
.cen-estado[data-estado="sin_motor"],
.cen-estado[data-estado="solo_configuracion"] {
  border-color: var(--c-warn-line);
  background: var(--c-warn-soft);
  color: var(--c-warn);
}
.cen-estado[data-estado="desactualizado"]::before,
.cen-estado[data-estado="sin_motor"]::before,
.cen-estado[data-estado="solo_configuracion"]::before {
  background: var(--c-warn);
}
.cen-estado[data-estado="incompleto"] {
  border-color: var(--c-info-line);
  background: var(--c-info-soft);
  color: var(--c-info);
}
.cen-estado[data-estado="incompleto"]::before {
  background: var(--c-info);
}
.cen-estado[data-estado="error"] {
  border-color: var(--c-danger-line);
  background: var(--c-danger-soft);
  color: var(--c-danger);
}
.cen-estado[data-estado="error"]::before {
  background: var(--c-danger);
}
@keyframes cen-pulso {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cen-estado[data-estado="calculando"]::before,
  .cen-estado[data-estado="cargando"]::before {
    animation: none;
  }
}
.cen-aviso {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-line-strong);
  border-left-width: 4px;
  border-radius: var(--r-2);
  background: var(--c-surface);
  color: var(--c-ink);
}
.cen-aviso p,
.cen-aviso ul {
  margin: 0;
}
.cen-aviso .cen-num {
  overflow-wrap: anywhere;
}
.cen-aviso ul {
  flex-basis: 100%;
  padding-left: var(--sp-5);
  font-size: var(--fs-md);
}
.cen-aviso[data-tipo="stale"],
.cen-aviso[data-tipo="pendiente"] {
  border-color: var(--c-warn-line);
  border-left-color: var(--c-warn);
  background: var(--c-stale-soft);
}
.cen-aviso[data-tipo="error"] {
  border-color: var(--c-danger-line);
  border-left-color: var(--c-danger);
  background: var(--c-danger-soft);
}
.cen-aviso[data-tipo="info"] {
  border-color: var(--c-info-line);
  border-left-color: var(--c-info);
  background: var(--c-info-soft);
}
.cen-toast {
  position: fixed;
  left: 50%;
  bottom: max(var(--sp-4), env(safe-area-inset-bottom));
  z-index: 60;
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter));
  transform: translateX(-50%);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-2);
  background: var(--c-ink);
  color: #fff;
  box-shadow: var(--sh-3);
  font-size: var(--fs-md);
}

/* ------------------------------------------------------------------ workspace shell */
/* scroll-padding follows the sticky step bar (espacio.js writes --ws-barra-h on <html> while a project is open),
   so focused or scrolled-to controls never sit under .ws-barra in either visual direction. */
html {
  scroll-padding-top: calc(var(--ws-barra-h, 0px) + var(--sp-2));
}
.ws {
  --ws-pad: clamp(var(--gutter), 3vw, var(--sp-7));
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--ws-pad) var(--sp-7);
  min-width: 0;
}
/* The band: the home hero's language in one compact strip (≈ 80 px at 1440 × 900) — UC dark blue with the hero's
   gradient towards the right, breadcrumb «Inicio / Calculadoras / <ACV|Térmica>», the project name in white Roboto
   Slab and the yellow rule. It bleeds to the window edges like the hero (box-shadow + clip-path: no scroll overflow)
   and carries no controls; only a failed save adds one line. `.ws-head` stays as its class: renderers measure it. */
.ws-banda {
  position: relative;
  z-index: 35; /* the «Calculadoras» menu opens over the sticky step bar (30) below */
  isolation: isolate;
  margin: 0 calc(-1 * var(--ws-pad));
  padding: 12px var(--ws-pad) 16px;
  color: #fff;
}
/* the dark fill and its bleed live on a layer of their own, so the clip that stops the bleed from scrolling
 * never clips the breadcrumb's menu */
.ws-banda::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--uc-azul-osc);
  background-image:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.045) 0 1px, transparent 1px 22px),
    linear-gradient(90deg, #03122e 0%, #03122e 46%, #0a2552 78%, #0f3167 100%);
  background-size: 42% 100%, 100% 100%;
  background-position: right top, left top;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 100vmax var(--uc-azul-osc);
  clip-path: inset(0 -100vmax);
}
/* the yellow rule (the hero's h1::after), on the band's bottom edge so it costs no height */
.ws-banda::after {
  content: "";
  position: absolute;
  left: var(--ws-pad);
  bottom: 0;
  width: 72px;
  height: 4px;
  background: var(--uc-amarillo);
}
.ws-banda-in {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ws-bread {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--sp-2);
  min-width: 0;
  color: #b9c6da;
  font-size: var(--fs-sm);
  line-height: 18px;
}
/* a full-size target without growing the line: the link's box overlaps the band's padding */
.ws-bread a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  margin-block: calc((var(--tap-min) - 18px) / -2);
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.ws-bread a:hover {
  color: var(--uc-amarillo);
}
/* «Calculadoras ▾» in the breadcrumb: calculators, each with its two directions to the right */
.ws-bm {
  position: relative;
  display: inline-flex;
}
.ws-bm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-min);
  margin-block: calc((var(--tap-min) - 18px) / -2);
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.ws-bm-btn:hover,
.ws-bm-btn[aria-expanded="true"] {
  color: var(--uc-amarillo);
}
.ws-bm-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform var(--t-fast, 120ms) ease;
}
.ws-bm-btn[aria-expanded="true"] .ws-bm-caret {
  transform: rotate(180deg);
}
.ws-bm-l,
.ws-bm-sub {
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  color: var(--c-ink, #1b1b1b);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgb(3 18 46 / 0.22), 0 2px 6px rgb(3 18 46 / 0.12);
}
.ws-bm-l {
  position: absolute;
  top: calc(100% + 10px);
  left: -6px;
  z-index: 40;
  width: 18rem;
}
.ws-bm-l::before {
  /* hover bridge between the button and the menu */
  content: "";
  position: absolute;
  inset: -12px 0 auto;
  height: 12px;
}
.ws-bm-i {
  position: relative;
}
.ws-bm-c,
.ws-bm-v {
  display: grid;
  width: 100%;
  min-height: var(--tap-min);
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
/* the breadcrumb's own link styles (white, underlined, inline-flex) must not reach the menu's links */
.ws-bread .ws-bm-v,
.ws-bread .ws-bm-v:hover {
  display: grid;
  margin: 0;
  color: inherit;
  text-decoration: none;
}
.ws-bm-c {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
}
.ws-bm-c span:first-child,
.ws-bm-v span {
  color: var(--uc-azul-osc, #03122e);
  font-weight: 700;
}
.ws-bm-c small,
.ws-bm-v small {
  color: var(--c-muted, #5c6670);
  font-size: var(--fs-xs);
}
.ws-bm-c small {
  grid-row: 2;
}
.ws-bm-flecha {
  grid-row: 1 / 3;
  grid-column: 2;
  color: var(--c-muted, #5c6670);
  font-size: 18px;
}
.ws-bm-i[data-abierto] > .ws-bm-c,
.ws-bm-c:hover,
.ws-bm-v:hover,
.ws-bm-v:focus-visible {
  background: var(--uc-gris-b);
}
.ws-bm-v[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--uc-amarillo);
}
.ws-bm-sub {
  position: absolute;
  top: -6px;
  left: calc(100% + 6px);
  width: 13rem;
  visibility: hidden;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s 120ms;
}
.ws-bm-sub::before {
  /* hover bridge to the right */
  content: "";
  position: absolute;
  inset: 0 100% 0 auto;
  width: 12px;
}
.ws-bm-i[data-abierto] > .ws-bm-sub {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 120ms ease, transform 120ms ease;
}
.ws-bm :focus-visible {
  outline: 2px solid var(--uc-azul, #173f8a);
  outline-offset: 1px;
}
/* phones: no room to the right, the two directions sit under their calculator */
@media (max-width: 599px) {
  .ws-bm-l {
    width: min(18rem, calc(100vw - 2 * var(--ws-pad)));
  }
  .ws-bm-flecha {
    display: none;
  }
  .ws-bm-sub {
    position: static;
    width: auto;
    padding: 0 0 4px 10px;
    visibility: visible;
    opacity: 1;
    transform: none;
    box-shadow: none;
  }
  .ws-bm-sub::before {
    display: none;
  }
  .ws-bm-v {
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    align-items: baseline;
  }
}
.ws-kicker {
  color: #fff;
  font-weight: 700;
}
.ws-h1 {
  margin: 0;
  font-family: var(--uc-font-slab);
  font-weight: 700;
  font-size: clamp(22px, 0.8vw + 15px, 28px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #fff;
  overflow-wrap: anywhere;
}
.ws-banda :focus-visible {
  outline-color: var(--uc-amarillo);
}
.ws-h1:focus {
  outline: none;
}
.ws-h1:focus-visible {
  outline: 3px solid var(--uc-amarillo);
  outline-offset: 2px;
}
/* only when saving FAILED (or another tab changed the project): the message and its recovery actions */
.ws-guardado-fallo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--sp-3);
  margin: var(--sp-1) 0 0;
  font-size: var(--fs-sm);
}
.ws-guardado-fallo[hidden] {
  display: none;
}
.ws-guardado {
  color: var(--uc-amarillo);
  font-weight: 700;
}
.ws-guardado-acciones {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}
.ws-banda .cen-btn--texto {
  color: #fff;
}
.ws-banda .cen-btn--texto:hover {
  color: var(--uc-amarillo);
}
/* UC's PDA coverage question (shown by the shell when the renderer does not show it). */
.ws-pda {
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-5);
  margin: 0 0 var(--sp-4);
}
.ws-pda-texto {
  flex: 1 1 320px;
  min-width: 0;
}
.ws-pda-campo {
  flex: 0 1 340px;
  min-width: min(100%, 240px);
  margin: 0;
}
.ws-barra {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  margin: 0 calc(-1 * var(--ws-pad)) var(--sp-4);
  padding: 6px var(--ws-pad);
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
  box-shadow: var(--uc-sombra);
  backdrop-filter: blur(6px);
}
/* The bar's own controls are always on screen (it is sticky): without this, html's scroll-padding-top counts a focused
   control in the bar as hidden under the bar, and focusing it (Tab, or a tap that focuses) scrolled the page up by
   about the bar's height — in Formal the scroll-spy then marked the previous section and ‹ › stood still. */
.ws-barra :is(button, select, input, textarea, summary, a[href], [tabindex]) {
  scroll-margin-top: calc(-1 * (var(--ws-barra-h, 0px) + var(--sp-2)));
}
.ws-pasos {
  min-width: 0;
  flex: 1 1 auto;
}
.ws-pasos-lista {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ws-pasos-lista button {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-3) 0 var(--sp-2);
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--c-ink-2);
  font-size: var(--fs-md);
  font-weight: 600;
}
.ws-pasos-lista button:hover {
  background: var(--c-sunken);
}
.ws-paso-n {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--c-line-strong);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.ws-pasos-lista button[aria-current="step"] {
  background: var(--c-surface);
  border-color: var(--c-accent);
  color: var(--c-accent-text);
}
.ws-pasos-lista button[aria-current="step"] .ws-paso-n {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-ink);
}
.ws-pasos-movil {
  display: none;
}
.ws-calc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.ws-historial {
  display: inline-flex;
}
.ws-aviso {
  margin: 0 0 var(--sp-4);
}
/* No scroll-margin here: <html>'s scroll-padding-top already reserves the sticky bar, and the two add up — the
   shell's step scroll then stopped one bar too early, leaving a strip of the header above the stepper (phones). */
.ws-render {
  min-width: 0;
}
.ws-missing {
  max-width: 720px;
}

/* ------------------------------------------------------------------ fallback renderer (vista-base.js) */
.pb-estado {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  margin: var(--sp-2) 0 var(--sp-4);
}
.pb-stale {
  color: var(--c-warn);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.pb-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--sp-3) var(--sp-4);
  margin: var(--sp-3) 0;
}
.pb-nota,
.pb-orden,
.pb-pie {
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
.pb-pendiente {
  display: block;
  margin-top: var(--sp-1);
  color: var(--c-warn);
  font-size: var(--fs-sm);
}
.pb-conclusion {
  padding: var(--sp-3) var(--sp-4);
  border-left: 4px solid var(--c-warn);
  background: var(--c-warn-soft);
}
.pb-check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  font-size: var(--fs-md);
}
.pb-num {
  width: 9ch !important;
  text-align: right;
}
.pb-unit {
  width: 7ch !important;
}
.pb-capas select,
.pb-filas select {
  min-width: 14ch;
}
.pb-acciones,
.pb-archivos {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}
.pb-archivos {
  margin-top: var(--sp-4);
}
.pb-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}
.pb-body {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}
.pb-body > section,
.pb-body section section {
  min-width: 0;
}

/* ------------------------------------------------------------------ tablets ≤ 1024 */
@media (max-width: 1024px) {
  .ws-pasos-lista button {
    padding: 0 var(--sp-2) 0 var(--sp-1);
    font-size: var(--fs-sm);
  }
}

/* narrow tablets: the step list keeps the current step's label; the others show their number (the label stays for
   assistive technology), so the list, the calculation chip and undo/redo fit on one row */
@media (min-width: 601px) and (max-width: 900px) {
  .ws-pasos-lista button:not([aria-current="step"]) .ws-paso-l {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .ws-pasos-lista button:not([aria-current="step"]) {
    padding: 0 var(--sp-2);
  }
}

/* ------------------------------------------------------------------ phones ≤ 600 */
@media (max-width: 600px) {
  :root {
    --fs-base: 15px;
  }
  .uc-strip-in {
    justify-content: center;
    min-height: 38px;
    padding-inline: var(--gutter);
  }
  .mast-inner {
    gap: var(--sp-3);
    min-height: 60px;
    padding: var(--sp-2) var(--gutter);
  }
  .brand {
    gap: var(--sp-3);
  }
  .brand-uc {
    height: 19px;
  }
  .brand-centro {
    font-size: var(--fs-md);
  }
  .brand-sub {
    font-size: var(--fs-xs);
    letter-spacing: 0.03em;
  }
  .mast-burger-txt {
    display: none;
  }
  .mast-burger {
    padding-inline: var(--sp-2);
    min-width: var(--tap);
    justify-content: center;
  }
  .uc-footer-in {
    gap: var(--sp-6);
    padding: var(--sp-7) var(--gutter) var(--sp-5);
  }
  .uc-footer-cols {
    gap: var(--sp-5) var(--sp-7);
  }
  [data-ruta="espacio"] .mast-inner {
    min-height: 52px;
    padding-inline: var(--gutter);
  }
  [data-ruta="espacio"] .brand-centro {
    font-size: var(--fs-sm);
  }
  [data-ruta="espacio"] .brand-sub {
    display: none;
  }
  .cen-page {
    padding: var(--sp-5) var(--gutter);
  }
  .ws {
    --ws-pad: var(--gutter);
  }
  /* phones: a compact band (≈ 64 px) */
  .ws-banda {
    padding: 10px var(--ws-pad) 14px;
  }
  .ws-banda::after {
    width: 56px;
  }
  .ws-bread {
    font-size: var(--fs-xs);
    line-height: 16px;
  }
  .ws-bread a {
    margin-block: calc((var(--tap-min) - 16px) / -2);
  }
  /* a long project name keeps the band at two lines at most (the full name is in the page title and ctx) */
  .ws-h1 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 20px;
  }
  .ws-paso-sel select {
    padding-left: var(--sp-2);
    padding-right: var(--sp-5);
  }
  .ws-pasos-lista {
    display: none;
  }
  .ws-pasos-movil {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    min-width: 0;
  }
  .ws-paso-sel {
    flex: 1 1 auto;
    min-width: 0;
  }
  .ws-paso-sel select {
    min-height: var(--tap);
    font-weight: 650;
  }
  .ws-paso-mover {
    flex: none;
    width: var(--tap);
    padding: 0;
    font-size: var(--fs-xl);
  }
  .ws-barra {
    flex-wrap: nowrap;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--ws-pad);
  }
  .ws-pasos {
    flex: 1 1 auto;
  }
  .ws-calc {
    flex: none;
  }
  .ws-calcular,
  .ws-historial,
  .ws-estado-el {
    display: none !important;
  }
  .cen-estado {
    padding-right: var(--sp-2);
  }
  /* stacked tables: each row becomes a card of label/value pairs */
  .cen-table-wrap {
    overflow-x: visible;
  }
  .cen-table:not(.pf-kv) thead {
    display: none;
  }
  .cen-table:not(.pf-kv) tr {
    display: block;
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--c-line);
  }
  .cen-table:not(.pf-kv) td {
    display: grid;
    grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
    gap: var(--sp-2);
    padding: var(--sp-1) 0;
    border: 0;
    text-align: left;
  }
  .cen-table:not(.pf-kv) td::before {
    content: attr(data-label);
    color: var(--c-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
  }
  .cen-table td > * {
    min-width: 0;
  }
  .pb-num,
  .pb-unit {
    width: 100% !important;
  }
  .pb-capas select,
  .pb-filas select {
    min-width: 0;
  }
}

/* ------------------------------------------------------------------ print (directions add their own) */
@media print {
  .skip,
  .uc-strip,
  .mast,
  .navbar,
  .navbar-backdrop,
  .footer,
  .ws-barra,
  .ws-guardado-fallo,
  .ws-pda-campo,
  .cen-toast,
  .pb-nav,
  .pb-archivos {
    display: none !important;
  }
  body {
    background: #fff;
  }
}

/* print: the band is the memoria's plain heading (no dark fill, no bleed) */
@media print {
  .ws-banda {
    margin: 0;
    padding: 0 0 var(--sp-2);
    color: #000;
  }
  .ws-banda::before,
  .ws-bm-caret,
  .ws-bm-l {
    display: none !important;
  }
  .ws-bm-btn {
    color: #000 !important;
  }
  .ws-banda::after {
    left: 0;
  }
  .ws-bread,
  .ws-bread a,
  .ws-kicker,
  .ws-h1 {
    color: #000;
  }
}

/* narrow phones: the sticky chip keeps its colour dot; the state text stays for assistive technology
   (and in the notice and next to the results), so the step selector keeps its full label. */
@media (max-width: 400px) {
  .ws-calc .cen-estado {
    position: relative;
    padding: 0;
    width: 28px;
    justify-content: center;
    border-radius: 50%;
  }
  .ws-calc .cen-estado [data-ws-estado-txt] {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .ws-calc .cen-estado::before {
    width: 12px;
    height: 12px;
  }
}
