/* Estilos propios de Capa Perfecta. Lo común (cabecera, tarjetas, pie, redes) está en ../shared.css */
:root {
  --thumb: 28px;
  --line: var(--c-border);
  --ink-soft: var(--c-muted);
  --olive-50: var(--c-good-bg);
  --olive-400: #8fa649;
  --olive-700: var(--c-good);
  --orange-50: #fff3df;
  --gold-50: #fff8e6;
  --gold-200: #fde3a1;
  --shadow-sm: 0 1px 3px 0 rgba(19, 38, 74, .12), 0 1px 2px -1px rgba(19, 38, 74, .1);
}

/* ===== Cifras clave ===== */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; padding: 10px 8px; }
.stat__k { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--c-muted); }
.stat__v { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 1.9rem; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--c-navy); }

/* ===== Vistas ===== */
.view { display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; padding: 4px; border-radius: 999px; background: var(--c-bg); border: 1px solid var(--c-border); }
.tab {
  flex: 1;
  min-height: 36px;
  padding: 4px 6px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-muted);
  transition: background-color .15s, color .15s;
}
.tab:hover { color: var(--c-navy); }
.tab[aria-selected="true"] { background: var(--c-navy); color: #fff; }
.tab:focus-visible { outline: 3px solid rgba(232, 130, 30, .5); outline-offset: 1px; }

.stage { position: relative; width: 100%; aspect-ratio: 1; touch-action: pan-y; container-type: size; }
.panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.square { position: relative; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); }
.square canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.panel > svg { display: block; width: 100%; height: auto; max-height: 100%; }

.svg-t-lg { font-size: 26px; font-weight: 600; }
.svg-t-md { font-size: 24px; }
.svg-t-sm { font-size: 22px; }
.svg-t-xs { font-size: 20px; }
.svg-t-2xs { font-size: 18px; }
@container (max-width: 560px) {
  .svg-t-lg { font-size: 34px; }
  .svg-t-md { font-size: 32px; }
  .svg-t-sm { font-size: 30px; }
  .svg-t-xs { font-size: 26px; }
  .svg-t-2xs { font-size: 24px; }
}

/* Diagnóstico */
.data {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--c-border);
  border-radius: var(--r-tile);
  background: #fff;
}
.data__verdict { margin: 0; padding: 8px 12px; border-radius: var(--r-tile); font-size: .9rem; line-height: 1.35; }
.data__list { flex: 1; display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 6px 14px; margin: 0; font-size: .9rem; }
.data__list > div { min-width: 0; padding-bottom: 4px; border-bottom: 1px solid var(--c-border); }
.data__list dt { font-size: .75rem; line-height: 1.25; color: var(--c-muted); }
.data__list dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }
.data__foot { margin: 0; font-size: .75rem; line-height: 1.35; color: var(--c-muted); }

/* Píldora de diagnóstico */
.pill {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  text-align: left;
  font-size: .95rem;
  line-height: 1.3;
}
.pill span { opacity: .8; }
.tone-good { background: var(--c-good-bg); color: var(--c-good); box-shadow: inset 0 0 0 1px rgba(143, 166, 73, .4); }
.tone-warn { background: var(--gold-50); color: #8a5a00; box-shadow: inset 0 0 0 1px rgba(233, 180, 76, .6); }
.tone-bad { background: #fdf0ea; color: #8f2c10; box-shadow: inset 0 0 0 1px rgba(196, 70, 29, .3); }

/* ===== Controles ===== */
.ctl { display: flex; flex-direction: column; gap: 6px; }
.ctl__top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.ctl__txt { min-width: 0; }
.ctl__label { display: block; font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase; color: var(--c-navy); }
.ctl__hint { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; color: var(--c-muted); }
.ctl__box {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 10px;
  border: 2px solid var(--c-border);
  border-radius: var(--r-tile);
  background: #fff;
}
.ctl__box:focus-within { border-color: var(--c-orange); box-shadow: 0 0 0 3px rgba(232, 130, 30, .25); }
.ctl__num {
  width: 72px;
  padding: 0;
  border: 0;
  background: none;
  outline: none;
  text-align: right;
  font-family: var(--f-display);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--c-navy);
}
.ctl__unit { font-family: var(--f-display); font-weight: 600; font-size: 1rem; color: var(--c-orange); }
.ctl__row { display: flex; align-items: center; gap: 10px; }
.step {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--c-border);
  border-radius: 50%;
  background: #fff;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: var(--c-navy);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform .15s, background-color .15s, border-color .15s;
}
.step:hover:not(:disabled) { border-color: var(--c-orange); }
.step:active:not(:disabled) { transform: scale(.94); background: var(--orange-50); }
.step:disabled { opacity: .4; cursor: default; }
.step:focus-visible { outline: 3px solid rgba(232, 130, 30, .5); outline-offset: 2px; }
.track { position: relative; flex: 1; min-width: 0; height: 44px; }
.track__rail { position: absolute; inset-inline: 0; top: 50%; height: 8px; transform: translateY(-50%); overflow: hidden; border-radius: 8px; background: var(--c-border); }
.track__band { position: absolute; inset-block: 0; background: rgba(143, 166, 73, .7); }
.track__fill { position: absolute; inset-block: 0; left: 0; opacity: .9; background: linear-gradient(90deg, var(--c-gold), var(--c-orange)); }
.slide { position: absolute; inset: 0; width: 100%; margin: 0; appearance: none; -webkit-appearance: none; cursor: pointer; touch-action: pan-y; background: transparent; }
.slide:focus { outline: none; }
.slide::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.slide::-moz-range-track { height: 44px; background: transparent; }
.slide::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: 8px;
  border-radius: 50%;
  background: #fff;
  border: 6px solid var(--c-navy);
  box-shadow: 0 3px 10px rgba(19, 38, 74, .35);
}
.slide::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 6px solid var(--c-navy);
  box-shadow: 0 3px 10px rgba(19, 38, 74, .35);
}
.slide:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(232, 130, 30, .35); }
.slide:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px rgba(232, 130, 30, .35); }
.ctl__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ctl__band { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0; font-size: .82rem; color: var(--c-muted); }
.ctl__band i { flex-shrink: 0; width: 16px; height: 8px; border-radius: 999px; background: rgba(143, 166, 73, .7); }
.ctl__band span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fit {
  flex-shrink: 0;
  min-height: 36px;
  padding-inline: 14px;
  border: 1px solid var(--c-good-line);
  border-radius: 999px;
  background: var(--c-good-bg);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-good);
  transition: background-color .15s;
}
.fit:hover { background: rgba(143, 166, 73, .2); }

/* Variedades */
.variety { min-width: 0; margin: 0; }
.variety__legend {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 8px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-navy);
}
.variety__legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--f-body); font-size: .8rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--c-muted); }
.variety__grid { clear: both; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.variety__opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 6px 4px 8px;
  border: 2px solid var(--c-border);
  border-radius: var(--r-tile);
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.variety__opt:hover { border-color: var(--c-gold); }
.variety__opt.on { border-color: var(--c-orange); box-shadow: 0 4px 14px -6px rgba(232, 130, 30, .6); }
.variety__opt:focus-within { outline: 3px solid rgba(232, 130, 30, .45); outline-offset: 2px; }
.variety__opt input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.variety__opt svg { flex-shrink: 0; width: 30px; height: 20px; }
.variety__opt span { font-family: var(--f-display); font-weight: 700; font-size: .85rem; line-height: 1.05; text-transform: uppercase; color: var(--c-navy); }

@media (min-width: 600px) {
  .stat__v { font-size: 2.2rem; }
}
