:root {
  --navy: #1f3864;
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e1e0d9;
  --text: #1a1a1a;
  --muted: #6b6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header h1 {
  color: var(--navy);
  margin-bottom: 4px;
  font-size: 1.6rem;
}

header .sub {
  color: var(--muted);
  margin-top: 0;
  font-size: 0.9rem;
}

.chat-card, .insight-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}

.messages {
  height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px;
}

.msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.35;
}

.msg.user {
  align-self: flex-end;
  background: var(--navy);
  color: white;
}

.msg.bot {
  align-self: flex-start;
  background: #eef1f6;
  color: var(--text);
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chat-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.chat-form button {
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 0.95rem;
}

#toggle-insight {
  background: none;
  border: none;
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 0.95rem;
}

.insight-panel { margin-top: 12px; }
.insight-panel.hidden { display: none; }

.insight-explainer {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0;
}

#insight-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

#insight-table th, #insight-table td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

#insight-table th { color: var(--muted); font-weight: 600; }

.media-card {
  margin-bottom: 1.5rem;
}

.media-gallery {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.media-gallery figure {
  margin: 0;
  width: 160px;
}

.media-gallery img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.media-gallery figcaption {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}
