/* pepmg app — self-contained styles. Does not share anything with pepmg.com's site CSS on purpose. */

:root {
  --bg: #f2f5f4;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #14201d;
  --text-dim: #55635e;
  --border: #d9e1de;
  --accent: #0f6f5c;
  --accent-contrast: #ffffff;
  --danger: #a8271d;
  --danger-contrast: #ffffff;
  --warn-bg: #fdf3e0;
  --warn-text: #7a4b06;
  --focus-ring: #0f6f5c;
  --radius: 12px;
  --radius-sm: 8px;
  --tabbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412;
    --surface: #141d1a;
    --surface-raised: #182421;
    --text: #e8efec;
    --text-dim: #9fb0aa;
    --border: #263531;
    --accent: #39b79d;
    --accent-contrast: #06110f;
    --danger: #ff7a6e;
    --danger-contrast: #200604;
    --warn-bg: #2a2007;
    --warn-text: #f0c778;
    --focus-ring: #39b79d;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--accent);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.app-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}

.app-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 32px);
}

/* Signed-out view */

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
}

.auth-card p {
  color: var(--text-dim);
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.field .hint {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
}

input[type="email"],
input[type="text"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-contrast);
}

.btn-block + .btn-block {
  margin-top: 10px;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 1em;
}

.dev-link-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* Cards / sections */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.journey-card{padding:18px;border:1px solid var(--border);border-radius:14px;background:linear-gradient(145deg,var(--surface),var(--surface-raised));box-shadow:0 10px 28px rgba(15,60,51,.07)}
.journey-kicker{margin-bottom:7px;color:var(--accent);font-size:10px;font-weight:800;letter-spacing:.12em;text-transform:uppercase}
.journey-card h3{margin:0 0 7px;font-size:18px;line-height:1.25}.journey-card>p{margin:0 0 14px;color:var(--text-dim);font-size:12px;line-height:1.5}
.journey-steps{display:grid;gap:7px}.journey-step{width:100%;padding:10px 11px;display:grid;grid-template-columns:25px 1fr auto;align-items:center;gap:10px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);text-align:left;cursor:pointer}
.journey-step:hover{border-color:var(--accent);transform:translateY(-1px)}.journey-step>span{width:24px;height:24px;display:grid;place-items:center;border-radius:8px;background:rgba(15,111,92,.1);color:var(--accent);font-size:10px;font-weight:800}.journey-step>div{display:grid;gap:2px}.journey-step b{font-size:12px}.journey-step small{color:var(--text-dim);font-size:10px;line-height:1.3}.journey-step i{color:var(--accent);font-style:normal}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 20px 0 8px;
}

/* Shot list */

.shot-day-group {
  margin-bottom: 18px;
}

.shot-day-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.shot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.shot-row .shot-main {
  min-width: 0;
}

.shot-row .shot-compound {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.shot-row .shot-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.shot-row .shot-notes {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.icon-btn {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* Calculator */

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.calc-row:last-child {
  border-bottom: none;
}

.calc-row .calc-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.calc-warning {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
}

/* Paywall */

.paywall-card {
  border: 1px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.paywall-card p {
  color: var(--text-dim);
  font-size: 14px;
}

/* "Your log always stays readable, exportable and deletable" — quieter than the price, but it is
   the line that makes the price honest, so it stays visible rather than tucked into a tooltip. */
.paywall-card .hint {
  font-size: 12px;
  margin-bottom: 14px;
}

.paywall-card .form-error:empty {
  display: none;
}

/* Disclaimer */

.disclaimer {
  margin-top: 24px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

/* Account */

.account-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.account-row:last-child {
  border-bottom: none;
}

.account-row .account-value {
  color: var(--text-dim);
  text-align: right;
}

/* Bottom tab bar */

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabbar-h);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn[aria-selected="true"] {
  color: var(--accent);
}

.tab-panel[hidden] {
  display: none;
}

[hidden] {
  display: none !important;
}

.noscript-banner {
  padding: 12px 16px;
  background: var(--warn-bg);
  color: var(--warn-text);
  text-align: center;
  font-size: 14px;
}

/* Signed-out conversion surface */

.hero {
  padding: 4px 0 18px;
}

.hero-headline {
  margin: 8px 0 8px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
}

.invite-details {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.invite-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-height: 32px;
  display: flex;
  align-items: center;
}

.invite-details .field {
  margin-top: 12px;
  margin-bottom: 0;
}

.beta-status {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.seat-line {
  font-size: 14px;
  font-weight: 600;
}

.seat-bar {
  height: 6px;
  margin: 10px 0 14px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.seat-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.waitlist-cta p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.social-proof {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  text-align: center;
}

/* Invites card */

.invite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.invite-row:last-child {
  border-bottom: none;
}

.invite-row-spent {
  opacity: 0.55;
}

.invite-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.invite-status,
.invite-feedback {
  font-size: 12px;
  color: var(--text-dim);
}

.invite-row .btn {
  flex-shrink: 0;
  margin: 0;
  min-height: 40px;
  padding: 8px 14px;
}

.beta-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Schedule tab */

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

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

.weekday {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

/* :has keeps the checked state on the label without a change listener; browsers without it still
   show a perfectly usable checkbox, so this is decoration only. */
.weekday:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
}

.schedule-card,
.vial-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.schedule-card-paused,
.vial-card-done {
  opacity: 0.65;
}

.schedule-head,
.vial-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.schedule-compound,
.vial-compound {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.schedule-cadence,
.vial-status {
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
  text-align: right;
}

.schedule-next {
  margin-top: 6px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
}

.schedule-meta,
.vial-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
  overflow-wrap: anywhere;
}

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

.vial-actions .btn {
  flex: 1;
  min-width: 120px;
  margin: 0;
}

/* Vials */

.vial-bar {
  height: 6px;
  margin-top: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.vial-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* Spend view */

.spend-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}

.spend-total-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.spend-total-unit {
  font-size: 13px;
  color: var(--text-dim);
}

@media (min-width: 480px) {
  .calc-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Chat tab
 *
 * Mobile-first, and laid out so the composer stays reachable with a thumb: the stream scrolls, the
 * composer and chips sit under it, and both clear the fixed tab bar. Assistant turns are plain on
 * the page rather than in bubbles — most of what arrives is a tutorial step or a table of figures,
 * and a chat bubble is a bad container for either. Only the user's own words get a bubble.
 */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 8px;
}

.chat-msg p {
  margin: 0 0 8px;
}

.chat-msg p:last-child {
  margin-bottom: 0;
}

.chat-msg-you {
  align-self: flex-end;
  max-width: 85%;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 14px;
  border-radius: var(--radius);
  border-bottom-right-radius: var(--radius-sm);
}

.chat-msg-pepmg {
  align-self: stretch;
}

.chat-thinking {
  color: var(--text-dim);
  letter-spacing: 3px;
}

.chat-notice {
  background: var(--warn-bg);
  color: var(--warn-text);
  padding: 12px 14px;
  border-radius: var(--radius);
}

/* A tutorial step. Set apart from ordinary prose because it is quoted, reviewed content rather
 * than something the assistant said. */

.chat-step {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
}

.chat-step-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.chat-step-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.chat-redflags {
  margin-top: 12px;
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.chat-redflags-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.chat-redflags ul,
.chat-sources ul {
  margin: 0;
  padding-left: 18px;
}

.chat-redflags li {
  margin-bottom: 4px;
}

.chat-sources {
  font-size: 13px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.chat-sources-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.chat-sources li {
  margin-bottom: 6px;
}

.chat-sources a {
  color: var(--accent);
}

.chat-source-pub {
  color: var(--text-dim);
}

.chat-calc {
  display: grid;
  gap: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.chat-calc-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.chat-offer {
  background: var(--surface-raised);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.chat-offer p {
  margin: 0 0 10px;
  font-size: 14px;
}

/* Suggested follow-ups. Horizontally scrollable so a long set never wraps into a wall of buttons. */

.chat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
}

.chat-chips::-webkit-scrollbar {
  display: none;
}

.chat-chip {
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.chat-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-composer textarea {
  flex: 1;
  resize: none;
  min-height: 52px;
  max-height: 140px;
  font: inherit;
}

.chat-composer .btn {
  width: auto;
  flex: 0 0 auto;
}

.chat-mic-hint {
  margin-top: 8px;
}

/* ---------------------------------------------------------------------------------------------
 * The chat, part two: threads, and the cards pepmg's research index answers with.
 *
 * The thread rail is a DRAWER on a phone and a fixed RAIL from 1000px up, where there is room for
 * it beside the 640px column. It is scoped to the chat tab (`body[data-tab="chat"]`) because a list
 * of conversations sitting next to the Vials form would be furniture with no purpose.
 */

.chat-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.chat-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* A small pill control in the chat's own chrome. Deliberately NOT `.icon-btn`, which is already the
 * destructive 44px square the Log and Vials rows use — reusing that name here recoloured every
 * delete button in the app and rounded it into something else. */
.chat-pill {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chat-pill:hover {
  color: var(--text);
  border-color: var(--accent);
}

.chat-sidebar {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  /* The tab bar is fixed over the bottom of the viewport, and the rail runs the full height, so the
   * last thing in it has to clear the bar or it is unreadable. */
  padding: 16px 16px calc(var(--tabbar-h) + 16px);
}

.chat-sidebar.open {
  display: flex;
  position: fixed;
  inset: 0 auto 0 0;
  width: min(300px, 84vw);
  z-index: 20;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
}

.chat-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 15;
}

.chat-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.chat-sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.conversation-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-sm);
}

.conversation-row:hover,
.conversation-row-active {
  background: var(--bg);
}

.conversation-open {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 9px 10px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-row-active .conversation-open {
  font-weight: 600;
  color: var(--accent);
}

/* Quiet, but always there. Hiding it until hover would put it out of reach on every touch device,
 * and behind a guess on every other one. */
.conversation-delete {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px;
  cursor: pointer;
  opacity: 0.55;
}

.conversation-row:hover .conversation-delete,
.conversation-delete:hover,
.conversation-delete:focus-visible {
  opacity: 1;
  color: var(--danger);
}

@media (min-width: 1000px) {
  body[data-tab="chat"] .chat-sidebar {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    overflow-y: auto;
    /* Above the sticky app header (z-index 5), which spans the full width and would otherwise be
     * painted over the top of the rail — hiding its heading and the New chat button. */
    z-index: 6;
  }

  body[data-tab="chat"] .chat-sidebar-head .chat-pill,
  body[data-tab="chat"] #btn-open-chats {
    display: none;
  }

  /* The rail is fixed, so the column has to be pushed clear of it — and its max-width grown by the
   * same amount, because `box-sizing: border-box` counts that padding INSIDE the 640px and would
   * otherwise squeeze the reading column down to ~330px on the widest screens. */
  body[data-tab="chat"] .app-main,
  body[data-tab="chat"] .app-header {
    padding-left: 296px;
  }

  body[data-tab="chat"] .app-main {
    max-width: 936px;
  }
}

/* The three dots while an answer is in flight. Motion is dropped entirely for anyone who asked for
 * less of it — the indicator still says something is happening, it just stops moving. */
.chat-thinking {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 6px 0;
}

.chat-thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: 0.35;
  animation: chat-dot 1.2s ease-in-out infinite;
}

.chat-thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-thinking-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes chat-dot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .chat-thinking-dot {
    animation: none;
    opacity: 0.5;
  }
}

/* Answers from the research index. A card, so a table of live prices or a sourced dose reads as a
 * record with provenance rather than as something the assistant said. */

.chat-engine-prose p {
  margin: 0 0 10px;
}

.chat-engine-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.chat-engine-link {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.chat-engine-link:hover {
  text-decoration: underline;
}

.chat-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-card-title {
  font-size: 15px;
  font-weight: 700;
}

.chat-card-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: -8px;
}

.chat-price-rows {
  display: flex;
  flex-direction: column;
}

.chat-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.chat-price-row:first-child {
  border-top: 0;
}

.chat-price-vendor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
}

.chat-price-figures {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-price-detail {
  font-size: 12px;
  color: var(--text-dim);
}

.chat-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}

.chat-tag-best {
  color: var(--accent);
  border-color: var(--accent);
}

.chat-tag-quiet {
  opacity: 0.75;
}

/* The dose card. The tier chip, the population and the source are laid out WITH the figure because
 * a published dose is only allowed on this surface while it travels with its provenance. */

.chat-dose {
  border-left: 3px solid var(--accent);
}

.chat-dose-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.chat-dose-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.chat-dose-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.chat-dose-tier {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
}

.chat-dose-figure {
  font-size: 16px;
}

.chat-dose-basis,
.chat-dose-meta {
  font-size: 13px;
  color: var(--text-dim);
}

.chat-dose-source {
  font-size: 12px;
}

.chat-dose-disclaimer {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.chat-study-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-study-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.chat-engine-note,
.chat-engine-receipt {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

/* The inline "save as regimen" form. Same defaults as the Schedule tab's own form — and, like it,
 * no default for the AMOUNT, which is only ever the number the reader gave. */

.chat-offer-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.chat-offer-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

.chat-offer-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.chat-offer-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-offer-weekday {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.chat-offer-done {
  margin: 0;
  font-weight: 600;
}
