body { font-family: system-ui, sans-serif; margin: 0; color: #222; }
.dv-main { max-width: 640px; margin: 2rem auto; padding: 0 1rem; }
body:not(.authed) .dv-main { display: none; }
h1 { font-size: 1.4rem; margin-bottom: 1rem; }
.row { margin: 1rem 0; }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.log-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.25rem; }
.log-head label { margin-bottom: 0; }
button.small { padding: 0.25rem 0.7rem; font-size: 0.85rem; }
#log {
  background: #111; color: #b5ffb5; font-family: ui-monospace, monospace;
  padding: 0.5rem; height: 480px; overflow: auto;
  white-space: pre-wrap; border-radius: 4px; font-size: 0.85rem;
}
#log .err { color: #ff8080; font-weight: 600; }
#log .dbg { color: #8ad9ff; }
.status.err { color: #b00020; font-weight: 600; }
button { padding: 0.5rem 1.2rem; font-size: 1rem; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.status { font-size: 0.9rem; color: #555; }
.placeholder { color: #777; font-style: italic; }
#firmware-list { display: flex; flex-direction: column; gap: 0.4rem; }
.firmware-item {
  text-align: left; padding: 0.5rem 0.75rem; font: inherit; font-size: 0.95rem;
  background: #f5f5f5; border: 1px solid #ddd; border-radius: 4px; cursor: pointer;
}
.firmware-item:hover { background: #ebebeb; }
.sub-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid #ddd; margin-bottom: 1rem; }
.sub-tab {
  padding: 0.4rem 0.9rem; background: transparent; border: none;
  border-bottom: 2px solid transparent; font: inherit; font-size: 0.9rem;
  color: #555; cursor: pointer;
}
.sub-tab:hover { color: #111; }
.sub-tab.active { color: #111; border-bottom-color: #2563eb; font-weight: 600; }
.eng-select, button.small {
  height: 1.875rem;
  padding: 0 0.7rem;
  font-family: inherit;
  font-size: 0.85rem;
  box-sizing: border-box;
  vertical-align: middle;
}
.eng-select { width: 18rem; }
.monitor-row { display: flex; gap: 0.75rem; align-items: stretch; }
.monitor-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.eng-shortcuts { display: flex; flex-direction: column; gap: 0.4rem; flex: 0 0 auto; padding-top: 1.875rem; align-items: center; }
.eng-shortcuts .shortcut-btn { width: 9rem; padding: 0.4rem 0.6rem; font-size: 0.85rem; white-space: nowrap; }
.input-required-empty { outline: 2px solid red; outline-offset: -1px; }
.eng-shortcuts .shortcut-row { position: relative; }
.eng-shortcuts .info-btn {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 0.3rem;
  width: 1.4rem; height: 1.4rem; border-radius: 50%; padding: 0;
  font: italic 600 0.85rem/1 serif; border: 1px solid #888; background: #f5f5f5;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
body[data-active-pane="engineering"] #last-update,
body[data-active-pane="engineering"] #status { display: none; }
body[data-active-pane="uploads"] .dv-main,
body[data-active-pane="admin"] .dv-main { max-width: 960px; }
.form-cols { display: flex; gap: 1.5rem; }
.form-cols > .col { flex: 1; display: flex; flex-direction: column; }
.form-cols .row { margin: 0 0 1rem 0; }
.form-cols .row.grow { flex: 1; display: flex; flex-direction: column; }
.form-cols .row.grow textarea { flex: 1; resize: vertical; min-height: 8rem; }
.form-cols input[type="text"], .form-cols input[type="number"], .form-cols select { width: 100%; box-sizing: border-box; padding: 0.35rem 0.5rem; font: inherit; }
.form-cols textarea { width: 100%; box-sizing: border-box; padding: 0.35rem 0.5rem; font: inherit; }
#cmdInput, #btnSend { height: 2.5rem; box-sizing: border-box; }
#cmdInput { padding: 0 0.75rem; font-size: 1rem; font-family: inherit; }
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85); color: white; padding: 0.5rem 1rem;
  border-radius: 4px; font-size: 0.9rem; z-index: 1000; pointer-events: none;
}
.toast.err { background: rgba(176, 0, 32, 0.92); }
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal[hidden] { display: none; }
.modal-dialog {
  background: white; border-radius: 6px; padding: 1.25rem;
  width: min(720px, 95vw); max-height: 90vh; display: flex; flex-direction: column; gap: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.modal-dialog h2 { margin: 0; font-size: 1.1rem; }
.modal-dialog header { display: flex; align-items: center; justify-content: space-between; }
.modal-dialog .modal-close {
  background: transparent; border: none; font-size: 1.4rem; padding: 0 0.4rem; cursor: pointer;
}
.modal-dialog textarea {
  flex: 1; min-height: 16rem; font-family: ui-monospace, monospace; font-size: 0.85rem;
  padding: 0.5rem; resize: vertical; box-sizing: border-box;
}
.modal-dialog .modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

.mptest-buttons {
  display: flex; flex-direction: column; gap: 0.5rem;
  align-items: stretch; width: fit-content;
}
.mptest-col { display: flex; flex-direction: column; gap: 0.25rem; align-items: stretch; }
.mptest-leds {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  margin-left: 0.6rem;
  display: flex; gap: 0.35rem; padding: 0.25rem 0.45rem;
  border: 1px solid #888; border-radius: 3px;
  box-sizing: border-box;
}
.mptest-led {
  width: 0.85rem; height: 0.85rem; border-radius: 50%;
  border: 1px solid #888; background: transparent; display: inline-block;
}
.mptest-led.on { background: #4caf50; border-color: #2e7d32; }
.mptest-btn {
  padding: 0.4rem 0.75rem; border: 2px solid transparent; background: #f0f0f0;
  font: inherit; cursor: pointer; border-radius: 3px;
  text-align: center; box-sizing: border-box;
}
.mptest-btn.active { border-color: red; }
.mptest-row { display: flex; align-items: center; gap: 0.5rem; position: relative; }
.mptest-row .mptest-btn { flex: 1; }
.mptest-result {
  position: absolute; left: 100%; margin-left: 0.6rem; white-space: nowrap;
  font-size: 0.9rem; font-weight: 600;
}
.mptest-result.pass { color: #2e7d32; }
.mptest-result.fail { color: #c62828; }
.mptest-info {
  width: 1.4rem; height: 1.4rem; border-radius: 50%; padding: 0; flex-shrink: 0;
  font: italic 600 0.85rem/1 serif; border: 1px solid #888; background: #f5f5f5;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#mptest-modal .modal-dialog { width: min(504px, 66.5vw); }
