:root {
  --paper: #f6f7f2;
  --surface: #ffffff;
  --surface-2: #eef3ee;
  --ink: #202326;
  --muted: #64706c;
  --line: #d7ded6;
  --teal: #2f6f73;
  --teal-dark: #214f53;
  --clay: #cf6a4c;
  --yellow: #f4c954;
  --green: #5d7d50;
  --shadow: 0 18px 55px rgba(32, 35, 38, 0.1);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(47, 111, 115, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(207, 106, 76, 0.07) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 242, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(32, 35, 38, 0.14);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.98rem;
  line-height: 1.25;
}

.top-actions,
.button-row,
.offer-head,
.dialog-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 2.5vw, 32px) 40px;
}

.workspace,
.results-grid {
  display: grid;
  gap: 18px;
}

.workspace {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
}

.results-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.customer-panel,
.scenario-panel,
.result-panel,
.talk-panel,
.catalog-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

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

.field,
.search-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.wide-field {
  margin-bottom: 14px;
}

.field input,
.field select,
.field textarea,
.search-field input {
  width: 100%;
  border: 1px solid #c9d3c9;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field textarea {
  resize: vertical;
  min-height: 112px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(47, 111, 115, 0.14);
}

.button-row {
  justify-content: flex-start;
  margin-top: 16px;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  border-color: #cbd8cd;
  background: var(--surface-2);
  color: var(--teal-dark);
}

.ghost-button,
.text-button {
  border-color: #ccd5cd;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

.text-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.8rem;
}

.icon-button {
  width: 38px;
  padding: 0;
  border-color: #ccd5cd;
  background: #fff;
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
}

.scenario-text {
  min-height: 74px;
  margin-bottom: 14px;
  color: var(--ink);
  line-height: 1.5;
}

.offer-box {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.offer-head {
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.selected-offer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 46px;
}

.selected-offer.empty,
.empty-state {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #c9d4cb;
  border-radius: 6px;
  background: #f8faf6;
  padding: 7px 8px 7px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.selected-chip button {
  min-height: 22px;
  width: 22px;
  border: 0;
  border-radius: 5px;
  background: #e7ece5;
  color: var(--ink);
  font-weight: 900;
}

.quiz-feedback {
  margin-top: 14px;
  line-height: 1.48;
}

.quiz-feedback strong {
  color: var(--teal-dark);
}

.count-pill {
  min-width: max-content;
  border: 1px solid rgba(47, 111, 115, 0.24);
  border-radius: 999px;
  background: rgba(47, 111, 115, 0.1);
  color: var(--teal-dark);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.recommendations {
  display: grid;
  gap: 12px;
}

.rec-card,
.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rec-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.rec-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.rec-meta,
.product-meta,
.source-note {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.rec-reason {
  margin: 0;
  color: #31393a;
  line-height: 1.48;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 999px;
  background: #edf2ed;
  color: #3d4a45;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.tag.strong {
  background: rgba(244, 201, 84, 0.34);
  color: #594512;
}

.rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.talk-track {
  display: grid;
  gap: 14px;
  color: #303736;
  line-height: 1.55;
}

.talk-track blockquote {
  margin: 0;
  border-left: 4px solid var(--yellow);
  padding: 10px 0 10px 14px;
  background: #fffaf0;
}

.talk-track ul {
  margin: 0;
  padding-left: 18px;
}

.catalog-panel {
  margin-top: 18px;
}

.catalog-heading {
  align-items: end;
}

.search-field {
  width: min(360px, 100%);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.category-tab {
  border: 1px solid #cdd8cf;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 850;
}

.category-tab[aria-selected="true"] {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

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

.product-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.product-card h3 {
  min-height: 42px;
}

.product-card p {
  margin-bottom: 0;
  color: #39413f;
  font-size: 0.86rem;
  line-height: 1.48;
}

.product-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

.link-button {
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 900;
  text-decoration: none;
}

.add-button {
  min-height: 32px;
  border: 1px solid #cbd8cd;
  border-radius: 6px;
  background: #f7faf6;
  color: var(--ink);
  padding: 0 9px;
  font-size: 0.8rem;
  font-weight: 900;
}

dialog {
  width: min(680px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(32, 35, 38, 0.35);
}

#sourceList {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 18px;
}

#sourceList a {
  color: var(--teal-dark);
  font-weight: 800;
}

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

  .catalog {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar,
  .catalog-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .search-field {
    width: 100%;
  }

  .top-actions > button,
  .button-row > button {
    flex: 1;
  }

  .form-grid,
  .catalog {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: flex-start;
  }
}
