:root {
  color-scheme: light;
  --bg: #eef3f6;
  --panel: #ffffff;
  --line: #cfd9e2;
  --text: #102033;
  --muted: #52677c;
  --green: #008451;
  --green-dark: #006d43;
  --blue: #12617d;
  --soft-green: #e9f6f0;
  --soft-blue: #e9f3f7;
  --warn: #fff4df;
  --danger: #a83a32;
  --shadow: 0 8px 24px rgba(16, 32, 51, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.15;
}

p { margin: 0; color: var(--muted); }

main {
  width: min(1100px, calc(100vw - 32px));
  margin: 20px auto 42px;
}

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

.query-panel { margin-bottom: 18px; }

.section-title {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, button { font: inherit; }

input {
  width: 100%;
  height: 46px;
  border: 1px solid #b8c7d4;
  border-radius: 6px;
  padding: 0 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 132, 81, .13);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 145px 105px;
  gap: 10px;
}

.input-wrap { position: relative; }

button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--green-dark); }
button:focus-visible { outline: 3px solid rgba(18, 97, 125, .25); outline-offset: 2px; }

button.secondary {
  border: 1px solid #b8c7d4;
  background: #fff;
  color: var(--text);
}

button.secondary:hover { background: #f4f7f9; }

.hint { margin-top: 8px; font-size: 13px; }

.status {
  min-width: 210px;
  border: 1px solid #d4a64a;
  border-radius: 6px;
  padding: 10px 12px;
  color: #7a4b00;
  background: var(--warn);
  text-align: center;
  font-weight: 700;
}

.status.ready {
  border-color: #8ec5a9;
  color: #0e6040;
  background: var(--soft-green);
}

.status.error {
  border-color: #dfaaa5;
  color: var(--danger);
  background: #fff0ef;
}

.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(16, 32, 51, .16);
}

.suggestion {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.suggestion:hover, .suggestion.active { background: var(--soft-blue); }
.suggestion small { color: var(--muted); font-weight: 400; white-space: nowrap; }

.empty-state, .not-found {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 260px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong, .not-found strong { color: var(--text); font-size: 18px; }
.empty-icon { color: var(--green); font-size: 46px; line-height: 1; }

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 16px;
  border-left: 4px solid var(--green);
  border-radius: 4px;
  background: var(--soft-green);
}

.result-head h2 { margin: 0 0 5px; font-size: 24px; overflow-wrap: anywhere; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.component-list { display: grid; gap: 10px; }

.component-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) minmax(180px, 260px);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 13px 15px;
  background: #fbfcfd;
}

.component-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--soft-blue);
  color: var(--blue);
  font-weight: 800;
}

.component-code { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }

.location {
  padding: 9px 11px;
  border-radius: 5px;
  background: var(--soft-green);
  color: #0e6040;
}

.location span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.location strong { overflow-wrap: anywhere; }

.nearby { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.nearby p { margin-bottom: 9px; }
.nearby-list { display: flex; flex-wrap: wrap; gap: 8px; }
.nearby button { min-height: 34px; padding: 6px 10px; background: var(--blue); font-size: 13px; }

footer {
  padding: 0 18px 28px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 720px) {
  .topbar { display: block; padding: 18px; }
  .status { margin-top: 14px; }
  main { width: min(100% - 20px, 1100px); margin-top: 10px; }
  .panel { padding: 14px; }
  .search-row { grid-template-columns: 1fr 1fr; }
  .input-wrap { grid-column: 1 / -1; }
  .component-card { grid-template-columns: 38px minmax(0, 1fr); }
  .location { grid-column: 2; }
  .result-head { display: block; }
  .badge { margin-top: 10px; }
}

@media print {
  body { background: #fff; }
  .topbar, .query-panel, footer { display: none; }
  main { width: 100%; margin: 0; }
  .panel { border: 0; box-shadow: none; }
  .component-card { break-inside: avoid; }
}
