:root {
  color-scheme: light;
  --page: #eeeeeb;
  --card: #ffffff;
  --ink: #17191d;
  --muted: #737984;
  --line: #e7e8eb;
  --soft: #f1f2f4;
  --green: #18ad7d;
  --green-dark: #0c7754;
  --red: #ff2b50;
  --shadow: 0 12px 30px rgba(38, 42, 50, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: Aptos, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  text-transform: uppercase;
}

.page-shell {
  width: min(1740px, calc(100% - 40px));
  margin: 20px auto 12px;
}

main { display: grid; gap: 14px; }

.search-panel,
.results-panel {
  background: var(--card);
  border: 0;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(38, 42, 50, 0.07);
}

.search-panel {
  min-height: 108px;
  padding: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.search-form {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(190px, 0.45fr) 150px;
  gap: 12px;
  align-items: end;
}

label span {
  display: block;
  margin: 0 0 7px 2px;
  color: #171717;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .035em;
}

select,
button {
  width: 100%;
  height: 46px;
  border: 1px solid #d7d9dd;
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: #111;
  font: 600 15px Aptos, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
}

select:focus,
button:focus-visible {
  outline: 2px solid #777;
  outline-offset: 2px;
  border-color: #111;
}

select:disabled { color: #9da1a8; background: #f0f1f3; }

button {
  border: 0;
  background: #188d68;
  color: #fff;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover { background: #0f7253; transform: translateY(-1px); }
button:disabled { opacity: 0.55; cursor: wait; transform: none; }

.system-state {
  height: 46px;
  min-width: 172px;
  padding: 0 14px;
  border: 1px solid #252525;
  border-radius: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #333;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.state-light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a4a8ae;
}

.system-state.online .state-light { background: #222; box-shadow: none; }
.system-state.error .state-light { background: #777; box-shadow: none; }

.results-panel { min-height: 0; padding: 0 20px 20px; }

.results-heading {
  min-height: 68px;
  padding: 0 3px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.result-count { color: #1c1d20; font-size: 18px; font-weight: 650; }
.result-meta { color: #666b73; font-size: 12px; font-weight: 500; text-align: right; }

.empty-state {
  min-height: 450px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: #92969e;
  font-size: 14px;
  text-align: center;
}

.empty-state[hidden] { display: none; }

.empty-symbol { color: #222; font-size: 48px; line-height: 1; }

.trailer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 14px;
}

.trailer-grid[hidden] { display: none; }

.trailer-note {
  min-height: 390px;
  overflow: hidden;
  border: 1.5px solid #666b70;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(31, 35, 40, 0.06);
}

.trailer-note.unused {
  background: #fff;
  border-color: #aeb2b6;
  border-style: dashed;
  box-shadow: none;
  opacity: 1;
}

.trailer-note.missing { background: #fff; }

.note-head {
  min-height: 78px;
  padding: 20px 16px 8px;
  border-bottom: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.filled .note-head { background: #fff; color: #111; }

.note-head > strong { font-size: 17px; font-weight: 650; letter-spacing: .01em; text-align: center; }

.paper-form { padding: 0 22px 22px; }

.form-line {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.form-line > strong {
  padding-bottom: 4px;
  color: #111;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.form-line > span {
  min-width: 0;
  min-height: 27px;
  flex: 1;
  padding: 2px 3px 3px;
  border-bottom: 1px solid #252525;
  color: #111;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.form-row {
  display: grid;
  grid-template-columns: 1.2fr .8fr 1fr;
  gap: 12px;
}

.form-warning {
  margin-top: 18px;
  color: #333;
  font-size: 10px;
  font-weight: 650;
  text-align: center;
  letter-spacing: .05em;
}

.equipment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.equipment-grid .note-section + .note-section { border-left: 1px solid var(--line); }

.note-section { min-width: 0; padding: 14px 15px; }
.note-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.note-code { display: block; color: var(--ink); font-size: 19px; font-weight: 850; }
.note-value { display: block; margin-top: 5px; color: #565d66; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }

.location-section { border-bottom: 1px solid var(--line); }
.location-section > strong { font-size: 15px; }

.time-section > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  color: #60666f;
  font-size: 11px;
}

.time-section > div + div { border-top: 1px solid #eff0f1; }
.time-section strong { color: var(--ink); text-align: right; white-space: nowrap; }

.note-placeholder {
  min-height: 374px;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #969ba2;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.confidence {
  display: inline-flex;
  min-width: 86px;
  height: 32px;
  padding: 0 9px;
  border-radius: 9px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.confidence {
  min-width: auto;
  height: 27px;
  border: 1px solid #cfd1d2;
  border-radius: 6px;
  background: #fff;
  color: #4f555d;
}

.confidence.high,
.confidence.medium,
.confidence.low { background: #fff; color: #4f555d; }

footer {
  min-height: 34px;
  padding: 0 6px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  color: #333;
  font-size: 10px;
  font-weight: 700;
}

@media (max-width: 1050px) {
  .search-panel { align-items: stretch; flex-direction: column; }
  .search-form { grid-template-columns: 1fr 1fr; }
  .system-state { align-self: flex-end; }
  .trailer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .page-shell { width: calc(100% - 18px); margin-top: 9px; }
  .search-panel, .results-panel { border-radius: 14px; }
  .search-panel { padding: 15px; }
  .search-form { grid-template-columns: 1fr; }
  .system-state { width: 100%; align-self: auto; }
  .results-panel { min-height: 510px; padding: 0 12px 12px; }
  .results-heading { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
  .result-meta { text-align: left; }
  .trailer-grid { grid-template-columns: 1fr; }
  .equipment-grid { grid-template-columns: 1fr; }
  .equipment-grid .note-section + .note-section { border-left: 0; border-top: 1px solid var(--line); }
}
