:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #617083;
  --line: #d8dee7;
  --panel: #ffffff;
  --band: #eef3f8;
  --accent: #0f7b6c;
  --accent-dark: #0a5d52;
  --warn: #945500;
  --blue: #1f5fbf;
  --shadow: 0 18px 45px rgba(26, 39, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(238, 243, 248, 0.92), rgba(250, 251, 252, 0.96)),
    repeating-linear-gradient(90deg, rgba(31, 95, 191, 0.06) 0 1px, transparent 1px 80px);
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.workspace {
  display: grid;
  gap: 18px;
}

.topbar,
.tool-grid,
.result-layout,
.receipt-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p,
dl {
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #c8d2df;
  border-radius: 999px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 0.82rem;
  font-weight: 650;
}

.status-pill.good {
  color: var(--accent-dark);
  border-color: rgba(15, 123, 108, 0.32);
  background: rgba(15, 123, 108, 0.08);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  padding: 18px;
}

.search-panel {
  display: grid;
  gap: 12px;
}

.search-panel > label,
.controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

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

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c5ced9;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 123, 108, 0.18);
  border-color: var(--accent);
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  color: white;
  background: var(--accent);
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.controls {
  display: grid;
  grid-template-columns: 160px 120px minmax(170px, 1fr);
  gap: 10px;
  align-items: end;
}

.checkbox {
  min-height: 44px;
  grid-template-columns: 18px 1fr;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #c5ced9;
  border-radius: 6px;
  color: var(--ink);
  background: #fbfcfe;
}

.checkbox input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.summary-panel {
  padding: 14px;
  border: 1px solid #dfe5ed;
  border-radius: 8px;
  background: var(--band);
}

.summary-panel dl {
  display: grid;
  gap: 12px;
}

.summary-panel div {
  display: grid;
  gap: 4px;
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  font-weight: 760;
}

.result-layout,
.receipt-panel {
  padding: 18px;
}

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.results-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.product-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 255px;
  padding: 14px;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #fbfcfe;
}

.product-card h3 {
  min-height: 42px;
  margin: 0 0 8px;
  font-size: 0.98rem;
  line-height: 1.25;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #263544;
  background: #e8edf4;
  font-size: 0.76rem;
  font-weight: 720;
}

.tag.money {
  color: #064e43;
  background: rgba(15, 123, 108, 0.12);
}

.tag.warn {
  color: var(--warn);
  background: rgba(148, 85, 0, 0.12);
}

.description {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.48;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.card-actions a,
.card-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 760;
  text-decoration: none;
}

.card-actions a {
  border: 1px solid #c5ced9;
  color: var(--blue);
  background: #fff;
}

.card-actions button {
  background: #233140;
}

.card-actions button:hover {
  background: #111820;
}

pre {
  min-height: 160px;
  margin: 12px 0 0;
  overflow: auto;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  padding: 14px;
  color: #152231;
  background: #f7f9fc;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .tool-grid,
  .results {
    grid-template-columns: 1fr;
  }

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

  .checkbox {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding: 10px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .input-row,
  .controls,
  .card-actions,
  .results-header {
    grid-template-columns: 1fr;
  }

  .results-header {
    display: grid;
  }
}
