/* Diálogos de trabajo (2026-09-20, petición de Carlos): foco discreto en los
   campos y hojas anchas, ordenadas y con la acción principal siempre a la
   vista. Solo tokens. */

/* — Foco: borde y halo suave en la propia caja, nunca un anillo encima. — */
input:focus-visible,select:focus-visible,textarea:focus-visible{outline:0;border-color:var(--turquoise);box-shadow:0 0 0 3px rgba(21,156,132,.14)}
dialog input:focus,dialog select:focus,dialog textarea:focus{outline:0;border-color:var(--turquoise);box-shadow:0 0 0 3px rgba(21,156,132,.14)}

/* — Hoja: ancha, cabecera y pie fijos, cuerpo con aire. — */
dialog.sheet-dialog{width:min(96vw,1120px);max-width:min(96vw,1120px);max-height:90dvh;border:0;padding:0;border-radius:16px;background:transparent}
dialog.sheet-dialog>.dialog-card{display:flex;flex-direction:column;width:100%;max-height:90dvh;margin:0;padding:0;overflow:hidden;border-radius:16px;border-top:5px solid var(--turquoise);background:var(--surface);box-shadow:var(--shadow)}
dialog.sheet-dialog>.dialog-card>header{flex:none;display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin:0;padding:22px 28px 18px;border-bottom:1px solid var(--line)}
dialog.sheet-dialog>.dialog-card>header span{display:block;color:var(--blue-dark);font-size:11px;font-weight:850;letter-spacing:.09em;text-transform:uppercase}
dialog.sheet-dialog>.dialog-card>header h2{margin:4px 0 0;font-size:24px;line-height:1.15}
dialog.sheet-dialog>.dialog-card>header p{margin:6px 0 0;color:var(--muted);font-size:13px}
dialog.sheet-dialog>.dialog-card>header .icon-button{flex:none;width:44px;height:44px}
dialog.sheet-dialog .sheet-body{flex:1 1 auto;min-height:0;overflow:auto;padding:22px 28px 26px}
dialog.sheet-dialog .sheet-footer{flex:none;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 28px;border-top:1px solid var(--line);background:var(--surface)}
dialog.sheet-dialog .sheet-footer small{color:var(--muted);font-size:12px}
dialog.sheet-dialog .sheet-footer .button{width:auto;min-width:220px}
dialog.sheet-dialog .dialog-error{margin:0}
dialog.sheet-dialog .sheet-footer .dialog-error{flex:1}
/* Avisos: una línea discreta, no un bloque gris. */
dialog.sheet-dialog .automation-guard{margin:0 0 18px;padding:10px 14px;border-left:3px solid var(--turquoise);background:var(--soft);font-size:13px}
dialog.sheet-dialog .automation-guard strong{display:inline;margin-right:6px}
dialog.sheet-dialog .automation-guard p{display:inline;margin:0;color:var(--muted)}
dialog.sheet-dialog label{display:block;margin:0 0 14px;color:var(--text);font-size:13px;font-weight:700}
dialog.sheet-dialog label>small{display:block;margin-top:4px;color:var(--muted);font-size:12px;font-weight:500}
dialog.sheet-dialog input:not([type="checkbox"]):not([type="radio"]),dialog.sheet-dialog select,dialog.sheet-dialog textarea{width:100%;box-sizing:border-box;margin-top:6px;min-height:46px;padding:10px 13px;border:1px solid var(--line-control);border-radius:10px;background:var(--surface);font-size:15px}
dialog.sheet-dialog textarea{min-height:88px;resize:vertical}
dialog.sheet-dialog .field-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:0 18px}
/* Bloque de sección dentro de la hoja. */
dialog.sheet-dialog .sheet-section{margin:0 0 18px;padding:18px 20px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
dialog.sheet-dialog .sheet-section>header{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin:0 0 14px}
dialog.sheet-dialog .sheet-section>header span{display:block;color:var(--blue-dark);font-size:11px;font-weight:850;letter-spacing:.09em}
dialog.sheet-dialog .sheet-section>header h3{margin:2px 0 0;font-size:16px}
dialog.sheet-dialog .sheet-section>header small{color:var(--muted);font-size:12px}
dialog.sheet-dialog .sheet-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 28px}
dialog.sheet-dialog .sheet-columns>.wide{grid-column:1/-1}


/* — Composición de materiales: lista a la izquierda, editor a la derecha — */
#automation-bom-dialog .sheet-body{display:grid;grid-template-columns:340px minmax(0,1fr);gap:0 26px;align-content:start}
#automation-bom-dialog .automation-guard{grid-column:1/-1}
#automation-bom-dialog .bom-aside{position:sticky;top:0;align-self:start;max-height:calc(100dvh - 190px);overflow:auto;padding-right:6px}
#automation-bom-dialog .bom-aside details{margin:0 0 12px;border:1px solid var(--line);border-radius:10px;padding:8px 12px}
#automation-bom-dialog .bom-aside summary{cursor:pointer;font-size:12px;font-weight:800;color:var(--blue-dark);padding:4px 0}
#automation-bom-dialog .bom-product-list{grid-template-columns:1fr;gap:6px;margin:8px 0 4px}
#automation-bom-dialog .bom-product-card{padding:11px 12px;border-radius:8px}
#automation-bom-dialog .bom-placeholder{display:grid;place-items:center;min-height:320px;padding:30px;border:1px dashed var(--line);border-radius:12px;color:var(--muted);text-align:center}
#automation-bom-dialog .sheet-body:has(#automation-bom-form:not([hidden])) .bom-placeholder{display:none}
#automation-bom-dialog #automation-bom-form{min-width:0}
#automation-bom-dialog .bom-editor-head{border-radius:12px}
#automation-bom-dialog .bom-readiness{margin:0 0 16px;padding:14px 16px;border:1px solid var(--line);border-radius:12px}
#automation-bom-dialog .bom-readiness>header{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:8px}
#automation-bom-dialog .bom-readiness>header label{width:150px;margin:0}
#automation-bom-dialog #automation-bom-form>.field-grid{grid-template-columns:200px minmax(0,1fr)}
#automation-bom-dialog .bom-components{border-top:0;padding-top:0}
#automation-bom-dialog .bom-component-row{border-radius:10px}
#automation-bom-dialog #bom-proposal-review{padding:12px 14px}
#automation-bom-dialog #bom-proposal-review ul{margin:6px 0;padding-left:18px}
/* Revisión de Factusol compacta (2026-10-18): explicación en «?», detalles plegados y lo que bloquea con su acción. */
#automation-bom-dialog .bom-review-head{display:flex;align-items:center;gap:4px;margin:0 0 6px}
#automation-bom-dialog .bom-review-head strong{display:inline;margin:0;font-size:14px}
#automation-bom-dialog #bom-proposal-review details{margin:4px 0}
#automation-bom-dialog #bom-proposal-review details>summary{padding:4px 0;font-size:12px;font-weight:700;color:var(--blue-dark)}
#automation-bom-dialog #bom-proposal-review p{display:block;margin:0 0 8px;color:var(--text)}
#automation-bom-dialog #bom-proposal-review label.bom-confirm{display:flex;align-items:flex-start;gap:10px;margin:10px 0 0;font-size:13px}
#automation-bom-dialog .bom-missing{margin:10px 0 4px;padding:12px 14px;border:1px solid var(--amber-strong);border-radius:10px;background:var(--amber-soft)}
#automation-bom-dialog .bom-missing.is-done{border-color:var(--line);background:var(--surface)}
#automation-bom-dialog .bom-missing-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 14px;align-items:center;padding:10px 0;border-top:1px solid var(--line)}
#automation-bom-dialog .bom-missing-row:first-of-type{border-top:0}
#automation-bom-dialog .bom-missing-identity span,#automation-bom-dialog .bom-missing-identity strong,#automation-bom-dialog .bom-missing-identity small{display:block}
#automation-bom-dialog .bom-missing-identity span{color:var(--blue-dark);font-size:11px;font-weight:850;letter-spacing:.06em}
#automation-bom-dialog .bom-missing-identity strong{margin:2px 0;font-size:13px}
#automation-bom-dialog .bom-missing-identity small{color:var(--muted);font-size:12px}
#automation-bom-dialog .bom-missing-actions{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end}
#automation-bom-dialog .bom-missing-actions .small-action{overflow-wrap:normal;word-break:normal}
#automation-bom-dialog #bom-proposal-review p strong{margin-right:0}
#automation-bom-dialog .bom-missing-actions .small-action,#automation-bom-dialog .bom-missing-row.is-resolved .small-action{width:auto;min-height:38px;padding:6px 12px}
#automation-bom-dialog .bom-missing-done{grid-column:1/-1;grid-row:2;margin:0;color:var(--green);font-size:13px;font-weight:700}
#automation-bom-dialog .bom-missing-row.is-resolved{grid-template-columns:minmax(0,1fr) auto}
#automation-bom-dialog .bom-missing-row.is-resolved>.small-action{grid-column:2;grid-row:1}
#automation-bom-dialog .bom-missing-search{grid-column:1/-1}
#automation-bom-dialog .bom-missing-search label{margin:0}
#automation-bom-dialog .bom-missing-search .automation-search-results{max-height:220px;overflow:auto}
/* Pie fijo: el motivo del bloqueo a la izquierda, las acciones a la derecha; nada queda encima del formulario. */
#automation-bom-dialog .bom-footer{flex-wrap:wrap}
#automation-bom-dialog .bom-footer>small{flex:1 1 260px}
#automation-bom-dialog .bom-footer>small.is-blocked{color:var(--amber);font-weight:700}
#automation-bom-dialog .bom-footer>.dialog-error{flex:1 1 100%}
#automation-bom-dialog .bom-footer-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
#automation-bom-dialog .bom-footer .button.secondary{min-width:0}
#automation-bom-dialog .bom-readiness[hidden]{display:none}
@media (max-width:900px){#automation-bom-dialog .sheet-body{display:block}#automation-bom-dialog .bom-aside{position:static;max-height:none;overflow:visible;padding-right:0}}
@media (max-width:640px){#automation-bom-dialog .bom-missing-row{grid-template-columns:minmax(0,1fr)}#automation-bom-dialog .bom-missing-actions{justify-content:flex-start}#automation-bom-dialog .bom-footer-actions,#automation-bom-dialog .bom-footer-actions .button{width:100%;min-width:0}}

/* — Orden de fabricación (Carlos, 2026-10-18): hoja con cabecera de artículo, cantidad y estado, barra de
   trabajo en una línea, tabla de previsto frente a real, series y unidades, y acciones en el pie fijo. — */
#automation-detail-dialog .automation-detail-headline{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;margin:10px 0 0;color:var(--text);font-size:13px}
#automation-detail-dialog .automation-detail-headline .status{padding:4px 10px}
#automation-detail-dialog .automation-detail-headline b{font-size:15px}
#automation-detail-dialog .automation-detail-headline>span:not(.status){color:var(--muted)}
#automation-detail-dialog .automation-detail-headline em{flex:1 1 100%;color:var(--muted);font-style:normal;font-size:12px}
#automation-detail-dialog>.dialog-card>header h2{font-size:21px;overflow-wrap:anywhere}
#automation-detail-dialog .sheet-body{padding:18px 28px 22px}
#automation-detail-dialog .automation-clock{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin:0 0 16px;padding:10px 14px;border:1px solid var(--line);border-radius:12px;background:var(--thead);color:var(--text)}
#automation-detail-dialog .automation-clock>div:first-child{flex:1 1 220px;display:flex;align-items:center;flex-wrap:wrap;gap:4px 10px}
#automation-detail-dialog .automation-clock>div:first-child>span:first-child{color:var(--blue-dark);font-size:11px;font-weight:850;letter-spacing:.09em}
#automation-detail-dialog .automation-clock strong{margin:0;font-size:15px}
#automation-detail-dialog .automation-phase-options{min-width:0}
#automation-detail-dialog .automation-phase-options summary{padding:8px 0;color:var(--blue-dark);font-size:13px}
#automation-detail-dialog .automation-phase-options label{margin:6px 0 0;color:var(--text)}
#automation-detail-dialog .automation-clock .button{width:auto;min-width:170px;min-height:44px}
#automation-detail-dialog .automation-material-panel{margin:0 0 16px;border:1px solid var(--line);border-radius:12px;background:var(--surface);overflow:hidden}
#automation-detail-dialog .automation-material-panel>header{align-items:center;padding:12px 16px}
#automation-detail-dialog .automation-material-panel>header h3{display:flex;align-items:center;margin:2px 0 0;font-size:16px}
#automation-detail-dialog .automation-cost-chip{border-radius:999px;background:var(--soft);color:var(--blue-dark)}
#automation-detail-dialog .automation-material-actions{padding:10px 16px}
#automation-detail-dialog .automation-material-actions .button{min-width:0}
#automation-detail-dialog .automation-material-list{display:block;padding:0 16px 12px}
#automation-detail-dialog .automation-bom{margin:12px 0 0;border:0;background:transparent}
#automation-detail-dialog .automation-bom>summary{padding:6px 0 8px}
#automation-detail-dialog .mfg-material-scroll{overflow-x:auto;border:1px solid var(--line);border-radius:10px}
#automation-detail-dialog .mfg-material-table{width:100%;border-collapse:collapse;font-size:13px}
#automation-detail-dialog .mfg-material-table th,#automation-detail-dialog .mfg-material-table td{padding:8px 12px;border-bottom:1px solid var(--line-inner);text-align:left;vertical-align:middle}
#automation-detail-dialog .mfg-material-table thead th{background:var(--thead);color:var(--muted);font-size:11px;font-weight:850;letter-spacing:.06em;text-transform:uppercase}
#automation-detail-dialog .mfg-material-table tbody tr:last-child>*{border-bottom:0}
#automation-detail-dialog .mfg-material-table tbody th{font-weight:500}
#automation-detail-dialog .mfg-material-table tbody th span,#automation-detail-dialog .mfg-material-table tbody th strong,#automation-detail-dialog .mfg-material-table tbody th small{display:block}
#automation-detail-dialog .mfg-material-table tbody th span{color:var(--blue-dark);font-size:11px;font-weight:850;letter-spacing:.05em}
#automation-detail-dialog .mfg-material-table tbody th strong{font-size:13px;font-weight:650;overflow-wrap:anywhere}
#automation-detail-dialog .mfg-material-table tbody th small{color:var(--amber);font-size:11px;font-weight:800}
#automation-detail-dialog .mfg-material-table .num{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
#automation-detail-dialog .mfg-material-table td small{color:var(--muted);font-size:11px}
#automation-detail-dialog .mfg-material-table tr.is-complete{background:var(--green-soft)}
#automation-detail-dialog .mfg-chip{display:inline-block;padding:3px 9px;border-radius:999px;background:var(--amber-soft);color:var(--amber);font-size:11px;font-weight:800;white-space:nowrap}
#automation-detail-dialog .mfg-chip.ok{background:var(--surface);color:var(--green);box-shadow:inset 0 0 0 1px var(--green)}
#automation-detail-dialog .mfg-chip.muted{background:var(--bg);color:var(--muted)}
#automation-detail-dialog .mfg-chip.extra{background:var(--info-soft);color:var(--info)}
#automation-detail-dialog .automation-bom>footer{margin-top:8px;border-radius:8px;overflow:hidden}
#automation-detail-dialog .automation-material-moves{margin:10px 0 0}
#automation-detail-dialog .automation-material-moves>summary{padding:6px 0;color:var(--blue-dark);font-size:12px;font-weight:800;cursor:pointer}
#automation-detail-dialog .production-units{border-radius:12px;border-top-width:1px;padding:12px 16px}
#automation-detail-dialog .production-units>header strong{font-size:16px}
#automation-detail-dialog .unit-form{border-radius:10px}
#automation-detail-dialog .unit-form>p{display:flex;align-items:center}
#automation-detail-dialog .production-units .unit-serial-field input{min-height:46px;font-size:16px}
#automation-detail-dialog .unit-list{grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}
#automation-detail-dialog .unit-row{border-radius:8px}
#automation-detail-dialog .automation-completion{border-radius:12px}
#automation-detail-dialog .automation-more-details{margin:0;border-bottom:0}
#automation-detail-dialog .automation-more-details>summary{color:var(--blue-dark)}
/* Las ayudas «?» no heredan el rótulo en versalitas de la cabecera donde se colocan. */
#automation-detail-dialog .help-tip-panel{display:grid;color:var(--text);font-size:13px;font-weight:500;letter-spacing:0;text-transform:none}
#automation-detail-dialog .help-tip-paragraph{display:block;color:var(--text);font-size:13px;font-weight:500;letter-spacing:0}
#automation-detail-dialog .automation-detail-footer{flex-wrap:wrap}
#automation-detail-dialog .automation-detail-footer>small{flex:1 1 200px}
#automation-detail-dialog .automation-detail-footer-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
#automation-detail-dialog .automation-detail-footer-actions .button{min-width:0}
#automation-detail-dialog .automation-detail-footer-actions:empty{display:none}
#automation-detail-dialog .automation-detail-footer-actions>#production-unit-submit{min-width:240px;min-height:48px}
@media (max-width:640px){#automation-detail-dialog .sheet-body{padding:14px 16px 18px}#automation-detail-dialog .automation-clock .button,#automation-detail-dialog .automation-detail-footer-actions,#automation-detail-dialog .automation-detail-footer-actions .button,#automation-detail-dialog .automation-detail-footer-actions>#production-unit-submit{width:100%;min-width:0}#automation-detail-dialog .mfg-material-table th,#automation-detail-dialog .mfg-material-table td{padding:7px 8px}#automation-detail-dialog .automation-material-list{padding:0 10px 10px}}

/* — Orden de fabricación a pantalla completa (Carlos, 2026-10-21): barra de trabajo arriba; componentes con su
   stock en la columna principal y series, unidades, datos y coste en la lateral. En tablet, una sola columna:
   barra → series y unidades → componentes → datos; la tabla pasa a tarjetas con botones de 44 px. — */
#automation-detail-dialog .of-header-actions{display:flex;align-items:center;gap:8px;margin-left:auto;margin-right:8px}
#automation-detail-dialog .of-header-actions[hidden]{display:none}
#automation-detail-dialog .of-header-actions .button{min-height:44px;width:auto;white-space:nowrap}
#automation-detail-dialog .of-layout{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px;align-items:start}
#automation-detail-dialog .of-layout[hidden]{display:none}
#automation-detail-dialog .of-main,#automation-detail-dialog .of-side{min-width:0;display:flex;flex-direction:column;gap:16px}
#automation-detail-dialog .of-side{position:sticky;top:0}
#automation-detail-dialog .of-side>*,#automation-detail-dialog .of-main>*{margin:0}
#automation-detail-dialog .of-components{border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:12px 12px 14px}
#automation-detail-dialog.dialog--full .sheet-body{padding:16px 20px 20px}
#automation-detail-dialog .of-components-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:6px 16px;margin:0 0 10px}
#automation-detail-dialog .of-components-head span{color:var(--blue-dark);font-size:11px;font-weight:850;letter-spacing:.09em}
#automation-detail-dialog .of-components-head h3{display:flex;align-items:center;margin:2px 0 0;font-size:16px}
#automation-detail-dialog .of-components-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;font-size:12px}
#automation-detail-dialog .of-source{padding:3px 10px;border-radius:999px;background:var(--soft);color:var(--blue-dark);font-size:12px;font-weight:800;letter-spacing:0}
#automation-detail-dialog .of-source.is-factusol{background:var(--amber-soft);color:var(--amber)}
#automation-detail-dialog .of-notice{display:grid;gap:3px;margin:0 0 10px;padding:10px 14px;border:1px solid var(--amber-strong);border-radius:10px;background:var(--amber-soft);font-size:13px}
#automation-detail-dialog .of-notice small{color:var(--muted)}
#automation-detail-dialog .of-components-actions{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 10px}
#automation-detail-dialog .of-components-actions .button{width:auto;min-height:44px}
#automation-detail-dialog .of-take-all{display:grid;gap:4px;max-width:440px}
#automation-detail-dialog .of-take-all-note{display:block;color:var(--muted);line-height:1.35}
#automation-detail-dialog .of-components-table td.of-location b{display:block;font-weight:800}
#automation-detail-dialog .of-components-table td.of-location b span{font-weight:600;color:var(--muted)}
#automation-detail-dialog .of-components-table td.of-location small,#automation-detail-dialog .of-components-table td.of-status small{display:block;margin-top:2px}
#automation-detail-dialog .of-components-table td.num small.of-per-unit{display:block}
#automation-detail-dialog .of-components-table{font-size:12.5px}
#automation-detail-dialog .of-components-table th,#automation-detail-dialog .of-components-table td{padding:8px 6px}
#automation-detail-dialog .of-components-table tr>:first-child{padding-left:12px}
#automation-detail-dialog .of-components-table tr>:last-child{padding-right:12px}
#automation-detail-dialog .of-components-table tbody th[scope=row]{min-width:130px}
#automation-detail-dialog .of-components-table td.of-location{min-width:110px}
#automation-detail-dialog .of-components-table thead th{font-size:10px;letter-spacing:.02em;line-height:1.2;vertical-align:bottom;white-space:normal}
#automation-detail-dialog .of-components-table td.num,#automation-detail-dialog .of-components-table thead th.num{padding-left:4px;padding-right:4px}
#automation-detail-dialog .of-components-table td.of-actions{text-align:right;width:1%}
#automation-detail-dialog .of-components-table td.of-actions .small-action{display:block;width:100%;min-height:36px;margin:2px 0;padding:0 10px;white-space:nowrap;font-size:12px}
#automation-detail-dialog .of-components-table .of-serial-note{display:block;color:var(--muted);font-size:11px;white-space:normal}
#automation-detail-dialog .of-components-table tr.is-muted>*{color:var(--muted)}
#automation-detail-dialog .of-components-table tr.is-muted th strong{color:var(--muted);font-weight:500}
#automation-detail-dialog .of-components-table tr.is-missing{background:var(--red-soft)}
#automation-detail-dialog .of-components-table tr.of-group>th{background:var(--thead);color:var(--muted);font-size:11px;font-weight:850;letter-spacing:.06em;text-transform:uppercase}
#automation-detail-dialog .of-components-table tr.of-take-row>td{background:var(--thead)}
#automation-detail-dialog .of-take{display:flex;flex-wrap:wrap;align-items:flex-end;gap:8px 12px;margin:0}
#automation-detail-dialog .of-take>strong{flex:1 1 100%;font-size:13px}
#automation-detail-dialog .of-take label{display:flex;flex-direction:column;gap:4px;margin:0;font-size:12px}
#automation-detail-dialog .of-take label>input,#automation-detail-dialog .of-take label>select{margin-top:0}
#automation-detail-dialog .of-take input{width:130px}
#automation-detail-dialog .of-take .button{width:auto;min-height:44px}
#automation-detail-dialog .of-take .dialog-error{flex:1 1 100%;margin:0}
#automation-detail-dialog .mfg-chip.danger{background:var(--red-soft);color:var(--red)}
#automation-detail-dialog .mfg-chip.info{background:var(--info-soft);color:var(--info)}
#automation-detail-dialog .of-plan-guard{display:grid;gap:8px;padding:12px 14px;border:1px solid var(--amber-strong);border-radius:12px;background:var(--amber-soft);font-size:13px}
#automation-detail-dialog .of-plan-guard[hidden]{display:none}
#automation-detail-dialog .of-plan-guard small{color:var(--muted)}
#automation-detail-dialog .of-plan-guard .button{width:100%;min-height:44px;margin:4px 0 0}
#automation-detail-dialog .of-cost{padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
#automation-detail-dialog .of-cost[hidden]{display:none}
#automation-detail-dialog .of-cost>span{color:var(--blue-dark);font-size:11px;font-weight:850;letter-spacing:.09em}
#automation-detail-dialog .of-cost dl{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:8px 0 0}
#automation-detail-dialog .of-cost dt{color:var(--muted);font-size:11px}
#automation-detail-dialog .of-cost dd{margin:2px 0 0;font-weight:800;font-variant-numeric:tabular-nums}
#automation-detail-dialog .of-side .automation-more-details{border:1px solid var(--line);border-radius:12px;padding:0 14px;background:var(--surface)}
#automation-detail-dialog .of-side .automation-detail-grid{grid-template-columns:1fr}
#automation-detail-dialog .of-side .production-units{margin:0}
#automation-detail-dialog .of-side .automation-completion.units-empty{display:none}
/* El material de la orden queda como pie de la tabla: sin cabecera propia, acciones en una fila. */
#automation-detail-dialog.is-production-order .automation-material-panel>header{display:none}
#automation-detail-dialog.is-production-order .automation-material-panel{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;margin:-10px 0 0;border-top-left-radius:0;border-top-right-radius:0}
#automation-detail-dialog.is-production-order .automation-material-panel>.automation-material-actions{grid-column:1;grid-row:1}
#automation-detail-dialog.is-production-order .automation-material-panel>.procurement-free-trigger{grid-column:2;grid-row:1;justify-self:start;min-height:44px}
#automation-detail-dialog.is-production-order .automation-material-panel>form,#automation-detail-dialog.is-production-order .automation-material-panel>.automation-material-list{grid-column:1/-1}
#automation-detail-dialog.is-production-order .automation-material-panel>.automation-material-actions>span{display:none}
#automation-detail-dialog.is-production-order .automation-material-panel>.automation-material-actions{border:0}
#automation-detail-dialog.is-production-order .automation-material-list:empty{display:none}
@media (max-width:1200px){
#automation-detail-dialog .of-layout{display:flex;flex-direction:column;align-items:stretch}
#automation-detail-dialog .of-main,#automation-detail-dialog .of-side{display:contents}
#automation-detail-dialog .of-layout>*>*{order:3}
#automation-detail-dialog #of-plan-guard{order:1}
#automation-detail-dialog .of-side .production-units{order:2}
#automation-detail-dialog .of-side .automation-completion,#automation-detail-dialog .of-cost{order:4}
#automation-detail-dialog .of-side .automation-more-details{order:5}
#automation-detail-dialog .of-components-table thead{display:none}
#automation-detail-dialog .of-components-table,#automation-detail-dialog .of-components-table tbody{display:block}
#automation-detail-dialog .mfg-material-scroll:has(.of-components-table){border:0;overflow:visible}
#automation-detail-dialog .of-components-table tr{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px 12px;margin:0 0 10px;padding:12px 14px;border:1px solid var(--line);border-radius:10px}
#automation-detail-dialog .of-components-table tr>*,#automation-detail-dialog .of-components-table tr>:first-child,#automation-detail-dialog .of-components-table tr>:last-child{padding:0;border:0}
#automation-detail-dialog .of-components-table tr>th{grid-column:1/-1}
#automation-detail-dialog .of-components-table td.num{text-align:left;padding:0}
#automation-detail-dialog .of-components-table td[data-label]::before{content:attr(data-label);display:block;color:var(--muted);font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase}
#automation-detail-dialog .of-components-table td.of-location{grid-column:span 2}
#automation-detail-dialog .of-components-table td.of-actions{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:center;gap:8px;width:auto;text-align:left;white-space:normal}
#automation-detail-dialog .of-components-table td.of-actions .small-action{display:inline-flex;align-items:center;width:auto;min-height:44px;margin:0;padding:0 16px}
#automation-detail-dialog .of-components-table td.of-actions:empty{display:none}
#automation-detail-dialog .of-components-table tr.of-group{display:block;border:0;padding:4px 0}
#automation-detail-dialog .of-components-table tr.of-take-row{display:block}
}
@media (max-width:640px){
#automation-detail-dialog .of-components-table tr{grid-template-columns:repeat(2,minmax(0,1fr))}
#automation-detail-dialog .of-header-actions #of-back-project{display:none}
#automation-detail-dialog.is-production-order .automation-material-panel{display:block}
}

/* — Nuevo pedido — */
#procurement-order-dialog .purchase-order-body{padding:18px 22px 20px}
#procurement-order-dialog .purchase-order-supplier-step,#procurement-order-dialog .purchase-order-add,#procurement-order-dialog .purchase-order-lines{margin:0 0 16px;padding:18px 20px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
#procurement-order-dialog .purchase-order-supplier-step{grid-template-columns:36px minmax(0,1fr);align-items:start}
#procurement-order-dialog .purchase-order-supplier-step>div{grid-template-columns:minmax(260px,1fr) auto;align-items:center}
#procurement-order-dialog .purchase-new-supplier summary{font-size:12px;font-weight:700;color:var(--blue-dark);cursor:pointer}
#procurement-order-dialog .purchase-order-lines-head{padding:0 0 12px;background:transparent}
#procurement-order-dialog .purchase-order-lines-head strong{font-size:14px;letter-spacing:0;text-transform:none;color:var(--text)}
#procurement-order-dialog .purchase-order-lines-head small{color:var(--muted)}
#procurement-order-dialog .purchase-step-number{border-radius:999px;min-width:30px;height:30px;background:var(--soft);border-color:transparent}
/* El buscador es un <label> con icono y campo en fila: la regla genérica label{display:block} de la hoja no debe pisarlo. */
#procurement-order-dialog label.purchase-item-search{display:flex;align-items:center;gap:10px;margin:0;border-radius:10px}
#procurement-order-dialog .purchase-search-scope{display:flex;align-items:center;gap:10px;margin:10px 0 0;font-size:12px}
#procurement-order-dialog .purchase-search-scope select{width:auto;min-height:38px;margin:0;padding:6px 10px;font-size:13px}
#procurement-order-dialog .purchase-search-scope small{display:none}
#procurement-order-dialog .purchase-free-line{margin-top:10px}
#procurement-order-dialog .purchase-free-line summary,#procurement-order-dialog .purchase-pending-needs summary{font-size:12px;font-weight:700;color:var(--blue-dark);cursor:pointer}
#procurement-order-dialog .purchase-lines-empty{margin:0;padding:22px;border:1px dashed var(--line);border-radius:10px;color:var(--muted);text-align:center}
#procurement-order-dialog .purchase-pending-needs{margin:0 0 16px;padding:12px 16px;border:1px solid var(--line);border-radius:12px}
#procurement-order-dialog .purchase-order-notes{margin:0}
#procurement-order-dialog .purchase-order-footer{position:static;border-top:1px solid var(--line);padding:14px 22px}

/* — Objetivos — */
#objectives-dialog .objective-form .field-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
#objectives-dialog .objective-editor{margin-top:6px;border-top:0}
#objectives-dialog .objective-editor-row{margin:0 0 10px;padding:14px 16px;border:1px solid var(--line);border-radius:12px;background:var(--bg)}
#objectives-dialog .objective-editor-row small{font-size:12px}
#objectives-dialog .objective-editor-fields{grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:0 12px}
#objectives-dialog .objective-editor-fields label{margin:8px 0 0}
#objectives-dialog .objective-editor-fields input,#objectives-dialog .objective-editor-fields select{min-height:42px;font-size:14px}
#objectives-dialog .objective-editor-fields select[multiple]{min-height:96px}
#objectives-dialog .objective-add select{width:auto;min-width:320px}
#objectives-dialog .objective-form-actions{margin:0}
@media (max-width:900px){#objectives-dialog .objective-form .field-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:640px){dialog.sheet-dialog{width:100vw;max-width:100vw;max-height:100dvh;border-radius:0}dialog.sheet-dialog>.dialog-card{border-radius:0;max-height:100dvh}dialog.sheet-dialog>.dialog-card>header,dialog.sheet-dialog .sheet-body,dialog.sheet-dialog .sheet-footer{padding-left:16px;padding-right:16px}dialog.sheet-dialog .sheet-columns,#objectives-dialog .objective-form .field-grid{grid-template-columns:1fr}}
/* Confirmaciones cortas dentro del diálogo de objetivos: caja pequeña. */
#objectives-dialog:has(.confirm-card){width:min(92vw,520px);max-width:min(92vw,520px)}
#objectives-dialog .confirm-card{padding:22px 24px}
#objectives-dialog .confirm-card>header{padding:0 0 10px;border:0}
#objectives-dialog .confirm-card p{margin:0 0 16px;font-size:15px}
/* Buscadores con icono dentro de la hoja: el campo interior no lleva caja propia. */
dialog.sheet-dialog .purchase-item-search input,dialog.sheet-dialog .purchase-item-search input:focus,dialog.sheet-dialog .search-box input,dialog.sheet-dialog .search-box input:focus{width:auto;flex:1;min-height:46px;margin:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}
dialog.sheet-dialog .purchase-item-search:focus-within{border-color:var(--turquoise);box-shadow:0 0 0 3px rgba(21,156,132,.14)}
dialog.sheet-dialog .sheet-footer .button.secondary{min-width:0}
#objectives-dialog .objective-editor-row{background:var(--surface)}
#objectives-dialog .objective-editor-row>div:first-child strong{font-size:15px}
#objectives-dialog .objective-editor-row>div:first-child small{display:block;margin-top:2px}
#objectives-dialog .objective-editor-row details{margin-top:4px}
#objectives-dialog .objective-editor-row details summary{cursor:pointer;font-size:12px;color:var(--blue-dark);font-weight:700}
#objectives-dialog .objective-editor-row details p{margin:4px 0 0;font-size:12px;color:var(--muted)}

/* — Editor de indicadores: cabecera con nombre y Quitar, campos en fila, líneas como chips. — */
#objectives-dialog{width:min(96vw,1240px);max-width:min(96vw,1240px)}
#objectives-dialog>.dialog-card{height:calc(100dvh - 24px)}
#objectives-dialog .objective-editor-row{padding:16px 18px}
#objectives-dialog .objective-editor-row>header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin:0 0 6px}
#objectives-dialog .objective-editor-row>header .button{width:auto;min-height:36px;padding:6px 12px;font-size:13px}
#objectives-dialog .objective-editor-fields{grid-template-columns:repeat(auto-fit,minmax(150px,220px));gap:0 14px;align-items:end}
#objectives-dialog .objective-editor-fields label{margin:6px 0 0}
#objectives-dialog .objective-lines{margin:12px 0 0;padding:0;border:0}
#objectives-dialog .objective-lines legend{padding:0;margin:0 0 6px;font-size:12px;font-weight:700}
#objectives-dialog .objective-lines small{display:block;margin-top:6px;color:var(--muted);font-size:11px}
#objectives-dialog .objective-chip{display:inline-flex;align-items:center;margin:0 6px 6px 0;padding:0;font-weight:600}
#objectives-dialog .objective-chip input{position:absolute;opacity:0;width:0;height:0;margin:0}
#objectives-dialog .objective-chip span{display:inline-block;padding:7px 12px;border:1px solid var(--line-control);border-radius:999px;background:var(--surface);color:var(--text);font-size:12px;cursor:pointer}
#objectives-dialog .objective-chip input:checked+span{border-color:var(--turquoise);background:var(--soft);color:var(--blue-dark)}
#objectives-dialog .objective-chip input:focus-visible+span{box-shadow:0 0 0 3px rgba(21,156,132,.14)}
#objectives-dialog .objective-form>.sheet-body>.field-grid{grid-template-columns:repeat(5,minmax(0,1fr))}
#objectives-dialog .objective-form>.sheet-body>label{max-width:none}
#objectives-dialog .objective-form textarea{min-height:64px}
#objectives-dialog .objective-editor>header{padding:14px 0 10px}
@media (max-width:900px){#objectives-dialog .objective-form>.sheet-body>.field-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
/* Nuevo pedido en móvil (hallazgo 2 del 17/10/2026): el paso Proveedor a una columna y el pie con el botón a lo ancho. */
@media (max-width:640px){#procurement-order-dialog .purchase-order-body{padding:14px 16px 16px}#procurement-order-dialog .purchase-order-supplier-step>div,#procurement-order-dialog .purchase-new-supplier .field-grid{grid-template-columns:minmax(0,1fr)}#procurement-order-dialog .purchase-order-footer{flex-wrap:wrap;padding:12px 16px}#procurement-order-dialog .purchase-order-footer .button{width:100%;min-width:0}}
