:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #66707d;
  --line: #d9e0e7;
  --panel: #ffffff;
  --page: #eef3f6;
  --blue: #0f2a3d;
  --orange: #f97316;
  --warn-bg: #fff4df;
  --warn: #704500;
  --good-bg: #e8f5e8;
  --good: #255d28;
  --shadow: 0 14px 36px rgba(23, 35, 48, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 8px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(1380px, 100%);
  margin: 0 auto;
}

.brand img {
  width: 46px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.28rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--orange);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.app {
  display: grid;
  grid-template-columns: minmax(290px, 0.78fr) minmax(320px, 1.22fr);
  gap: 16px;
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 16px clamp(12px, 3vw, 28px) 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 15px;
}

.controls {
  grid-row: span 2;
}

.fine,
.checklist {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin-bottom: 13px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 11px;
}

.field span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #bfc9d4;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 3px solid rgba(249, 115, 22, 0.22);
  outline-offset: 1px;
}

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

.fine-grid {
  grid-template-columns: minmax(160px, 0.5fr) minmax(160px, 0.5fr) minmax(260px, 1fr);
}

.wide {
  grid-column: auto;
}

.toggle-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.pill,
.action-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fbfc;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 11px;
  cursor: pointer;
}

.pill.active,
.action-button {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
  font-weight: 800;
}

.action-button.secondary {
  border-color: #bfc9d4;
  background: #fff;
  color: var(--ink);
}

.recommendation,
.notes,
.advice {
  display: grid;
  gap: 9px;
}

.setting-card,
.note,
.check-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 11px;
}

.setting-card strong,
.note strong {
  display: block;
  margin-bottom: 4px;
}

.setting-card p,
.note p {
  margin-bottom: 5px;
  line-height: 1.36;
}

.setting-meta {
  margin-bottom: 5px;
  color: var(--orange);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.warning {
  color: var(--warn);
  background: var(--warn-bg);
  border-left: 3px solid #d18b18;
  padding: 7px 8px;
  border-radius: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 0 6px 6px 0;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e9f2f6;
  color: #254a5c;
  font-size: 0.78rem;
  font-weight: 800;
}

.tag.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.tag.good {
  background: var(--good-bg);
  color: var(--good);
}

.wiring-layout,
.pid-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.82fr) minmax(260px, 1fr);
  gap: 13px;
}

.terminal-card {
  border: 1px solid #bfc9d4;
  border-radius: 8px;
  overflow: hidden;
}

.terminal-title {
  background: var(--blue);
  color: #fff;
  padding: 10px 12px;
  font-weight: 800;
}

.terminal-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  min-height: 48px;
  border-top: 1px solid var(--line);
}

.terminal-row code {
  display: grid;
  place-items: center;
  background: #eef3f6;
  font-weight: 900;
  white-space: normal;
  text-align: center;
}

.terminal-row span {
  align-self: center;
  padding: 9px;
  color: #313b45;
}

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

.check-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.check-item input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--orange);
}

.check-item span {
  line-height: 1.32;
}

.footer {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 28px) 24px;
  color: #4d5965;
  font-size: 0.86rem;
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  transform: translate(-50%, 18px);
  min-width: min(360px, calc(100vw - 32px));
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  padding: 11px 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .topbar {
    position: static;
  }

  .app,
  .wiring-layout,
  .pid-grid {
    grid-template-columns: 1fr;
  }

  .controls,
  .fine,
  .checklist {
    grid-column: auto;
    grid-row: auto;
  }

  .checklist-items {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .fine-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .brand img {
    width: 40px;
    height: 36px;
  }

  h1 {
    font-size: 1.08rem;
  }

  .panel {
    padding: 12px;
  }

  .range-grid,
  .checklist-items {
    grid-template-columns: 1fr;
  }

  .toggle-row,
  .button-row {
    flex-direction: column;
  }

  .pill,
  .action-button {
    width: 100%;
  }
}

@media print {
  .topbar,
  .button-row,
  .toast {
    display: none;
  }

  body {
    background: #fff;
  }

  .app {
    display: block;
    padding: 0;
  }

  .panel {
    box-shadow: none;
    break-inside: avoid;
    margin-bottom: 10px;
  }
}
