:root {
  --bg: #ebe2d0;
  --panel: rgba(255, 252, 245, 0.82);
  --panel-strong: #fffdf8;
  --panel-soft: #f8f4ec;
  --ink: #1e292d;
  --muted: #68767c;
  --accent: #0f6b52;
  --accent-2: #dceddf;
  --accent-3: #c7e6da;
  --warm: #a8612f;
  --warn-bg: #fff3df;
  --warn-line: rgba(168, 97, 47, 0.24);
  --user: #ddf5ca;
  --assistant: #ffffff;
  --line: rgba(30, 41, 45, 0.08);
  --line-strong: rgba(15, 107, 82, 0.18);
  --shadow-soft: 0 20px 55px rgba(30, 41, 45, 0.1);
  --shadow-card: 0 16px 28px rgba(30, 41, 45, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --ease: 180ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 107, 82, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(190, 120, 73, 0.1), transparent 20%),
    radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.4), transparent 22%),
    var(--bg);
}

button,
input {
  font: inherit;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

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

.sidebar {
  padding: 28px 24px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f6b52, #21a47d);
  box-shadow: 0 0 0 10px rgba(15, 107, 82, 0.12);
}

.eyebrow,
.summary-eyebrow,
.mode-title {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--muted);
}

.sidebar h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.02;
}

.sidebar-copy,
.mode-subtitle,
.chat-header p,
.reply-hint,
.reply-count {
  color: var(--muted);
}

.sidebar-copy {
  margin: 0;
  line-height: 1.65;
}

.mode-panel,
.stats div,
.ghost-button,
.reply-panel,
.summary-card,
.warning-block,
.product-card {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow-card);
}

.mode-panel {
  border-radius: var(--radius-lg);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mode-button {
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--panel-soft);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  cursor: pointer;
  transition:
    transform var(--ease),
    background var(--ease),
    border-color var(--ease),
    color var(--ease);
}

.mode-button:hover,
.ghost-button:hover,
.reply-chip:hover,
.inline-action:hover,
.product-card:hover {
  transform: translateY(-1px);
}

.mode-button.is-active {
  background: linear-gradient(180deg, var(--accent-2), var(--accent-3));
  border-color: var(--line-strong);
  color: var(--ink);
}

.stats {
  display: grid;
  gap: 10px;
  margin: 0;
}

.stats div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 14px;
  border-radius: 16px;
}

.stats dt {
  color: var(--muted);
}

.stats dd {
  margin: 0;
  font-weight: 700;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
}

.ghost-button {
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition:
    border-color var(--ease),
    transform var(--ease),
    background var(--ease);
}

.ghost-button:hover {
  border-color: var(--line-strong);
  background: #ffffff;
}

.chat-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100vh;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 245, 239, 0.9);
  backdrop-filter: blur(16px);
}

.chat-header-copy {
  min-width: 0;
}

.chat-header h2,
.chat-header p {
  margin: 0;
}

.avatar,
.header-badge,
.reply-chip,
.inline-action,
.chip-badge {
  display: inline-flex;
  align-items: center;
}

.avatar {
  width: 46px;
  height: 46px;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f6b52, #1e9f76);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(15, 107, 82, 0.22);
}

.header-badge {
  margin-left: auto;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(15, 107, 82, 0.08);
  border: 1px solid rgba(15, 107, 82, 0.12);
  white-space: nowrap;
}

.chat-timeline {
  padding: 24px;
  overflow: auto;
  display: grid;
  gap: 16px;
}

.message-row {
  display: flex;
  animation: bubbleIn 260ms ease both;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(780px, 88%);
  padding: 14px 16px;
  border-radius: 20px;
  line-height: 1.6;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
}

.assistant .bubble {
  background: var(--assistant);
  border-bottom-left-radius: 7px;
}

.user .bubble {
  background: var(--user);
  border-bottom-right-radius: 7px;
}

.rich-bubble {
  display: grid;
  gap: 14px;
  background: linear-gradient(180deg, #fffefb 0%, #f5f1e8 100%);
}

.message-intro {
  margin: 0;
}

.summary-card {
  border-radius: var(--radius-lg);
  padding: 16px;
}

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

.summary-header h3 {
  margin: 0;
  font-size: 22px;
}

.summary-count {
  background: var(--accent-2);
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  white-space: nowrap;
}

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

.summary-row {
  background: var(--panel-soft);
  border-radius: 14px;
  padding: 12px 13px;
}

.summary-row dt,
.meta-row dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.summary-row dd,
.meta-row dd {
  margin: 0;
  font-weight: 700;
}

.warning-block {
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  background: linear-gradient(180deg, #fffaf1 0%, var(--warn-bg) 100%);
  border-color: var(--warn-line);
}

.warning-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--warm);
}

.warning-list {
  margin: 10px 0 0 20px;
  padding: 0;
  color: #7d5232;
  display: grid;
  gap: 8px;
}

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

.product-card {
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 12px;
  transition:
    transform var(--ease),
    box-shadow var(--ease),
    border-color var(--ease);
}

.product-card:hover {
  box-shadow: 0 18px 34px rgba(30, 41, 45, 0.12);
  border-color: rgba(15, 107, 82, 0.14);
}

.product-topline,
.product-badges,
.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-topline {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.product-name {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
}

.chip-badge {
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.chip-badge.is-warning {
  background: #fff0db;
  color: var(--warm);
}

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

.meta-row {
  background: rgba(15, 107, 82, 0.04);
  border-radius: 12px;
  padding: 11px 12px;
}

.inline-action {
  gap: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition:
    transform var(--ease),
    background var(--ease),
    border-color var(--ease);
}

.inline-action.is-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.inline-action:hover {
  border-color: var(--line-strong);
}

.inline-action.is-primary:hover {
  background: #0d5d48;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reply-panel {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--line);
  background: rgba(248, 245, 239, 0.94);
  backdrop-filter: blur(14px);
}

.reply-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.reply-label,
.reply-hint {
  margin: 0;
}

.reply-label {
  font-weight: 700;
}

.search-box {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #ffffff;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.search-box input:focus {
  outline: none;
  border-color: rgba(15, 107, 82, 0.25);
  box-shadow: 0 0 0 4px rgba(15, 107, 82, 0.08);
}

.reply-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reply-chip {
  gap: 8px;
  border: 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-3));
  color: var(--ink);
  border-radius: 18px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  min-width: min(320px, 100%);
  display: grid;
  align-items: start;
  transition:
    transform var(--ease),
    box-shadow var(--ease),
    background var(--ease);
  box-shadow: 0 8px 18px rgba(15, 107, 82, 0.08);
}

.reply-chip strong {
  font-size: 15px;
}

.reply-chip span {
  font-size: 13px;
  color: #4d6660;
}

.reply-chip:hover {
  background: linear-gradient(180deg, #d6eee5, #c5e7da);
  box-shadow: 0 16px 28px rgba(15, 107, 82, 0.12);
}

.empty-state {
  color: var(--muted);
  margin: 8px 0 0;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(30, 41, 45, 0.92);
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(30, 41, 45, 0.22);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity var(--ease), transform var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

  .chat-shell {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .chat-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .header-badge {
    margin-left: 0;
  }

  .summary-grid,
  .product-meta {
    grid-template-columns: 1fr;
  }

  .bubble {
    max-width: 100%;
  }

  .reply-panel,
  .chat-timeline,
  .chat-header,
  .sidebar {
    padding-left: 16px;
    padding-right: 16px;
  }
}
