/* ══════════════════════════════════════════════════════════════════
   Sahaj Swasthya — design system
   Warm + Safe + Friendly + Trustworthy (requirement #41)

   Deliberately plain CSS: no framework, no build step, ~20 KB before gzip.
   Low-bandwidth design (requirement #42) and strong accessibility (#37).
   ══════════════════════════════════════════════════════════════════ */

:root {
  /* palette */
  --lavender: #6d4aa6;
  --lavender-soft: #efe8fb;
  --lavender-line: #d9cbf3;

  --pink: #e2557f;
  --pink-soft: #fdeaf1;
  --pink-line: #f8cddc;

  --peach: #f28b50;
  --peach-soft: #fdf0e7;

  --green: #2f8f5b;
  --green-soft: #e8f6ee;

  --sky: #2b7fb8;
  --sky-soft: #e7f2fa;

  --amber: #b8791a;
  --amber-soft: #fdf3e2;

  --red: #c62828;
  --red-soft: #fdecec;

  --ink: #1f1930;
  --ink-2: #4a4360;
  --ink-3: #6d6684;
  --paper: #ffffff;
  --paper-2: #fbf9fe;
  --line: #e7e2f0;

  /* metrics */
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(31, 25, 48, 0.06);
  --shadow: 0 4px 16px rgba(31, 25, 48, 0.08);
  --shadow-lg: 0 12px 32px rgba(31, 25, 48, 0.12);
  --maxw: 1240px;
  --touch: 48px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Devanagari',
    'Noto Sans Bengali', 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper-2);
  /* leave room for the sticky mobile bottom bar */
  padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  overflow-wrap: break-word;
}

img, svg, iframe { max-width: 100%; }
svg { width: 1.15em; height: 1.15em; }

a { color: var(--lavender); text-underline-offset: 3px; }
a:hover { color: var(--pink); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + 1vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.85em; }

/* ── accessibility helpers (requirement #37) ───────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--lavender); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--lavender);
  outline-offset: 2px;
  border-radius: 6px;
}

/* honour reduced-motion (requirement #37) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* high contrast + larger text support */
@media (prefers-contrast: more) {
  :root { --ink-2: #2a2440; --ink-3: #3b3550; --line: #b9b1cd; }
}

/* ══ BUTTONS & INPUTS ═══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--touch); padding: 0.6rem 1.15rem;
  font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  border: 2px solid transparent; border-radius: 999px; cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  background: var(--paper); color: var(--ink);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--lavender); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: #5c3c92; color: #fff; }
.btn--secondary { background: var(--lavender-soft); color: #4a3178; border-color: var(--lavender-line); }
.btn--secondary:hover { background: #e5daf8; color: #3d2765; }
.btn--outline { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn--outline:hover { border-color: var(--lavender); color: var(--lavender); }
.btn--ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn--ghost:hover { background: var(--lavender-soft); color: var(--lavender); }
.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover { background: #a71f1f; color: #fff; }
.btn--lg { min-height: 56px; padding: 0.85rem 1.6rem; font-size: 1.06rem; }
.btn--sm { min-height: 40px; padding: 0.4rem 0.85rem; font-size: 0.92rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.input {
  width: 100%; min-height: var(--touch);
  padding: 0.6rem 0.9rem; font: inherit; color: var(--ink);
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius-sm);
}
.input:focus { border-color: var(--lavender); outline: none; box-shadow: 0 0 0 3px var(--lavender-soft); }
.textarea { min-height: 96px; resize: vertical; }

.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; min-width: 0; }
.field label { font-weight: 600; font-size: 0.95rem; color: var(--ink-2); }
.field__hint { margin: 0; font-size: 0.85rem; color: var(--ink-3); }
.field-row { display: grid; gap: 0.9rem; grid-template-columns: 1fr; }
.fieldset { border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 0.8rem 1rem; margin: 0 0 0.9rem; }
.fieldset legend { font-weight: 600; color: var(--ink-2); padding: 0 0.4rem; font-size: 0.95rem; }
.check, .radio { display: flex; align-items: flex-start; gap: 0.6rem; min-height: 40px; padding: 0.3rem 0; cursor: pointer; }
.check input, .radio input { width: 22px; height: 22px; margin: 0.15rem 0 0; accent-color: var(--lavender); flex: none; }
.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

@media (min-width: 600px) {
  .field-row { grid-template-columns: 1fr 1fr; }
}

/* ══ HEADER ═════════════════════════════════════════════════════ */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0.6rem 1rem; display: flex; align-items: center; gap: 0.75rem;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); min-width: 0; }
.brand__mark { font-size: 1.6rem; line-height: 1; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name { font-weight: 800; color: var(--lavender); font-size: 1.05rem; }
.brand__tag { font-size: 0.72rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-header__actions { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.header-emergency {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--red-soft); color: var(--red); font-weight: 700;
  text-decoration: none; padding: 0.45rem 0.7rem; border-radius: 999px;
  border: 2px solid #f2c4c4; min-height: 40px;
}
.header-emergency:hover { background: #fbdcdc; color: var(--red); }
.header-emergency__label { display: none; }

.lang-select { display: flex; align-items: center; gap: 0.25rem; }
.lang-select__select {
  font: inherit; font-size: 0.9rem; font-weight: 600; padding: 0.35rem 0.5rem;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink-2); min-height: 40px;
}
.lang-select__go { display: none; }

@media (min-width: 560px) { .header-emergency__label { display: inline; } }
@media (max-width: 480px) { .brand__tag { display: none; } }

/* ══ LAYOUT SHELL ═══════════════════════════════════════════════ */
.shell {
  max-width: var(--maxw); margin: 0 auto; padding: 1rem;
  display: grid; gap: 1.25rem; grid-template-columns: 1fr;
}
.main { min-width: 0; }
.page { display: flex; flex-direction: column; gap: 1.25rem; }
.leftnav, .sidebar { display: none; } /* mobile first: hidden */

/* ── left navigation (desktop) ─────────────────────────────────── */
.leftnav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.leftnav__link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.7rem 0.8rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-2); font-weight: 600; min-height: var(--touch);
}
.leftnav__link:hover { background: var(--lavender-soft); color: var(--lavender); }
.leftnav__link.is-active { background: var(--lavender); color: #fff; box-shadow: var(--shadow-sm); }
.leftnav__icon { font-size: 1.25rem; width: 1.5rem; text-align: center; }
.leftnav__foot {
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.1rem;
}

/* ── right sidebar (desktop) ──────────────────────────────────── */
.sidebar { flex-direction: column; gap: 1rem; }
.sidebar__card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem; }
.sidebar__card--warn { border-color: var(--red); background: #fffafa; }
.sidebar__card--quiet { background: var(--paper-2); }
.sidebar__title { font-size: 1rem; margin: 0 0 0.6rem; display: flex; align-items: center; gap: 0.4rem; }

@media (min-width: 1024px) {
  body { padding-bottom: 0; }
  .shell {
    grid-template-columns: 232px minmax(0, 1fr) 320px;
    align-items: start;
    padding: 1.5rem 1rem 2.5rem;
  }
  .leftnav { display: block; position: sticky; top: 84px; }
  .sidebar { display: flex; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
  .bottomnav { display: none; }
  .mobile-emergency { display: none; }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .shell { grid-template-columns: 200px minmax(0, 1fr) 280px; }
}

/* wide mode (/ask) has no sidebar */
.layout--wide .shell { grid-template-columns: 1fr; }
@media (min-width: 1024px) {
  .layout--wide .shell { grid-template-columns: 232px minmax(0, 900px); justify-content: center; }
}

/* ══ MOBILE BOTTOM NAVIGATION (requirement #50) ═════════════════ */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(31, 25, 48, 0.06);
}
.bottomnav__link {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.1rem; padding: 0.5rem 0.2rem; min-height: 60px;
  text-decoration: none; color: var(--ink-3); font-size: 0.72rem; font-weight: 600;
}
.bottomnav__link.is-active { color: var(--lavender); }
.bottomnav__link.is-active .bottomnav__icon { transform: translateY(-1px) scale(1.1); }
.bottomnav__icon { font-size: 1.35rem; line-height: 1; transition: transform 0.15s ease; }

/* ══ HERO ═══════════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(160deg, var(--lavender-soft) 0%, var(--pink-soft) 55%, var(--peach-soft) 100%);
  border-radius: var(--radius-lg); padding: 1.5rem 1.1rem 1.75rem; text-align: center;
}
.hero__eyebrow { margin: 0 0 0.4rem; font-weight: 800; color: var(--lavender); letter-spacing: 0.02em; }
.hero__title { margin: 0 0 0.5rem; }
.hero__sub { color: var(--ink-2); margin: 0 auto 1.25rem; max-width: 34ch; }
.hero__ask {
  background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg); padding: 1.25rem 1rem; box-shadow: var(--shadow); max-width: 560px; margin: 0 auto;
}
.hero__ask-title { font-size: 1.3rem; margin: 0 0 1rem; color: var(--ink); }
.hero__hint { font-size: 0.9rem; color: var(--ink-3); margin: 0.75rem 0 0; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-top: 1.1rem; }
.hero__promise {
  margin: 1.25rem auto 0; max-width: 52ch; font-size: 0.9rem; color: var(--ink-2);
  background: rgba(255, 255, 255, 0.6); padding: 0.7rem 0.9rem; border-radius: var(--radius-sm);
}

/* ══ MICROPHONE BUTTON (the centrepiece) ════════════════════════ */
.mic-btn {
  position: relative; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.4rem;
  border: none; cursor: pointer; text-decoration: none;
  background: linear-gradient(150deg, var(--lavender), var(--pink));
  color: #fff; border-radius: 50%;
  box-shadow: 0 10px 30px rgba(109, 74, 166, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mic-btn:hover { transform: scale(1.04); box-shadow: 0 14px 38px rgba(226, 85, 127, 0.4); }
.mic-btn:active { transform: scale(0.98); }
.mic-btn--hero { width: 168px; height: 168px; margin: 0 auto; }
.mic-btn--ask { width: 196px; height: 196px; margin: 0 auto; }
.mic-btn__glyph { font-size: 3.2rem; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25)); }
.mic-btn--ask .mic-btn__glyph { font-size: 3.8rem; }
.mic-btn__label { font-size: 0.76rem; font-weight: 700; padding: 0 0.9rem; line-height: 1.25; }

/* pulsing rings */
.mic-btn__ring {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.55);
  animation: mic-pulse 2.4s ease-out infinite;
}
.mic-btn__ring--2 { inset: -20px; animation-delay: 0.8s; }
@keyframes mic-pulse {
  0%   { transform: scale(0.9); opacity: 0.75; }
  70%  { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1.2); opacity: 0; }
}
/* only pulse while waiting for input */
.ask__stage[data-state='thinking'] .mic-btn__ring { animation-duration: 1.1s; }

/* ══ ASK / VOICE ASSISTANT ═════════════════════════════════════ */
.ask { display: flex; flex-direction: column; gap: 1.1rem; }
.ask__head { text-align: center; }
.ask__title { margin: 0 0 0.3rem; }
.ask__note { color: var(--ink-3); font-size: 0.9rem; margin: 0; }
.ask__stage {
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  padding: 1.5rem 1rem; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.ask__status { font-weight: 700; color: var(--lavender); margin: 0; text-align: center; }
.ask__stage[data-state='listening'] .ask__status { color: var(--pink); }
.ask__stage[data-state='listening'] .mic-btn { background: linear-gradient(150deg, var(--pink), var(--peach)); }

/* waveform */
.wave { display: none; align-items: flex-end; gap: 4px; height: 34px; }
.wave span { display: block; width: 5px; height: 8px; border-radius: 3px; background: var(--pink); animation: wave 1s ease-in-out infinite; }
.wave span:nth-child(2) { animation-delay: 0.12s; }
.wave span:nth-child(3) { animation-delay: 0.24s; }
.wave span:nth-child(4) { animation-delay: 0.36s; }
.wave span:nth-child(5) { animation-delay: 0.48s; }
.ask__stage[data-state='listening'] .wave { display: flex; }
@keyframes wave { 0%,100% { height: 8px; } 50% { height: 30px; } }

.ask__log { display: flex; flex-direction: column; gap: 0.75rem; }
.msg { border-radius: var(--radius); padding: 0.9rem 1rem; border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow-sm); }
.msg--user { background: var(--lavender-soft); border-color: var(--lavender-line); }
.msg--assistant { background: var(--paper); }
.msg--emergency { background: var(--red-soft); border-color: var(--red); border-width: 2px; }
.msg__role { display: block; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin-bottom: 0.3rem; }
.msg__text { margin: 0; white-space: pre-wrap; }
.msg__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-top: 0.6rem; }
.msg--pending .msg__text::after { content: ' ▍'; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.ask__text { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.9rem; }
.ask__text-summary { cursor: pointer; font-weight: 700; color: var(--lavender); min-height: 40px; display: flex; align-items: center; }
.ask__form { margin-top: 0.7rem; }
.ask__form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.playback {
  display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0.75rem;
  background: var(--lavender-soft); border-radius: var(--radius); border: 1px solid var(--lavender-line);
}
.playback[hidden] { display: none; }

.ask__emergency {
  background: var(--red-soft); border: 3px solid var(--red); border-radius: var(--radius);
  padding: 1rem; text-align: center;
}
.ask__emergency[hidden] { display: none; }
.ask__emergency-title { color: var(--red); margin: 0 0 0.8rem; }
.ask__emergency-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.ask__disclaimer { font-size: 0.88rem; color: var(--ink-3); background: var(--amber-soft); padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); margin: 0; }
.ask__history-note { font-size: 0.85rem; color: var(--ink-3); margin: 0; text-align: center; }

/* ══ SPEAK BUTTON ═══════════════════════════════════════════════ */
.speak-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 40px; padding: 0.35rem 0.8rem;
  font: inherit; font-size: 0.9rem; font-weight: 600;
  background: var(--sky-soft); color: #1c6288;
  border: 1px solid #bfdcee; border-radius: 999px; cursor: pointer;
}
.speak-btn:hover { background: #d8eaf6; }
.speak-btn.is-speaking { background: var(--sky); color: #fff; border-color: var(--sky); }
.speak-btn--compact { padding: 0.3rem 0.5rem; min-height: 36px; }
.speak-btn__icon { width: 1.05em; height: 1.05em; }

/* ══ CARDS / BLOCKS ═════════════════════════════════════════════ */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm);
}
.card--danger { border-color: #f0bcbc; background: #fffcfc; }
.card--safety { border-color: var(--amber); background: var(--amber-soft); }
.block { display: flex; flex-direction: column; gap: 0.8rem; }
.block__head { display: flex; flex-direction: column; gap: 0.15rem; }
.block__title { margin: 0; display: flex; align-items: center; gap: 0.4rem; }
.block__sub { margin: 0; color: var(--ink-3); font-size: 0.92rem; }

.page-header { display: flex; flex-direction: column; gap: 0.3rem; }
.page-header__title { margin: 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.page-header__icon { font-size: 1.2em; }
.page-header__sub { margin: 0; color: var(--ink-2); max-width: 68ch; }

.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.content-block { display: flex; flex-direction: column; gap: 0.5rem; }
.content-block__title { margin: 0; }
.content-block__body { margin: 0; white-space: pre-wrap; }

/* ══ TILE / CATEGORY GRIDS ═════════════════════════════════════ */
.tile-grid { display: grid; gap: 0.7rem; grid-template-columns: repeat(2, 1fr); }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.45rem; text-align: center; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 1rem 0.7rem; min-height: 104px; font-weight: 700; font-size: 0.95rem;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--lavender); box-shadow: var(--shadow); color: var(--ink); }
.tile__icon { font-size: 2rem; line-height: 1; }
.tile__label { line-height: 1.25; }
.tile--danger { border-color: var(--red); background: var(--red-soft); }
.tile--accent-rose { border-color: var(--pink-line); background: var(--pink-soft); }
.tile--accent-lavender { border-color: var(--lavender-line); background: var(--lavender-soft); }
.tile--accent-peach { border-color: #f6cdb2; background: var(--peach-soft); }
.tile--accent-green { border-color: #b8e0c8; background: var(--green-soft); }
.tile--accent-sky { border-color: #bfdcee; background: var(--sky-soft); }
.tile--accent-amber { border-color: #ecd3a6; background: var(--amber-soft); }
.tile--accent-red { border-color: #f2bcbc; background: var(--red-soft); }

@media (min-width: 520px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 780px) { .tile-grid--4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .tile-grid--3 { grid-template-columns: repeat(3, 1fr); } }

/* ══ CATEGORY CARDS ════════════════════════════════════════════ */
.cat-card {
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.cat-card__link { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem 1rem 0.7rem; text-decoration: none; color: var(--ink); flex: 1; }
.cat-card__icon { font-size: 2rem; line-height: 1; }
.cat-card__title { margin: 0; font-size: 1.05rem; }
.cat-card__text { margin: 0; font-size: 0.9rem; color: var(--ink-2); }
.cat-card__foot { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 1rem; }
.cat-card--rose { border-color: var(--pink-line); }
.cat-card--lavender { border-color: var(--lavender-line); }
.cat-card--peach { border-color: #f6cdb2; }
.cat-card--green { border-color: #b8e0c8; }
.cat-card--sky { border-color: #bfdcee; }
.cat-card--amber { border-color: #ecd3a6; }
.cat-card--red { border-color: #f2bcbc; }

/* ══ WARNING SIGNS ═════════════════════════════════════════════ */
.warn-grid { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.warn-chip {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--red-soft); border: 1px solid #f2c4c4; border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem; font-size: 0.94rem;
}
.warn-chip > span:nth-child(2) { flex: 1; }
.warn-card {
  display: flex; align-items: flex-start; gap: 0.7rem;
  border-radius: var(--radius-sm); padding: 0.75rem 0.85rem; border: 1px solid var(--line);
}
.warn-card--emergency { background: var(--red-soft); border-color: #f2c4c4; }
.warn-card--urgent { background: var(--amber-soft); border-color: #ecd3a6; }
.warn-card__icon { font-size: 1.5rem; line-height: 1; flex: none; }
.warn-card__body { flex: 1; min-width: 0; }
.warn-card__text { margin: 0; font-weight: 700; }
.warn-card__action { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--red); font-weight: 600; }
.warn-list { list-style: none; margin: 0 0 0.7rem; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.warn-list__item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.warn-list__text { flex: 1; }

.sidebar__card--warn .warn-list__item::before { content: '•'; color: var(--red); font-weight: 900; }

/* ══ DID YOU KNOW ══════════════════════════════════════════════ */
.dyk-grid { display: grid; gap: 0.7rem; grid-template-columns: 1fr; }
.dyk {
  background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--peach);
  border-radius: var(--radius-sm); padding: 0.8rem 0.9rem; display: flex; flex-direction: column; gap: 0.4rem;
}
.dyk--sidebar { padding: 0.6rem 0.7rem; margin-bottom: 0.5rem; border-left-width: 4px; }
.dyk--wide { border-left-width: 6px; }
.dyk__head { display: flex; align-items: center; gap: 0.4rem; }
.dyk__icon { font-size: 1.5rem; line-height: 1; }
.dyk__title { margin: 0; font-size: 0.92rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.dyk__text { margin: 0; font-weight: 600; }
@media (min-width: 620px) { .dyk-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .dyk-grid { grid-template-columns: repeat(3, 1fr); } }

/* ══ TRUST ═════════════════════════════════════════════════════ */
.trust { background: var(--green-soft); border: 1px solid #b8e0c8; border-radius: var(--radius); padding: 1.1rem; }
.trust__body { max-width: 70ch; }
.trust__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ══ FAQ ═══════════════════════════════════════════════════════ */
.faq-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.faq { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper-2); }
.faq details { padding: 0; }
.faq__q {
  cursor: pointer; padding: 0.8rem 0.9rem; font-weight: 700; display: flex;
  align-items: center; justify-content: space-between; gap: 0.5rem; min-height: var(--touch);
  list-style: none;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__chev { color: var(--lavender); transition: transform 0.15s ease; flex: none; }
.faq details[open] .faq__chev { transform: rotate(180deg); }
.faq__a { padding: 0 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; }
.faq__a p { margin: 0; }
.faq__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

/* ══ COMMUNITY ═════════════════════════════════════════════════ */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.8rem; min-height: 40px; border-radius: 999px;
  background: var(--paper); border: 2px solid var(--line);
  text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 0.9rem;
}
.chip:hover { border-color: var(--lavender); color: var(--lavender); }
.chip.is-active { background: var(--lavender); color: #fff; border-color: var(--lavender); }
.chip--sm { padding: 0.3rem 0.6rem; min-height: 34px; font-size: 0.85rem; }
.chip--check { cursor: pointer; }
.chip--check input { accent-color: var(--lavender); width: 18px; height: 18px; }
.chip-row--check { gap: 0.4rem; }

.new-post { padding: 0; }
.new-post__summary {
  cursor: pointer; padding: 1rem 1.1rem; font-weight: 700; color: var(--lavender);
  min-height: var(--touch); display: flex; align-items: center; list-style: none;
}
.new-post__summary::-webkit-details-marker { display: none; }
.new-post .form { padding: 0 1.1rem 1.1rem; }

.post-list { display: flex; flex-direction: column; gap: 0.7rem; }
.post-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; box-shadow: var(--shadow-sm);
}
.post-card--muted { opacity: 0.65; }
.post-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--ink-3); margin-bottom: 0.4rem; }
.post-card__avatar { font-size: 1.1rem; }
.post-card__author { font-weight: 700; color: var(--ink-2); }
.post-card__cat { background: var(--lavender-soft); color: #4a3178; padding: 0.1rem 0.5rem; border-radius: 999px; font-weight: 600; }
.post-card__title { margin: 0 0 0.3rem; font-size: 1.12rem; }
.post-card__title a { text-decoration: none; color: var(--ink); }
.post-card__title a:hover { color: var(--lavender); }
.post-card__excerpt { margin: 0 0 0.6rem; color: var(--ink-2); font-size: 0.95rem; }
.post-card__foot { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.post-full { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.post-full__title { margin: 0.2rem 0 0.6rem; }
.post-full__body { white-space: pre-wrap; }
.post-full__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem; }
.post-full__actions form { display: inline; }

.comments { display: flex; flex-direction: column; gap: 0.7rem; }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.comment { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; }
.comment--muted { opacity: 0.6; }
.comment__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.83rem; color: var(--ink-3); }
.comment__body { margin: 0.35rem 0 0.5rem; white-space: pre-wrap; }
.comment__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.comment__actions form { display: inline; }
.comment-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }

.breadcrumb { font-size: 0.9rem; }
.empty-state { padding: 1.4rem 1rem; text-align: center; color: var(--ink-3); background: var(--paper-2); border: 1px dashed var(--line); border-radius: var(--radius); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 800; padding: 0.15rem 0.5rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em; }
.badge--demo { background: var(--amber-soft); color: var(--amber); border: 1px solid #ecd3a6; }
.badge--live { background: var(--green-soft); color: var(--green); border: 1px solid #b8e0c8; }
.badge--warn { background: var(--red-soft); color: var(--red); border: 1px solid #f2c4c4; }
.badge--ok { background: var(--green-soft); color: var(--green); border: 1px solid #b8e0c8; }
.badge--muted { background: var(--paper-2); color: var(--ink-3); border: 1px solid var(--line); }

/* ══ NOTICES ═══════════════════════════════════════════════════ */
.notice { display: flex; gap: 0.5rem; padding: 0.75rem 0.9rem; border-radius: var(--radius-sm); margin: 0; font-size: 0.93rem; border: 1px solid var(--line); background: var(--paper-2); }
.notice--demo { background: var(--amber-soft); border-color: #ecd3a6; }
.notice--warn { background: var(--red-soft); border-color: #f2c4c4; }
.notice--ok { background: var(--green-soft); border-color: #b8e0c8; }
.disclaimer { font-size: 0.85rem; color: var(--ink-3); background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; margin: 0; }
.sources { font-size: 0.85rem; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 0.7rem; }
.sources p { margin: 0 0 0.3rem; }
.sources__note { font-style: italic; }

/* ══ EMERGENCY ═════════════════════════════════════════════════ */
.emergency-bar {
  display: flex; gap: 0.6rem; align-items: flex-start;
  background: var(--red-soft); border: 2px solid var(--red);
  border-radius: var(--radius); padding: 0.8rem 0.9rem;
}
.emergency-bar__icon { font-size: 1.5rem; line-height: 1; flex: none; }
.emergency-bar__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.emergency-bar__body strong { color: var(--red); }
.emergency-bar__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mobile-emergency { margin-bottom: 1rem; }

.emergency-hero {
  background: linear-gradient(150deg, var(--red-soft), var(--peach-soft));
  border: 3px solid var(--red); border-radius: var(--radius-lg);
  padding: 1.2rem 1rem; text-align: center;
}
.emergency-hero__title { color: var(--red); margin: 0 0 0.9rem; }
.emergency-hero__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }

.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.contact-list__item {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.55rem 0.7rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.contact-list__item strong { display: block; }
.contact-list__meta { display: block; font-size: 0.82rem; color: var(--ink-3); }

/* ══ CARE / DOCTORS / CONSULTATION ════════════════════════════ */
.care-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.care-actions__note { flex-basis: 100%; margin: 0; font-size: 0.86rem; color: var(--ink-3); }
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.filters .field { margin-bottom: 0; flex: 1 1 180px; }

.clinic-list, .doctor-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .clinic-list, .doctor-grid { grid-template-columns: repeat(2, 1fr); } }

.clinic-card, .doctor-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.6rem;
}
.clinic-card--emergency { border-color: var(--red); border-width: 2px; }
.clinic-card__head, .doctor-card__head { display: flex; align-items: flex-start; gap: 0.6rem; }
.clinic-card__icon, .doctor-card__avatar { font-size: 1.7rem; line-height: 1; flex: none; }
.clinic-card__name, .doctor-card__name { margin: 0; font-size: 1.05rem; }
.clinic-card__type, .doctor-card__spec { margin: 0; font-size: 0.88rem; color: var(--ink-3); }
.clinic-card__facts, .doctor-card__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.8rem; margin: 0; font-size: 0.88rem; }
.clinic-card__facts dt, .doctor-card__facts dt { color: var(--ink-3); font-size: 0.8rem; font-weight: 600; }
.clinic-card__facts dd, .doctor-card__facts dd { margin: 0; font-weight: 600; }
.clinic-card__foot, .doctor-card__foot { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: auto; }
.doctor-card__qual { margin: 0; font-size: 0.85rem; color: var(--ink-3); }
.map-frame { width: 100%; height: 260px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
@media (min-width: 700px) { .map-frame { height: 340px; } }

.recommend { background: var(--lavender-soft); border: 2px solid var(--lavender-line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.recommend__title { margin: 0 0 0.3rem; }
.recommend__intro { margin: 0; font-size: 0.92rem; }
.recommend__value { margin: 0.5rem 0; font-size: 1.2rem; font-weight: 800; color: var(--lavender); }
.recommend__note { font-size: 0.82rem; color: var(--ink-3); margin: 0 0 0.7rem; }

.tier-grid { display: grid; gap: 0.8rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .tier-grid { grid-template-columns: 1fr 1fr; } }
.tier { border-radius: var(--radius); padding: 1rem 1.1rem; border: 2px solid var(--line); display: flex; flex-direction: column; gap: 0.6rem; }
.tier--free { background: var(--green-soft); border-color: #b8e0c8; }
.tier--premium { background: linear-gradient(150deg, var(--lavender-soft), var(--pink-soft)); border-color: var(--lavender-line); }
.tier__title { margin: 0; }
.tier__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.93rem; }
.tier__note { font-size: 0.82rem; color: var(--ink-3); margin: 0; }

/* ══ AUTH / PROFILE / HISTORY ══════════════════════════════════ */
.auth-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .auth-grid { grid-template-columns: 1fr 1fr; } }
.form { display: flex; flex-direction: column; }
.cta-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.cta-card--center { align-items: center; text-align: center; }
.cta-card__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.danger-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.history-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 1rem; display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between; }
.history-card__main { flex: 1 1 240px; min-width: 0; }
.history-card__summary { margin: 0 0 0.25rem; font-size: 1.02rem; }
.history-card__meta { margin: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; font-size: 0.83rem; color: var(--ink-3); }
.history-card__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.steps { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.35rem; }
.privacy-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }

/* ══ ADMIN ═════════════════════════════════════════════════════ */
.admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.admin-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: space-between; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; }
.admin-row__actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.admin-row__comment { margin: 0.3rem 0 0; font-size: 0.9rem; }
.admin-row form { display: inline; }

/* ══ FEEDBACK ══════════════════════════════════════════════════ */
.feedback { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.feedback[hidden] { display: none; }
.feedback__q { margin: 0; font-weight: 700; }
.feedback__row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.feedback__form { display: flex; flex-direction: column; gap: 0.5rem; }
.feedback__thanks { margin: 0; color: var(--green); font-weight: 700; }

/* ══ FOOTER ════════════════════════════════════════════════════ */
.site-footer { background: #2a2340; color: #e8e3f4; margin-top: 2rem; padding: 1.5rem 1rem 2rem; }
.site-footer__grid { max-width: var(--maxw); margin: 0 auto 1.25rem; display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.site-footer__heading { font-size: 0.95rem; color: #fff; margin: 0 0 0.5rem; }
.site-footer__promise { font-size: 0.88rem; color: #c9c0e2; margin: 0; }
.site-footer__links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.site-footer__links a { color: #d7cfee; text-decoration: none; font-size: 0.9rem; }
.site-footer__links a:hover { color: #fff; text-decoration: underline; }
.site-footer__bottom { max-width: var(--maxw); margin: 0 auto; border-top: 1px solid #463c63; padding-top: 1rem; font-size: 0.82rem; color: #bdb2da; }
.site-footer__bottom p { margin: 0 0 0.4rem; }
.site-footer__emergency { color: #ffc9c9; font-weight: 600; }

/* ══ PRINT ═════════════════════════════════════════════════════ */
@media print {
  .site-header, .bottomnav, .leftnav, .sidebar, .playback, .speak-btn, .site-footer { display: none !important; }
  body { padding: 0; background: #fff; }
  .card, .hero { box-shadow: none; border-color: #999; }
}
