:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --bg-strong: #fffaf0;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #fffefa;
  --surface-alt: #efe7d8;
  --text: #1f2933;
  --muted: #6b7280;
  --line: rgba(31, 41, 51, 0.12);
  --accent: #b4232a;
  --accent-2: #0f766e;
  --accent-3: #d69e2e;
  --shadow: 0 24px 70px rgba(31, 41, 51, 0.14);
  --radius: 8px;
}

body.dark {
  color-scheme: dark;
  --bg: #111827;
  --bg-strong: #18212f;
  --surface: rgba(26, 35, 48, 0.82);
  --surface-solid: #182230;
  --surface-alt: #233044;
  --text: #f8fafc;
  --muted: #aab4c2;
  --line: rgba(248, 250, 252, 0.12);
  --accent: #f05a5f;
  --accent-2: #37b5a7;
  --accent-3: #e7b84a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(180, 35, 42, 0.12), transparent 30%),
    radial-gradient(circle at 85% 0%, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-strong));
  color: var(--text);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px;
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 154px;
  height: 46px;
  object-fit: contain;
  flex: 0 0 auto;
  background: transparent;
  padding: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.02rem;
}

.brand span,
.panel-title,
.answer-meta,
#resultSummary,
.status-pill {
  color: var(--muted);
  font-size: 0.84rem;
}

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

.stats-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stats-grid strong,
.stats-grid span {
  display: block;
}

.stats-grid strong {
  font-size: 1.35rem;
  letter-spacing: 0;
}

.stats-grid span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

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

.panel-title {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-list button,
.quick-row button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 12px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.chip-list button:hover,
.quick-row button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.mini-list {
  display: grid;
  gap: 8px;
  max-height: 44vh;
  overflow: auto;
  padding-right: 3px;
}

.mini-item {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.mini-item strong,
.mini-item span {
  display: block;
}

.mini-item strong {
  font-size: 0.9rem;
  line-height: 1.25;
}

.mini-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.main {
  padding: 28px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 22px;
  min-width: 0;
}

.topbar,
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 1.2rem;
}

#subtitle {
  margin-top: 8px;
  color: var(--muted);
}

.icon-button,
.send-button {
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
}

.icon-button svg,
.send-button svg,
.input-wrap > svg,
.answer-icon svg,
.empty-state svg {
  width: 20px;
  height: 20px;
}

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

.ask-form {
  margin: 0;
}

.input-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 84px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.input-wrap > svg {
  color: var(--accent);
  margin-left: 5px;
}

textarea {
  width: 100%;
  min-height: 50px;
  max-height: 160px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.45;
}

textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}

.send-button {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.send-button:disabled {
  opacity: 0.58;
  cursor: progress;
}

.quick-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quick-row button {
  white-space: nowrap;
}

.answer-band,
.results-layout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(16px);
}

.answer-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
}

.answer-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent-2) 16%, transparent);
  color: var(--accent-2);
}

#answerText {
  margin-top: 4px;
  line-height: 1.6;
}

.results-layout {
  padding: 18px;
  min-height: 340px;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: var(--surface-solid);
  white-space: nowrap;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.product-card {
  border: 1px solid var(--line);
  background: var(--surface-solid);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-rows: 210px auto;
  min-width: 0;
}

.product-media {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), color-mix(in srgb, var(--accent-2) 10%, transparent)),
    var(--surface-alt);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 14px;
}

.product-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

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

.tag {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  max-width: 100%;
}

.product-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.product-card p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.price-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.price-line strong {
  color: var(--accent);
  font-size: 1rem;
}

.action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg-strong);
  text-decoration: none;
  font-weight: 700;
}

.detail-link.secondary {
  min-width: 68px;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--line);
}

.content-section {
  margin-top: 22px;
}

.section-title {
  font-weight: 800;
  margin-bottom: 10px;
}

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

.content-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-solid);
}

.content-item img {
  width: 76px;
  height: 96px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--surface-alt);
}

.content-item h3 {
  margin: 0;
  font-size: 0.98rem;
}

.content-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.content-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.content-actions a {
  min-width: 74px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text);
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 800;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mini-list {
    max-height: 220px;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .results-head {
    align-items: flex-start;
  }

  h1 {
    font-size: 2.4rem;
  }

  .input-wrap {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .input-wrap > svg {
    display: none;
  }

  .content-item {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .content-item img {
    width: 62px;
    height: 82px;
  }

  .content-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}
