:root {
  --paper: #f3f0e8;
  --card: #fffcf8;
  --ink: #1c2b24;
  --sage: #3d6b58;
  --deep: #234236;
  --mist: #d5e3da;
  --clay: #a86b52;
  --line: #e2ddd3;
  --muted: #5c6d64;
  --danger: #8c3a2f;
  --on-accent: #fff;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.4;
}

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

button { cursor: pointer; }

h1 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 14px 0 8px;
}

h2 { font-size: 18px; line-height: 1.3; margin: 0; }

p { margin: 0; }

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

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
}

sup.tm {
  font-size: 0.4em;
  font-weight: 500;
  line-height: 0;
  margin-left: 0.08em;
  vertical-align: baseline;
  position: relative;
  top: -0.85em;
}

.screen {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(112px + env(safe-area-inset-bottom));
}

.intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom));
  background: var(--deep);
  color: var(--paper);
}

.intro-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro-title { font-size: 42px; margin: 18px 0 10px; }

.lede { font-size: 18px; max-width: 18em; }

.mark svg { display: block; }

.skip {
  display: block;
  width: 100%;
  min-height: 64px;
  margin-top: 24px;
  border: 0;
  border-radius: 16px;
  background: var(--paper);
  color: var(--deep);
  font-size: 22px;
  font-weight: 700;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.mark { animation: rise 700ms ease both; }
.intro-title { animation: rise 700ms ease 120ms both; }
.lede { animation: rise 700ms ease 240ms both; }

@media (prefers-reduced-motion: reduce) {
  .mark, .intro-title, .lede { animation: none; }
}

.welcome {
  min-height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
}

.graphic { margin-top: 16px; }
.graphic svg { display: block; width: 100%; height: auto; }

.body-copy, .disclaimer-copy { margin-top: 8px; }
.body-copy { color: var(--muted); }
.disclaimer-copy { font-size: 18px; }

.dots { margin-top: auto; padding: 18px 0 8px; }
.pip {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--mist);
}
.pip.on { background: var(--sage); }

.primary, .secondary, .danger {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 10px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 700;
}

.primary { background: var(--sage); color: var(--on-accent); border: 0; }
.secondary { background: transparent; color: var(--deep); border: 1px solid var(--line); }
.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }

.date { font-size: 22px; font-weight: 700; margin-top: 4px; }

.week {
  display: flex;
  justify-content: space-between;
  list-style: none;
  margin: 16px 0 8px;
  padding: 0;
}

.day { width: 36px; text-align: center; }
.letter { display: block; font-size: 13px; font-weight: 700; }
.day.today .letter { color: var(--sage); }

.dot {
  display: block;
  width: 16px;
  height: 16px;
  margin: 6px auto 0;
  border: 2px solid var(--sage);
  border-radius: 50%;
}
.dot.none { background: transparent; }
.dot.partial { background: linear-gradient(90deg, var(--sage) 50%, transparent 50%); }
.dot.complete { background: var(--sage); }
.day.today .dot { box-shadow: 0 0 0 2px var(--clay); }

.progress-block { margin-top: 8px; }
.progress-label { display: flex; justify-content: space-between; font-size: 15px; font-weight: 700; }
.bar { height: 10px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: var(--mist); }
.bar-fill { height: 100%; background: var(--sage); }

.block {
  margin-top: 12px;
  padding: 14px 14px 4px;
  border-radius: 18px;
  background: var(--card);
}

.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.clock { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.slot { color: var(--muted); font-size: 15px; text-align: right; }

.item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.item-body { flex: 1; min-width: 0; padding-top: 6px; }
.dose { margin-top: 2px; }
.note { margin-top: 4px; color: var(--muted); font-size: 15px; }
.buy { display: inline-block; margin-top: 6px; font-size: 15px; }

.check {
  display: flex;
  flex: 0 0 56px;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 3px solid var(--sage);
  border-radius: 50%;
  background: var(--card);
}
.check.on { background: var(--sage); }
.tick {
  width: 16px;
  height: 9px;
  margin-top: -4px;
  border-bottom: 3px solid var(--on-accent);
  border-left: 3px solid var(--on-accent);
  transform: rotate(-45deg);
}

.totals { margin-top: 16px; font-size: 15px; }
.fine { margin-top: 8px; color: var(--muted); font-size: 13px; }
.reminder { margin-top: 14px; color: var(--ink); font-size: 15px; }
.empty { margin-top: 16px; }
.about-meta { margin-top: 8px; }
.saved { margin-top: 8px; color: var(--sage); font-weight: 700; }
.error { margin-top: 8px; color: var(--danger); }

.edit-list {
  margin: 12px 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--card);
}

.edit-row {
  display: block;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.edit-time, .edit-name { font-weight: 700; }
.edit-name { margin-left: 8px; }
.edit-dose { display: block; color: var(--muted); font-size: 15px; }

label { display: block; margin-top: 14px; font-size: 14px; font-weight: 700; }

input, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--mist);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}

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

.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--card);
}

.nav button {
  flex: 1;
  min-height: 56px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.nav button[aria-current="page"] {
  color: var(--deep);
  box-shadow: inset 0 3px 0 var(--sage);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(28, 43, 36, 0.46);
}

.modal-card {
  width: min(480px, 100%);
  padding: 20px;
  border-radius: 18px;
  background: var(--card);
}

.modal-card p { margin-bottom: 8px; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 2px;
}

.sales {
  min-height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
}

.price { margin-top: 14px; font-size: 20px; font-weight: 700; color: var(--clay); }
.safety-title { margin-top: 22px; font-size: 18px; }
.steps { margin: 12px 0; padding-left: 1.2em; }
.steps li { margin: 8px 0; }
.log-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.log-table th, .log-table td {
  border-bottom: 1px solid var(--line);
  padding: 6px 4px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}
.trend-svg { display: block; width: 100%; height: auto; margin-top: 8px; }

html[data-brand="aibloodbuddy"] .block,
html[data-brand="aibloodbuddy"] .edit-list,
html[data-brand="aibloodbuddy"] .sales,
html[data-brand="aibloodbuddy"] .modal-card {
  background: linear-gradient(180deg, #5A0C18, #3A0810);
}
html[data-brand="aibloodbuddy"] .nav {
  background: #1A070C;
  border-top-color: #5A0C18;
}
html[data-brand="aibloodbuddy"] .nav button {
  color: #F3C7CC;
  font-size: 13px;
}
html[data-brand="aibloodbuddy"] .secondary {
  color: #FFF4F0;
  border-color: #F0C85A;
}
html[data-brand="aibloodbuddy"] a.buy {
  color: #F0C85A;
  font-size: 17px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 2px;
}
.sales-hero { margin: 0 0 12px; }
.sales-mark svg { display: block; width: 88px; height: 88px; }
.sales-banner svg { display: block; width: 100%; height: auto; margin-top: 12px; }

@media print {
  body, .sales, .screen, .block, .print-sheet, .log-table, .steps {
    background: #fff !important;
    color: #000 !important;
  }
  .nav, .no-print, .intro, .welcome, .sales { display: none !important; }
  .screen { padding: 0; }
  .log-table th, .log-table td { border-color: #000; color: #000; }
}
