/* NARA / REFINERÍA — FIELD APPEARANCE R9
   Día y Noche son paletas visuales reales; la lógica de MachineOpsService no cambia.
   Este archivo carga después de todas las pantallas E4 y prevalece solo en FIELD. */

/* Selector visible en Más: radio nativo accesible, muestras reales de color. */
.field-e4 .e4-appearance-fieldset{
  min-width:0;margin:3px 0 8px;padding:0;border:0;
}
.field-e4 .e4-appearance-fieldset legend{
  font-size:13px;font-weight:750;color:#4d6c81;margin-bottom:10px;
}
.field-e4 .e4-appearance-options{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;
}
.field-e4 .e4-appearance-choice{
  position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:4px;
  min-width:0;min-height:124px;padding:12px;
  background:#f4f7fa;border:2px solid #c9d9e4;border-radius:13px;
  cursor:pointer;touch-action:manipulation;
}
.field-e4 .e4-appearance-choice:has(input:checked){
  background:#e8f2fa;border-color:#1779bf;box-shadow:0 0 0 2px #1779bf22;
}
.field-e4 .e4-appearance-choice:has(input:focus-visible){
  outline:3px solid #edb632;outline-offset:2px;
}
.field-e4 .e4-appearance-choice>input{
  position:absolute;right:10px;top:12px;margin:0;
  width:22px;height:22px;min-height:22px;accent-color:#176eaa;
}
.field-e4 .e4-appearance-choice .e4-appearance-swatch{
  width:64px;height:37px;margin-bottom:3px;border-radius:8px;
  display:flex;align-items:flex-end;padding:5px;border:1px solid #aec2d0;
}
.field-e4 .e4-swatch-day{background:linear-gradient(135deg,#f1f5f8 54%,#e1eaf3 54%)}
.field-e4 .e4-swatch-day>span{display:block;width:42px;height:13px;border-radius:3px;background:#fff;box-shadow:0 0 0 1px #bbcfdc}
.field-e4 .e4-swatch-night{background:linear-gradient(135deg,#081b2e 54%,#102f48 54%);border-color:#38607b}
.field-e4 .e4-swatch-night>span{display:block;width:42px;height:13px;border-radius:3px;background:#183951;box-shadow:0 0 0 1px #547389}
.field-e4 .e4-appearance-choice strong{font-size:16px;line-height:1.2;color:#0c3654}
.field-e4 .e4-appearance-choice small{font-size:12px;line-height:1.25;color:#587285}
.field-e4 .e4-appearance-status{font-size:12px!important;line-height:1.5!important;
  font-weight:750;color:#376783!important;margin:7px 0 10px!important}
.field-e4 .e4-more-appearance-preview{margin:0}

/* Modo Día: luz, superficies blancas y tinta azul profundo. Respeta marcas institucionales. */
body.field-shell.field-e4[data-field-theme="day"]{
  color-scheme:light;
  background:linear-gradient(180deg,#e7eef5 0,#f6f8fb 470px);color:#082b45;
}
/* The entire application shell has its own legacy light background; theme it too. */
body.field-shell.field-e4[data-field-theme="day"] .app-shell{
  background:#f1f5f9!important;
}
body.field-shell.field-e4[data-field-theme="day"] .e4-appearance-choice:has(input:checked){
  border-color:#1769a1;
}

/* Modo Noche: fondos oscuros continuos, contraste tipográfico, controles industriales.
   Los paneles HERO y logos oficiales no se filtran ni invierten. */
body.field-shell.field-e4[data-field-theme="night"]{
  color-scheme:dark;--text:#f0f7fe;--muted:#bdd6e9;--line:#41637b;--card:#122c40;
  --e4-ink:#edf6ff;--e4-blue:#b8d9f0;--e4-soft:#0d2234;
  background:linear-gradient(180deg,#071522 0%,#0a1928 420px,#0d2031 100%)!important;
  color:#eef6fc!important;
}
body.field-shell.field-e4[data-field-theme="night"] .app-shell{
  color:#eef6fc!important;
  background:#0a1928!important;
}
body.field-shell.field-e4[data-field-theme="night"] main,
body.field-shell.field-e4[data-field-theme="night"] #operatorView{
  background:transparent!important;
}
body.field-shell.field-e4[data-field-theme="night"] #demoModeBanner{
  background:#172f43!important;border:1px solid #31536c!important;color:#d3e5f3!important;
}
body.field-shell.field-e4[data-field-theme="night"] #demoModeBanner strong,
body.field-shell.field-e4[data-field-theme="night"] #demoModeDescription{color:#d3e5f3!important}
body.field-shell.field-e4[data-field-theme="night"] .field-intro h2,
body.field-shell.field-e4[data-field-theme="night"] .field-section-heading h2,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-heading h2,
body.field-shell.field-e4[data-field-theme="night"] .e4-records-heading h2,
body.field-shell.field-e4[data-field-theme="night"] .e4-operation-heading h2{
  color:#f0f8ff!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-intro>span,
body.field-shell.field-e4[data-field-theme="night"] .field-section-heading>span,
body.field-shell.field-e4[data-field-theme="night"] .e4-records-heading>span,
body.field-shell.field-e4[data-field-theme="night"] .e4-operation-heading>span,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-heading>span{
  color:#92c4e8!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-intro p,
body.field-shell.field-e4[data-field-theme="night"] .field-section-heading p,
body.field-shell.field-e4[data-field-theme="night"] .e4-operation-heading p,
body.field-shell.field-e4[data-field-theme="night"] .e4-records-heading p,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-heading p{
  color:#b5cadc!important;
}
/* No aclarar la cabecera institucional ni el foco principal: ya usan texto blanco y navy. */
body.field-shell.field-e4[data-field-theme="night"] .field-section .card:not(.hero):not(.e4-equipment-hero),
body.field-shell.field-e4[data-field-theme="night"] .e4-more-card,
body.field-shell.field-e4[data-field-theme="night"] .e4-prestart-card,
body.field-shell.field-e4[data-field-theme="night"] .e4-activity-card{
  background:#122c40!important;border-color:#34536b!important;box-shadow:0 9px 20px #020a1280!important;
  color:#e8f4fd!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-next-step{
  background:#122c40!important;border-color:#3b5c73!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-next-step #fieldGuideTitle,
body.field-shell.field-e4[data-field-theme="night"] .e4-prestart-heading strong,
body.field-shell.field-e4[data-field-theme="night"] .e4-shift-close-assistant h4,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-card h3,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-card strong,
body.field-shell.field-e4[data-field-theme="night"] .e4-activity-card h3,
body.field-shell.field-e4[data-field-theme="night"] .e4-prestart-card h3,
body.field-shell.field-e4[data-field-theme="night"] #e4MoreEquipmentName,
body.field-shell.field-e4[data-field-theme="night"] .e4-queue-header strong{
  color:#eef7ff!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-next-step .field-guide-description,
body.field-shell.field-e4[data-field-theme="night"] .e4-prestart-heading p,
body.field-shell.field-e4[data-field-theme="night"] .e4-prestart-warning,
body.field-shell.field-e4[data-field-theme="night"] .e4-truth-note,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-card p:not(.e4-connectivity-disclosure),
body.field-shell.field-e4[data-field-theme="night"] .e4-more-equipment small,
body.field-shell.field-e4[data-field-theme="night"] #e4MoreEquipmentState,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-card li,
body.field-shell.field-e4[data-field-theme="night"] .e4-records-visible,
body.field-shell.field-e4[data-field-theme="night"] .field-guide-description{
  color:#b7d0e2!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-sync-strip{
  background:#1b394e!important;border-color:#3c5d73!important;color:#e6f2fa!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-more-command,
body.field-shell.field-e4[data-field-theme="night"] .e4-cycle-focus,
body.field-shell.field-e4[data-field-theme="night"] .e4-work-focus,
body.field-shell.field-e4[data-field-theme="night"] .e4-operation-overview,
body.field-shell.field-e4[data-field-theme="night"] .e4-records-asset{
  background:linear-gradient(130deg,#061626,#0b2b43)!important;border-color:#355d78!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-command-metrics strong,
body.field-shell.field-e4[data-field-theme="night"] .e4-command-top h3,
body.field-shell.field-e4[data-field-theme="night"] .e4-focus-heading h4{
  color:#fff!important;
}
/* Inputs, selectores y formularios de turno/carguío/medidor. */
body.field-shell.field-e4[data-field-theme="night"] .field-section label,
body.field-shell.field-e4[data-field-theme="night"] #opsPanel label,
body.field-shell.field-e4[data-field-theme="night"] .e4-activity-card label,
body.field-shell.field-e4[data-field-theme="night"] .e4-prestart-card label,
body.field-shell.field-e4[data-field-theme="night"] .e4-setting-row strong{
  color:#d7ebf8!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-section input:not([type=radio]):not([type=checkbox]),
body.field-shell.field-e4[data-field-theme="night"] .field-section select,
body.field-shell.field-e4[data-field-theme="night"] .field-section textarea{
  background:#0a2032!important;border:1px solid #58748b!important;color:#f3f9ff!important;
  caret-color:#fff!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-section input::placeholder,
body.field-shell.field-e4[data-field-theme="night"] .field-section textarea::placeholder{
  color:#a8c2d4!important;opacity:1;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-more-card a,
body.field-shell.field-e4[data-field-theme="night"] .field-section a{
  color:#83cbff!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-more-choose-equipment,
body.field-shell.field-e4[data-field-theme="night"] .e4-records-tabs button:not([aria-pressed=true]),
body.field-shell.field-e4[data-field-theme="night"] .field-quick-secondary,
body.field-shell.field-e4[data-field-theme="night"] .field-section .secondary{
  background:#1c3a51!important;border:1px solid #54708a!important;color:#e4f2fd!important;
}
/* Status and local evidence; keep status semantics independent from color. */
body.field-shell.field-e4[data-field-theme="night"] .e4-home-metrics>div,
body.field-shell.field-e4[data-field-theme="night"] .e4-record-stat,
body.field-shell.field-e4[data-field-theme="night"] .e4-event-list .event,
body.field-shell.field-e4[data-field-theme="night"] .e4-close-values>div,
body.field-shell.field-e4[data-field-theme="night"] .e4-connectivity-indicators>div{
  background:#1b394e!important;border-color:#42647d!important;
  box-shadow:none!important;color:#eff7ff!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-home-metrics strong,
body.field-shell.field-e4[data-field-theme="night"] .e4-record-stat strong,
body.field-shell.field-e4[data-field-theme="night"] .e4-event-list .event strong,
body.field-shell.field-e4[data-field-theme="night"] .e4-connectivity-indicators strong,
body.field-shell.field-e4[data-field-theme="night"] .e4-close-values strong{
  color:#f1f8ff!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-record-stat>span,
body.field-shell.field-e4[data-field-theme="night"] .e4-record-stat small,
body.field-shell.field-e4[data-field-theme="night"] .e4-event-list .event small,
body.field-shell.field-e4[data-field-theme="night"] .e4-home-metrics span,
body.field-shell.field-e4[data-field-theme="night"] .e4-connectivity-indicators span,
body.field-shell.field-e4[data-field-theme="night"] .e4-close-values span{
  color:#bed6e8!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-record-stat:nth-child(2) strong{
  color:#ffcf70!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-records-queue,
body.field-shell.field-e4[data-field-theme="night"] .e4-shift-close-assistant{
  background:#173146!important;border-color:#45657e!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-close-delta,
body.field-shell.field-e4[data-field-theme="night"] .e4-close-explanation,
body.field-shell.field-e4[data-field-theme="night"] .e4-queue-header span{
  color:#c2d9e9!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-close-validation,
body.field-shell.field-e4[data-field-theme="night"] .e4-close-delta.is-invalid{
  color:#ffbdac!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-records-queue .e4-queue-header{
  border-color:#365a72!important;
}
/* Five operation category controls retain distinct visual identity at night. */
body.field-shell.field-e4[data-field-theme="night"] #opsPanel>.tabs.e4-operation-actions{
  background:#102b40!important;border-color:#41637e!important;
}
body.field-shell.field-e4[data-field-theme="night"] #opsPanel>.tabs.e4-operation-actions>.e4-operation-tab{
  --action-bg:#193b56;--action-border:#57748a;--action-fg:#f4f9fd;--action-active:#315d82;
}
body.field-shell.field-e4[data-field-theme="night"] #opsPanel>.tabs.e4-operation-actions>[data-tab="availability"]{
  --action-bg:#123e44;--action-border:#3f8a8f;--action-fg:#aaf6ed;--action-active:#23676b;
}
body.field-shell.field-e4[data-field-theme="night"] #opsPanel>.tabs.e4-operation-actions>[data-tab="downtime"]{
  --action-bg:#4b3118;--action-border:#b17d3c;--action-fg:#ffdca0;--action-active:#85501c;
}
body.field-shell.field-e4[data-field-theme="night"] #opsPanel>.tabs.e4-operation-actions>[data-tab="hourmeter"]{
  --action-bg:#1b3257;--action-border:#547cad;--action-fg:#c9e3ff;--action-active:#335a91;
}
body.field-shell.field-e4[data-field-theme="night"] #opsPanel>.tabs.e4-operation-actions>[data-tab="summary"]{
  --action-bg:#293748;--action-border:#78899a;--action-fg:#dbe8f2;--action-active:#415b76;
}
body.field-shell.field-e4[data-field-theme="night"] #tab-cycle .cycle-step:not(.active):not(.done){
  background:#29465b;border-color:#52738a;
}
/* Appearance selector itself stays obvious and legible in either mode. */
body.field-shell.field-e4[data-field-theme="night"] .e4-appearance-choice{
  background:#18364a;border-color:#486981;color:#f0f7fd;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-appearance-choice:has(input:checked){
  background:#254a61;border-color:#f3b935;box-shadow:0 0 0 2px #f3b93533;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-appearance-choice strong{
  color:#f2f8fe!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-appearance-choice small,
body.field-shell.field-e4[data-field-theme="night"] .e4-appearance-fieldset legend,
body.field-shell.field-e4[data-field-theme="night"] .e4-appearance-status,
body.field-shell.field-e4[data-field-theme="night"] .e4-setting-row small,
body.field-shell.field-e4[data-field-theme="night"] .e4-preferences-note{
  color:#c4d9ea!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-setting-row,
body.field-shell.field-e4[data-field-theme="night"] .e4-preferences-note{
  border-color:#385a74!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-connectivity-disclosure{
  background:#493616!important;border-color:#a47e35!important;color:#ffe5b4!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-connectivity-explanation summary,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-collapse summary{
  color:#e9f5fe!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-connectivity-explanation summary::after,
body.field-shell.field-e4[data-field-theme="night"] .e4-more-collapse summary::after,
body.field-shell.field-e4[data-field-theme="night"] .e4-help-notice{
  background:#1f4058!important;color:#e0effa!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-more-collapse-content,
body.field-shell.field-e4[data-field-theme="night"] .e4-connectivity-explanation>div{
  border-color:#436077!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-records-filters label,
body.field-shell.field-e4[data-field-theme="night"] .e4-records-visible{
  color:#bed7e8!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-bottom-nav{
  background:#041521!important;border-color:#31516a!important;
  box-shadow:0 -9px 22px #020a16b5!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-bottom-nav button{
  color:#b8d3e5!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-bottom-nav button[aria-current="page"]{
  background:#1d3b52!important;color:#ffce66!important;border-bottom-color:#f5bb38!important;
}
body.field-shell.field-e4[data-field-theme="night"] .field-feedback{
  background:#4b2626!important;color:#ffdfd9!important;border-color:#df786c!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-activity-cta,
body.field-shell.field-e4[data-field-theme="night"] #fieldStartShortcut,
body.field-shell.field-e4[data-field-theme="night"] #e4CloseSaveAndFinish{
  color:#0c2638!important;
}

/* Layered controls inside operational cards must not retain white Day backgrounds. */
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .delivery-panel,
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .summary-grid>div,
body.field-shell.field-e4[data-field-theme="night"] #startPanel .checklist label,
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .checklist label,
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .event,
body.field-shell.field-e4[data-field-theme="night"] .field-section .event:not(.e4-event-error):not(.e4-event-pending){
  background:#1c3b50!important;border-color:#4b6a82!important;color:#ecf5fc!important;
}
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .delivery-panel h4,
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .summary-grid strong{
  color:#f0f8ff!important;
}
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .summary-grid span,
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .muted,
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .status-line{
  color:#bdd6e9!important;
}
body.field-shell.field-e4[data-field-theme="night"] #opsPanel .badge:not(.online):not(.offline),
body.field-shell.field-e4[data-field-theme="night"] #startPanel .badge:not(.online):not(.offline){
  background:#26465d!important;color:#dceefb!important;
}
body.field-shell.field-e4[data-field-theme="night"] .e4-records-grid .e4-record-stat-error strong{
  color:#ffabb5!important;
}

@media(max-width:365px) {
  .field-e4 .e4-appearance-choice{min-height:115px;padding:10px}
  .field-e4 .e4-appearance-choice .e4-appearance-swatch{width:54px}
}
