:root {
  --bg: #f6f7f4;
  --ink: #18221d;
  --muted: #66746b;
  --panel: #ffffff;
  --line: #dce4dd;
  --accent: #1f6a55;
  --accent-2: #c7872b;
  --soft: #eef4ef;
  --shadow: 0 16px 42px rgba(26, 43, 34, 0.1);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button,
.link-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 15px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.link-button:hover {
  border-color: #adbbb1;
}

.shell {
  width: min(1220px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

.topbar p {
  max-width: 720px;
  color: var(--muted);
  margin-top: 8px;
}

.toolbar {
  display: grid;
  grid-template-columns: 190px 210px minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 7px;
  color: #3c4941;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 106, 85, 0.12);
}

.answer-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.answer-panel div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.answer-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.answer-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.1;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.quick-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.quick-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.quick-card strong {
  display: block;
  margin-top: 8px;
  line-height: 1.35;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 12px;
}

h2 {
  font-size: 20px;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-height: 250px;
  display: grid;
  gap: 12px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.product {
  font-weight: 800;
  font-size: 17px;
}

.country {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.confidence {
  align-self: start;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.term {
  border-left: 4px solid var(--accent-2);
  padding-left: 10px;
}

.term span,
.block span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.term strong {
  font-size: 22px;
  line-height: 1.2;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfb;
  padding: 6px 9px;
  font-size: 12px;
}

.query {
  display: grid;
  gap: 7px;
}

.query code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #10211a;
  color: #e7f2eb;
  padding: 10px;
  font-size: 12px;
}

.note {
  color: #4a574f;
  font-size: 13px;
  line-height: 1.45;
}

.empty {
  grid-column: 1 / -1;
  border: 1px dashed #b7c5bc;
  border-radius: 8px;
  background: #fff;
  padding: 28px;
  color: var(--muted);
}

@media (max-width: 1060px) {
  .toolbar,
  .cards,
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 24px, 1220px);
    padding-top: 18px;
  }

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

  .toolbar,
  .answer-panel,
  .cards,
  .quick-grid {
    grid-template-columns: 1fr;
  }
}
