/* ALPHA GAL design system — bold, warm, zero pity */
:root {
  --ink: #221727;
  --ink-soft: #5c4a63;
  --cream: #faf4ec;
  --paper: #ffffff;
  --berry: #c62368;
  --berry-dark: #9c1a52;
  --berry-soft: #fbe3ee;
  --gold: #e8a33d;
  --gold-soft: #fdf1dd;
  --green: #2e8b57;
  --green-soft: #e3f2e9;
  --red: #c0392b;
  --red-soft: #fae4e1;
  --amber: #b97a1a;
  --border: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --radius: 14px;
  --font-display: 'Archivo Black', sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
}

h1, h2, h3, .display { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
a { color: var(--berry); }
p { margin-bottom: 0.6em; }
small, .muted { color: var(--ink-soft); }

/* ---------- shells ---------- */
.wrap { max-width: 680px; margin: 0 auto; padding: 16px; }
.wrap-wide { max-width: 1000px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card.flat { box-shadow: none; }
.card.berry { background: var(--berry); color: #fff; }
.card.berry .muted { color: #f7cfe0; }
.card.gold { background: var(--gold-soft); }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  background: var(--berry); color: #fff; border: var(--border); box-shadow: var(--shadow-sm);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 1.25rem;
}
.brand .word { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: 0.01em; }
.brand .word em { color: var(--berry); font-style: normal; }
.tagline { color: var(--ink-soft); font-size: 0.85rem; }

/* ---------- buttons & inputs ---------- */
button, .btn {
  font-family: var(--font-body); font-weight: 700; font-size: 1rem;
  border: var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
  background: var(--paper); color: var(--ink);
  padding: 12px 18px; cursor: pointer; text-decoration: none; display: inline-block;
  transition: transform 0.05s ease;
}
button:active, .btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn-primary { background: var(--berry); color: #fff; }
.btn-gold { background: var(--gold); }
.btn-ghost { box-shadow: none; border-color: transparent; background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { display: block; width: 100%; text-align: center; }
button:disabled { opacity: 0.5; cursor: wait; }

input, select, textarea {
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  width: 100%; padding: 11px 12px; border: var(--border); border-radius: 10px;
  background: var(--paper); margin-bottom: 10px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--berry-soft); }
label { font-weight: 700; font-size: 0.85rem; display: block; margin-bottom: 4px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- chips, pills, badges ---------- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; border: 1.5px solid var(--ink);
}
.pill.safe { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.pill.caution { background: var(--gold-soft); color: var(--amber); border-color: var(--amber); }
.pill.avoid { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.pill.neutral { background: var(--cream); color: var(--ink-soft); border-color: var(--ink-soft); }
.pill.berry { background: var(--berry-soft); color: var(--berry-dark); border-color: var(--berry-dark); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--ink); background: var(--paper); border-radius: 999px;
  padding: 7px 13px; font-size: 0.85rem; font-weight: 600; cursor: pointer; box-shadow: none;
}
.chip.active, .chip:hover { background: var(--berry); color: #fff; border-color: var(--ink); }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--paper); border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 12px; text-align: center;
}
.stat .num { font-family: var(--font-display); font-size: 1.6rem; color: var(--berry); }
.stat .lbl { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }

/* ---------- nav ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; background: var(--cream);
  border-bottom: var(--border); padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--paper); border-top: var(--border);
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav button {
  flex: 1; border: none; box-shadow: none; background: none; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 0.66rem; font-weight: 700; padding: 6px 2px; color: var(--ink-soft);
}
.bottom-nav button .ico { font-size: 1.3rem; line-height: 1; }
.bottom-nav button.active { color: var(--berry); background: var(--berry-soft); }
main.has-nav { padding-bottom: 86px; }

/* ---------- lists ---------- */
.entry { border-bottom: 1.5px dashed #e3d5c8; padding: 10px 0; }
.entry:last-child { border-bottom: none; }
.entry .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.entry .title { font-weight: 700; }
.stars { color: var(--gold); letter-spacing: 2px; font-size: 1.05rem; }
.stars .off { color: #ddd0c2; }

/* ---------- chat ---------- */
.chat-box { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 11px 14px; border-radius: 14px; border: var(--border); white-space: pre-wrap; overflow-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--berry); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--paper); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.msg.ai .thinking { color: var(--ink-soft); font-style: italic; }
.chat-input { position: sticky; bottom: 86px; display: flex; gap: 8px; background: var(--cream); padding-top: 8px; }
.chat-input textarea { flex: 1; margin: 0; resize: none; height: 52px; }
.chat-input button { flex: 0 0 auto; }

/* ---------- misc ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 4px; }
.tabs .chip { white-space: nowrap; }
.hidden { display: none !important; }
.divider { border: none; border-top: var(--border); margin: 18px 0; }
.center { text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px;
  font-weight: 700; z-index: 90; box-shadow: var(--shadow-sm); max-width: 90vw; text-align: center;
}
.hero-num { font-family: var(--font-display); font-size: 2.6rem; }
.accordion h3 { cursor: pointer; padding: 12px 0; display: flex; justify-content: space-between; align-items: center; }
.accordion h3::after { content: '+'; color: var(--berry); font-size: 1.3rem; }
.accordion .open h3::after { content: '\2212'; }
.accordion .body { display: none; padding-bottom: 12px; }
.accordion .open .body { display: block; }
.accordion > div { border-bottom: 1.5px dashed #e3d5c8; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1.5px solid #eee2d4; vertical-align: top; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.scroll-x { overflow-x: auto; }

.fab {
  position: fixed; right: 16px; bottom: 96px; z-index: 45;
  width: 58px; height: 58px; border-radius: 50%; font-size: 1.7rem;
  background: var(--gold); border: var(--border); box-shadow: var(--shadow);
  display: grid; place-items: center;
}

/* landing */
.landing-hero { padding: 42px 0 20px; }
.landing-hero h1 { font-size: 2.35rem; margin-bottom: 10px; }
.landing-hero h1 .berry { color: var(--berry); }
.landing-hero .sub { font-size: 1.05rem; color: var(--ink-soft); max-width: 32ch; }
.feature-ico { font-size: 1.6rem; }

/* print (emergency + chef cards) */
.print-card { background: var(--paper); border: var(--border); border-radius: var(--radius); padding: 18px; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .print-card { box-shadow: none; page-break-inside: avoid; margin-bottom: 20px; }
}

@media (min-width: 720px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .landing-hero h1 { font-size: 3.2rem; }
}
