/* =========================================================
   Dose: design system
   Atkinson Hyperlegible · WCAG AA contrast or better
   ========================================================= */

:root {
  /* Surfaces */
  --bg: #FBF6EE;          /* cream, less glare than pure white */
  --surface: #FFFFFF;
  --surface-2: #F4ECDF;
  --line: #E3D8C6;

  /* Text */
  --ink: #1B1F3B;         /* 14.9:1 on --bg */
  --ink-2: #4A4F68;       /* 7.3:1 on --bg */

  /* Brand and states */
  --primary: #2B3A8C;     /* indigo, 10:1 on white */
  --primary-hover: #222E70;
  --primary-soft: #E6E9F7;
  --accent: #B4441F;      /* terracotta, 5.5:1 on white */
  --success: #1D6B43;     /* 6.5:1 on white */
  --success-soft: #E2F2E8;
  --warn: #7A4300;
  --warn-soft: #FFF1D6;
  --danger: #A12622;
  --danger-soft: #FCE6E4;

  /* Times of day (decoration only, never carry text) */
  --morning: #F2B33D;
  --noon: #F5C842;
  --evening: #E0703A;
  --night: #2E3A7A;

  /* Shape */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(27, 31, 59, .06), 0 8px 24px rgba(27, 31, 59, .08);
  --tap: 48px;            /* minimum touch target */

  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Comic Sans MS", cursive;

  --kente: repeating-linear-gradient(135deg,
    var(--primary) 0 12px, var(--morning) 12px 24px,
    var(--accent) 24px 36px, var(--success) 36px 48px);
}

html.big-text { font-size: 125%; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); letter-spacing: -.01em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-underline-offset: .2em; }
img, svg { max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px var(--morning);
  border-radius: 6px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; 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: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: #fff; padding: .75rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

.kente { height: 10px; background: var(--kente); }

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem clamp(1rem, 4vw, 2.5rem);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: 1.5rem; color: var(--ink); text-decoration: none;
}
.brand svg { width: 36px; height: 36px; }
.header-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .7rem 1.4rem;
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none;
  border-radius: var(--radius-pill); border: 2px solid transparent;
  cursor: pointer; transition: background-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-lg { min-height: 60px; font-size: 1.125rem; padding: .9rem 1.6rem; }

/* “I took it” button */
.take {
  min-height: 60px; min-width: 9rem; padding: .7rem 1.2rem;
  font: inherit; font-weight: 700; font-size: 1.125rem;
  border-radius: var(--radius-pill); cursor: pointer;
  color: var(--success); background: var(--surface); border: 3px solid var(--success);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.take:hover { background: var(--success-soft); }
.take[aria-pressed="true"] { background: var(--success); color: #fff; }
.take .check { width: 1.4em; height: 1.4em; }

/* Listen button */
.listen {
  width: var(--tap); height: var(--tap); flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--primary);
  background: var(--primary-soft); color: var(--primary); cursor: pointer;
}
.listen svg { width: 24px; height: 24px; }
.listen[aria-pressed="true"] { background: var(--primary); color: #fff; }

/* Language picker */
.lang-select {
  position: relative; display: inline-flex; align-items: center;
  border: 2px solid var(--line); border-radius: var(--radius-pill); background: var(--surface);
}
.lang-select:focus-within { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 7px var(--morning); }
.lang-globe { position: absolute; left: .7rem; display: grid; pointer-events: none; color: var(--ink-2); }
.lang-globe svg { width: 20px; height: 20px; }
.lang-select select {
  appearance: none; -webkit-appearance: none; font: inherit; font-weight: 700; color: var(--ink);
  min-height: 44px; padding: 0 2rem 0 2.4rem; border: 0; background: transparent; border-radius: var(--radius-pill); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%231B1F3B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 16px;
}
.lang-select select:focus-visible { outline: none; box-shadow: none; }
.hint-voice.hint-info { background: var(--primary-soft); color: var(--primary); }

/* Segmented control */
.segmented { display: inline-flex; border: 2px solid var(--line); border-radius: var(--radius-pill); padding: 2px; }
.segmented button {
  min-height: 40px; min-width: 44px; padding: 0 .8rem; font: inherit; font-weight: 700;
  border: 0; background: transparent; color: var(--ink-2); border-radius: var(--radius-pill); cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem;
}

/* ---------- Pictograms ---------- */
.pill { display: block; flex: none; }
.pill-row { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; }
.pill-count {
  font-weight: 700; font-size: 1.25rem; margin-left: .35rem;
  background: var(--surface-2); border-radius: var(--radius-pill); padding: .1rem .6rem;
}

.moment-icon { display: block; flex: none; }

.meal-seq {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--surface-2); border-radius: var(--radius-pill);
  padding: .25rem .75rem .25rem .35rem; font-weight: 700; color: var(--ink);
}
.meal-seq.no-seq { padding-left: .75rem; }
.meal-seq { max-width: 100%; }
.meal-seq .seq { display: inline-flex; align-items: center; gap: .1rem; }
.meal-seq svg { width: 30px; height: 30px; flex: none; }
.meal-seq .seq { flex: none; }
.meal-seq .arrow { width: 18px !important; height: 18px !important; color: var(--ink-2); }

/* Dose card (component preview) */
.dose {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
  padding: 1rem; border-radius: var(--radius-sm); background: var(--surface);
  border: 2px solid var(--line);
}
.dose.is-taken { border-color: var(--success); background: var(--success-soft); }
.dose-qty { font-size: 1.375rem; font-weight: 700; margin: 0; }
.dose-name { margin: 0 0 .4rem; color: var(--ink-2); }
.dose-name strong { color: var(--ink); }
@media (max-width: 560px) {
  .dose { grid-template-columns: auto 1fr; gap: .75rem; }
  .dose > .take, .dose > .prn-actions { grid-column: 1 / -1; }
  .take { width: 100%; }
  .dose-visual { width: 72px; }
  .dose-visual .pill { width: 33px; height: 33px; }
}

.moment-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.moment-head h3 { margin: 0; font-size: 1.5rem; }
.moment-head p { margin: 0; color: var(--ink-2); }
.moment-head .listen { margin-left: auto; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =========================================================
   Style guide
   ========================================================= */
.sg main { max-width: 1100px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 4rem; }
.sg section { margin-top: 3rem; }
.sg .lead { font-size: 1.2rem; color: var(--ink-2); max-width: 60ch; }
.sg .section-intro { color: var(--ink-2); max-width: 65ch; }
.sg-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.swatch { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.swatch-color { height: 84px; display: flex; align-items: flex-end; padding: .5rem .75rem; font-weight: 700; }
.swatch-meta { padding: .6rem .75rem; font-size: .9rem; }
.swatch-meta code { font-size: .85rem; }
.badge-aa { display: inline-block; font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 6px; background: var(--success-soft); color: var(--success); }
.badge-deco { background: var(--surface-2); color: var(--ink-2); }
.type-specimen p { margin: .25rem 0 1rem; }
.type-specimen .label { font-size: .85rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center;
}
.tile small { color: var(--ink-2); }
.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.stack { display: grid; gap: 1rem; }
.do-dont { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.do-dont .tile { align-items: flex-start; text-align: left; }
.tag-do { color: var(--success); font-weight: 700; }
.tag-dont { color: var(--danger); font-weight: 700; }
.sg footer { text-align: center; color: var(--ink-2); padding: 2rem 1rem; border-top: 1px solid var(--line); }

/* =========================================================
   Patient view
   ========================================================= */
.patient main { max-width: 680px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.patient main:focus { outline: none; }
.hide-sm { }
@media (max-width: 480px) { .hide-sm { display: none; } }

.icon-btn {
  width: var(--tap); height: var(--tap); flex: none; display: inline-grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface-2); }
.btn svg { width: 1.3em; height: 1.3em; flex: none; }

.demo-banner {
  display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; justify-content: space-between;
  background: var(--primary-soft); color: var(--primary); border-radius: var(--radius-sm);
  padding: .6rem 1rem; font-weight: 700; margin-bottom: 1.25rem;
}

/* Greeting */
.hello { margin-bottom: 1.25rem; }
.hello-date { color: var(--ink-2); margin: 0 0 .25rem; }
.hello-date::first-letter { text-transform: uppercase; }
.hello h1 { margin-bottom: .25rem; }
.hello-from { color: var(--ink-2); margin-bottom: 1rem; }
.day-progress { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; font-weight: 700; }
.day-label { white-space: nowrap; }
.day-bar { flex: 1; height: 12px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; border: 1px solid var(--line); }
.day-bar span { display: block; height: 100%; background: var(--primary); border-radius: var(--radius-pill); }
.hello-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hello-actions .btn { flex: 1 1 240px; }

/* Current status */
.status-stack { display: grid; gap: .75rem; margin-bottom: 1.5rem; }
.status {
  display: flex; gap: 1rem; align-items: flex-start;
  border-radius: var(--radius); padding: 1.1rem 1.25rem; border: 2px solid var(--line); background: var(--surface);
}
.status p { margin: 0 0 .5rem; }
.status p:last-child { margin-bottom: 0; }
.status-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 .35rem; }
.status-kicker { font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; }
.status-hint { display: block; font-size: 1rem; font-weight: 400; color: var(--ink-2); margin-top: .2rem; }
.status-next { border-color: var(--primary); background: var(--primary-soft); }
.status-next .btn { margin-top: .5rem; }
.status-warn { border-color: #C98A0C; background: var(--warn-soft); color: var(--warn); }
.status-warn .status-title { color: var(--ink); }
.status-done { border-color: var(--success); background: var(--success-soft); }
.status-done .status-title { color: var(--success); }
.status-done::before {
  content: ""; flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 60% no-repeat;
  animation: pop .4s ease-out;
}
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* Times of day */
.moment {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1.25rem;
  border-top: 8px solid var(--moment-color, var(--line));
  scroll-margin-top: 1rem;
}
.moment-morning { --moment-color: var(--morning); }
.moment-noon { --moment-color: var(--noon); }
.moment-evening { --moment-color: var(--evening); }
.moment-night { --moment-color: var(--night); }
.moment-prn { --moment-color: var(--ink-2); }
.moment.is-next { outline: 3px solid var(--primary); outline-offset: 2px; }
.moment-head h2 { margin: 0; font-size: 1.5rem; }
.now-badge {
  display: inline-block; margin: 0 0 .25rem !important; padding: .1rem .6rem; border-radius: var(--radius-pill);
  background: var(--primary); color: #fff !important; font-size: .85rem; font-weight: 700;
}
.prn-icon {
  width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: 18px;
  background: var(--surface-2); font-size: 2rem; font-weight: 700; color: var(--ink-2);
}

.doses { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.dose { align-items: start; }
.dose-visual { padding-top: .25rem; width: 88px; }
.dose-visual .pill-row { gap: 4px; }
.dose-visual .pill-row .pill-count { margin: .25rem 0 0; }
.dose-body { min-width: 0; }
.dose-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.dose-note { margin: 0 0 .5rem; padding: .5rem .75rem; background: var(--warn-soft); border-radius: var(--radius-sm); font-weight: 700; }
.dose > .take, .prn-actions { align-self: center; }
.dose.is-taken .dose-qty, .dose.is-taken .dose-name { opacity: .75; }

.chip {
  display: inline-flex; align-items: center; padding: .3rem .75rem; border-radius: var(--radius-pill);
  background: var(--surface-2); font-weight: 700; font-size: .95rem;
}
.chip-accent { background: var(--accent); color: #fff; }

.info-btn {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .25rem;
  background: none; border: 0; font: inherit; font-weight: 700; color: var(--primary);
  text-decoration: underline; text-underline-offset: .2em; cursor: pointer; text-align: left;
}
.info-btn svg { width: 22px; height: 22px; flex: none; }

/* Only if needed */
.prn-actions { display: grid; gap: .5rem; }
.prn-count { display: flex; align-items: center; gap: .6rem; font-weight: 700; margin: 0 0 .5rem; }
.dots { display: inline-flex; gap: .3rem; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-2); }
.dot.on { background: var(--ink); border-color: var(--ink); }
.prn-limit { margin: 0 0 .5rem; padding: .5rem .75rem; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 700; }

.call-card {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--primary); color: var(--ink); text-decoration: none;
}
.call-card svg { width: 32px; height: 32px; color: var(--primary); flex: none; }

.empty { text-align: center; color: var(--ink-2); padding: 3rem 1rem; }
.empty svg { margin: 0 auto 1rem; }

.patient-footer { max-width: 680px; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; color: var(--ink-2); font-size: .9rem; text-align: center; }

/* Medicine sheet (dialog) */
.sheet {
  width: min(640px, calc(100% - 1.5rem)); max-height: calc(100% - 1.5rem);
  border: 0; border-radius: var(--radius); padding: 1.25rem; color: var(--ink); background: var(--bg);
  box-shadow: 0 20px 60px rgba(27, 31, 59, .35);
}
.sheet::backdrop { background: rgba(27, 31, 59, .55); }
.sheet-head { display: flex; align-items: flex-start; gap: .9rem; margin-bottom: 1rem; }
.sheet-head > div { flex: 1; }
.sheet-head h2 { margin: 0; font-size: 1.5rem; }
.sheet-strength { font-weight: 400; color: var(--ink-2); font-size: 1.1rem; }
.sheet-for { margin: .25rem 0 0; font-weight: 700; color: var(--primary); }
.fiche { display: grid; gap: .75rem; margin-top: 1rem; }
.fiche-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; }
.fiche-block h3 { display: flex; align-items: center; gap: .5rem; font-size: 1.1rem; margin: 0 0 .4rem; }
.fiche-icon { font-size: 1.4rem; }
.fiche-block ul { margin: 0; padding-left: 1.25rem; }
.fiche-block li + li { margin-top: .3rem; }
.fiche-alert { background: var(--danger-soft); border-color: #E7B4B0; }
.fiche-alert h3 { color: var(--danger); }
.fiche-how { background: var(--success-soft); border-color: #B9DCC6; }
.sheet-source { margin: 1rem 0 0; font-size: .9rem; color: var(--ink-2); }

/* Embedded preview (pharmacist view) */
.embed .site-header, .embed .kente, .embed .patient-footer, .embed .skip-link { display: none; }
.embed main { padding: 1rem .85rem 2rem; }
.embed .hello h1 { font-size: 2rem; }

/* =========================================================
   Pharmacist view
   ========================================================= */
.brand-tag {
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: var(--primary-soft); color: var(--primary); padding: .15rem .55rem; border-radius: var(--radius-pill);
}
.pharma-layout {
  max-width: 1320px; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 5rem;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 2rem; align-items: start;
}
.pharma-layout:focus { outline: none; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-end; margin-bottom: 1.25rem; }
.page-head h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: .25rem; }
.page-head .lead { color: var(--ink-2); margin: 0; max-width: 55ch; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.form-section { margin-bottom: 1.25rem; }
.form-section h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.35rem; margin-bottom: 1rem; }
.step-num {
  width: 34px; height: 34px; flex: none; display: inline-grid; place-items: center; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 1rem;
}
.optional { font-size: .9rem; font-weight: 400; color: var(--ink-2); }
.grid2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Fields */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; align-content: start; }
.field label, .field .label, .fs legend { font-weight: 700; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  min-height: var(--tap); padding: .6rem .85rem; width: 100%;
  border: 2px solid #B9AE9C; border-radius: var(--radius-sm);
}
.field textarea { resize: vertical; min-height: 4.5rem; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { border-color: var(--primary); }
.field [aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
.field-inline { grid-template-columns: 1fr 6rem; align-items: center; max-width: 26rem; margin: .5rem 0 0; }
.field-error { margin: 0; color: var(--danger); font-weight: 700; }
.field-error::before { content: "⚠ "; }
.hint { color: var(--ink-2); margin: 0 0 .5rem; }
.hint-small { font-size: .9rem; }
.hint-strong { color: var(--ink); font-weight: 700; }
.hint-voice { background: var(--warn-soft); color: var(--warn); padding: .6rem .85rem; border-radius: var(--radius-sm); font-weight: 700; }

.fs { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
.fs legend { padding: 0; margin-bottom: .5rem; }

/* Adding medicines */
.add-row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.add-field { flex: 1 1 260px; margin-bottom: 0; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1rem 0; }
.quick-label { font-weight: 700; color: var(--ink-2); }
.quick-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.quick-btn {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .3rem .85rem .3rem .45rem;
  font: inherit; font-weight: 700; background: var(--surface-2); color: var(--ink);
  border: 2px solid transparent; border-radius: var(--radius-pill); cursor: pointer;
}
.quick-btn:hover { border-color: var(--primary); }
.empty-meds { color: var(--ink-2); padding: 1.25rem; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius-sm); margin: 0; }
.empty-meds[hidden] { display: none; }

/* Medicine card */
.med-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.med-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem .25rem; background: var(--bg); }
.med-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.med-pill { min-width: 40px; }
.med-summary { margin: -.5rem 0 1rem; color: var(--ink-2); font-weight: 700; }
.med-card.is-collapsed { padding-bottom: 1rem; }
.med-card.is-collapsed .med-summary { margin-bottom: 0; }
.med-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.btn-edit[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.med-title { flex: 1; margin: 0; font-size: 1.15rem; display: grid; }
.med-num { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.btn-sm { min-height: 40px; padding: .35rem .8rem; font-size: .95rem; }

.tiles { display: flex; flex-wrap: wrap; gap: .5rem; }
.tile-radio { position: relative; }
.tile-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tile-face {
  display: inline-flex; align-items: center; gap: .45rem; min-height: var(--tap); padding: .35rem .8rem .35rem .5rem;
  border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-weight: 700; cursor: pointer;
}
.tile-label { font-size: .95rem; }
.tile-radio input:checked + .tile-face { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.tile-radio input:focus-visible + .tile-face { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 7px var(--morning); }
.tiles-meal .tile-face { padding: .25rem; background: var(--surface-2); }
.tiles-meal .meal-seq { background: transparent; }

.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch-radio { position: relative; width: var(--tap); height: var(--tap); display: grid; place-items: center; }
.swatch-radio input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); pointer-events: none; }
.swatch-radio input:checked + .swatch-dot { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--primary); }
.swatch-radio input:checked + .swatch-dot::after {
  content: ""; display: block; width: 100%; height: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4L18 8' fill='none' stroke='%231B1F3B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 60% no-repeat;
}
.swatch-radio input:focus-visible + .swatch-dot { outline: 3px solid var(--ink); outline-offset: 5px; }

.stepper { display: inline-flex; align-items: center; gap: .5rem; }
.stepper .icon-btn { font-size: 1.5rem; font-weight: 700; border-color: var(--primary); color: var(--primary); }
.stepper output { min-width: 8.5rem; text-align: center; font-weight: 700; font-size: 1.1rem; }

.moment-toggles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.moment-toggles[hidden] { display: none; }
.moment-toggle {
  display: grid; justify-items: center; gap: .25rem; padding: .5rem .25rem; min-height: 84px;
  font: inherit; font-weight: 700; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; position: relative;
}
.moment-toggle[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.moment-toggle[aria-pressed="true"]::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4L18 8' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 70% no-repeat;
}
@media (max-width: 420px) { .moment-toggles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.check-row { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); font-weight: 700; cursor: pointer; }
.check-row input { width: 24px; height: 24px; accent-color: var(--primary); flex: none; }
.check-row svg { width: 20px; height: 20px; vertical-align: -4px; color: var(--primary); }
.fiche-opts { border-top: 1px dashed var(--line); padding-top: .5rem; margin-bottom: .75rem; }

/* Voice */
.voice { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.voice audio { max-width: 100%; }
.btn-rec { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-rec:hover { background: var(--danger-soft); }
.btn-rec.is-recording { background: var(--danger); color: #fff; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: currentColor; }
.is-recording .rec-dot { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-bar { flex: 1 1 160px; height: 10px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.rec-bar span { display: block; height: 100%; background: var(--danger); }

/* Errors */
.error-summary {
  border: 3px solid var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm);
  padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.error-summary p { margin: 0 0 .5rem; color: var(--danger); }
.error-summary ul { margin: 0; padding-left: 1.25rem; }
.error-summary a { color: var(--danger); font-weight: 700; }

.generate-row { display: grid; gap: .5rem; justify-items: start; margin: 1.5rem 0; }

/* Result */
.result { border: 3px solid var(--success); scroll-margin-top: 1rem; }
.result:focus { outline: none; }
.result.is-stale { border-color: #C98A0C; }
.result-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.result-head h2 { margin: 0; }
.result-check { width: 52px; height: 52px; flex: none; border-radius: 50%; background: var(--success); color: #fff; display: grid; place-items: center; }
.result-check svg { width: 30px; height: 30px; }
.result-time { margin: 0; color: var(--success); font-weight: 700; }
.result.is-stale .result-check { background: #C98A0C; }
.stale-note { background: var(--warn-soft); color: var(--warn); font-weight: 700; padding: .6rem .85rem; border-radius: var(--radius-sm); }
.result-body { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 640px) { .result-body { grid-template-columns: 1fr; } }
.qr { margin: 0; text-align: center; max-width: 260px; }
.qr-code { background: #fff; padding: .5rem; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.qr-code svg { width: 100%; height: auto; display: block; }
.qr figcaption { color: var(--ink-2); font-size: .9rem; margin-top: .5rem; }
.share { display: grid; gap: .6rem; }
.share .field { margin: 0; }
.share input { font-size: .85rem; }
.btn-whatsapp { background: #0F7B3D; color: #fff; }
.btn-whatsapp:hover { background: #0B6332; }

/* Preview */
.preview { position: sticky; top: 1rem; }
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.preview-head h2 { font-size: 1.1rem; margin: 0; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.preview-close { display: none; }
.phone {
  width: 100%; max-width: 390px; aspect-ratio: 9 / 18.5; max-height: calc(100vh - 6rem);
  border: 12px solid var(--ink); border-radius: 46px; overflow: hidden; background: var(--bg);
  box-shadow: var(--shadow); margin: 0 auto;
}
.phone iframe { width: 100%; height: 100%; border: 0; display: block; }
.preview-fab { display: none; }

@media (max-width: 1000px) {
  .pharma-layout { grid-template-columns: 1fr; }
  .preview {
    display: none; position: fixed; inset: 0; z-index: 50; padding: 1rem;
    background: rgba(27, 31, 59, .92); overflow: auto;
  }
  .preview.is-open { display: block; }
  .preview-head h2 { color: #fff; }
  .preview-close { display: inline-grid; }
  .phone { max-height: calc(100vh - 6rem); }
  .preview-fab {
    display: inline-flex; position: fixed; right: 1rem; bottom: 1rem; z-index: 40;
    box-shadow: 0 6px 20px rgba(27, 31, 59, .3);
  }
}

/* =========================================================
   Paper sheet
   ========================================================= */
.print-btn { width: 100%; margin-top: 1.25rem; }
.print-only { display: none; }

@media print {
  @page { size: A4 landscape; margin: 9mm; }
  html, body { background: #fff !important; font-size: 10.5pt; }
  body > *:not(#print-sheet) { display: none !important; }
  #print-sheet { display: block !important; color: #000; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.ps-page { page-break-after: always; break-after: page; }
.ps-page:last-child { page-break-after: auto; break-after: auto; }
.ps-head { display: flex; align-items: center; gap: 6mm; border-bottom: 2px solid #1B1F3B; padding-bottom: 3mm; margin-bottom: 3mm; }
.ps-brand { display: flex; align-items: center; gap: 2mm; font-weight: 700; font-size: 14pt; }
.ps-brand svg { width: 9mm; height: 9mm; }
.ps-head h1 { font-size: 16pt; margin: 0; flex: 1; }
.ps-meta { display: flex; gap: 6mm; margin: 0; }
.ps-meta dt { font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #4A4F68; }
.ps-meta dd { margin: 0; font-weight: 700; }
.ps-howto { display: flex; align-items: center; gap: 2mm; margin: 0 0 3mm; font-weight: 700; }
.ps-na-key { display: inline-block; width: 5mm; height: 5mm; margin-left: 4mm; background: repeating-linear-gradient(135deg, #ddd 0 1.5px, #fff 1.5px 4px); border: 1px solid #bbb; }
.ps-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ps-table th, .ps-table td { border: 1px solid #9A9384; padding: 1mm; text-align: center; vertical-align: middle; }
.ps-table thead th { font-size: 9pt; background: #F4ECDF; }
.ps-table thead small { font-weight: 400; }
.ps-medcol { width: 78mm; }
.ps-med { text-align: left !important; font-weight: 400; display: table-cell; }
.ps-med .ps-pills { display: inline-block; vertical-align: middle; width: 16mm; }
.ps-med .ps-pills .pill-row { gap: 1px; }
.ps-med .ps-text { display: inline-block; vertical-align: middle; width: calc(100% - 18mm); font-size: 9.5pt; line-height: 1.3; }
.ps-med .meal-seq { padding: 0 2mm 0 0; font-size: 8.5pt; background: none; }
.ps-med .meal-seq svg { width: 5mm; height: 5mm; }
.ps-med .meal-seq .arrow { width: 3mm !important; height: 3mm !important; }
.ps-moment th { text-align: left; font-size: 11pt; background: #FBF6EE; }
.ps-moment th > * { vertical-align: middle; }
.ps-moment svg { display: inline-block; width: 8mm; height: 8mm; margin-right: 2mm; }
.ps-moment small { font-weight: 400; color: #4A4F68; margin-left: 2mm; }
.ps-q { display: inline-grid; place-items: center; width: 8mm; height: 8mm; border-radius: 2mm; background: #F4ECDF; margin-right: 2mm; }
.box { display: inline-block; width: 6mm; height: 6mm; border: 1.5px solid #1B1F3B; border-radius: 1mm; background: #fff; }
.box.sm { width: 3.6mm; height: 3.6mm; margin: .3mm; }
.ps-table td.na { background: repeating-linear-gradient(135deg, #ddd 0 1.5px, #fff 1.5px 4px); }
.ps-table td.multi { line-height: 0; }
.ps-note td { text-align: left; font-size: 8.5pt; color: #4A4F68; border-top: 0; }
.ps-more, .ps-advice { margin: 2mm 0 0; font-size: 9.5pt; }
.ps-more { font-weight: 700; }
.ps-foot { margin-top: 3mm; font-size: 8pt; color: #4A4F68; }
.ps-back h2 { font-size: 15pt; margin: 0 0 4mm; }
.ps-fiches { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.ps-fiche { border: 1px solid #9A9384; border-radius: 3mm; padding: 3mm 4mm; break-inside: avoid; }
.ps-fiche h3 { font-size: 11.5pt; margin: 0 0 2mm; display: flex; align-items: center; gap: 2mm; flex-wrap: wrap; }
.ps-fiche h3 small { font-weight: 400; color: #2B3A8C; }
.ps-fiche p { margin: 0 0 1.5mm; font-size: 9.5pt; line-height: 1.35; }
.ps-f-alert { background: #FCE6E4; padding: 1.5mm 2mm; border-radius: 2mm; }

/* =========================================================
   Home page
   ========================================================= */
.landing main:focus { outline: none; }
.hero {
  max-width: 1200px; margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(2rem, 4vw, 4rem); align-items: center;
}
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.eyebrow { font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; margin-bottom: .75rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -.03em; margin-bottom: 1rem; }
.hero-lead { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--ink-2); max-width: 34ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

.before-after { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
@media (max-width: 560px) {
  .before-after { grid-template-columns: 1fr; }
  .ba-arrow { transform: rotate(90deg); justify-self: center; }
}
.ba { margin: 0; display: grid; gap: .6rem; }
.ba figcaption { font-size: .95rem; color: var(--ink-2); }
.ba-tag { display: inline-block; font-weight: 700; padding: .1rem .6rem; border-radius: var(--radius-pill); margin-right: .25rem; }
.ba-tag-before { background: var(--danger-soft); color: var(--danger); }
.ba-tag-after { background: var(--success-soft); color: var(--success); }
.ba-arrow { font-size: 2.5rem; font-weight: 700; color: var(--ink-2); }

.scrawl {
  background: #FFFDF7; border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem 1.1rem;
  box-shadow: var(--shadow); transform: rotate(-2deg);
  background-image: repeating-linear-gradient(#FFFDF7 0 31px, #E6E9F7 31px 32px);
}
.hand { font-family: var(--hand); font-size: 1.55rem; line-height: 32px; color: #2B3A8C; margin: 0; display: grid; }
.hand span:nth-child(2) { transform: rotate(1deg); }
.hand span:nth-child(3) { transform: rotate(-1.5deg); letter-spacing: -.02em; }
.hand .sig { justify-self: end; transform: rotate(-6deg); font-size: 1.8rem; }

.mini-phone {
  background: var(--bg); border: 10px solid var(--ink); border-radius: 34px; padding: 1rem .85rem;
  box-shadow: var(--shadow); display: grid; gap: .75rem;
}
.mini-moment { display: flex; align-items: center; gap: .6rem; }
.mini-moment > div { flex: 1; }
.mini-title { font-weight: 700; font-size: 1.25rem; margin: 0; }
.mini-hint { margin: 0; color: var(--ink-2); font-size: .9rem; }
.mini-listen { width: 40px; height: 40px; }
.mini-listen svg { width: 20px; height: 20px; }
.mini-dose { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; display: grid; gap: .5rem; justify-items: start; }
.mini-qty { font-weight: 700; font-size: 1.2rem; margin: 0; }
.mini-take { min-height: 48px; min-width: 0; width: 100%; font-size: 1rem; pointer-events: none; }
.mini-dose .meal-seq { font-size: .9rem; }

.band { padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem); }
.band-alt { background: var(--surface); border-block: 1px solid var(--line); }
.band-inner { max-width: 1200px; margin: 0 auto; }
.band h2 { max-width: 28ch; margin-bottom: 2rem; }
.cards3 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.band-alt .feature { background: var(--bg); }
.feature h3 { margin: .6rem 0 .4rem; }
.feature p { color: var(--ink-2); margin: 0; }
.feature-icon { font-size: 1.8rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); counter-reset: none; }
.step { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.step-badge {
  position: absolute; top: -16px; left: 1.4rem; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; display: grid; place-items: center;
}
.step-visual {
  min-height: 110px; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem;
  background: var(--surface); border-radius: var(--radius-sm); border: 1px dashed var(--line); margin: .5rem 0 1rem;
}
.step-visual .chip svg { margin-right: .3rem; }
.step-moments { display: inline-flex; gap: .3rem; }
.chip-timer { background: var(--success-soft); color: var(--success); }
.step-channels span {
  padding: .5rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 700;
}
.step-channels span:nth-child(2) { background: #0F7B3D; color: #fff; }
.step p { color: var(--ink-2); margin: 0; }
.step .mini-take { width: auto; }

.band-cta { background: var(--ink); color: #fff; }
.band-cta h2 { color: #fff; margin-bottom: .5rem; }
.band-cta p { color: #D9DBE8; font-size: 1.15rem; }
.band-cta .btn-secondary { background: transparent; color: #fff; border-color: #fff; }
.band-cta .btn-secondary:hover { background: rgba(255, 255, 255, .1); }
.band-cta .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .4); }
.band-cta .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.band-cta .btn-primary { background: var(--morning); color: var(--ink); }
.band-cta .btn-primary:hover { background: #F5C55E; }
.band-cta :focus-visible { outline-color: #fff; }

.landing-footer { text-align: center; padding: 2rem 1rem 3rem; color: var(--ink-2); font-size: .9rem; }
.landing-footer p { margin: 0 0 .35rem; }
