:root {
  --paper: #fbf1e2;
  --paper-2: #f6e8d4;
  --surface: #fffdf8;
  --surface-2: #fff7ea;
  --ink: #271b12;
  --muted: #85705c;
  --line: #ecdcc0;
  --line-soft: #f2e5cd;

  --accent: #e8623f;
  --accent-2: #ff8f66;
  --accent-ink: #fff6ef;
  --accent-soft: #fde2d4;

  --teal: #0f4c4a;
  --teal-2: #1a716b;
  --teal-soft: #dcede9;

  --ok: #2f7a4f;
  --ok-soft: #e2f2e5;
  --warn: #c77d1a;
  --warn-soft: #fbecd3;
  --bad: #c2432e;
  --bad-soft: #fbdfd6;

  --display: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", system-ui, sans-serif;
  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Concentric radius scale: an inner element's radius is its container's
     radius minus the padding between them, never independently larger.
     In rem so radii grow with the fluid root font-size on large screens. */
  --r-xl: 1.875rem;
  --r-lg: 1.5rem;
  --r-md: 1.125rem;
  --r-sm: 0.75rem;
  --r-xs: 0.5rem;
  --r-pill: 999px;

  /* Fluid container system: gutter scales with viewport, maxw caps only
     on ultra-wide screens so there are no large empty side gutters. */
  --gutter: clamp(16px, 3.5vw, 72px);
  --maxw: 2400px;

  /* Motion: spring-like, interruptible easing. --ease-spring carries a touch
     of overshoot for momentum-driven feedback (press, hover-lift); --ease-snappy
     is the critically-damped default for state changes (route swaps, toggles). */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-snappy: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;

  --sh-xs: 0 1px 1px rgba(39, 27, 18, .06);
  --sh-sm: 0 1px 2px rgba(39, 27, 18, .06), 0 1px 1px rgba(39, 27, 18, .04);
  --sh-md: 0 10px 22px -12px rgba(39, 27, 18, .16), 0 3px 8px -4px rgba(39, 27, 18, .08), inset 0 1px 0 rgba(255, 255, 255, .5);
  --sh-lg: 0 24px 48px -20px rgba(39, 27, 18, .22), 0 8px 20px -10px rgba(39, 27, 18, .13), inset 0 1px 0 rgba(255, 255, 255, .4);
  --sh-hover: 0 30px 56px -20px rgba(39, 27, 18, .26), 0 12px 24px -12px rgba(39, 27, 18, .16);
  --img-outline: rgba(39, 27, 18, .12);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #17110c; --paper-2: #1d150e; --surface: #221912; --surface-2: #2a1f16;
    --ink: #f6ead9; --muted: #c2ab93; --line: #3a2c1e; --line-soft: #2e2317;
    --accent: #ff8b62; --accent-2: #ffab84; --accent-ink: #22140d; --accent-soft: #3a2418;
    --teal: #6fc7bd; --teal-2: #8ed8cf; --teal-soft: #1c3532;
    --ok: #7ed19a; --ok-soft: #1c3324; --warn: #f0b559; --warn-soft: #3a2b12; --bad: #f0917d; --bad-soft: #3d2019;
    --sh-md: 0 10px 24px -10px rgba(0, 0, 0, .5), 0 3px 8px -3px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .04);
    --sh-lg: 0 26px 52px -18px rgba(0, 0, 0, .6), 0 10px 22px -8px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .04);
    --sh-hover: 0 34px 64px -18px rgba(0, 0, 0, .65), 0 14px 28px -10px rgba(0, 0, 0, .5);
    --img-outline: rgba(255, 255, 255, .12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #17110c; --paper-2: #1d150e; --surface: #221912; --surface-2: #2a1f16;
  --ink: #f6ead9; --muted: #c2ab93; --line: #3a2c1e; --line-soft: #2e2317;
  --accent: #ff8b62; --accent-2: #ffab84; --accent-ink: #22140d; --accent-soft: #3a2418;
  --teal: #6fc7bd; --teal-2: #8ed8cf; --teal-soft: #1c3532;
  --ok: #7ed19a; --ok-soft: #1c3324; --warn: #f0b559; --warn-soft: #3a2b12; --bad: #f0917d; --bad-soft: #3d2019;
  --sh-md: 0 10px 24px -10px rgba(0, 0, 0, .5), 0 3px 8px -3px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .04);
  --sh-lg: 0 26px 52px -18px rgba(0, 0, 0, .6), 0 10px 22px -8px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .04);
  --sh-hover: 0 34px 64px -18px rgba(0, 0, 0, .65), 0 14px 28px -10px rgba(0, 0, 0, .5);
  --img-outline: rgba(255, 255, 255, .12);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden; max-width: 100%;
  /* Fluid root scale: text, spacing and radii (in rem) grow from phones to TVs. */
  font-size: clamp(15px, 0.35vw + 11px, 22px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
body {
  background:
    radial-gradient(760px 420px at 92% -6%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(640px 380px at -8% 12%, color-mix(in srgb, var(--teal) 14%, transparent), transparent 60%),
    var(--paper);
  color: var(--ink); font: 0.97rem/1.6 var(--sans);
  margin: 0; overflow-x: hidden;
  min-height: 100dvh; display: flex; flex-direction: column;
}
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); display: grid; gap: 1.375rem; min-width: 0; }
.wrap > * { min-width: 0; }
.layout > * { min-width: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; text-wrap: balance; margin: 0; line-height: 1.14; font-optical-sizing: auto; }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); letter-spacing: -0.03em; }
h2 { font-size: 1.35rem; letter-spacing: -0.016em; }
h3 { font-size: 1.04rem; font-weight: 700; letter-spacing: -0.008em; }
p { margin: 0; }
p.prose, .aside-note.prose { text-wrap: pretty; }
a { color: var(--accent); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.aside-note { color: var(--muted); font-size: 0.85rem; }
.prose { max-width: 65ch; }
.notice { border: 1.5px dashed color-mix(in srgb, var(--warn) 55%, transparent); background: var(--warn-soft); color: var(--ink); padding: 12px 16px; border-radius: var(--r-md); font-size: 0.88rem; box-shadow: var(--sh-sm); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0; z-index: 80; text-decoration: none; font-weight: 700; }
.skip-link:focus-visible { left: 0; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm);
}

/* header / nav — translucent material: content scrolls under, hairline edge */
.site-header {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: 0 12px 24px -22px rgba(39, 27, 18, .3);
}
.nav-inner { width: 100%; max-width: var(--maxw); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 0.75rem; padding-inline: var(--gutter); flex-wrap: wrap; }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.28rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(135deg, var(--accent), var(--teal)); box-shadow: var(--sh-sm); transform: rotate(6deg); }
.nav-controls { display: flex; align-items: center; gap: 8px; order: 2; }
nav.primary { order: 3; flex-basis: 100%; }
@media (min-width: 761px) { nav.primary { order: 1; flex-basis: auto; flex: 1; } .nav-controls { order: 2; } }
.navlinks { display: flex; gap: 4px; flex-wrap: wrap; list-style: none; margin: 0; padding: 6px; background: var(--paper-2); border-radius: var(--r-pill); width: fit-content; }
@media (max-width: 760px) { .navlinks { width: 100%; border-radius: var(--r-md); } }
.navlinks a {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: 14px; border-radius: var(--r-pill);
  color: var(--muted); font-weight: 600; font-size: 0.9rem; text-decoration: none;
  transition-property: color, background-color, box-shadow; transition-duration: var(--dur-base); transition-timing-function: var(--ease-snappy);
}
.navlinks a:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.navlinks a.active { color: var(--accent-ink); background: var(--accent); box-shadow: var(--sh-sm); }
.menu-btn, .theme-btn { font: inherit; font-size: 0.85rem; font-weight: 700; padding: 9px 14px; border-radius: var(--r-pill); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition-property: transform, box-shadow, border-color; transition-duration: var(--dur-base); transition-timing-function: var(--ease-spring); min-height: 44px; }
.menu-btn:hover, .theme-btn:hover { border-color: var(--accent); box-shadow: var(--sh-sm); }
.menu-btn:active, .theme-btn:active { transform: scale(0.97); transition-duration: var(--dur-fast); }
.menu-btn { display: none; }
@media (max-width: 760px) {
  .navlinks { flex-direction: column; padding: 6px; display: none; gap: 2px; }
  .navlinks.open { display: flex; }
  .navlinks a { border-radius: var(--r-sm); }
  .menu-btn { display: inline-block; }
  .nav-controls { flex-basis: 100%; justify-content: flex-end; }
}

main.wrap { padding-block: 26px 72px; flex: 1 0 auto; }

/* hero — bento tile */
.hero {
  display: grid; gap: 1rem; padding: 1.875rem clamp(1.25rem, 4vw, 2.5rem);
  background:
    radial-gradient(420px 220px at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    linear-gradient(155deg, var(--surface), var(--surface-2));
  border-radius: var(--r-xl); box-shadow: var(--sh-lg); border: 1px solid var(--line-soft);
}
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); }
.filters { display: flex; flex-wrap: wrap; gap: 0.875rem 0.75rem; align-items: flex-end; }
.filters > div { display: grid; gap: 0.375rem; min-width: 0; flex: 1 1 11rem; }
.filters > div:has(.segmented) { flex: 2 1 20rem; }
.filters > div:has(> .cta) { flex: 0 0 auto; }
.filters .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
select, input[type="number"], input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="date"], textarea {
  font: inherit; padding: 11px 14px; min-height: 44px; border-radius: var(--r-pill); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); width: 100%; box-shadow: var(--sh-xs);
  transition-property: border-color, box-shadow; transition-duration: var(--dur-base); transition-timing-function: var(--ease-snappy);
  appearance: none;
}
textarea { border-radius: var(--r-md); }
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'><path d='M5 8l5 5 5-5' stroke='%2385705c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 0.875rem center; background-size: 1rem 1rem; padding-right: 2.75rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
select:hover, input:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
select:focus-visible, input:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); outline: none; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 44px; display: flex; align-items: center; }
textarea { min-height: 108px; resize: vertical; border-radius: var(--r-md); }

/* steps bento — 1 → 2 → 4 columns; auto-fit collapses unused tracks so 4
   items never spread past 4 columns even on very wide screens. */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 0.875rem; }
.step {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 1.125rem; min-width: 0;
  display: grid; gap: 8px; box-shadow: var(--sh-md); position: relative; overflow: hidden;
  transition-property: transform, box-shadow; transition-duration: var(--dur-base); transition-timing-function: var(--ease-spring);
}
.step::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.step:hover { transform: translateY(-3px); box-shadow: var(--sh-hover); }
.step:nth-child(4n+2)::after { background: color-mix(in srgb, var(--teal) 16%, transparent); }
.step h3 { position: relative; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr)); gap: 1.125rem; }
.listing-card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); overflow: hidden;
  display: block; text-decoration: none; color: var(--ink); min-width: 0; box-shadow: var(--sh-md);
  transition-property: transform, box-shadow, border-color; transition-duration: var(--dur-base); transition-timing-function: var(--ease-spring);
}
.listing-card:hover, .listing-card:focus-visible { border-color: var(--accent); transform: translateY(-4px); box-shadow: var(--sh-hover); }
.listing-thumb { aspect-ratio: 16 / 10; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; font-size: 0.85rem; background-color: var(--paper-2); outline: 1px solid var(--img-outline); outline-offset: -1px; }
img.listing-thumb { display: block; width: 100%; height: auto; object-fit: cover; }
.listing-thumb.placeholder { background-image: repeating-linear-gradient(135deg, var(--paper-2), var(--paper-2) 10px, var(--line) 10px, var(--line) 11px); }
.listing-thumb.placeholder span { padding: 4px 12px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--sh-xs); font-size: 0.78rem; }
.listing-body { padding: 1rem; display: grid; gap: 9px; }
.listing-body h3 { font-size: 1.05rem; }
.mini-figures { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; color: var(--muted); font-size: 0.82rem; }
.mini-figures > span { min-width: 0; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.check-list { margin: 0; padding-left: 1.1em; display: grid; gap: 8px; max-width: 65ch; }

header.top { display: grid; gap: 12px; padding-block: 4px 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 0.9rem; }
.meta span b { color: var(--ink); font-weight: 600; }
.breadcrumb { font-size: 0.85rem; color: var(--muted); }
.breadcrumb a { color: var(--accent); font-weight: 600; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(20rem, 26vw, 30rem); gap: 1.375rem; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
main.ficha-main { display: grid; gap: 1.25rem; min-width: 0; }
section.block {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-xl); padding: clamp(1.125rem, 3vw, 1.625rem);
  display: grid; gap: 1rem; min-width: 0; box-shadow: var(--sh-md);
}
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.summary ul { margin: 0; padding-left: 1.1em; display: grid; gap: 5px; max-width: 65ch; }

/* figures — bento stat tiles */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 0.75rem; }
.figure {
  display: grid; gap: 3px; padding: 14px 16px; border-radius: var(--r-md); min-width: 0;
  background: linear-gradient(160deg, var(--surface-2), var(--paper-2)); border: 1px solid var(--line-soft); box-shadow: var(--sh-xs);
}
.figure:nth-child(4n+1) { background: linear-gradient(160deg, var(--accent-soft), var(--surface-2)); }
.figure:nth-child(4n+3) { background: linear-gradient(160deg, var(--teal-soft), var(--surface-2)); }
.figure .v { font-size: 1.28rem; font-weight: 800; font-variant-numeric: tabular-nums; font-family: var(--display); }

/* cost table styled as a grouped inset list: rounded container, hairline
   row dividers inset from the edges, no heavy borders */
.table-scroll { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line-soft); background: var(--surface-2); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 480px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--surface-2); }
td.amt, th.amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-family: var(--mono); }
tbody tr { background: var(--surface); transition: background var(--dur-fast) var(--ease-snappy); }
tr:hover td { background: var(--paper-2); }
tr:last-child td { border-bottom: 0; }
tr.total td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 700; padding-top: 14px; background: var(--surface-2); }
.src { font-size: 0.8rem; color: var(--muted); display: block; }

/* pills — flat tonal status chips (confirmado / recuperable / estimado / en disputa) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--r-pill); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.bad { color: var(--bad); background: var(--bad-soft); }
.pill.neutral { color: var(--muted); background: var(--paper-2); }

.risk-list { display: grid; gap: 10px; }
.risk { display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: start; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-soft); min-width: 0; }
.risk p { min-width: 0; overflow-wrap: anywhere; }
.risk:has(.pill.bad) { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.risk:has(.pill.warn) { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.risk:has(.pill.ok) { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
@media (max-width: 520px) { .risk { grid-template-columns: 1fr; gap: 6px; } }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 12px 4px; border-bottom: 1px dashed var(--line); min-width: 0; }
.timeline li:last-child { border-bottom: 0; }
.timeline li p { min-width: 0; }
.timeline .when { font-family: var(--mono); font-size: 0.82rem; color: var(--accent); font-weight: 600; }
@media (max-width: 560px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .two { grid-template-columns: 1fr; } }
.two > div { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 14px 16px; min-width: 0; }
.two ul { margin: 6px 0 0; padding-left: 1.1em; display: grid; gap: 5px; }

aside.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 84px); display: grid; gap: 1rem; min-width: 0; }
@media (max-width: 960px) { aside.side { position: static; } }
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-xl); padding: 1.25rem; display: grid; gap: 13px; box-shadow: var(--sh-lg); min-width: 0; }
.card.verdict { background: linear-gradient(160deg, var(--accent-soft), var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--line-soft)); }
.verdict .big { font-family: var(--display); font-size: 1.35rem; font-weight: 800; color: var(--accent); }

.bid { display: grid; gap: 9px; }
.bid-value { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; font-family: var(--display); }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 44px; padding-block: 18px; border-radius: var(--r-pill); background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent), var(--teal)); box-shadow: var(--sh-xs); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent), var(--teal)); box-shadow: var(--sh-xs); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; margin-top: -8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--accent); box-shadow: var(--sh-md); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 4px solid var(--accent);
  box-shadow: var(--sh-md); cursor: pointer; transition: transform var(--dur-fast) var(--ease-spring);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:active::-moz-range-thumb { transform: scale(1.12); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--sh-md), var(--focus-ring); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: var(--sh-md), var(--focus-ring); }

/* grouped inset list — iOS Settings style rows for the bid breakdown */
/* Row rules (`.rows > div`, `.amt`) live in the ficha section below: the mock-up's `.rows div span:last-child`
   would force monospace/nowrap on every value and is superseded there. */
.rows { display: grid; font-size: 0.9rem; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
.rows .strong { font-weight: 700; border-top: 1px dashed var(--line); background: var(--surface); }
.saving { color: var(--ok); font-weight: 700; }

/* buttons — hierarchy: primary filled (.cta), secondary tinted (.cta.secondary),
   tertiary plain (.cta.text, .menu-btn, .theme-btn). Flat fills, no loud gradients. */
.cta {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; text-align: center;
  padding: 12px 18px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 0.96rem;
  border: 0; cursor: pointer; font-family: var(--sans); text-decoration: none; box-shadow: var(--sh-md);
  transition-property: transform, box-shadow, background-color; transition-duration: var(--dur-base); transition-timing-function: var(--ease-spring);
}
.cta:hover { box-shadow: var(--sh-hover); background: color-mix(in srgb, var(--accent) 92%, black); }
.cta:active { transform: scale(0.97); transition-duration: var(--dur-fast); }
.cta.secondary {
  background: var(--accent-soft); color: var(--accent); box-shadow: none; border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.cta.secondary:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent) 8%); box-shadow: none; }
.cta-note { font-size: 0.8rem; color: var(--muted); }

/* pagination — prev / numbered pills / next; wraps on phones, no fixed width */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 0.75rem; margin-top: 1.75rem; }
.pagination .cta { width: auto; min-width: 7rem; }
.cta.is-disabled { opacity: 0.45; pointer-events: none; cursor: default; }
.pagination-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.375rem; list-style: none; margin: 0; padding: 0; }
.page-link { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding-inline: 12px; border-radius: var(--r-pill); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 0.9rem; font-variant-numeric: tabular-nums; text-decoration: none; transition-property: border-color, background-color, transform; transition-duration: var(--dur-base); transition-timing-function: var(--ease-snappy); }
.page-link:hover { border-color: var(--accent); }
.page-link:active { transform: scale(0.97); transition-duration: var(--dur-fast); }
.page-link[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pagination-gap { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; color: var(--muted); }
.form-grid { display: grid; gap: 1.25rem; }
.field { display: grid; gap: 0.375rem; min-width: 0; }
.field textarea { min-height: 8rem; resize: vertical; }
.field-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); gap: 1rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.form-actions .cta { width: auto; min-width: 12rem; padding-inline: 1.75rem; }
@media (max-width: 640px) { .form-actions .cta { width: 100%; } }
.cta-done { font-size: 0.88rem; color: var(--ok); font-weight: 600; }

.gallery { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 10px; aspect-ratio: 16 / 8; max-width: 100%; }
.gallery figure { margin: 0; position: relative; overflow: hidden; border-radius: var(--r-md); background: var(--line); min-width: 0; }
.gallery figure:first-child { grid-row: 1 / span 3; border-radius: var(--r-lg); }
.gallery img, .gallery .listing-thumb { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--dur-base) var(--ease-snappy); }
.gallery img { outline: 1px solid var(--img-outline); outline-offset: -1px; }
.gallery figure:hover img { transform: scale(1.05); }
.gallery figcaption { position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: var(--r-pill); background: rgba(23, 17, 12, 0.72); color: #fbf1e2; font-size: 0.75rem; font-weight: 600; }
@media (max-width: 620px) {
  .gallery { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto auto; aspect-ratio: auto; }
  .gallery figure:first-child { grid-row: auto; grid-column: 1 / -1; aspect-ratio: 4 / 3; }
  .gallery figure:not(:first-child) { aspect-ratio: 1 / 1; }
}
.credits { font-size: 0.75rem; color: var(--muted); }
.map-frame { width: 100%; aspect-ratio: 16 / 9; max-width: 100%; border: 1px solid var(--img-outline); border-radius: var(--r-md); background: var(--paper-2); display: block; box-shadow: var(--sh-xs); }
.map-links { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.88rem; }
.map-links a { color: var(--accent); font-weight: 600; }
.nearby { margin: 0; padding-left: 1.1em; display: grid; gap: 5px; font-size: 0.92rem; }

details.faq { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 2px 18px; background: var(--surface-2); box-shadow: var(--sh-xs); transition: box-shadow var(--dur-base) var(--ease-snappy); min-width: 0; }
details.faq[open] { box-shadow: var(--sh-md); }
details.faq + details.faq { margin-top: 8px; }
details.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; min-height: 44px; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-family: var(--display); font-size: 1.3rem; color: var(--accent); transition: transform var(--dur-base) var(--ease-spring); flex: none; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq p { padding-bottom: 14px; color: var(--muted); max-width: 65ch; }

dl.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); gap: 0.875rem; margin: 0; }
dl.glossary div { border: 1px solid var(--line-soft); background: var(--surface-2); border-radius: var(--r-md); padding: 14px 16px; min-width: 0; box-shadow: var(--sh-xs); transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-spring); }
dl.glossary div:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
dl.glossary dt { font-family: var(--display); font-weight: 700; }
dl.glossary dd { margin: 5px 0 0; color: var(--muted); max-width: 65ch; }

.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 1.125rem; }
.pkg { background: linear-gradient(160deg, var(--surface), var(--surface-2)); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 1.375rem; display: grid; gap: 11px; min-width: 0; box-shadow: var(--sh-md); transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-spring); }
.pkg:hover { transform: translateY(-3px); box-shadow: var(--sh-hover); }
.pkg .price { font-family: var(--display); font-size: 1.5rem; font-weight: 800; color: var(--teal); }
:root[data-theme="dark"] .pkg .price { color: var(--teal); }

/* footer stays a normal, static, in-flow element with no reveal animation. */
footer.legal { background: var(--surface); border-top: 1px solid var(--line-soft); margin-top: 20px; flex-shrink: 0; }
.foot-inner {
  width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter);
  padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 7px; font-size: 0.8rem; color: var(--muted); min-width: 0;
}

/* segmented control — used for the risk filter; grouped, tactile, one active segment */
.segmented { display: flex; flex-wrap: nowrap; width: 100%; min-height: 44px; box-sizing: border-box; gap: 2px; padding: 3px; background: var(--paper-2); border: 1px solid var(--line-soft); border-radius: var(--r-pill); }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.segmented label {
  min-height: 36px; flex: 1 1 0; min-width: 0; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; padding-inline: 0.75rem;
  border-radius: var(--r-pill); font-weight: 600; font-size: 0.85rem; color: var(--muted); cursor: pointer; text-align: center;
  transition: background-color var(--dur-base) var(--ease-snappy), color var(--dur-base) var(--ease-snappy), box-shadow var(--dur-base) var(--ease-snappy);
}
.segmented input:checked + label { background: var(--surface); color: var(--ink); box-shadow: var(--sh-sm); }
.segmented input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.segmented label:hover { color: var(--ink); }

/* native-feeling switch — reused for the light/dark toggle */
.switch-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 10px 4px 4px; border-radius: var(--r-pill); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer; transition: border-color var(--dur-base) var(--ease-snappy); }
.switch-btn:hover { border-color: var(--accent); }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--line); flex: none; transition: background-color var(--dur-base) var(--ease-snappy); }
.switch-track::before { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--sh-sm); transition: transform var(--dur-base) var(--ease-spring); }
.switch-btn[aria-pressed="true"] .switch-track { background: var(--teal); }
.switch-btn[aria-pressed="true"] .switch-track::before { transform: translateX(16px); }

@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.listing-card, .step, .pkg, details.faq, .figure, dl.glossary div {
  animation: riseIn 420ms var(--ease-snappy) both;
}
.grid-cards .listing-card:nth-child(2), .steps .step:nth-child(2), .pkg-grid .pkg:nth-child(2) { animation-delay: 40ms; }
.grid-cards .listing-card:nth-child(3), .steps .step:nth-child(3), .pkg-grid .pkg:nth-child(3) { animation-delay: 80ms; }
.grid-cards .listing-card:nth-child(4), .steps .step:nth-child(4) { animation-delay: 120ms; }

/* ---- Site additions (not in the 06 mock-up; same tokens, same component language) ----
   Buttons outside a form size to their content; the tertiary text button completes the
   primary / secondary / tertiary hierarchy required by CLAUDE.md. */
.cta.auto { width: auto; padding-inline: 1.5rem; }
.cta.text { background: transparent; color: var(--accent); box-shadow: none; padding-inline: 0.75rem; }
.cta.text:hover { background: var(--accent-soft); box-shadow: none; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.page-head { display: grid; gap: 0.75rem; }
.page-head p { max-width: 65ch; color: var(--muted); }
.empty-state { display: grid; gap: 0.75rem; justify-items: start; padding: 1.5rem; border-radius: var(--r-lg); border: 1.5px dashed var(--line); background: var(--surface-2); }
.empty-state p { max-width: 65ch; color: var(--muted); }
.filters .filters-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 0.75rem; }
@media (max-width: 640px) { .filters .filters-actions { flex: 1 1 100%; } .filters .filters-actions .cta { flex: 1 1 auto; } }

/* ---- Ficha components: rules of render/plantillas/_estilos.css.j2 that design 06's mock-up
   lacks or draws differently. tests/web/test_detalle.py checks none is missing here, so the
   standalone ficha and the website's detail page cannot diverge. ---- */
.summary ul, .check-list { margin: 0; padding-left: 1.1em; display: grid; gap: 8px; max-width: 65ch; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 0.75rem; }
.figure {
  display: grid; gap: 5px; padding: 14px 16px; border-radius: var(--r-md); min-width: 0;
  background: linear-gradient(160deg, var(--surface-2), var(--paper-2)); border: 1px solid var(--line-soft); box-shadow: var(--sh-xs);
}
.figure .v { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; font-family: var(--display); overflow-wrap: anywhere; }
/* "Datos del bien" — iOS-style grouped inset rows: a muted label on the
   left, the value in regular body weight (never the display font) that
   wraps naturally, with a compact pill + [n] footnote at the row end.
   Below 560px the label moves above the value instead of squeezing both
   onto one line. */
.rows > div.bien-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 4px 16px; }
.bien-row .row-label { flex: 0 0 auto; color: var(--muted); font-weight: 700; font-size: 0.82rem; padding-top: 2px; }
.bien-row .row-value {
  flex: 1 1 16rem; min-width: 0; text-align: right; font-family: var(--sans); font-weight: 500;
  overflow-wrap: anywhere; display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 10px;
}
@media (max-width: 560px) {
  .bien-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .bien-row .row-value { text-align: left; justify-content: flex-start; }
}
/* "Descripción del inmueble" — a native <details> "Ver más": no JS needed,
   styled like the 06 design's details.faq component. */
details.ver-mas { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 2px 16px; background: var(--surface-2); }
details.ver-mas summary { cursor: pointer; font-weight: 700; padding: 10px 0; min-height: 44px; list-style: none; display: flex; align-items: center; gap: 8px; color: var(--accent); }
details.ver-mas summary::-webkit-details-marker { display: none; }
details.ver-mas summary::after { content: "+"; font-family: var(--display); font-size: 1.2rem; transition: transform var(--dur-base) var(--ease-spring); }
details.ver-mas[open] summary::after { transform: rotate(45deg); }
details.ver-mas p { padding-bottom: 12px; }
/* Fuentes — a grouped list instead of a scrollable table, so mobile never
   needs horizontal scroll to read a source. */
.rows > div.fuente-row { display: grid; gap: 8px; align-items: start; }
.fuente-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.fuente-nombre { font-weight: 700; overflow-wrap: anywhere; }
.fuente-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: var(--muted); align-items: center; }
.fuente-meta a { font-weight: 600; }
/* A pill must never stretch: width: fit-content plus align-self: flex-start
   keep it a small, compact chip even inside a flex/grid cell whose sibling
   is taller (a wrapped address, a two-line concept label, …). */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; height: 1.75rem; width: fit-content; align-self: flex-start; border-radius: var(--r-pill); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.risk:has(.pill.neutral) { background: var(--paper-2); }
/* T15: the known-cost card leads with the amount; pending items are compact
   chips (never a big red banner), and the status pill is deliberately small
   and secondary — it must never outweigh the amount above it. */
.verdict .pendientes-lead { margin: 0; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; padding: 3px 10px; height: 1.6rem; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line-soft); font-size: 0.76rem; font-weight: 600; color: var(--ink); text-decoration: none; transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-spring); }
.chip:hover, .chip:focus-visible { transform: translateY(-1px); box-shadow: var(--sh-xs); }
.chip-mas { color: var(--muted); background: transparent; border-style: dashed; }
.verdict .estado-secundario { margin: 0; font-size: 0.78rem; color: var(--muted); }
.pill.small { height: 1.4rem; padding: 2px 9px; font-size: 0.72rem; }
.rows > div { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.rows > div:last-child { border-bottom: 0; }
.rows .amt { font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--mono); }
/* .pill-amt: a small, token-consistent extension — the 06 design's .rows
   rows only ever hold a label and a value; a ficha row also needs a status
   pill, so the value side groups the pill and the amount together. */
.pill-amt { display: inline-flex; align-items: center; gap: 10px; }
sup { line-height: 0; }
sup a { text-decoration: none; font-weight: 700; font-size: 0.72em; }

/* back-office (admin) — reuses the public tokens; nothing here is indexed or linked from the public nav */
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line-soft); }
.admin-links { display: flex; flex-wrap: wrap; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.admin-links a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 1rem; border-radius: var(--r-pill); color: var(--muted); font-weight: 600; text-decoration: none; }
.admin-links a:hover { color: var(--ink); }
.admin-links a.active { background: var(--accent-soft); color: var(--accent); }
.admin-session { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; min-width: 0; }
.login-card { max-width: 30rem; }
.form-error { margin: 0; padding: 0.75rem 1rem; border-radius: var(--r-md); background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.admin-shell { display: grid; gap: 1.375rem; min-width: 0; }
.admin-shell > * { min-width: 0; }
.admin-shell > section { display: grid; gap: 0.875rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); gap: 0.875rem; }
.stat { gap: 0.25rem; }
.stat-num { font-family: var(--display); font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.job-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.job-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr)); gap: 0.75rem; margin: 0; }
.job-facts dt { font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.job-facts dd { margin: 0; }
.inline-form { margin: 0; }
.captcha { display: block; max-width: 100%; height: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; image-rendering: pixelated; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.cell-error { max-width: 28rem; overflow-wrap: anywhere; color: var(--bad); }
.filters .form-error { flex: 1 0 100%; }

/* ficha review: the preview frames the public ficha body exactly as the public page renders it */
.accion-lista { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: start; }
.accion { display: grid; gap: 0.375rem; justify-items: start; margin: 0; }
.cta[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.preview-frame { border: 1.5px dashed var(--line); border-radius: var(--r-lg); padding: var(--gutter, 1rem); background: var(--paper); min-width: 0; overflow-x: auto; }

/* public forms (M4.1): honeypot, consent checkbox and field errors */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.check { display: flex; align-items: flex-start; gap: 0.75rem; min-height: 44px; }
.check input[type="checkbox"] { flex: none; width: 1.375rem; height: 1.375rem; margin-top: 0.125rem; accent-color: var(--accent); }
.check label { line-height: 1.4; }
.field-error { margin: 0; color: var(--bad); font-size: 0.85rem; font-weight: 600; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
dl.detalle { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 0.875rem; margin: 0; }
dl.detalle div { min-width: 0; }
dl.detalle dt { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
dl.detalle dd { margin: 0.125rem 0 0; overflow-wrap: anywhere; }
.mensaje { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 65ch; margin: 0; }
