/* NAURALABS / nAURA Labs dark brand theme (T24). Pure CSS: no @import, no external URLs. Local fonts only. File name kept: templates link it. */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/poppins-latin-600-normal.woff2") format("woff2");
}

:root {
  --bg: #12142D;             /* page background */
  --surface: #1E2038;        /* container, nav, hero, dropzone */
  --card: #262940;           /* cards */
  --surface-2: #2E3150;      /* table header, hover */
  --border: rgba(255, 255, 255, .08);
  --border-strong: #7479A0;  /* inputs, swatch rings */
  --text: #FFFFFF;
  --text-dim: #A3A6BC;       /* descriptions */
  --text-faint: #8A8DA6;     /* placeholders only */
  --accent: #46C855;         /* logo green: the only accent */
  --accent-hover: #5ED96B;
  --on-accent: #12142D;      /* navy text ON green (never white on green) */
  --danger: #C2373C;
  --danger-hover: #A32E33;
  --danger-text: #FF8A8F;
  --input-bg: #171932;
  --focus: #7CF08A;          /* 3px outline, 2px offset */
  --radius: 8px;             /* cards, inputs, buttons */
  --radius-hero: 12px;
  --radius-chip: 6px;
  --font-display: "Poppins", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); color: var(--text); color-scheme: dark; scrollbar-color: var(--border-strong) transparent; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word; /* only breaks words that cannot fit at all */
}

/* Display: h1/h2 Poppins 600, sentence case. h3 system-ui 600. */
h1 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: var(--text);
  margin: .5rem 0;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  text-wrap: balance;
}
h2, h3 { font-weight: 600; line-height: 1.25; color: var(--text); margin: .5rem 0; }
h2 { font-family: var(--font-display); letter-spacing: -.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: .5rem 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--text-faint); opacity: 1; font-weight: 400; }

.accent { color: var(--accent); }
.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.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;
}

.container {
  width: min(1200px, 100% - 2rem);
  margin-inline: auto;
}
main.container { display: grid; gap: 1.5rem; padding-block: 1.5rem 3rem; }
.container > * { min-width: 0; }
.hint { color: var(--text-dim); font-size: .9rem; margin: 0; }
.stack { display: grid; gap: 1.5rem; min-width: 0; }

/* ---------- Cards ---------- */

.glass {
  position: relative;
  padding: 1.25rem;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.glass.dense { padding: .9rem 1rem; }

/* Top bar: solid, full width, sticky, aligned to the 1200px column */
.glass-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .5rem;
  margin: 0;
  /* align brand/links with the 1200px content column */
  padding: .4rem max(1rem, calc((100% - 1200px) / 2 + 1px));
  color: var(--text);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
  text-decoration: none;
}
.brand img { display: block; height: 32px; width: auto; }
.brand .brand-wordmark { height: 18px; }
@media (max-width: 420px) { .brand-wordmark { display: none; } }
.glass-nav .brand {
  min-height: 44px;
  margin-right: auto;
  padding: 0 .6rem;
}
.glass-nav .nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
}
.glass-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 .6rem;
  white-space: nowrap;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.glass-nav a:hover { color: var(--text); background: var(--surface-2); }
.glass-nav a.brand, .glass-nav a.brand:hover { color: var(--text); background: none; }
.nav-count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4rem; height: 1.4rem; margin-left: .25rem; padding: 0 .35rem; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .75rem; font-weight: 700; }
.progress-steps a { color: inherit; }
.glass-nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.glass-nav .nav-user {
  padding: .2rem .7rem;
  font-weight: 600;
  color: var(--text);
  border-left: 1px solid var(--border-strong);
}
.glass-nav .nav-form { margin: 0; }
.glass-nav .glass-pill.ghost { color: var(--accent); background: transparent; border: 1px solid var(--border-strong); }
.glass-nav .glass-pill.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent); }
.glass-nav.staff { padding-inline: 1rem; }

.glass-nav .nav-toggle { display: none; }
/* Mobile: brand + "Menú" button; links open as a full-width list below.
   Without JS the toggle stays hidden and the links simply wrap (nothing is lost). */
@media (max-width: 960px) {
  .glass-nav .nav-links { flex-wrap: wrap; width: 100%; row-gap: .25rem; }
  .glass-nav .nav-links > * { flex: none; }
  .glass-nav .nav-user { border-left: 0; }
  .js-nav .nav-toggle { display: inline-flex; }
  .js-nav .nav-links { display: none; flex-direction: column; align-items: stretch; padding: .25rem 0 .5rem; }
  .js-nav .nav-links.open { display: flex; flex-wrap: nowrap; max-height: calc(100dvh - 58px); overflow-y: auto; }
  .js-nav .nav-links a { min-height: 48px; }
  .js-nav .nav-links .nav-form .glass-pill { width: 100%; }
  .js-nav .nav-user { margin-top: .5rem; padding: .75rem .75rem .25rem; border-top: 1px solid var(--border); color: var(--text-dim); font-size: .85rem; font-weight: 400; }
}
/* Staff have twice the links (~1010px): collapsed menu from 961px to 1440px, until the row fits beside the logo, instead of wrapping under it. */
@media (min-width: 961px) and (max-width: 1440px) {
  .glass-nav.staff .nav-links { width: 100%; }
  .glass-nav.staff .nav-user { border-left: 0; }
  .js-nav .glass-nav.staff .nav-toggle { display: inline-flex; }
  .js-nav .glass-nav.staff .nav-links { display: none; flex-direction: column; align-items: stretch; padding: .25rem 0 .5rem; }
  .js-nav .glass-nav.staff .nav-links.open { display: flex; flex-wrap: nowrap; max-height: calc(100dvh - 58px); overflow-y: auto; }
  .js-nav .glass-nav.staff .nav-links a { min-height: 48px; }
  .js-nav .glass-nav.staff .nav-links .nav-form .glass-pill { width: 100%; }
  .js-nav .glass-nav.staff .nav-user { margin-top: .5rem; padding: .75rem .75rem .25rem; border-top: 1px solid var(--border); color: var(--text-dim); font-size: .85rem; font-weight: 400; }
}

/* ---------- Buttons ---------- */

.glass-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 44px;
  min-width: 44px;
  padding: .6rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.glass-pill:hover:not(:disabled):not([aria-disabled="true"]) { border-color: var(--accent); }
.glass-pill.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.glass-pill.primary:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--accent-hover); border-color: var(--accent-hover); }
.glass-pill.danger { background: var(--danger); color: #FFFFFF; border-color: var(--danger); }
.glass-pill.danger:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--danger-hover); border-color: var(--danger-hover); }
.glass-pill.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.glass-pill.ghost:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--surface-2); }
.glass-pill[aria-current="page"] { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
.glass-pill:disabled,
.glass-pill[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ---------- Chips (quote states, PLAN 5.4). Navy text on every fill ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: .2rem .7rem;
  border-radius: var(--radius-chip);
  background: #CBD5E1;
  color: var(--on-accent);
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}
.chip.in_revision { background: #FFD479; }   /* En revisión */
.chip.with_remarks { background: #FFB37A; }  /* Con observaciones */
.chip.approved { background: #7CE0A0; }      /* Aprobada */
.chip.paid { background: #5EEAD4; }          /* Pagada */
.chip.in_progress { background: #8FB8FF; }   /* En producción */
.chip.done { background: #C7F464; }          /* Terminada */
.chip.refunded { background: #C4B5FD; }      /* Reembolsada */

/* ---------- Swatches ----------
   CSP forbids style attributes, so no --swatch inline var. Pattern:
   <button class="swatch" data-hex="#RRGGBB" aria-pressed="false">
     <svg class="swatch-fill" viewBox="0 0 30 30" aria-hidden="true" focusable="false">
       <circle cx="15" cy="15" r="15" fill="#RRGGBB"/>
     </svg>
   </button>
   Fill comes from the SVG presentation attribute (not blocked by CSP).
*/
.swatch {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}
.swatch-fill { display: block; width: 30px; height: 30px; border-radius: 50%; }
.swatch.selected,
.swatch[aria-pressed="true"],
.swatch:has(input:checked) { border-color: var(--surface); outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Dropzone ---------- */

.dropzone {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: 2rem 1.25rem;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-hero);
}
.dropzone.dragover {
  border-color: var(--accent);
}
.dropzone label { font-weight: 700; }
.dropzone input[type="file"] { max-width: 100%; min-height: 44px; }
input[type="file"]::file-selector-button {
  min-height: 44px;
  margin-right: .75rem;
  padding: .5rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent); }

progress {
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 6px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border-strong);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--border-strong); border-radius: 6px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 6px; }
progress::-moz-progress-bar { background: var(--accent); }

/* ---------- Price box ---------- */

.price-box { display: grid; gap: 1rem; }
.price-box .price-total {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.price-bar { display: none; }
/* Under 1100px the price column sits below the options: keep total + CTA in a bar fixed to the bottom. */
@media (max-width: 1099px) {
  .price-bar { position: fixed; inset: auto 0 0 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem max(1rem, env(safe-area-inset-left)) calc(.6rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border-strong); }
  .price-bar-total { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
  body:has(.price-bar) { padding-bottom: 5rem; }
}
.price-box .price-note { margin: 0; font-size: .9rem; color: var(--text-dim); }

/* ---------- Table ---------- */

.table-glass {
  padding: 0;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.table-glass table { width: 100%; border-collapse: collapse; }
.table-glass th,
.table-glass td {
  padding: .75rem 1rem;
  text-align: left;
  vertical-align: middle;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.table-glass.dense th,
.table-glass.dense td { padding: .5rem .75rem; }
.table-glass thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text);
  font-size: .85rem;
  font-weight: 700;
}
.table-glass tbody tr:nth-child(even) { background: #232640; }
.table-glass tbody tr:hover { background: var(--surface-2); }

/* ---------- Forms ---------- */

.form-grid { display: grid; gap: 1rem; min-width: 0; }
.form-grid > label,
.field { display: grid; gap: .35rem; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.filters > .glass-pill { flex: 1 1 auto; } /* filter row spans the full column like the cards below */
@media (max-width: 640px) { .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; } .filters > .glass-pill { flex: 0 0 auto; } }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
select,
textarea {
  width: 100%;
  min-height: 44px;
  max-width: 100%;
  padding: .6rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):focus,
select:focus,
textarea:focus { border-color: var(--accent); }
textarea { min-height: 6rem; resize: vertical; }
select option { background: var(--surface); color: var(--text); }

/* ---------- Alerts ---------- */

.alert {
  padding: .9rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.alert.error { background: #3A1E2A; color: #FF8A8F; border-color: #6B2E3A; }
.alert.ok { background: #17322A; color: #7EE08A; border-color: #2D5A3A; }
.alert.info { background: #1B2A4A; color: #9CC2FF; border-color: #2F4778; }

/* ---------- Dialog ---------- */

dialog.glass-dialog {
  width: min(960px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  padding: 1.25rem;
  margin: auto;
  overflow: auto;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
dialog.glass-dialog::backdrop { background: rgba(5, 6, 20, .7); }
.dialog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

/* ---------- Layout ---------- */

.layout-quote {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
}
.layout-quote > * { min-width: 0; }
@media (min-width: 760px) {
  .layout-quote { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .layout-quote { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Hero: copy + upload on the left, decorative photo on the right. The scrim keeps text on a flat dark area. */
.hero {
  /* dark side ends where the copy column ends (padding + 33rem column + trust row slack), at any width */
  --copy-end: calc(clamp(1.25rem, 5vw, 3.5rem) + 35rem);
  --scrim: linear-gradient(90deg, #080916 var(--copy-end), rgba(8, 9, 22, .8) calc(var(--copy-end) + 6rem), rgba(8, 9, 22, 0) calc(var(--copy-end) + 20rem));
  display: grid;
  gap: 1rem;
  padding: clamp(1.25rem, 5vw, 3.5rem);
  background-color: #080916;
  background-image: var(--scrim), url("/static/img/hero-print.webp");
  background-position: right center;
  background-size: cover;
  background-repeat: no-repeat;
  border-radius: var(--radius-hero);
}
.hero.hero-pcb { background-image: var(--scrim), url("/static/img/hero-pcb.webp"); }
.hero > * { position: relative; width: 100%; max-width: 33rem; min-width: 0; }
/* Decorative loop over the still (same first frame). Masked so the copy side stays flat dark; off on phones and reduced motion. */
.hero { position: relative; overflow: hidden; }
.hero .hero-video {
  position: absolute; inset: 0; max-width: none; height: 100%;
  object-fit: cover; object-position: right center; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent var(--copy-end), rgba(0, 0, 0, .2) calc(var(--copy-end) + 6rem), #000 calc(var(--copy-end) + 20rem));
  mask-image: linear-gradient(90deg, transparent var(--copy-end), rgba(0, 0, 0, .2) calc(var(--copy-end) + 6rem), #000 calc(var(--copy-end) + 20rem));
}
@media (max-width: 760px), (prefers-reduced-motion: reduce) { .hero .hero-video { display: none; } }
.hero h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.1; }
.hero .lead { margin: 0; font-size: 1.1rem; color: var(--text-dim); }
.hero .dropzone { margin-top: .5rem; padding: 1.5rem 1.25rem; background: var(--bg); border-radius: var(--radius); }
@media (max-width: 760px) {
  .hero { --scrim: linear-gradient(rgba(8, 9, 22, .93), rgba(8, 9, 22, .93)); }
}

.trust { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: 0; padding: 0; list-style: none; color: var(--text-dim); font-size: .9rem; }
.hero .trust { max-width: 36rem; }
.trust li::before { content: "✓"; margin-right: .4rem; color: var(--accent); font-weight: 700; }

/* Home sections: type and rules instead of boxes */
.section { display: grid; gap: 1.25rem; padding-top: 1.5rem; }
.section h2 { margin: 0 0 1.25rem; font-size: 1.6rem; }
.section > h2 { margin: 0; }
.steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; padding-top: 1rem; border-top: 1px solid var(--border-strong); }
.steps li::before { content: "0" counter(step); display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--accent); }
.steps h3, .services dt { margin: .25rem 0; font-size: 1.1rem; font-weight: 600; color: var(--text); }
.steps p, .services dd { margin: 0; color: var(--text-dim); }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: center; }
.split img { display: block; width: 100%; height: auto; border-radius: var(--radius-hero); }
.services { display: grid; gap: 1.25rem; margin: 0; }
@media (min-width: 760px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem; }
}

.error-page { display: grid; justify-items: center; gap: .5rem; padding-block: 3rem; text-align: center; }
.error-page h1 { margin: 0; font-family: var(--font-display); font-size: clamp(1.75rem, 6vw, 2.5rem); }
.error-page .error-code { margin: 0; font-family: var(--font-display); font-size: clamp(3rem, 12vw, 5rem); line-height: 1; color: var(--accent); }
.error-page a { color: var(--accent); }
.site-footer { display: grid; gap: .25rem; margin-bottom: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); text-align: center; font-size: .9rem; color: var(--text-dim); }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.site-footer p { margin: 0; }
.legal { width: 100%; max-width: 90ch; margin-inline: auto; }
.legal a, label.check a { color: var(--accent); }
label.check { display: flex; gap: .5rem; align-items: baseline; }
/* Bare admin checkbox/radio labels: 44px tap target like label.check */
label:not([class]):has(> input[type="checkbox"], > input[type="radio"]), label.actions:has(> input[type="checkbox"]) { display: flex; gap: .5rem; align-items: center; min-height: 44px; }

/* ---------- Thumb ---------- */

.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: zoom-in;
}
.thumb img,
.thumb svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { border-color: var(--accent); }
img.thumb { height: auto; cursor: default; }
img.thumb:hover { border-color: var(--border); }
main > form.form-grid { max-width: 44rem; }
.price-box > .glass-pill { justify-self: start; }
.table-glass td form { display: inline-block; }

/* ---------- Metrics (dl grid) ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: .75rem 1rem;
  margin: 0;
  padding: .75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.metrics > div { min-width: 0; }
.metrics dt { font-size: .85rem; color: var(--text-dim); }
.metrics dd {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Spinner ---------- */

.spinner {
  display: inline-block;
  width: 2.5rem;
  height: 2.5rem;
  border: 4px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- More contrast ---------- */

@media (prefers-contrast: more) {
  .glass, .alert, dialog.glass-dialog, .table-glass, .thumb, .metrics, .glass-pill, select, textarea,
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]) {
    border-color: #FFFFFF;
  }
  dialog.glass-dialog::backdrop { background: rgba(5, 6, 20, .85); }
}

.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }

/* Form groups and option cards (quote page) */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: .4rem; font-weight: 700; }
fieldset > .option-card + .option-card { margin-top: .6rem; }
.option-card { display: grid; grid-template-columns: auto 1fr; gap: .75rem; align-items: start; cursor: pointer; border-width: 2px; }
.option-card:hover { border-color: var(--border-strong); }
.option-card input[type="radio"] { margin-top: .3rem; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.option-card strong { display: block; }
.option-card .hint { display: block; font-weight: 400; }
.option-card:has(input:checked) { border: 2px solid var(--accent); }
.option-card:not(:has(input:checked)) { border-color: var(--border); }
.material-img { display: block; width: 100%; height: auto; border-radius: var(--radius); margin: .5rem 0; }
#material-panel .hint:first-child { margin: 0; text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 700; color: var(--accent); }
#color-swatches { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.swatch-fill circle { stroke: #A3A6BC; stroke-width: 1.5; } /* light ring so black/navy swatches read on dark */
.swatch-opt { display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 5.5rem; cursor: pointer; }
.swatch-name { font-size: 12px; line-height: 1.2; text-align: center; text-wrap: balance; overflow-wrap: break-word; }
.swatch-opt:has(input:checked) .swatch { border-color: var(--surface); outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch-opt:has(input:checked) .swatch-name { font-weight: 700; }
.swatch-opt:has(input:focus-visible) .swatch { outline: 3px solid var(--focus); outline-offset: 2px; }
/* color photo instead of the hex circle; bigger preview of the selected color below the swatches */
.swatch-photo { object-fit: cover; outline: 1.5px solid #A3A6BC; outline-offset: -1.5px; }
.color-photo { margin: .75rem 0 0; max-width: 320px; }
.color-photo img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }
.color-photo figcaption { margin-top: .25rem; }
/* checkerboard behind translucent colors */
.swatch-fill.translucent { background: repeating-conic-gradient(#D9DBE6 0 25%, #FFFFFF 0 50%) 0 0 / 10px 10px; }

/* Shipping block (staff order page) */
[aria-labelledby="envio-titulo"] { display: grid; gap: .35rem; }
[aria-labelledby="envio-titulo"] h3 { margin: 0 0 .25rem; }
[aria-labelledby="envio-titulo"] address { font-style: normal; line-height: 1.45; }
[aria-labelledby="envio-titulo"] p { margin: 0; font-size: .95rem; color: var(--text); }
[aria-labelledby="envio-titulo"] .glass-pill { margin-top: .4rem; justify-self: start; }

/* long metric values (e.g. 40.0 × 40.0 × 40.0 mm) wrap instead of overflowing */
.metrics dd { overflow-wrap: anywhere; white-space: normal; }
/* Tables: never split short tokens (codes, amounts, actions); only long emails/file names may wrap */
.table-glass th, .table-glass td { overflow-wrap: normal; word-break: normal; }
.table-glass td:first-child, .table-glass td:last-child, .table-glass th { white-space: nowrap; }
a.chip { text-decoration: none; }
a.chip:hover { filter: brightness(.95); }

/* Spanish file picker: native input stays focusable/required for validation, label is the visible button */
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-input:focus-visible + .file-pick { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-pick { cursor: pointer; }
.file-name { margin: 0; color: var(--text-dim); font-size: .95rem; overflow-wrap: anywhere; }
.dropzone .hint { color: var(--text-dim); text-wrap: balance; }
/* select arrow: light chevron (data: SVG is allowed by CSP img-src data:) */
select { -webkit-appearance: none; appearance: none; padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23A3A6BC' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9rem center; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
/* Google sign-in button: white per Google branding, dark text */
.glass-pill.google-btn { display: inline-flex; align-items: center; gap: .6rem; background: #FFFFFF; color: #1F1F1F; border-color: #FFFFFF; }
.glass-pill.google-btn:hover { background: #E8EAED; border-color: #E8EAED; }
.google-g { flex: none; }
.auth-card .google-btn { width: 100%; }
/* Login cards: narrow, not the full 1200px column */
.auth-card { max-width: 28rem; padding: 1.75rem; }
/* Login pages: heading, alerts, card and hints share one centered column. */
main.container:has(> .auth-card):not(:has(> nav)) > * { width: 100%; max-width: 28rem; margin-inline: auto; }
/* one-time password: stacked, never broken mid-string */
.temp-cred { display: grid; gap: .25rem; margin: 0 0 1rem; }
.temp-cred dt { color: var(--text-dim); font-size: .85rem; }
.temp-cred dd { margin: 0 0 .75rem; overflow-wrap: anywhere; }
.temp-pw { display: inline-block; font-size: 1.25rem; letter-spacing: .06em; color: var(--accent); user-select: all; white-space: nowrap; }

/* ---------- Inventory (mobile, NFC) — PLAN 5.9. Phone first (360–412 px), max 640 px on desktop. ---------- */
.inv-page { display: grid; gap: 1rem; width: 100%; max-width: 640px; margin-inline: auto; min-width: 0; }
.inv-page h1 { margin: 0; }
.inv-page h2 { margin-top: .5rem; }
.inv-page :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.inv-page input:not([type="checkbox"]):not([type="file"]):not(.inv-step),
.inv-page textarea { width: 100%; min-height: 48px; padding: .6rem .8rem; background: var(--input-bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.inv-page input[readonly] { color: var(--text-dim); }
.inv-page select { min-height: 48px; }
.inv-page .glass-pill { min-height: 48px; }
.inv-big { width: 100%; min-height: 56px; font-size: 1.1rem; }
.inv-huge { width: 100%; min-height: 72px; font-size: 1.25rem; }
.inv-actions { display: grid; gap: .75rem; }
.inv-actions .glass-pill { width: 100%; min-height: 56px; font-size: 1.1rem; }
.inv-code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .85rem; color: var(--text-dim); overflow-wrap: anywhere; }
.inv-code-xl { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.inv-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.inv-search input { min-height: 48px; }

/* list */
.inv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.inv-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.inv-card:hover { border-color: var(--accent); }
.inv-card-link { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: .75rem; align-items: center; min-height: 48px; padding: .75rem; color: var(--text); text-decoration: none; }
.inv-card-body { display: grid; gap: .2rem; min-width: 0; }
.inv-card-name { font-weight: 600; overflow-wrap: anywhere; }
.inv-stock { display: grid; justify-items: end; text-align: right; }
.inv-stock-n { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--text); }
.inv-stock-l { font-size: .75rem; color: var(--text-dim); }
.inv-inactive { justify-self: start; }
.inv-thumb { display: block; width: 64px; height: 64px; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.inv-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* scan */
.inv-scan { justify-items: center; text-align: center; }
.inv-scan-btn { width: min(100%, 240px); aspect-ratio: 1; border-radius: 50%; font-size: 1.2rem; font-weight: 700; }
.inv-status { min-height: 1.5rem; margin: 0; font-weight: 600; }
.inv-manual { width: 100%; display: grid; gap: .5rem; text-align: left; }
.inv-manual label { font-weight: 600; }

/* forms */
.inv-form { display: grid; gap: 1rem; min-width: 0; }
.inv-check { display: flex; align-items: center; gap: .6rem; min-height: 48px; font-weight: 600; }
.inv-check input { width: 1.4rem; height: 1.4rem; }
.inv-form-photo { width: 160px; max-width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.inv-errors { margin: 0; padding-left: 1.2rem; }

/* detail / unit */
.inv-card-lg { display: grid; gap: .75rem; padding: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.inv-card-lg > * { min-width: 0; }
.inv-hero-photo { display: block; width: 100%; max-width: 360px; height: auto; aspect-ratio: 4 / 3; object-fit: contain; border-radius: var(--radius); background: var(--surface-2); }
.inv-title { margin: 0; font-size: 1.5rem; overflow-wrap: anywhere; }
.inv-meta { margin: 0; color: var(--text-dim); }
.inv-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.inv-stat { margin: 0; padding: .75rem .4rem; min-width: 0; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.inv-stat dt { font-size: .8rem; color: var(--text-dim); }
.inv-stat dd { margin: 0; font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.inv-add { display: grid; gap: .75rem; }
.inv-stepper { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; gap: .5rem; align-items: center; }
.inv-step { min-width: 56px; min-height: 56px; padding: 0; font-size: 1.6rem; }
.inv-qty { min-height: 56px; text-align: center; font-size: 1.3rem; font-weight: 700; }
.inv-new-units { display: grid; gap: .6rem; }
.inv-new-units h2 { margin: 0; }
.inv-write-row { display: grid; gap: .4rem; padding: .6rem 0; border-top: 1px solid var(--border); }
.inv-write-row .glass-pill { width: 100%; min-height: 56px; }
.nfc-row-status { min-height: 1.25rem; margin: 0; font-weight: 600; }
.nfc-write.is-done { background: transparent; color: var(--accent); border-color: var(--accent); }
.inv-units, .inv-moves { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.inv-unit-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; min-height: 48px; padding: .5rem .75rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.inv-unit-row a.inv-code { color: var(--accent); font-weight: 700; }
.inv-moves li { padding: .5rem .75rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); font-size: .95rem; overflow-wrap: anywhere; }
.inv-when { display: block; font-size: .85rem; color: var(--text-dim); }
.inv-main-action { margin: 0; }
.inv-danger { display: grid; gap: .75rem; padding: 1rem; background: var(--surface); border: 1px solid #6B2E3A; border-radius: var(--radius); }
.inv-danger h2 { margin: 0; color: var(--danger-text); }
.inv-danger .glass-pill.danger { width: 100%; }
.inv-danger textarea { min-height: 6rem; }
@media (min-width: 640px) {
  .inv-actions { grid-template-columns: 1fr 1fr; }
  .inv-write-row { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .inv-write-row .glass-pill { width: auto; }
}
/* Unit page from a tag: main action above the fold on any phone */
.inv-unit .inv-hero-photo { aspect-ratio: auto; height: 28vh; max-height: 220px; }
.inv-danger > summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; color: var(--danger-text); font-weight: 700; }
.inv-danger[open] > summary { margin-bottom: .5rem; }
.inv-title { letter-spacing: 0; }
.field-label { font-weight: 600; }
.inv-step:disabled { opacity: .4; cursor: not-allowed; }
/* Upload page: instant on-device preview while the file uploads */
.local-preview { display: grid; gap: .75rem; width: 100%; }
.local-preview-stage { width: 100%; aspect-ratio: 4 / 3; max-height: 320px; border-radius: var(--radius); background: #171932; overflow: hidden; }
.local-preview-stage:empty { display: none; }
.local-preview-stage canvas { display: block; width: 100%; height: 100%; }

/* PCB quote: two columns (left = preview + options, right = sticky price panel). Pattern after JLCPCB's quote page. */
.pcb-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (min-width: 960px) {
  .pcb-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .pcb-side { position: sticky; top: 76px; }
}
.pcb-main { display: grid; gap: 1rem; min-width: 0; }
.pcb-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.pcb-head h2, .pcb-head p { margin: 0; }
.pcb-preview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; min-width: 0; }
.pcb-preview figure { display: grid; gap: .4rem; margin: 0; min-width: 0; }
.pcb-preview img { width: 100%; height: auto; background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius); }
.pcb-preview figcaption { font-size: .85rem; color: var(--text-dim); }
@media (min-width: 720px) { .pcb-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pcb-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: .5rem 1rem; margin: 0; }
.pcb-facts dt { font-size: .8rem; color: var(--text-dim); }
.pcb-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.pcb-files > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; }
.pcb-file-list { margin: .5rem 0 0; padding-left: 1.2rem; overflow-wrap: anywhere; }
.pcb-section { margin: .5rem 0 0; padding: .55rem .9rem; font-size: 1rem; background: var(--surface-2); border-radius: var(--radius-chip); }

/* Option rows: label column + pill choices */
.opt-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; padding: .35rem 0; }
@media (min-width: 640px) { .opt-row { grid-template-columns: 11rem minmax(0, 1fr); align-items: start; gap: 1rem; } .opt-label { padding-top: .6rem; } }
.opt-label { font-weight: 600; color: var(--text-dim); }
.opt-choices { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; }
.opt-choices textarea { width: 100%; }
.opt-note { flex-basis: 100%; }
.opt-qty { width: 7rem; }
.opt-pill { position: relative; display: inline-flex; cursor: pointer; }
.opt-pill > span, .opt-pill.static {
  position: relative;
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: 44px; padding: 0 .95rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-chip);
  background: var(--input-bg); color: var(--text); font-weight: 600; line-height: 1.2;
}
.opt-pill small { font-weight: 400; color: var(--text-dim); }
.opt-pill:hover > span { border-color: var(--accent); }
/* Selected: green border + text + tinted fill, corner check (shape, not color only) */
.opt-pill input:checked + span, .opt-pill.static.on { border-color: var(--accent); color: var(--accent); background: rgba(70, 200, 85, .1); overflow: hidden; padding-right: 1.6rem; }
.opt-pill input:checked + span::after, .opt-pill.static.on::after {
  content: "✓"; position: absolute; right: 0; bottom: 0; width: 24px; height: 24px;
  padding-right: 3px; font-size: 13px; font-weight: 900; line-height: 30px; text-align: right; color: var(--on-accent);
  background: linear-gradient(135deg, transparent 50%, var(--accent) 50%);
}
/* Read-only (single option / detected): plain value, no hover, no check */
.opt-pill.static { cursor: default; background: transparent; border-color: transparent; padding-left: 0; }
.opt-pill.static.off { border-color: var(--danger-text); border-style: dashed; padding-left: .95rem; color: var(--danger-text); }
.opt-pill input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt-dot { width: 16px; height: 16px; flex: none; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--text-dim), 0 0 0 3px var(--input-bg); }
.alert.warn { background: #3A2E14; color: #FFD479; border-color: #6B5320; }

/* Price panel */
.pcb-side .price-box h2 { margin: 0; font-size: 1.05rem; }
.price-lines { display: grid; gap: .35rem; margin: 0; padding: 0 0 .75rem; list-style: none; border-bottom: 1px solid var(--border); }
.price-lines li, .price-lines > div { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.price-lines li > span:first-child, .price-lines dt { color: var(--text-dim); }
.price-lines dd { margin: 0; font-weight: 600; }
.price-lines .sum { padding-top: .35rem; border-top: 1px dashed var(--border); font-weight: 700; }
.price-lines .sum > span:first-child { color: var(--text); }
.price-final { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.price-final > span { font-weight: 700; }
.price-cta { width: 100%; min-height: 52px; font-size: 1.05rem; }

/* Coupons (/cupones, /admin/cupones) */
.coupon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.coupon-grid > article h2 { margin: 0; }
.coupon-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.35rem; font-weight: 700; letter-spacing: .08em;
  color: var(--accent); user-select: all; overflow-wrap: anywhere;
}
.coupon-conditions { margin: 0; padding-left: 1.1rem; color: var(--text-dim); font-size: .9rem; }
.coupon-conditions li + li { margin-top: .2rem; }
.coupon-off { color: #7EE08A; font-weight: 600; }
/* Checkout: coupon list inside the form (no page change) */
.coupon-pick > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); font-weight: 600; }
.coupon-pick ul { display: grid; gap: .75rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.coupon-pick li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1rem; align-items: center; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.coupon-pick li > button { grid-row: 1 / span 9; grid-column: 2; }
.coupon-pick .coupon-code { font-size: 1rem; }

/* Quote detail: order progress (done / current / todo) */
.progress-steps { display: flex; gap: .25rem; margin: 0 0 1.5rem; padding: 0; list-style: none; counter-reset: pstep; }
.progress-steps li { flex: 1 1 0; min-width: 0; counter-increment: pstep; padding-top: .5rem; border-top: 4px solid var(--border-strong); color: var(--text-dim); font-size: .85rem; overflow-wrap: anywhere; }
.progress-steps li::before { content: counter(pstep) ". "; }
.progress-steps li.done { border-top-color: var(--accent); }
.progress-steps li.done::before { content: "✓ "; color: var(--accent); }
.progress-steps li.current { border-top-color: var(--accent); color: var(--text); font-weight: 700; }
@media (max-width: 480px) { .progress-steps li:not(.current) { font-size: 0; } .progress-steps li:not(.current)::before { font-size: .85rem; } .progress-steps li.current { flex-grow: 4; } }

/* Customer tables become stacked cards under 640px (rows marked tr.card-row, cells carry data-label). */
@media (max-width: 640px) {
  .table-glass:has(tr.card-row), .table-glass:has(tr.card-row) tbody, .table-glass tr.card-row, .table-glass tr.card-row td { display: block; }
  .table-glass:has(tr.card-row) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-glass tr.card-row { padding: .5rem 0; border-bottom: 1px solid var(--border); }
  .table-glass tr.card-row td { white-space: normal; padding: .35rem 1rem; }
  .table-glass tr.card-row td[data-label]::before { content: attr(data-label); display: block; font-size: .8rem; color: var(--text-dim); }
  .table-glass tr.card-row td:first-child::before { content: none; }
  /* Compact card: thumbnail left, details right; only Estado/Total keep an inline label. */
  .table-glass tr.card-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: .75rem; align-items: start; padding: .75rem 1rem; }
  .table-glass tr.card-row td { padding: .15rem 0; }
  .table-glass tr.card-row td:first-child { grid-row: span 5; padding-top: .25rem; }
  .table-glass tr.card-row td[data-label]::before { display: inline; margin-right: .4rem; }
  .table-glass tr.card-row td:is([data-label="Cotización"], [data-label="Opciones"], [data-label="Acciones"])::before { content: none; }
  .table-glass tr.card-row td[data-label="Acciones"] { display: flex; flex-wrap: wrap; gap: .5rem; padding-top: .5rem; }
}

/* Touch targets (WCAG 2.5.5 style 44px minimum) */
label.check { min-height: 44px; align-items: center; }
input[type="radio"]:not(.sr-only), input[type="checkbox"]:not(.sr-only) { width: 1.25rem; height: 1.25rem; }
.table-glass td a.glass-pill, .table-glass td button.glass-pill { min-height: 44px; }
.table-glass td a:not(.glass-pill), .actions > input[type="checkbox"] + label, .actions > a:not(.glass-pill) { display: inline-flex; align-items: center; min-height: 44px; }
a.chip { min-height: 44px; }

/* Referral link row: label, readonly input and copy button wrap on mobile. */
.ref-link { display: flex; flex-wrap: wrap; align-items: stretch; gap: .75rem; }
.ref-link label { flex-basis: 100%; }
.ref-link input { flex: 1 1 16rem; min-width: 0; }
.ref-link button { flex: 0 0 auto; white-space: nowrap; }
.ref-link .hint { flex-basis: 100%; }

/* ---------- Project quote (multipart ZIP): options card, part cards, sticky price panel ---------- */
.layout-project { display: grid; gap: 1.25rem; align-items: start; min-width: 0; }
.layout-project > * { min-width: 0; }
.project-head { display: grid; gap: .4rem; }
.project-head h1 { margin: 0; }
.project-head p { margin: 0; }
/* Phone/tablet: CTA lives in the fixed .price-bar. Desktop (≥1100px): the sidebar CTA replaces it. */
.price-cta { display: none; }
@media (min-width: 1100px) {
  .layout-project { grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; }
  .project-side { position: sticky; top: 76px; }
  .price-cta { display: inline-flex; width: 100%; min-height: 52px; font-size: 1.05rem; }
}
form#project-form { display: grid; gap: 1rem; }

.all-opts { display: grid; gap: .9rem; }
.all-opts > h2 { margin: 0; }
.all-opts > .hint { margin: 0; }
.apply-row { display: grid; gap: 1rem; }
.apply-pair { display: grid; gap: 1rem; min-width: 0; }
@media (min-width: 560px) {
  .apply-pair { grid-template-columns: minmax(0, 1fr) 9rem; align-items: end; }
}
.apply-row > .actions { justify-content: flex-start; }
.project-field { display: grid; gap: .4rem; min-width: 0; }
.project-field > legend { margin: 0 0 .5rem; }
.project-field .opt-choices { gap: .4rem; }
.project-field .opt-pill > span { min-height: 44px; }
.project-field .swatch-opt { width: 5rem; }
.project-swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.project-field .swatch { width: 44px; height: 44px; }

.project-parts { display: grid; gap: 1rem; min-width: 0; }
.part-card { display: grid; gap: 1rem; min-width: 0; }
.part-card.failed { display: grid; gap: .6rem; border-style: dashed; }
.part-card.failed .part-name { margin: 0; }
.part-card.skipped { border-style: dashed; border-color: var(--border-strong); }
.part-card.skipped .part-media img { filter: grayscale(1); opacity: .5; }
.part-main { display: grid; gap: .75rem; min-width: 0; }
.part-media { width: 160px; max-width: 100%; }
.part-media .thumb { width: 100%; }
.part-info { display: grid; gap: .6rem; min-width: 0; align-content: start; }
.part-name { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.part-metrics { padding: .5rem .75rem; grid-template-columns: 1fr; }
.part-metrics dd { font-size: 1rem; white-space: normal; }
.part-info .hint { margin: 0; }
.part-opts { display: grid; gap: .9rem; min-width: 0; }
.part-opts .field { gap: .4rem; }
.part-qty-row { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1.25rem; }
.part-qty-row .field { flex: 0 1 8rem; }
.part-qty-row .field input { max-width: 8rem; }
.part-qty-row .check { flex: 0 0 auto; }
.part-price { margin: 0; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.part-card.skipped .part-price { font-weight: 400; color: var(--text-dim); }
@media (min-width: 480px) {
  .part-main { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
}
@media (min-width: 760px) {
  .part-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.25rem 1.5rem; align-items: start; }
  .part-card.failed { grid-template-columns: minmax(0, 1fr); }
}
.project-side { min-width: 0; }


/* ---------- Landing (T38): / only. Reuses .hero, .trust, .section, .steps, tokens; no new colors. ---------- */
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.cards { display: grid; gap: 1.25rem; margin: 0; padding: 0; min-width: 0; }
.landing-card, .review-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.landing-card img, .review-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-2);
}
.landing-card-body, .review-body { display: grid; gap: .5rem; padding: 1rem 1.1rem 1.2rem; }
.landing-card-body h3 { margin: 0; }
.landing-card-body p { margin: 0; color: var(--text-dim); }
.landing-card-body { flex: 1; grid-template-rows: auto auto 1fr; }
.landing-card-body a { justify-self: start; align-self: end; min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; }
.landing-card > img { aspect-ratio: 16 / 9; }
.landing-card .services { gap: .6rem; }
.landing-card .services dd { margin: 0; color: var(--text-dim); }
/* Sticky top bar: in-page targets and focused headings stay visible below it. */
main section[aria-labelledby] { scroll-margin-top: 5rem; }
.review-card .review-photo { display: block; }
.review-summary { margin: 0; font-weight: 600; color: var(--accent); }
.stars { margin: 0; color: var(--accent); letter-spacing: .1em; font-size: 1.1rem; }
.review-text {
  margin: 0;
  color: var(--text);
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.review-body .hint { margin: 0; }
.faq { display: grid; gap: .5rem; min-width: 0; }
.faq details { padding: 0 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.faq summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--text); }
.faq details[open] summary { color: var(--accent); }
.faq details p { margin: 0 0 1rem; color: var(--text-dim); }
.cta-band { padding-block: 1.5rem; border-top: 1px solid var(--border); }
.cta-band > p { margin: 0; }
@media (min-width: 760px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
  .cards.reviews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .cards.reviews { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Reviews (T40): star rating, photo thumbs, customer panel, admin review cards ---------- */
.star-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; margin: .4rem 0 0; }
@media (min-width: 560px) { .star-row { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.star-opt { display: flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px; padding: .4rem .6rem; border: 2px solid var(--border); border-radius: var(--radius); background: var(--input-bg); color: var(--text); font-weight: 600; cursor: pointer; text-align: center; }
.star-opt > span { color: var(--text-dim); font-size: 1.25rem; line-height: 1; }
.star-opt:hover { border-color: var(--border-strong); }
.star-opt:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
.star-opt:has(input:checked) > span { color: var(--accent); }
.star-opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.star-opt input[type="radio"] { width: 1.1rem; height: 1.1rem; margin: 0; }
.review-form .check { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-weight: 600; }
.review-form .check input { width: 1.25rem; height: 1.25rem; }
.review-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); gap: .5rem; margin: .5rem 0 0; }
.review-thumbs a { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); min-height: 44px; }
.review-thumbs a:hover { border-color: var(--accent); }
.review-thumbs img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.review-thumb-item { display: grid; gap: .35rem; min-width: 0; }
.review-thumb-item img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.review-tiers { margin: 0; padding-left: 1.2rem; color: var(--text); }
.review-reward { display: grid; gap: .4rem; padding: 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.review-reward h2 { margin: 0; font-size: 1.1rem; }
.review-reward p { margin: 0; }
.review-panel { display: grid; gap: .5rem; }
.review-panel h2 { margin: 0; font-size: 1.15rem; }
.review-panel p { margin: 0; }
.review-panel .actions { margin-top: .25rem; }
.review-panel .glass-pill { min-height: 44px; }
.review-delete { display: flex; }
.review-delete .glass-pill { min-height: 44px; }
.review-empty { display: grid; gap: .75rem; justify-items: start; }
.review-empty p { margin: 0; }
.review-pager { justify-content: center; margin-top: .5rem; }
.review-pager .glass-pill { min-height: 44px; }
.admin-review { display: grid; gap: .75rem; min-width: 0; }
.admin-review-head { display: grid; gap: .25rem; min-width: 0; }
.admin-review-head h2 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.admin-review-head p { margin: 0; overflow-wrap: anywhere; }
.admin-review-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.admin-review-body { margin: 0; white-space: pre-line; overflow-wrap: anywhere; background: var(--surface-2); border-radius: var(--radius); padding: .6rem .8rem; }
.admin-review-actions { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); padding-top: .75rem; border-top: 1px solid var(--border); }
@media (min-width: 760px) { .admin-review-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.admin-review-form { display: grid; gap: .6rem; align-content: start; min-width: 0; }
.admin-review-form .glass-pill { min-height: 44px; justify-self: start; }
.admin-review-form .hint { margin: 0; }

/* /cuenta: connected AI apps (PLAN 5.18) */
.app-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.app-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.app-item > div { min-width: 0; overflow-wrap: anywhere; }
.app-item p { margin: 0; }
