/* Produccion reutiliza los tokens visuales de Sofi Bodega. Todo queda aislado
   bajo .production-module o .production-station para no afectar otros modulos. */
.production-module {
  --prod-ink: var(--ink, #172026);
  --prod-muted: var(--muted, #65727d);
  --prod-line: var(--line, #d9e0e5);
  --prod-paper: var(--paper, #f5f7f8);
  --prod-panel: var(--panel, #fff);
  --prod-brand: var(--brand, #184e3d);
  --prod-brand-dark: var(--brand-dark, #122d27);
  --prod-accent: var(--brand-accent, #35b887);
  --prod-green: var(--green, #12805c);
  --prod-green-soft: var(--green-soft, #dff5eb);
  --prod-red: var(--red, #c93c37);
  --prod-red-soft: var(--red-soft, #ffe1df);
  --prod-blue: var(--blue, #2364aa);
  --prod-blue-soft: var(--blue-soft, #e3effd);
  --prod-yellow: var(--yellow, #b7791f);
  --prod-yellow-soft: var(--yellow-soft, #fff4cf);
  color: var(--prod-ink);
}

.production-module *,
.production-station * { box-sizing: border-box; }

.production-module button,
.production-module input,
.production-module select,
.production-module textarea,
.production-station button,
.production-station input,
.production-station select,
.production-station textarea { font: inherit; }

.production-module input,
.production-module select,
.production-module textarea,
.production-station input,
.production-station select,
.production-station textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--prod-line, #d9e0e5);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--prod-ink, #172026);
  background: #fff;
}

.production-module textarea,
.production-station textarea { min-height: 88px; resize: vertical; }

.production-module input:focus-visible,
.production-module select:focus-visible,
.production-module textarea:focus-visible,
.production-module button:focus-visible,
.production-station input:focus-visible,
.production-station select:focus-visible,
.production-station textarea:focus-visible,
.production-station button:focus-visible {
  outline: 3px solid rgba(35, 100, 170, .22);
  outline-offset: 2px;
}

.production-module label,
.production-station label {
  display: block;
  margin: 0 0 6px;
  color: var(--prod-muted, #65727d);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.production-module .prod-shell { display: grid; gap: 16px; }

.production-module .prod-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 92px;
  padding: 18px 20px;
  border: 1px solid #b8ead4;
  border-radius: 10px;
  background: linear-gradient(135deg, #f4fcf8, #e2f6ed);
}

.production-module .prod-banner h2 { margin: 0 0 5px; font-size: 20px; }
.production-module .prod-banner p { margin: 0; color: #49635a; }
.production-module .prod-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.production-module .prod-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: thin;
}

.production-module .prod-tab {
  min-height: 42px;
  border: 1px solid var(--prod-line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fff;
  color: #3e505a;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.production-module .prod-tab:hover { border-color: var(--prod-brand); }
.production-module .prod-tab.active { color: #fff; background: var(--prod-brand); border-color: var(--prod-brand); }
.production-module .prod-tab-panel { display: none; }
.production-module .prod-tab-panel.active { display: grid; gap: 16px; }

.production-module .prod-grid { display: grid; gap: 16px; }
.production-module .prod-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.production-module .prod-grid-aside { grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); align-items: start; }
.production-module .prod-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.production-module .prod-card,
.production-module .prod-panel {
  min-width: 0;
  border: 1px solid var(--prod-line);
  border-radius: 8px;
  background: var(--prod-panel);
  box-shadow: 0 12px 30px rgba(23, 32, 38, .06);
}

.production-module .prod-card { min-height: 112px; padding: 16px; display: grid; align-content: space-between; gap: 8px; }
.production-module .prod-card > span { color: var(--prod-muted); font-size: 13px; font-weight: 700; }
.production-module .prod-card > strong { font-size: 30px; line-height: 1; }
.production-module .prod-card small { color: var(--prod-muted); }
.production-module .prod-card.attention { background: var(--prod-yellow-soft); border-color: #f1d98a; }
.production-module .prod-card.danger { background: var(--prod-red-soft); border-color: #efb7b2; }
.production-module .prod-card.success { background: var(--prod-green-soft); border-color: #b8ead4; }

.production-module .prod-panel-head {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--prod-line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.production-module .prod-panel-head h2,
.production-module .prod-panel-head h3 { margin: 0; font-size: 17px; }
.production-module .prod-panel-body { padding: 16px; }
.production-module .prod-panel-body + .prod-panel-body { border-top: 1px solid var(--prod-line); }
.production-module .prod-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.production-module .prod-actions.end { justify-content: flex-end; }

.production-module .prod-btn,
.production-station .prod-btn {
  min-height: 42px;
  border: 1px solid var(--prod-line, #d9e0e5);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--prod-ink, #172026);
  font-weight: 900;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.production-module .prod-btn:hover:not(:disabled),
.production-station .prod-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(23, 32, 38, .1); }
.production-module .prod-btn:disabled,
.production-station .prod-btn:disabled { cursor: not-allowed; opacity: .55; }
.production-module .prod-btn.primary,
.production-station .prod-btn.primary { color: #fff; background: var(--prod-brand, #184e3d); border-color: var(--prod-brand, #184e3d); }
.production-module .prod-btn.info,
.production-station .prod-btn.info { color: var(--prod-blue, #2364aa); background: var(--prod-blue-soft, #e3effd); border-color: #b8d4f7; }
.production-module .prod-btn.warn,
.production-station .prod-btn.warn { color: var(--prod-yellow, #b7791f); background: var(--prod-yellow-soft, #fff4cf); border-color: #f1d98a; }
.production-module .prod-btn.danger,
.production-station .prod-btn.danger { color: var(--prod-red, #c93c37); background: #fff7f6; border-color: #efb7b2; }
.production-module .prod-btn.ghost,
.production-station .prod-btn.ghost { background: #f6f8f9; border-color: #cfd8de; color: #30414b; }
.production-module .prod-btn.compact { min-height: 34px; padding: 0 10px; font-size: 12px; }

.production-module .prod-status,
.production-station .prod-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 27px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.production-module .prod-status.green,
.production-station .prod-status.green { color: var(--prod-green, #12805c); background: var(--prod-green-soft, #dff5eb); }
.production-module .prod-status.blue,
.production-station .prod-status.blue { color: var(--prod-blue, #2364aa); background: var(--prod-blue-soft, #e3effd); }
.production-module .prod-status.yellow,
.production-station .prod-status.yellow { color: var(--prod-yellow, #b7791f); background: var(--prod-yellow-soft, #fff4cf); }
.production-module .prod-status.red,
.production-station .prod-status.red { color: var(--prod-red, #c93c37); background: var(--prod-red-soft, #ffe1df); }
.production-module .prod-status.gray,
.production-station .prod-status.gray { color: #5a6871; background: #edf2f4; }

.production-module .prod-table-wrap { width: 100%; overflow-x: auto; }
.production-module .prod-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.production-module .prod-table th,
.production-module .prod-table td { padding: 11px 8px; border-bottom: 1px solid var(--prod-line); text-align: left; vertical-align: middle; }
.production-module .prod-table th { color: var(--prod-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .02em; }
.production-module .prod-table tr:last-child td { border-bottom: 0; }
.production-module .prod-table tbody tr[data-action] { cursor: pointer; }
.production-module .prod-table tbody tr[data-action]:hover { background: #f5faf8; }

.production-module .prod-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.production-module .prod-form-grid .wide { grid-column: 1 / -1; }
.production-module .prod-field-note { display: block; margin-top: 5px; color: var(--prod-muted); font-size: 12px; line-height: 1.4; }
.production-module .prod-check { display: flex; align-items: flex-start; gap: 9px; }
.production-module .prod-check input { width: 18px; min-height: 18px; margin-top: 2px; }
.production-module .prod-check label { margin: 0; text-transform: none; font-size: 13px; }
.production-module label.prod-check { margin: 0; text-transform: none; font-size: 13px; letter-spacing: 0; }

.production-module .prod-alert,
.production-station .prod-alert {
  padding: 12px;
  border: 1px solid var(--prod-line, #d9e0e5);
  border-radius: 8px;
  background: #fff;
  color: var(--prod-muted, #65727d);
  line-height: 1.45;
}

.production-module .prod-alert.ok,
.production-station .prod-alert.ok { color: var(--prod-green, #12805c); background: var(--prod-green-soft, #dff5eb); border-color: #b8ead4; font-weight: 800; }
.production-module .prod-alert.warn,
.production-station .prod-alert.warn { color: #7b5400; background: var(--prod-yellow-soft, #fff4cf); border-color: #f1d98a; font-weight: 800; }
.production-module .prod-alert.err,
.production-station .prod-alert.err { color: var(--prod-red, #c93c37); background: var(--prod-red-soft, #ffe1df); border-color: #efb7b2; font-weight: 800; }
.production-module .prod-alert.info,
.production-station .prod-alert.info { color: var(--prod-blue, #2364aa); background: var(--prod-blue-soft, #e3effd); border-color: #b8d4f7; font-weight: 800; }

.production-module .prod-flow { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.production-module .prod-step { position: relative; min-height: 90px; padding: 12px; border: 1px solid var(--prod-line); border-radius: 8px; background: #fff; display: grid; gap: 7px; align-content: space-between; }
.production-module .prod-step::after { content: ""; position: absolute; right: -9px; top: 50%; width: 9px; border-top: 2px solid #b8c6cc; }
.production-module .prod-step:last-child::after { display: none; }
.production-module .prod-step strong { font-size: 13px; }
.production-module .prod-step small { color: var(--prod-muted); }
.production-module .prod-step.done { border-color: #9fe2c5; background: #f4fcf8; }
.production-module .prod-step.active { border-color: #8cb9e9; background: var(--prod-blue-soft); box-shadow: 0 0 0 3px rgba(35, 100, 170, .08); }
.production-module .prod-step.blocked { border-color: #efb7b2; background: #fff8f8; }

.production-module .prod-progress,
.production-station .prod-progress { height: 9px; overflow: hidden; border-radius: 999px; background: #edf2f4; }
.production-module .prod-progress > span,
.production-station .prod-progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--prod-green, #12805c); transition: width .2s ease; }

.production-module .prod-person-list { display: grid; gap: 8px; }
.production-module .prod-person {
  display: grid;
  grid-template-columns: minmax(120px, .6fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--prod-line);
}
.production-module .prod-person:last-child { border-bottom: 0; }
.production-module .prod-person small { display: block; margin-top: 3px; color: var(--prod-muted); }

.production-module .prod-filterbar { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)) auto; gap: 10px; align-items: end; }
.production-module .prod-empty { min-height: 130px; display: grid; place-items: center; padding: 24px; color: var(--prod-muted); text-align: center; }
.production-module .prod-empty strong { display: block; margin-bottom: 5px; color: var(--prod-ink); }
.production-module .prod-muted { color: var(--prod-muted); }
.production-module .prod-small { color: var(--prod-muted); font-size: 12px; }
.production-module .prod-mono { font-variant-numeric: tabular-nums; }

.production-module .prod-material-map { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, .42fr); gap: 14px; }
.production-module .prod-map-stage {
  min-height: 330px;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--prod-line);
  border-radius: 8px;
  background-color: #eef3f5;
  background-image: linear-gradient(#dde6ea 1px, transparent 1px), linear-gradient(90deg, #dde6ea 1px, transparent 1px);
  background-size: 28px 28px;
}
.production-module .prod-map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; min-width: 460px; }
.production-module .prod-location { min-height: 76px; padding: 10px; border: 1px solid #aebbc4; border-radius: 8px; background: #fff; display: grid; gap: 4px; align-content: center; }
.production-module .prod-location.has-material { border-color: var(--prod-green); background: var(--prod-green-soft); }
.production-module .prod-location.active { outline: 3px solid rgba(35, 100, 170, .25); border-color: var(--prod-blue); }
.production-module .prod-location strong { font-size: 12px; }
.production-module .prod-location span { color: var(--prod-muted); font-size: 11px; }

.production-module .prod-formula-result,
.production-station .prod-formula-result { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.production-module .prod-formula-value,
.production-station .prod-formula-value { padding: 12px; border: 1px solid #b8d4f7; border-radius: 8px; background: var(--prod-blue-soft); }
.production-module .prod-formula-value span,
.production-station .prod-formula-value span { display: block; color: #45698e; font-size: 12px; }
.production-module .prod-formula-value strong,
.production-station .prod-formula-value strong { display: block; margin-top: 4px; color: var(--prod-blue); font-size: 21px; }
.production-module .prod-input-difference,
.production-station .prod-input-difference { border-color: var(--prod-red, #c93c37); background: #fff8f8; box-shadow: 0 0 0 2px rgba(201, 60, 55, .1); }

/* Selectores, configuración y controles colaborativos */
.production-module .prod-reference-picker { position: relative; }
.production-module .prod-reference-results {
  position: absolute;
  inset: 68px 0 auto;
  z-index: 8;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--prod-line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(23, 32, 38, .16);
}
.production-module .prod-reference-results:empty { display: none; }
.production-module .prod-reference-results button {
  width: 100%;
  min-height: 62px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--prod-line);
  background: #fff;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.production-module .prod-reference-results button:hover { background: #f4fcf8; }
.production-module .prod-reference-results strong,
.production-module .prod-reference-results small { display: block; }
.production-module .prod-reference-results small { margin-top: 3px; color: var(--prod-muted); }
.production-module .prod-reference-loading { padding: 15px; color: var(--prod-muted); }
.production-module .prod-reference-selected { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--prod-green-soft); color: var(--prod-green); }
.production-module .prod-empty-inline { background: #f3f6f7; color: var(--prod-muted); }

.production-module .prod-subtabs { display: flex; gap: 8px; margin-bottom: 12px; }
.production-module .prod-subtab { min-height: 40px; padding: 0 16px; border: 1px solid var(--prod-line); border-radius: 999px; background: #fff; font-weight: 900; cursor: pointer; }
.production-module .prod-subtab.active { color: #fff; border-color: var(--prod-brand); background: var(--prod-brand); }
.production-module .prod-catalog-search { max-width: 560px; margin-bottom: 14px; }

.production-module .prod-formula-prototype,
.production-station .prod-formula-prototype { display: grid; gap: 12px; padding: 15px; border: 1px dashed #d7b34f; border-radius: 10px; background: #fffdf5; }
.production-module .prod-formula-prototype.compact { grid-template-columns: minmax(170px, 1fr) minmax(120px, .55fr) auto; align-items: end; }
.production-module .prod-formula-prototype-head,
.production-station .prod-formula-prototype-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.production-module .prod-formula-prototype.compact > .prod-formula-prototype-head,
.production-module .prod-formula-prototype.compact > p,
.production-module .prod-formula-prototype.compact > [data-formula-prototype-message] { grid-column: 1 / -1; }
.production-module .prod-input-with-unit,
.production-station .prod-input-with-unit { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 7px; }
.production-module .prod-formula-empty,
.production-station .prod-formula-empty { min-height: 64px; padding: 10px 12px; border: 1px solid var(--prod-line); border-radius: 8px; background: #f5f7f8; }
.production-module .prod-formula-empty span,
.production-station .prod-formula-empty span { display: block; color: var(--prod-muted); font-size: 12px; }
.production-module .prod-formula-empty strong,
.production-station .prod-formula-empty strong { display: block; margin-top: 3px; font-size: 24px; }

.production-module .prod-config-snapshot { padding: 12px; border: 1px solid var(--prod-line); border-radius: 9px; background: #fafcfc; }
.production-module .prod-config-snapshot summary { cursor: pointer; }
.production-module .prod-config-list { display: grid; gap: 12px; }
.production-module .prod-config-row { padding: 13px; border: 1px solid var(--prod-line); border-radius: 9px; background: #fff; }
.production-module .prod-config-row.not-applicable { opacity: .66; background: #f4f6f7; }
.production-module .prod-config-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.production-module .prod-config-row-head .prod-btn { margin-left: auto; }
.production-module .prod-config-row small { display: block; margin-top: 5px; color: var(--prod-muted); }
.production-module .prod-save-default { padding: 13px; border: 1px solid #b8d4f7; border-radius: 9px; background: var(--prod-blue-soft); }
.production-module .prod-save-default span { display: grid; gap: 3px; }
.production-module .prod-save-default small { color: #45698e; }

.production-module .prod-count-grid,
.production-station .prod-count-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 12px; }
.production-module .prod-count-card,
.production-station .prod-count-card { min-width: 0; padding: 13px; border: 1px solid var(--prod-line); border-radius: 10px; background: #fff; box-shadow: 0 7px 18px rgba(23, 32, 38, .05); display: grid; gap: 12px; }
.production-module .prod-count-head,
.production-station .prod-count-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.production-module .prod-count-head small,
.production-station .prod-count-head small { display: block; margin-top: 4px; color: var(--prod-muted); }
.production-module .prod-count-metrics,
.production-station .prod-count-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.production-module .prod-count-metrics > div,
.production-station .prod-count-metrics > div { padding: 9px; border-radius: 7px; background: #f3f6f7; }
.production-module .prod-count-metrics span,
.production-station .prod-count-metrics span { display: block; color: var(--prod-muted); font-size: 11px; }
.production-module .prod-count-metrics strong,
.production-station .prod-count-metrics strong { display: block; margin-top: 3px; font-size: 16px; }
.production-module .prod-count-metrics .has-difference,
.production-station .prod-count-metrics .has-difference { color: var(--prod-red); background: var(--prod-red-soft); }
.production-module .prod-contribution-list,
.production-station .prod-contribution-list { display: grid; gap: 5px; }
.production-module .prod-contribution-list > div,
.production-station .prod-contribution-list > div { display: grid; grid-template-columns: minmax(80px, 1fr) auto; gap: 3px 8px; padding: 7px 0; border-bottom: 1px solid var(--prod-line); }
.production-module .prod-contribution-list > div.is-voided,
.production-station .prod-contribution-list > div.is-voided { color: var(--prod-muted); opacity: .72; text-decoration: line-through; }
.production-module .prod-contribution-list small,
.production-station .prod-contribution-list small { grid-column: 1 / -1; color: var(--prod-muted); }
.production-module .prod-count-contribute { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.production-module .prod-count-resolution { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 11px; border-top: 1px solid var(--prod-line); }
.production-module .prod-count-resolution .wide { grid-column: 1 / -1; }
.production-module .prod-modal-wide .prod-modal { width: min(1120px, 100%); }

.production-station .station-material-line { display: grid; gap: 3px; padding: 8px 0; border-bottom: 1px solid var(--prod-line); }
.production-station .station-material-line:last-child { border-bottom: 0; }
.production-station .station-material-line span { font-size: 12px; }
.production-station #stationMaterialGate ul { margin: 7px 0 0; padding-left: 19px; }
.production-station .station-filling-identity { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.production-station .station-filling-identity > div { padding: 12px; border: 1px solid #b8d4f7; border-radius: 9px; background: var(--prod-blue-soft); }
.production-station .station-filling-identity span,
.production-station .station-filling-identity small { display: block; color: #45698e; }
.production-station .station-filling-identity strong { display: block; margin: 4px 0; }
.production-station .prod-receipt-list { display: grid; gap: 12px; }
.production-station .prod-receipt-row { padding: 13px; border: 1px solid var(--prod-line); border-radius: 10px; background: #fff; }
.production-station .prod-receipt-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 12px 0; }
.production-station .prod-receipt-metrics > div { min-width: 0; padding: 9px; border-radius: 7px; background: #f3f6f7; }
.production-station .prod-receipt-metrics span { display: block; color: var(--prod-muted); font-size: 11px; }
.production-station .prod-receipt-metrics strong { display: block; margin-top: 3px; overflow-wrap: anywhere; font-size: 15px; }
.production-station .station-material-receipt-summary { color: var(--prod-blue); font-weight: 800; }
.production-station .station-material-receipt-summary.pending { color: var(--prod-yellow); }
.production-station .station-count-entry { position: sticky; bottom: 0; padding: 13px; border: 1px solid #b8d4f7; border-radius: 10px; background: var(--prod-blue-soft); }
.production-station .station-modal-wide .prod-modal { width: min(1120px, 100%); }

.production-module .prod-drawer-backdrop,
.production-module .prod-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  background: rgba(23, 32, 38, .48);
}
.production-module .prod-drawer-backdrop.open,
.production-module .prod-modal-backdrop.open { display: flex; }
.production-module .prod-drawer-backdrop { justify-content: flex-end; }
.production-module .prod-drawer { width: min(650px, 96vw); height: 100%; overflow: auto; background: #fff; box-shadow: -24px 0 70px rgba(0, 0, 0, .2); }
.production-module .prod-drawer .prod-panel-head { position: sticky; top: 0; z-index: 2; background: #fff; }
.production-module .prod-modal-backdrop { align-items: center; justify-content: center; padding: 18px; }
.production-module .prod-modal { width: min(620px, 100%); max-height: 92vh; overflow: auto; border-radius: 10px; background: #fff; box-shadow: 0 24px 80px rgba(0, 0, 0, .22); }

.production-module .prod-toast-region,
.production-station .prod-toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 8px; width: min(380px, calc(100vw - 36px)); }
.production-module .prod-toast,
.production-station .prod-toast { padding: 12px 14px; border: 1px solid #b8ead4; border-left: 5px solid var(--prod-green, #12805c); border-radius: 8px; background: #fff; box-shadow: 0 14px 40px rgba(23, 32, 38, .18); font-weight: 800; }
.production-module .prod-toast.err,
.production-station .prod-toast.err { border-color: #efb7b2; border-left-color: var(--prod-red, #c93c37); }

.production-module .prod-connection,
.production-station .prod-connection {
  position: fixed;
  inset: 0 0 auto;
  z-index: 150;
  display: none;
  padding: 9px 16px;
  color: #fff;
  background: var(--prod-red, #c93c37);
  text-align: center;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.production-module .prod-connection.show,
.production-station .prod-connection.show { display: block; }

/* Estacion compartida */
body.production-station {
  --prod-ink: #172026;
  --prod-muted: #65727d;
  --prod-line: #d9e0e5;
  --prod-paper: #eef3f5;
  --prod-panel: #fff;
  --prod-brand: #184e3d;
  --prod-brand-dark: #122d27;
  --prod-accent: #35b887;
  --prod-green: #12805c;
  --prod-green-soft: #dff5eb;
  --prod-red: #c93c37;
  --prod-red-soft: #ffe1df;
  --prod-blue: #2364aa;
  --prod-blue-soft: #e3effd;
  --prod-yellow: #b7791f;
  --prod-yellow-soft: #fff4cf;
  margin: 0;
  min-width: 320px;
  color: var(--prod-ink);
  background: var(--prod-paper);
  font-family: Inter, system-ui, "Segoe UI", sans-serif;
}

.production-station .prod-grid { display: grid; gap: 12px; }
.production-station .prod-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.production-station .prod-form-grid .wide { grid-column: 1 / -1; }
.production-station .prod-small { color: var(--prod-muted); font-size: 12px; }
.production-station .prod-btn.compact { min-height: 34px; padding: 0 10px; font-size: 12px; }
.production-station .station-hidden { display: none !important; }
.production-station .station-screen { min-height: 100dvh; }
.production-station .station-auth { width: min(560px, calc(100% - 28px)); margin: 0 auto; padding: clamp(22px, 6vw, 64px) 0; display: grid; gap: 16px; }
.production-station .station-auth-card { padding: clamp(20px, 5vw, 34px); border: 1px solid var(--prod-line); border-radius: 12px; background: #fff; box-shadow: 0 20px 55px rgba(23, 32, 38, .1); display: grid; gap: 15px; }
.production-station .station-brand { display: flex; gap: 11px; align-items: center; }
.production-station .station-mark { position: relative; width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--prod-brand), var(--prod-brand-dark)); font-weight: 950; }
.production-station .station-mark::after { content: ""; position: absolute; right: 7px; bottom: 7px; width: 14px; height: 5px; border-radius: 99px; background: var(--prod-accent); }
.production-station .station-auth h1 { margin: 8px 0 0; font-size: clamp(27px, 5vw, 38px); }
.production-station .station-auth p { margin: 0; color: var(--prod-muted); line-height: 1.45; }

.production-station .station-app { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 100dvh; }
.production-station .station-topbar { position: sticky; top: 0; z-index: 30; min-height: 72px; padding: 11px clamp(14px, 3vw, 28px); color: #fff; background: linear-gradient(135deg, var(--prod-brand), var(--prod-brand-dark)); display: flex; justify-content: space-between; gap: 12px; align-items: center; box-shadow: 0 8px 20px rgba(18, 45, 39, .18); }
.production-station .station-user { display: flex; align-items: center; gap: 10px; }
.production-station .station-avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--prod-brand); background: #fff; font-weight: 950; }
.production-station .station-user small { display: block; color: #c6dcd4; margin-top: 2px; }
.production-station .station-top-actions { display: flex; gap: 8px; align-items: center; }
.production-station .station-top-actions .prod-btn { min-height: 42px; border-color: rgba(255, 255, 255, .3); color: #fff; background: rgba(255, 255, 255, .1); }

.production-station .station-main { width: min(1220px, 100%); margin: 0 auto; padding: clamp(14px, 3vw, 28px); display: grid; gap: 16px; align-content: start; }
.production-station .station-grid { display: grid; grid-template-columns: minmax(320px, .85fr) minmax(420px, 1.15fr); gap: 16px; align-items: start; }
.production-station .station-panel { border: 1px solid var(--prod-line); border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(23, 32, 38, .06); overflow: hidden; }
.production-station .station-panel-head { min-height: 58px; padding: 13px 16px; border-bottom: 1px solid var(--prod-line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.production-station .station-panel-head h2 { margin: 0; font-size: 18px; }
.production-station .station-panel-body { padding: 16px; display: grid; gap: 14px; }
.production-station .station-task-list { display: grid; gap: 10px; max-height: calc(100dvh - 200px); overflow: auto; padding: 2px; }
.production-station .station-task { width: 100%; min-height: 112px; padding: 13px; border: 1px solid var(--prod-line); border-radius: 9px; background: #fff; text-align: left; cursor: pointer; display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.production-station .station-task:hover { border-color: var(--prod-green); }
.production-station .station-task.active { border-color: var(--prod-green); outline: 3px solid rgba(18, 128, 92, .12); background: #f8fefa; }
.production-station .station-task.material-blocked { border-color: #e5c66d; background: #fffdf7; }
.production-station .station-task img,
.production-station .station-product-image { width: 62px; height: 62px; border: 1px solid var(--prod-line); border-radius: 8px; object-fit: contain; background: #f8faf9; }
.production-station .station-task strong { display: block; font-size: 15px; }
.production-station .station-task small { display: block; margin-top: 4px; color: var(--prod-muted); line-height: 1.35; }
.production-station .station-task-meta { text-align: right; display: grid; justify-items: end; gap: 5px; }

.production-station .station-work-head { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: center; }
.production-station .station-product-image { width: 92px; height: 92px; }
.production-station .station-work-head h1 { margin: 0 0 5px; font-size: clamp(22px, 4vw, 32px); }
.production-station .station-work-head p { margin: 0; color: var(--prod-muted); }
.production-station .station-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.production-station .station-kpi { min-height: 82px; padding: 11px; border: 1px solid var(--prod-line); border-radius: 8px; background: #fff; }
.production-station .station-kpi span { display: block; color: var(--prod-muted); font-size: 12px; }
.production-station .station-kpi strong { display: block; margin-top: 5px; font-size: 23px; line-height: 1; }
.production-station .station-timer { padding: 18px; border: 1px solid #b8d4f7; border-radius: 10px; background: var(--prod-blue-soft); text-align: center; }
.production-station .station-timer span { display: block; color: #426a92; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.production-station .station-timer strong { display: block; margin-top: 5px; color: var(--prod-blue); font-size: clamp(38px, 8vw, 58px); line-height: 1; font-variant-numeric: tabular-nums; }
.production-station .station-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.production-station .station-actions .prod-btn { min-height: 58px; font-size: 16px; }
.production-station .station-actions .wide { grid-column: 1 / -1; }
.production-station .station-inline { display: flex; gap: 10px; align-items: end; }
.production-station .station-inline > div { flex: 1; }
.production-station .station-handoff-card { display: grid; gap: 9px; padding: 13px; border: 1px solid var(--prod-line); border-radius: 9px; background: #fff; }
.production-station .station-handoff-card p { margin: 0; color: var(--prod-muted); }
.production-station .station-actions .prod-btn:disabled { cursor: not-allowed; opacity: .52; }

.production-station .operator-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
.production-station .operator-choice { min-height: 86px; padding: 10px; border: 1px solid var(--prod-line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 900; }
.production-station .operator-choice.active { border-color: var(--prod-green); color: var(--prod-green); background: var(--prod-green-soft); }
.production-station .pin-input { text-align: center; letter-spacing: .45em; font-size: 28px; font-weight: 950; }

.production-station .prod-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(23, 32, 38, .55);
}
.production-station .prod-modal-backdrop.open { display: flex; }
.production-station .prod-modal { width: min(650px, 100%); max-height: 92dvh; overflow: auto; border-radius: 10px; background: #fff; box-shadow: 0 24px 80px rgba(0, 0, 0, .24); }

@media (max-width: 1100px) {
  .production-module .prod-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-module .prod-grid-aside,
  .production-module .prod-material-map { grid-template-columns: 1fr; }
  .production-module .prod-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .production-station .station-grid { grid-template-columns: 1fr; }
  .production-station .station-task-list { max-height: 370px; }
}

@media (max-width: 700px) {
  .production-module .prod-banner { display: grid; }
  .production-module .prod-banner-actions { justify-content: flex-start; }
  .production-module .prod-grid-2,
  .production-module .prod-kpis,
  .production-module .prod-form-grid,
  .production-module .prod-formula-result,
  .production-module .prod-filterbar { grid-template-columns: 1fr; }
  .production-module .prod-person { grid-template-columns: 1fr; }
  .production-module .prod-form-grid .wide { grid-column: auto; }
  .production-module .prod-formula-prototype.compact { grid-template-columns: 1fr; }
  .production-module .prod-formula-prototype.compact > .prod-formula-prototype-head,
  .production-module .prod-formula-prototype.compact > p,
  .production-module .prod-formula-prototype.compact > [data-formula-prototype-message] { grid-column: auto; }
  .production-module .prod-count-contribute,
  .production-module .prod-count-resolution { grid-template-columns: 1fr; }
  .production-module .prod-count-resolution .wide { grid-column: auto; }
  .production-module .prod-card { min-height: 98px; }
  .production-station .station-topbar { align-items: flex-start; }
  .production-station .station-top-actions { display: grid; }
  .production-station .station-top-actions .prod-btn { min-height: 36px; padding: 0 9px; font-size: 12px; }
  .production-station .station-task { grid-template-columns: 52px minmax(0, 1fr); }
  .production-station .station-task img { width: 52px; height: 52px; }
  .production-station .station-task-meta { grid-column: 2; text-align: left; }
  .production-station .station-kpis { grid-template-columns: 1fr 1fr; }
  .production-station .station-work-head { grid-template-columns: 70px minmax(0, 1fr); }
  .production-station .station-product-image { width: 70px; height: 70px; }
  .production-station .station-inline { display: grid; }
  .production-station .prod-form-grid { grid-template-columns: 1fr; }
  .production-station .prod-form-grid .wide { grid-column: auto; }
  .production-station .prod-formula-result { grid-template-columns: 1fr; }
  .production-station .station-filling-identity,
  .production-station .prod-receipt-metrics,
  .production-module .prod-count-grid,
  .production-station .prod-count-grid { grid-template-columns: 1fr; }
}

@media print {
  .production-module .prod-tabs,
  .production-module .prod-banner-actions,
  .production-module .prod-actions,
  .production-module .prod-filterbar,
  .production-module .prod-connection,
  .production-module .prod-toast-region { display: none !important; }
  .production-module .prod-tab-panel { display: none !important; }
  .production-module .prod-tab-panel.active { display: block !important; }
  .production-module .prod-panel,
  .production-module .prod-card { box-shadow: none; break-inside: avoid; }
}
