/* DSolutions — calculadoras del Toolkit (OEE y Takt), v1 2026-09-24. Solo se cargan en las páginas con calculadora.
   Colores = los de las hojas técnicas (paleta validada): ok #2E8B57 · ámbar #E3A008 · rojo #C0392B ·
   pérdida principal #C2610C · contexto #7B8594 · tinta #1B4E85. El texto usa las tintas del sitio, nunca el color de serie. */
.tk-calc-sec:empty { display: none; }
.tkc { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; margin-top: 20px; align-items: start; }
@media (max-width: 880px) { .tkc { grid-template-columns: 1fr; } }

/* ---- formulario */
.tkc-form { background: var(--bone); border-radius: 20px; padding: 20px; display: grid; gap: 16px; }
.tkc-field { min-width: 0; }
.tkc-field label, .tkc-label { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.35; color: var(--ink); margin: 0 0 6px; }
/* Etiqueta "del ejemplo": oculta hasta que la sección se toca (tkc-touched) y solo en el campo que sigue con el número de partida (is-example). */
.tkc-ex {
  display: none; margin-left: 8px; white-space: nowrap; font: 600 10.5px 'JetBrains Mono', monospace; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted-on-bone); background: var(--paper); border: 1px solid #D6CFBF; border-radius: 999px;
  padding: 2px 8px; vertical-align: 1px;
}
.tkc-touched .tkc-field.is-example .tkc-ex { display: inline-block; }
.tkc-form input {
  width: 100%; box-sizing: border-box; font: 600 17px/1.2 'Inter', system-ui, sans-serif; color: var(--ink);
  background: var(--paper); border: 1.5px solid #D6CFBF; border-radius: 12px; padding: 11px 13px; min-height: 46px;
  font-variant-numeric: tabular-nums; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.tkc-form input:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(74, 138, 216, .28); }
.tkc-form input[aria-invalid="true"] { border-color: #C0392B; box-shadow: 0 0 0 3px rgba(192, 57, 43, .15); }
.tkc-field small { display: block; font-size: 12.5px; line-height: 1.4; color: var(--muted-on-bone); margin-top: 6px; }
.tkc-moneyin { border-top: 1px dashed #CFC8B8; padding-top: 14px; }
.tkc-reset {
  justify-self: start; background: none; border: 0; padding: 4px 0; cursor: pointer;
  font: 600 14px 'Inter', system-ui, sans-serif; color: var(--signal-ink); text-decoration: underline; text-underline-offset: 3px;
}
.tkc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tkc-steps-in { display: grid; gap: 8px; }
.tkc-sin, .tkc-rowhead { display: grid; grid-template-columns: var(--cols, minmax(0, 1fr) 92px 40px); gap: 8px; align-items: center; }
.tkc-rc { min-width: 0; display: block; }
.tkc-rc.nm input { font-weight: 500; }
.tkc-rowhead { margin: 0 0 6px; font: 600 11px 'JetBrains Mono', monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-on-bone); }
.tkc-rowhead { align-items: end; }
.tkc-rowhead span { min-width: 0; line-height: 1.25; overflow-wrap: anywhere; }
.tkc-rowhead span.c { text-align: center; }
.tkc-form select {
  width: 100%; box-sizing: border-box; min-height: 46px; padding: 0 8px; cursor: pointer;
  font: 600 17px/1.2 'Inter', system-ui, sans-serif; color: var(--ink); background: var(--paper);
  border: 1.5px solid #D6CFBF; border-radius: 12px; text-align: center;
}
.tkc-form select:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(74, 138, 216, .28); }
.tkc-chk { display: flex; align-items: center; justify-content: center; min-height: 46px; }
.tkc-chk input { width: 24px; height: 24px; min-height: 0; margin: 0; padding: 0; accent-color: #2E8B57; cursor: pointer; }
.tkc-x {
  width: 40px; height: 46px; border-radius: 12px; border: 1.5px solid #D6CFBF; background: var(--paper);
  color: var(--muted-on-bone); font-size: 20px; line-height: 1; cursor: pointer;
}
.tkc-x:hover { border-color: #C0392B; color: #C0392B; }
.tkc-add {
  margin-top: 8px; background: none; border: 1.5px dashed #C9C1AE; border-radius: 12px; padding: 9px 14px; cursor: pointer;
  font: 600 14px 'Inter', system-ui, sans-serif; color: var(--signal-ink);
}
.tkc-add:hover { border-color: var(--signal-ink); }

/* ---- resultado */
.tkc-out {
  scroll-margin-top: 96px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: grid; gap: 16px;
  box-shadow: var(--shadow-card); min-width: 0;
}
.tkc-eyebrow { margin: 0; font: 600 12px 'JetBrains Mono', monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tkc-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.tkc-hero-l { font: 700 15px 'JetBrains Mono', monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.tkc-hero-n { font-size: clamp(46px, 6.4vw, 66px); font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--signal-ink); font-variant-numeric: tabular-nums; }
.tkc-hero-sub { font-size: 14px; color: var(--muted); }
.tkc-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.tkc-chip.ok { background: #E3F2E8; color: #1E5E3A; }
.tkc-chip.warn { background: #FFF3CF; color: #7A5200; }
.tkc-chip.bad { background: #FBE3DF; color: #8E2A20; }
.tkc-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.tkc-dot.ok { background: #2E8B57; }
.tkc-dot.warn { background: #E3A008; }
.tkc-dot.bad { background: #C0392B; }
.tkc-rows { list-style: none; margin: 0; padding: 0; }
.tkc-rows li {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--carbon);
}
.tkc-rows li:first-child { border-top: 1px solid var(--line); }
.tkc-rows .v { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.tkc-rows .m { font-size: 13px; color: var(--muted); min-width: 84px; text-align: right; }
.tkc-p { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--carbon); }
.tkc-loss { display: grid; gap: 10px; }
.tkc-lossbar { display: flex; gap: 2px; height: 20px; border-radius: 5px; overflow: hidden; background: var(--paper); }
.tkc-lossbar span { background: #7B8594; min-width: 3px; }
.tkc-lossbar span.main { background: #C2610C; }
.tkc-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--carbon); }
.tkc-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: #7B8594; margin-right: 6px; vertical-align: -1px; }
.tkc-legend i.main { background: #C2610C; }
.tkc-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tkc-msg { margin: 0; font-size: 14.5px; line-height: 1.45; padding: 11px 13px; border-radius: 12px; background: #FFF3CF; color: #7A5200; }
.tkc-msg.err { background: #FBE3DF; color: #8E2A20; }
.tkc-msg-t { display: block; font-size: 15.5px; margin: 0 0 4px; }
.tkc-money-out { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; color: var(--ink); background: var(--bone); border-radius: 12px; padding: 12px 14px; }

/* ---- takt: ciclo por paso contra la línea de takt */
.tkc-steps-out { display: grid; gap: 10px; padding-top: 22px; }
/* columnas fijas: la línea de takt cae en el mismo x en todas las filas */
.tkc-srow { display: grid; grid-template-columns: 104px minmax(0, 1fr) 172px; align-items: center; gap: 10px; font-size: 14.5px; }
.tkc-srow .n { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tkc-track { position: relative; height: 28px; }
.tkc-fill { position: absolute; left: 0; top: 0; bottom: 0; box-sizing: border-box; border: 2px solid; border-radius: 0 5px 5px 0; overflow: hidden; }
.tkc-fill.ok { background: #E3F2E8; border-color: #2E8B57; }
.tkc-fill.warn { background: #FFF3CF; border-color: #E3A008; }
.tkc-fill.bad { background: #FBE3DF; border-color: #C0392B; }
.tkc-over {
  position: absolute; top: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(45deg, rgba(194, 97, 12, .6) 0 3px, rgba(194, 97, 12, .14) 3px 8px);
}
.tkc-taktline { position: absolute; top: -7px; bottom: -7px; width: 0; border-left: 2.5px dashed var(--signal-ink); pointer-events: none; }
.tkc-taktlabel {
  position: absolute; bottom: calc(100% + 2px); left: 0; transform: translateX(-50%);
  font: 700 12px 'JetBrains Mono', monospace; color: var(--signal-ink); white-space: nowrap; background: var(--paper); padding: 0 4px;
}
.tkc-srow .f { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; color: var(--carbon); }
.tkc-srow .f b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tkc-verdict { display: flex; gap: 10px; align-items: baseline; font-weight: 600; color: var(--ink); }
.tkc-verdict .tkc-dot { position: relative; top: 1px; }

/* ---- franja en vivo (solo con el formulario arriba del resultado) */
.tkc-live { display: none; }
@media (max-width: 880px) {
  .tkc-live {
    display: flex; flex-wrap: wrap; position: sticky; bottom: var(--tkc-live-bottom, 12px); z-index: 5; align-items: center; gap: 4px 12px;
    background: var(--ink); color: #fff; border-radius: 14px; padding: 11px 14px; box-shadow: 0 12px 30px rgba(15, 27, 45, .3);
  }
  .tkc-live:empty { display: none; }
  .tkc-live-v { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .tkc-live-t { order: 3; flex: 1 1 100%; min-width: 0; font-size: 12.5px; line-height: 1.3; color: #C9D6E8; }
  .tkc-live a { order: 2; margin-left: auto; color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
}

/* ---- llamada a David */
.tkc-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.tkc-cta p { margin: 0; font-weight: 700; font-size: 16px; color: var(--ink); }
.tkc-cta small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 3px; }

.tkc-takt-key { display: none; margin: -6px 0 0; align-items: center; gap: 8px; font: 700 12px 'JetBrains Mono', monospace; color: var(--signal-ink); }
.tkc-takt-key i { display: inline-block; width: 24px; border-top: 2.5px dashed var(--signal-ink); }

@media (max-width: 560px) {
  .tkc-taktlabel { display: none; }
  .tkc-takt-key { display: flex; }
  .tkc-steps-out { padding-top: 0; }
  .tkc-form, .tkc-out { padding: 16px; border-radius: 16px; }
  .tkc-srow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .tkc-srow .tkc-track { grid-column: 1 / -1; grid-row: 2; }
  .tkc-steps-out { gap: 12px; }
  .tkc-cta .btn { width: 100%; justify-content: center; }
}

/* ---- v2: SMED, VSM, Pareto, riesgo, Kanban */
.tkc-chiprow { margin: -6px 0 0; }
.tkc-dot.none { visibility: hidden; }
.tkc-legend i.work { background: #4A8AD8; }
.tkc-legend .tkc-note { color: var(--muted); }
.tkc-rows .v small { font-weight: 500; color: var(--muted); }
/* SMED: hoy vs. con SMED */
.tkc-cmp { display: grid; gap: 10px; }
.tkc-crow { display: grid; grid-template-columns: 88px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 14.5px; }
.tkc-crow .n { font-weight: 600; color: var(--ink); }
.tkc-crow .v { font-weight: 700; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.tkc-cbar { display: flex; height: 26px; border-radius: 5px; overflow: hidden; }
.tkc-cbar span { box-sizing: border-box; flex: none; }
.tkc-cbar span + span { border-left: 2px solid var(--paper); }
.tkc-cbar .ext { background: #C2610C; }
.tkc-cbar .int { background: #7B8594; }
/* VSM: línea de tiempo trabajo / espera */
.tkc-timeline { display: flex; gap: 2px; height: 26px; border-radius: 5px; overflow: hidden; background: var(--paper); }
.tkc-timeline span { min-width: 5px; }
.tkc-timeline .work { background: #4A8AD8; }
.tkc-timeline .wait { background: #7B8594; }
.tkc-timeline .wait.main { background: #C2610C; }
/* Pareto: barras ordenadas, pocos vitales en ámbar */
.tkc-pareto { padding-top: 0; }
.tkc-srow.wide { grid-template-columns: 170px minmax(0, 1fr) 128px; }
.tkc-fill.vital { background: #FBEBDD; border-color: #C2610C; }
.tkc-fill.rest { background: #EEF0F3; border-color: #7B8594; }
/* Matriz de riesgo 5 × 5 */
.tkc-mxwrap { display: grid; grid-template-columns: 18px minmax(0, 380px); grid-template-rows: auto auto; column-gap: 6px; row-gap: 4px; }
.tkc-mx-t { font: 600 11px 'JetBrains Mono', monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tkc-mx-t.s { grid-row: 1; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; align-self: center; }
.tkc-mx-t.p { grid-column: 2; padding-left: 26px; }
.tkc-matrix { display: grid; grid-template-columns: 20px repeat(5, minmax(0, 1fr)); gap: 3px; }
.tkc-mx { position: relative; aspect-ratio: 1.35; border-radius: 6px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px; }
.tkc-mx.lo { background: #E3F2E8; } .tkc-mx.mo { background: #FFF3CF; } .tkc-mx.hi { background: #FBE3DF; }
.tkc-mx em { position: absolute; right: 4px; bottom: 2px; font: 600 10px 'JetBrains Mono', monospace; font-style: normal; color: rgba(15, 27, 45, .38); }
.tkc-mx b {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font: 700 12px 'Inter', system-ui, sans-serif; color: #fff; position: relative; z-index: 1;
}
.tkc-mx b.lo { background: #2E8B57; } .tkc-mx b.mo { background: #B7800A; } .tkc-mx b.hi { background: #C0392B; }
.tkc-mx-ax { font: 600 11px 'JetBrains Mono', monospace; color: var(--muted); display: flex; align-items: center; justify-content: center; }

@media (max-width: 560px) {
  /* filas largas (SMED, VSM, riesgo): el nombre en su línea; cada dato con su título arriba */
  .tkc-rowhead.wide { display: none; }
  .tkc-sin.wide { grid-template-columns: repeat(var(--mn, 2), minmax(0, 1fr)) 40px; row-gap: 6px; align-items: end; }
  .tkc-sin.wide .tkc-rc.nm { grid-column: 1 / -1; }
  .tkc-sin.wide .tkc-rc:not(.nm)::before { content: attr(data-cap); display: block; margin: 0 0 3px; font: 600 10.5px 'JetBrains Mono', monospace; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-on-bone); }
  .tkc-sin.wide + .tkc-sin.wide { border-top: 1px dashed #D6CFBF; padding-top: 10px; }
  .tkc-srow.wide { grid-template-columns: minmax(0, 1fr) auto; }
  .tkc-crow { grid-template-columns: 72px minmax(0, 1fr) 56px; }
  .tkc-rows.risk li { grid-template-columns: 12px minmax(0, 1fr) auto; row-gap: 2px; }
  .tkc-rows.risk .m { grid-column: 2 / -1; text-align: left; min-width: 0; }
}
