:root {
  color-scheme: light;
  --navy: #12324d;
  --blue: #1d6fbf;
  --ink: #1c2833;
  --muted: #5c6b7a;
  --line: #d5dee8;
  --page: #eef3f8;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

.app {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--card);
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(18, 50, 77, 0.08);
}

header {
  background: var(--navy);
  color: white;
  padding: 18px 20px 16px;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
}

header p {
  margin: 6px 0 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #d7e4f0;
}

#chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.bubble {
  max-width: min(100%, 640px);
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.row.bot .bubble {
  background: #f3f6fa;
  border: 1px solid var(--line);
  white-space: normal;
}

.row.user .bubble {
  background: #e5f1fb;
  color: var(--navy);
}

.card {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.card h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--navy);
}

.library, .iupac, .meta, .stock, .lead, .summary {
  margin: 6px 0 0;
}

.iupac { font-style: italic; }
.meta, .lead, .library { color: var(--muted); font-size: 0.92rem; }
.stock { font-weight: 650; }

.prices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 16px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.actions a, #contact a {
  color: var(--blue);
}

.actions a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #b9d3ea;
  border-radius: 999px;
  background: #f7fbfe;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.actions a:hover { background: #e7f3fb; }

#composer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

#query {
  flex: 1;
  min-width: 0;
  border: 1px solid #b7c6d6;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
}

#query:focus {
  outline: 2px solid #9cc6e8;
  border-color: var(--blue);
}

#search {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--blue);
  color: white;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

#search:disabled, #query:disabled { opacity: 0.55; cursor: not-allowed; }

#contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: #f7fafc;
  color: var(--muted);
  font-size: 0.86rem;
  font-style: normal;
  line-height: 1.35;
}

.contact-name {
  color: var(--navy);
  font-weight: 700;
}

@media (min-width: 800px) {
  body { padding: 24px 0; }
  .app {
    min-height: calc(100vh - 48px);
    border-radius: 18px;
    overflow: hidden;
  }
}
