:root {
  --ink: #111;
  --bg: #fff;
  --blue: #06245C;
  --green: #085C28;
  --line: #111;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 22px; }
html.xl { font-size: 26px; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.3;
  min-height: 100vh;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: #fff;
  color: #111;
  padding: 8px 12px;
  z-index: 50;
  font-weight: 800;
}
.skip:focus { top: 8px; }

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #111;
  color: #fff;
  text-align: center;
  padding: calc(10px + env(safe-area-inset-top)) 12px 12px;
}
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.appname { margin: 0; font-size: 1.25rem; font-weight: 800; }
button.bar-fresh {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 4px 10px;
  background: #fff;
  color: #111;
  border: 3px solid #fff;
  font-size: 1rem;
}
#disclaimer { margin: 6px 0 0; font-size: 1.05rem; font-weight: 800; }

.banner {
  background: #FFF3A3;
  color: #111;
  border-bottom: 4px solid #111;
  padding: 12px 14px;
}
.banner[hidden] { display: none; }
#banner-text { margin: 0 0 8px; font-weight: 800; font-size: 1.15rem; }
.banner button {
  background: #111;
  color: #fff;
  width: auto;
  min-height: 52px;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px calc(108px + env(safe-area-inset-bottom));
}

h1 { font-size: 1.7rem; margin: 4px 0 10px; line-height: 1.15; }
h1.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
h2 { font-size: 1.45rem; margin: 16px 0 8px; }
.slot h2 { margin: 2px 0 6px; }
h3 { font-size: 1.45rem; margin: 0 0 2px; line-height: 1.15; }
p { margin: 0 0 10px; }

.switcher { display: flex; gap: 8px; margin: 0 0 8px; }
.switcher button {
  flex: 1;
  background: #fff;
  color: #111;
  border: 4px solid #111;
  min-height: 60px;
  font-size: 1.25rem;
}
.switcher button[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.slot h2 { margin: 8px 0; }

.dose {
  border: 4px solid #111;
  border-radius: 18px;
  padding: 10px 12px;
  margin: 0 0 8px;
  background: #fff;
}
.tone-late { background: #FFF4B8; }
.tone-now { background: #E7EEF9; border-color: var(--blue); }
.tone-taken { background: #E3F6E8; border-color: var(--green); }
.tone-skip { background: #fff; }
.flag { font-weight: 800; margin: 0 0 2px; font-size: 1.05rem; }
.amt { font-size: 1.2rem; font-weight: 800; margin: 0 0 2px; }
.notes { margin: 0 0 8px; }

.actions { display: flex; gap: 10px; }
.actions button { flex: 1; min-height: 68px; font-size: 1.3rem; margin: 0; }
.go-taken { background: var(--green); color: #fff; border: 4px solid #043016; }
.go-skip { background: #fff; color: #111; border: 4px solid #111; }
.undo { background: #fff; color: #111; border: 4px solid #111; }

button, .btn, input, select, textarea { font: inherit; color: inherit; }
button, .btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  border-radius: 16px;
  min-height: 64px;
  padding: 12px 14px;
  font-weight: 800;
  background: var(--blue);
  color: #fff;
  border: 4px solid #031533;
  margin: 8px 0;
}
button.secondary, a.secondary {
  background: #fff;
  color: #111;
  border: 4px solid #111;
}
button.ghost, button.slim {
  background: #fff;
  color: #111;
  border: 4px solid #111;
}
button.slim { min-height: 52px; margin: 0 0 8px; padding: 8px 12px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 4px solid var(--blue);
  outline-offset: 3px;
}

label { display: block; font-weight: 800; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  min-height: 60px;
  border: 4px solid #111;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  font-size: 1.1rem;
}
textarea { min-height: 96px; }

.time-row { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; }
.time-row input { flex: 1; }
.time-row button {
  width: auto;
  min-width: 110px;
  margin: 0;
  background: #fff;
  color: #111;
  border: 4px solid #111;
}

.med-row, .person-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}
.med-row p { flex: 1; margin: 0; font-weight: 800; }
.med-row button, .person-row button {
  width: auto;
  min-width: 96px;
  margin: 0;
  min-height: 56px;
  background: #fff;
  color: #111;
  border: 4px solid #111;
}
.person-row input { flex: 1; }

.log { list-style: none; margin: 0 0 12px; padding: 0; }
.log li {
  border-bottom: 3px solid #111;
  padding: 12px 0;
  font-size: 1.15rem;
  font-weight: 700;
}
.act { display: inline-block; margin-left: 6px; }
.act.taken { color: var(--green); }
.act.skip { color: #111; }

#report {
  white-space: pre-wrap;
  border: 4px solid #111;
  border-radius: 16px;
  padding: 12px;
  font: inherit;
  font-weight: 700;
  background: #fff;
  margin: 0 0 8px;
}

#form-error:empty { display: none; }
#form-error { font-weight: 800; background: #FFF4B8; border: 4px solid #111; padding: 10px; border-radius: 12px; }

.limits p { font-size: 1.08rem; }
.repeat {
  background: #111;
  color: #fff;
  font-weight: 800;
  padding: 12px;
  border-radius: 14px;
  text-align: center;
}

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: #111;
  z-index: 15;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  padding: 16px 2px 14px;
  min-height: 64px;
}
.tabs a[aria-current="page"] { background: #fff; color: #111; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  background: #111;
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  z-index: 16;
  max-width: 92vw;
}
#toast:empty { display: none; }

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet[hidden] { display: none; }
.sheet-card {
  background: #fff;
  color: #111;
  width: min(520px, 100%);
  border-radius: 24px 24px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet-card h2 { margin-top: 0; }
#sheet-no { background: #fff; color: #111; border: 4px solid #111; }

.noscript { padding: 16px; font-size: 1.2rem; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
