:root {
  --bg: #101214;
  --surface: #1a1d21;
  --surface-2: #22262b;
  --border: #30353c;
  --text: #e8eaed;
  --text-dim: #9aa0a8;
  --accent: #e10600;
  --accent-soft: #ff4b45;
  --radius: 12px;
  --maxw: 860px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px solid var(--accent);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  font-weight: 800;
  letter-spacing: 1.5px;
  font-style: italic;
  color: var(--text);
}
.brand-sub {
  color: var(--accent-soft);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 2px;
}
.topbar-link { color: var(--text-dim); text-decoration: none; font-size: 14px; }
.topbar-link:hover { color: var(--text); }

.chat {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg { display: flex; }
.msg-body {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius);
  overflow-wrap: break-word;
}
.msg.user { justify-content: flex-end; }
.msg.user .msg-body {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.agent .msg-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-body p { margin: 0 0 10px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body a { color: var(--accent-soft); }
.msg-body ul, .msg-body ol { margin: 0 0 10px; padding-left: 22px; }
.msg-body code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 14px;
}
.msg-body h1, .msg-body h2, .msg-body h3 { font-size: 1.05em; margin: 12px 0 6px; }
.hint { color: var(--text-dim); font-size: 14px; }

.typing { color: var(--text-dim); }
.typing::after { content: "…"; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* Product cards */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 85%;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}
.product-card:hover { border-color: var(--accent-soft); }
.product-card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; }
.product-card .pc-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.pc-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.pc-meta { display: flex; justify-content: space-between; align-items: center; }
.pc-price { color: var(--accent-soft); font-weight: 700; }
.pc-stock { font-size: 12px; color: #4caf50; }
.pc-stock.out { color: var(--text-dim); }

.composer {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 16px 4px;
}
.composer textarea {
  flex: 1;
  resize: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  max-height: 140px;
}
.composer textarea:focus { outline: none; border-color: var(--accent-soft); }
.composer button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.composer button:hover { background: var(--accent-soft); }
.composer button:disabled { opacity: 0.5; cursor: default; }

.disclaimer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin: 6px auto 12px;
  max-width: var(--maxw);
  padding: 0 16px;
}

/* Email gate */
.gate {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 12, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.gate.hidden { display: none; }
.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 420px;
  width: 100%;
}
.gate-card h2 { margin: 0 0 8px; }
.gate-card p { color: var(--text-dim); margin: 0 0 18px; font-size: 15px; }
.gate-card form { display: flex; flex-direction: column; gap: 10px; }
.gate-card input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}
.gate-card input:focus { outline: none; border-color: var(--accent-soft); }
.gate-card button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.gate-card button:hover { background: var(--accent-soft); }

@media (max-width: 600px) {
  .msg-body, .products { max-width: 100%; }
}
