html, body, #root { height: 100%; }
body { margin: 0; overflow: hidden; background: #d7e4f2; }

.hmi {
  height: 100%;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 36px;
  color: #102033;
  background: #d7e4f2;
}
.hmi-title {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b4f9c;
  color: #fff;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0.04em;
}
.hmi-logo {
  position: absolute;
  left: 14px;
  height: 36px;
  width: auto;
  display: block;
}
.hmi-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
}
.hmi-nav {
  display: flex;
  flex-direction: column;
  background: #f7fafc;
  border-right: 1px solid #8fb0d0;
  overflow: auto;
}
.hmi-group {
  margin: 14px 14px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #5d738c;
}
.hmi-nav button {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  border-left: 4px solid transparent;
  background: transparent;
  color: #17324d;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}
.hmi-nav button.active {
  background: #e7f1fb;
  border-left-color: #0b4f9c;
  color: #0b4f9c;
}
.hmi-nav button:focus-visible,
.hmi-go:focus-visible {
  outline: 3px solid #f5c518;
  outline-offset: -3px;
}
.hmi-stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #e7f0f8;
}
.hmi-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}
.hmi-status {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
  background: #0b4f9c;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
}
.hmi-status span { white-space: nowrap; }
.hmi-status label { display: flex; align-items: center; gap: 6px; }
.hmi-status select {
  height: 26px;
  border: 0;
  background: #fff;
  color: #102033;
  padding: 0 6px;
}
.hmi-status [role="group"] {
  border: 0;
  background: transparent;
  padding: 0;
}
.hmi-status [role="group"] button {
  color: #fff;
  background: transparent;
  box-shadow: none;
}
.hmi-status [role="group"] button[aria-pressed="true"] {
  background: #fff;
  color: #0b4f9c;
}
.hmi-clock { margin-left: auto; font-variant-numeric: tabular-nums; }

.hmi-board {
  height: 100%;
  min-height: 460px;
  display: grid;
  grid-template-rows: minmax(190px, 36%) minmax(220px, 1fr);
  gap: 10px;
}
.hmi-split { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hmi-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #6ea2d8;
}
.hmi-card h2 {
  flex: 0 0 auto;
  background: #3b8fe0;
  color: #fff;
  text-align: center;
  font-size: 16px;
  font-weight: 750;
  padding: 8px 12px;
}
.hmi-card-body { padding: 16px 18px; overflow: auto; }
.hmi-fill { min-height: 100%; }
.hmi-plan-no { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: 0.02em; }
.hmi-plan-meta, .hmi-hint { margin-top: 8px; font-size: 18px; color: #23425f; }
.hmi-go-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.hmi-go {
  min-height: 52px;
  min-width: 120px;
  padding: 0 18px;
  background: #0b4f9c;
  color: #fff;
  border: 1px solid #083e7a;
  font-size: 16px;
  font-weight: 750;
}
.hmi-go:active { background: #083e7a; }
.hmi-lines { display: grid; gap: 8px; margin-top: 12px; }
.load-pair { display: grid; gap: 10px; }
.load-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 12px; background: #fff; }
.sample-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 0 12px; }
.break-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.unload-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sample-stats .sample-ok { color: #0b7a32; }
.sample-stats .sample-ng { color: #b42318; }
.load-stats article { min-height: 72px; padding: 10px 12px; background: #f4f8fd; border: 1px solid #c5daf0; }
.load-stats span { display: block; color: #516176; font-size: 14px; }
.load-stats strong { display: block; margin-top: 6px; color: #0b4f9c; font-size: 22px; }
.load-plan-note { margin: 0; padding: 0 12px 12px; color: #0b4f9c; font-weight: 700; }
.load-pair-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.load-bay { min-width: 0; display: flex; flex-direction: column; min-height: 520px; }
.load-bay .cfg-fields { grid-template-columns: 1fr; }
.load-bay .load-live li { grid-template-columns: 108px minmax(0, 1fr) auto; }
.load-bay .load-live b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.load-check { list-style: none; margin: 0; padding: 0 12px 8px; }
.load-check li { display: flex; justify-content: space-between; align-items: center; min-height: 40px; border-bottom: 1px solid #e2e8f0; }
.load-check-title { font-weight: 800; color: #0b4f9c; }
.load-live { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 12px; }
.hmi-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.hmi-status-grid article { min-height: 84px; padding: 12px; background: #f4f8fd; border: 1px solid #c5daf0; }
.hmi-status-grid span { display: block; color: #516176; font-size: 14px; }
.hmi-status-grid strong { display: block; margin-top: 8px; font-size: 18px; }
.hmi-scan { min-height: 52px; min-width: 240px; padding: 0 12px; border: 1px solid #8fb0d0; font-size: 18px; }
.load-live li { display: grid; grid-template-columns: 108px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 72px; padding: 10px 12px; background: #f4f8fd; border: 1px solid #c5daf0; }
.load-live strong { font-size: 20px; font-family: ui-monospace, Consolas, monospace; }
.load-live b { display: block; font-size: 16px; }
.load-live small { display: block; margin-top: 4px; color: #516176; font-size: 13px; }
.load-live .state { text-align: right; color: #0b4f9c; font-weight: 800; }
.load-live .state em { font-style: normal; }
.load-live .state button { background: #0b4f9c; color: #fff; border: 0; padding: 8px 14px; }
.load-empty { padding: 36px 16px; text-align: center; color: #516176; font-size: 16px; }
.sample-list { padding-top: 4px; }
.sample-list li { grid-template-columns: 120px minmax(0, 1fr) auto; }
.sample-list b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sample-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sample-actions button { min-height: 40px; min-width: 72px; border: 0; color: #fff; font-size: 16px; font-weight: 800; }
.sample-ok-btn { background: #0b7a32; }
.sample-ng-btn { background: #b42318; }
.sample-example { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid #8fb0d0; color: #0b4f9c; font-family: "Segoe UI", sans-serif; font-size: 12px; font-weight: 700; }
.sample-ok { color: #0b7a32; font-size: 22px; }
.sample-ng { color: #b42318; font-size: 22px; }
.load-bay .cfg thead { white-space: normal; }
.load-bay .cfg-feedback { margin: 0 14px 14px; }

.hmi-lines li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  min-height: 52px;
  padding: 8px 12px;
  background: #f3f8fd;
  border: 1px solid #c5daf0;
  font-size: 18px;
}

.hmi .cfg { gap: 10px; }
.hmi .cfg-panel {
  border-radius: 0;
  border: 1px solid #6ea2d8;
  box-shadow: none;
}
.hmi .cfg-panel > header {
  background: #3b8fe0;
  color: #fff;
  border-bottom: 0;
}
.hmi .cfg-panel > header h2 { font-size: 18px; }
.hmi .cfg-panel > header p,
.hmi .cfg-panel > header small { color: #e7f3ff; }
.hmi .cfg-panel > header .cfg-tag {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.hmi .cfg-panel > header button {
  min-height: 44px;
  background: #fff;
  color: #0b4f9c;
  border: 0;
  font-size: 16px;
}
.hmi .cfg-panel > header button:disabled { background: #d5e4f5; color: #6b7f96; }
.hmi .cfg-fields { gap: 12px; }
.hmi .cfg-fields label { font-size: 15px; }
.hmi .cfg-fields input,
.hmi .cfg-fields select,
.hmi-content input:not([type="checkbox"]),
.hmi-content select {
  min-height: 48px;
  font-size: 18px;
}
.hmi .cfg-panel button { min-height: 44px; font-size: 16px; }
.hmi .cfg th,
.hmi .cfg td { padding: 14px 12px; font-size: 15px; }
.hmi .plan-actions button { min-height: 40px; padding: 8px 12px; font-size: 15px; }
.hmi .rounded-xl { border-radius: 2px; }

@media (max-width: 980px) {
  body { overflow: auto; }
  .hmi { height: auto; min-height: 100%; grid-template-rows: 48px auto auto 36px; }
  .hmi-logo { height: 28px; left: 8px; }
  .hmi-body { grid-template-columns: 1fr; }
  .hmi-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid #8fb0d0; }
  .hmi-group { display: none; }
  .hmi-nav button { min-width: 92px; white-space: nowrap; }
  .hmi-split, .hmi-board, .load-pair-cols, .hmi-status-grid { grid-template-columns: 1fr; grid-template-rows: none; height: auto; }
  .load-stats { grid-template-columns: 1fr 1fr; }
  .hmi-clock { margin-left: 0; }
  .hmi-status { flex-wrap: wrap; height: auto; min-height: 36px; padding: 6px 12px; }
}
