.sgds {
  --sgds-bg: #f7f7f2;
  --sgds-surface: #ffffff;
  --sgds-ink: #151713;
  --sgds-muted: #63695f;
  --sgds-line: #d9ddcf;
  --sgds-accent: #a8d436;
  --sgds-accent-strong: #2f5f2e;
  --sgds-warm: #f4c95d;
  --sgds-danger: #925b2a;
  color: var(--sgds-ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sgds *,
.sgds *::before,
.sgds *::after {
  box-sizing: border-box;
}

.sgds .is-hidden {
  display: none !important;
}

.sgds__boot {
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  padding: 16px;
  background: var(--sgds-surface);
  display: flex;
  gap: 12px;
  align-items: center;
}

.sgds__boot--error {
  border-color: #c77a44;
  background: #fff6ed;
  color: var(--sgds-danger);
  align-items: flex-start;
  flex-direction: column;
}

.sgds__inner {
  background: var(--sgds-bg);
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  padding: 18px;
}

.sgds__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.sgds__eyebrow {
  margin: 0 0 6px;
  color: var(--sgds-accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.sgds h2 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: 0;
}

.sgds__header p:last-child {
  margin: 0;
  color: var(--sgds-muted);
  max-width: 760px;
}

.sgds__modes {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.sgds__mode,
.sgds button,
.sgds-card__actions a,
.sgds-empty a {
  min-height: 40px;
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: var(--sgds-surface);
  color: var(--sgds-ink);
  font: inherit;
  font-weight: 750;
  padding: 9px 12px;
  text-decoration: none;
  cursor: pointer;
}

.sgds__mode {
  white-space: nowrap;
}

.sgds__mode--assistant {
  border-color: #b6cf59;
  background: #f4ffd5;
  box-shadow: 0 8px 18px rgba(47, 95, 46, 0.12);
}

.sgds__mode span {
  display: block;
  color: var(--sgds-muted);
  font-size: 11px;
  font-weight: 700;
}

.sgds__mode.is-active {
  background: var(--sgds-ink);
  border-color: var(--sgds-ink);
  color: #fff;
}

.sgds__mode.is-active span {
  color: rgba(255, 255, 255, 0.72);
}

.sgds__mode[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
}

.sgds__searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.sgds__searchbox {
  position: relative;
  min-width: 0;
}

.sgds__search,
.sgds__field {
  display: grid;
  gap: 6px;
}

.sgds__search span,
.sgds__field span {
  color: var(--sgds-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.sgds input,
.sgds select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: var(--sgds-surface);
  color: var(--sgds-ink);
  font: inherit;
  padding: 9px 11px;
}

.sgds input:focus,
.sgds select:focus,
.sgds button:focus-visible,
.sgds a:focus-visible {
  outline: 3px solid rgba(168, 212, 54, 0.38);
  outline-offset: 2px;
}

.sgds__filter-toggle {
  display: none;
  align-self: end;
}

.sgds-autocomplete {
  position: absolute;
  inset: calc(100% + 6px) 0 auto 0;
  z-index: 50;
  display: grid;
  gap: 10px;
  max-height: min(460px, 72vh);
  overflow: auto;
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(17, 24, 13, 0.18);
  padding: 10px;
}

.sgds-autocomplete section {
  display: grid;
  gap: 6px;
}

.sgds-autocomplete section > strong {
  color: var(--sgds-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.sgds-autocomplete button,
.sgds-autocomplete a {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8faf3;
  color: var(--sgds-ink);
  padding: 9px 10px;
  text-align: left;
  text-decoration: none;
}

.sgds-autocomplete a {
  grid-template-columns: 46px minmax(0, 1fr);
}

.sgds-autocomplete button:hover,
.sgds-autocomplete a:hover,
.sgds-autocomplete button:focus-visible,
.sgds-autocomplete a:focus-visible {
  border-color: var(--sgds-accent);
  background: #fbfff0;
}

.sgds-autocomplete img,
.sgds-autocomplete a > span:first-child {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #eef0e6;
  object-fit: cover;
}

.sgds-autocomplete small {
  display: block;
  color: var(--sgds-muted);
  font-size: 12px;
  font-weight: 750;
}

.sgds mark {
  border-radius: 4px;
  background: #f4c95d;
  color: inherit;
  padding: 0 2px;
}

.sgds__presets {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 8px;
}

.sgds__preset {
  flex: 0 0 auto;
  background: #fbfff0;
  border-color: #cddd92;
}

.sgds__layout {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sgds__filters {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.sgds__filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sgds__filter-head button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.sgds__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sgds__price-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.sgds__price-presets button {
  min-height: 34px;
  padding: 7px 8px;
  font-size: 12px;
  background: #fbfff0;
  border-color: #cddd92;
}

.sgds__check {
  display: flex;
  align-items: start;
  gap: 9px;
  color: var(--sgds-ink);
  font-weight: 700;
}

.sgds__check input {
  width: auto;
  min-height: 0;
  margin-top: 4px;
}

.sgds__data-note {
  border-top: 1px solid var(--sgds-line);
  padding-top: 12px;
}

.sgds__data-note strong {
  display: block;
  margin-bottom: 4px;
}

.sgds__data-note p {
  margin: 0;
  color: var(--sgds-muted);
  font-size: 13px;
  line-height: 1.45;
}

.sgds__results {
  min-width: 0;
}

.sgds__result-head {
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.sgds__result-head strong {
  display: block;
  font-size: 18px;
}

.sgds__result-head span {
  color: var(--sgds-muted);
  font-size: 13px;
}

.sgds__result-head small {
  display: block;
  margin-top: 4px;
  color: var(--sgds-accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.sgds__result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sgds__result-actions button {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12px;
}

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

.sgds-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: var(--sgds-surface);
}

.sgds-card__media {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #eef0e6;
  overflow: hidden;
  color: var(--sgds-muted);
  text-decoration: none;
}

.sgds-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sgds-card__body {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.sgds-card__meta,
.sgds-card__facts,
.sgds-card__matches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sgds-card__meta span,
.sgds-card__facts span,
.sgds-card__matches span {
  border: 1px solid var(--sgds-line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--sgds-muted);
  font-size: 12px;
  font-weight: 750;
}

.sgds-card__matches span {
  background: #f4f8df;
  color: var(--sgds-accent-strong);
}

.sgds-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.24;
  letter-spacing: 0;
}

.sgds-card h3 a {
  color: var(--sgds-ink);
  text-decoration: none;
}

.sgds-card h3 a:hover {
  text-decoration: underline;
}

.sgds-card__price {
  font-size: 18px;
  font-weight: 850;
}

.sgds-card__availability {
  color: var(--sgds-muted);
  font-size: 13px;
  font-weight: 800;
}

.sgds-card__availability.is-ok {
  color: var(--sgds-accent-strong);
}

.sgds-card__excerpt {
  margin: 0;
  color: var(--sgds-muted);
  font-size: 13px;
  line-height: 1.45;
}

.sgds-card__reason {
  border-left: 3px solid var(--sgds-accent);
  padding-left: 10px;
}

.sgds-card__reason strong {
  display: block;
  margin-bottom: 3px;
}

.sgds-card__reason ul {
  margin: 0;
  padding-left: 18px;
  color: var(--sgds-muted);
  line-height: 1.45;
}

.sgds-card__actions {
  display: flex;
  gap: 8px;
}

.sgds-card__actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sgds-ink);
  border-color: var(--sgds-ink);
  color: #fff;
}

.sgds-empty {
  border: 1px dashed var(--sgds-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 22px;
}

.sgds-empty strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

.sgds-empty p {
  color: var(--sgds-muted);
  margin: 0 0 14px;
}

.sgds-empty div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sgds-assistant {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: start;
}

.sgds-assistant__main,
.sgds-assistant__side,
.sgds-data {
  min-width: 0;
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 14px;
}

.sgds-assistant__main {
  display: grid;
  gap: 12px;
}

.sgds-assistant__side {
  display: grid;
  gap: 12px;
}

.sgds-chat {
  min-height: 320px;
  max-height: min(62vh, 560px);
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 4px;
}

.sgds-chat__message {
  display: flex;
  justify-content: flex-start;
}

.sgds-chat__message > div {
  max-width: min(720px, 92%);
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: var(--sgds-surface);
  padding: 11px 12px;
  color: var(--sgds-ink);
  line-height: 1.5;
}

.sgds-chat__message.is-user {
  justify-content: flex-end;
}

.sgds-chat__message.is-user > div {
  background: var(--sgds-ink);
  border-color: var(--sgds-ink);
  color: #fff;
}

.sgds-chat__message.is-pending > div {
  color: var(--sgds-muted);
}

.sgds-chat__message p {
  margin: 0 0 8px;
}

.sgds-chat__message p:last-child,
.sgds-chat__message ul:last-child,
.sgds-chat__message ol:last-child {
  margin-bottom: 0;
}

.sgds-chat__products {
  display: grid;
  gap: 10px;
  margin: 8px 0 10px;
  padding-left: 22px;
}

.sgds-chat__products li {
  padding-left: 2px;
}

.sgds-chat__products a {
  color: var(--sgds-ink);
  font-weight: 850;
  text-decoration: none;
}

.sgds-chat__products a:hover {
  text-decoration: underline;
}

.sgds-chat__products span,
.sgds-chat__products small {
  display: block;
  color: var(--sgds-muted);
  font-size: 13px;
}

.sgds-assistant__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sgds-assistant__quick button {
  min-height: 36px;
  background: #fbfff0;
  border-color: #cddd92;
  font-size: 13px;
}

.sgds-assistant__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.sgds-consent,
.sgds-assistant__notice,
.sgds-assistant__spotlight,
.sgds-data__gaps {
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: var(--sgds-surface);
  padding: 12px;
}

.sgds-consent {
  display: grid;
  gap: 10px;
}

.sgds-consent strong,
.sgds-assistant__spotlight strong,
.sgds-data__gaps strong {
  display: block;
}

.sgds-consent p,
.sgds-assistant__notice,
.sgds-assistant__spotlight p,
.sgds-data p {
  color: var(--sgds-muted);
  font-size: 13px;
  line-height: 1.45;
}

.sgds-consent p,
.sgds-assistant__spotlight p,
.sgds-data p {
  margin: 0;
}

.sgds-consent__error {
  color: var(--sgds-danger) !important;
  font-weight: 800;
}

.sgds-data {
  display: grid;
  gap: 14px;
}

.sgds-data__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.sgds-data__head strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

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

.sgds-data__cards div {
  border: 1px solid var(--sgds-line);
  border-radius: 8px;
  background: var(--sgds-surface);
  padding: 12px;
}

.sgds-data__cards strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.sgds-data__cards span {
  display: block;
  margin-top: 5px;
  color: var(--sgds-muted);
  font-size: 13px;
  font-weight: 750;
}

.sgds-data__gaps ul {
  display: grid;
  gap: 7px;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.sgds-data__gaps li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--sgds-line);
  padding-bottom: 7px;
}

.sgds-data__gaps li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.sgds-data__table-wrap {
  overflow-x: auto;
}

.sgds-data__table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.sgds-data__table th,
.sgds-data__table td {
  border-bottom: 1px solid var(--sgds-line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.sgds-data__table th {
  color: var(--sgds-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.sgds-data__table a {
  color: var(--sgds-ink);
  font-weight: 800;
  text-decoration: none;
}

.sgds-data__table a:hover {
  text-decoration: underline;
}

.sgds__pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.sgds__pagination span {
  color: var(--sgds-muted);
  font-weight: 800;
}

.sgds.is-loading .sgds__results {
  opacity: 0.62;
  pointer-events: none;
}

@media (max-width: 900px) {
  .sgds__inner {
    padding: 12px;
  }

  .sgds__header,
  .sgds__layout,
  .sgds-assistant {
    grid-template-columns: 1fr;
  }

  .sgds__modes {
    width: 100%;
    overflow-x: auto;
  }

  .sgds__filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sgds__filters {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 9999;
    max-height: 78vh;
    overflow: auto;
    border-radius: 8px 8px 0 0;
    padding: 18px;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.2);
  }

  .sgds__filters.is-open {
    display: grid;
  }

  .sgds-card {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .sgds-data__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sgds__result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .sgds__result-actions {
    justify-content: flex-start;
  }

  .sgds-assistant__side {
    order: -1;
  }
}

@media (max-width: 560px) {
  .sgds h2 {
    font-size: 22px;
  }

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

  .sgds-autocomplete {
    max-height: 70vh;
  }

  .sgds-card {
    grid-template-columns: 1fr;
  }

  .sgds-card__media {
    max-height: 220px;
  }

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

  .sgds-assistant__form,
  .sgds-data__cards,
  .sgds-data__head {
    grid-template-columns: 1fr;
  }

  .sgds-data__head {
    display: grid;
  }

  .sgds-chat {
    min-height: 260px;
  }
}
