:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f4f6f8;
  color: #1d252c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
}

button,
.nav-link {
  min-height: 36px;
  border: 1px solid #9aa8b1;
  border-radius: 6px;
  background: #ffffff;
  color: #1d252c;
  padding: 7px 12px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button.primary,
.nav-link.primary {
  border-color: #176f62;
  background: #176f62;
  color: #ffffff;
}

button.danger {
  border-color: #9f3a38;
  color: #9f3a38;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #b5c0c7;
  border-radius: 6px;
  background: #ffffff;
  color: #1d252c;
  padding: 6px 8px;
}

label {
  display: grid;
  gap: 4px;
  color: #3b4650;
  font-size: 12px;
  font-weight: 600;
}

video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #c5ced4;
  border-radius: 6px;
  background: #111820;
  object-fit: contain;
}

.shell {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #d7dde1;
  background: #ffffff;
  padding: 12px 16px;
}

.title {
  display: grid;
  gap: 2px;
}

.title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.title span {
  color: #5a6873;
  font-size: 12px;
}

.toolbar,
.button-row,
.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar {
  justify-content: flex-end;
}

.content {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.panel {
  display: grid;
  gap: 12px;
  border: 1px solid #d5dde1;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
}

.metric-grid div {
  display: grid;
  gap: 3px;
  min-height: 58px;
  border: 1px solid #d5dde1;
  border-radius: 6px;
  background: #f7f9fa;
  padding: 8px;
}

.metric-grid span {
  color: #5a6873;
  font-size: 12px;
}

.metric-grid strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid #b5c0c7;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented label:has(input:checked) {
  border-color: #176f62;
  background: #e4f3ef;
  color: #0f5d52;
}

.log {
  min-height: 180px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #cbd4da;
  border-radius: 6px;
  background: #141b22;
  color: #dce6eb;
  padding: 10px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.log .error {
  color: #ffb3a6;
}

.log .ok {
  color: #9ee6c5;
}

.landing {
  align-content: start;
  max-width: 780px;
  margin: 0 auto;
  padding-top: 32px;
}

@media (max-width: 980px) {
  .field-grid,
  .two-column,
  .row,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    justify-content: flex-start;
  }
}
