/* Dosely on the web, dressed like the app: deep navy with an aqua glow,
   quiet glass cards, rounded type, coloured medicine icons. Always dark,
   like the app's default. */
:root {
  --navy-top: #0d1430;      /* 0.05 0.08 0.17 */
  --navy: #080d1c;          /* navyDeep */
  --navy-bottom: #050814;
  --navy-light: #142147;
  --brand: #47c7d9;         /* aqua, the app's accent */
  --brand-deep: #2194ab;
  --text: #f2f5fa;
  --muted: rgba(235, 240, 255, .62);
  --faint: rgba(235, 240, 255, .38);
  --glass: rgba(255, 255, 255, .075);
  --glass-strong: rgba(255, 255, 255, .12);
  --line: rgba(255, 255, 255, .09);
  --late: #ff9f0a;
  --ok: #30d158;
  --r-card: 22px;
  --r-large: 28px;
  --r-control: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--navy-bottom); }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(260px 260px at 78% -40px, rgba(71, 199, 217, .16), transparent 70%),
    radial-gradient(300px 300px at 10% 110%, rgba(20, 33, 71, .55), transparent 70%),
    linear-gradient(180deg, var(--navy-top), var(--navy) 50%, var(--navy-bottom));
  background-attachment: fixed;
}
main { max-width: 560px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px 48px; }
h1, h2, .metric, .brand, .large-title {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
}

/* Top bar */
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.logo { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 .5px rgba(255, 255, 255, .2); }

/* Surfaces */
.card, .person {
  background: var(--glass); border-radius: var(--r-card); padding: 18px; margin-bottom: 14px;
  box-shadow: inset 0 0 0 .5px var(--line);
  -webkit-backdrop-filter: blur(24px) saturate(1.3); backdrop-filter: blur(24px) saturate(1.3);
}
.person { padding: 0; overflow: hidden; position: relative; }
.person::before {                      /* the app's accent bar */
  content: ""; position: absolute; inset-block: 16px; inset-inline-start: 0; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--tint);
}
.person.behind { background: linear-gradient(0deg, rgba(255, 159, 10, .06), rgba(255, 159, 10, .06)), var(--glass); }

h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 6px; font-weight: 700; }
h2 { font-size: 19px; margin: 0; font-weight: 700; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--late); font-size: 14px; margin-top: 10px; }
.hidden { display: none !important; }
.note { background: rgba(71, 199, 217, .12); }

/* Page title, like a large navigation title */
.page-head { position: relative; margin: 4px 2px 14px; }
.large-title { font-size: 34px; margin: 0; letter-spacing: .2px; }
.subtitle { color: var(--muted); margin: 2px 0 0; font-size: 15px; }
.live {
  position: absolute; inset-inline-end: 0; top: 10px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--brand); background: rgba(71, 199, 217, .12);
  padding: 5px 10px; border-radius: 99px;
}
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* Forms */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; color: var(--muted); }
input {
  width: 100%; font: inherit; padding: 14px 16px; border-radius: var(--r-control); border: 0;
  background: rgba(255, 255, 255, .08); color: var(--text); box-shadow: inset 0 0 0 .5px var(--line);
}
input::placeholder { color: var(--faint); }
input:focus { outline: 2px solid var(--brand); }
input.code { font-size: 28px; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }

/* Buttons: prominent aqua, and quiet glass */
button {
  font: inherit; font-weight: 600; border: 0; cursor: pointer; border-radius: 999px;
  padding: 15px 18px; width: 100%; margin-top: 14px; color: #04212a;
  background: linear-gradient(180deg, #6fd8e6, var(--brand));
  box-shadow: 0 6px 20px rgba(71, 199, 217, .25), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .12s ease, opacity .2s;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }
button.ghost {
  background: var(--glass-strong); color: var(--brand); box-shadow: inset 0 0 0 .5px var(--line);
}
button.small { width: auto; margin: 0; padding: 8px 14px; font-size: 14px; }
button.link { background: none; box-shadow: none; color: var(--brand); padding: 8px 0; width: auto; margin: 6px 0 0; }

/* One person */
.person-top { display: flex; align-items: center; gap: 13px; padding: 16px 16px 6px 18px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 26px;
  background: color-mix(in srgb, var(--tint, var(--brand)) 22%, transparent);
  box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--tint, var(--brand)) 40%, transparent);
}
.person-text { flex: 1; min-width: 0; }
.person-text .muted { font-size: 13px; margin-top: 2px; }
.ring {
  --size: 58px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; display: grid; place-items: center;
  background:
    radial-gradient(closest-side, #0b1226 80%, transparent 81% 100%),
    conic-gradient(var(--tint) calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0);
}
.metric { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.metric small { font-size: 12px; color: var(--muted); font-weight: 600; }
.headline { margin: 2px 18px 6px; font-size: 14px; color: var(--muted); }
.headline.warn { color: var(--late); font-weight: 600; }
.tz { margin: 0 18px 14px; font-size: 12px; }
.empty-day { padding: 6px 18px 16px; margin: 0; }

/* One dose, like the app's rows */
.doses { padding-bottom: 6px; }
.dose {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px 11px 18px;
  border-top: .5px solid var(--line); transition: opacity .2s;
}
.dose.busy { opacity: .5; }
.dose.done .name { color: var(--muted); }
.med-icon {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: var(--tint); background: color-mix(in srgb, var(--tint) 20%, transparent);
}
.med-icon svg { width: 20px; height: 20px; }
.what { flex: 1; min-width: 0; }
.name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { font-size: 13px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dose.late .name + .sub { color: var(--late); }
.actions { display: flex; gap: 6px; flex: none; }
.chip { width: auto; margin: 0; padding: 8px 13px; font-size: 14px; }
.chip.ghost { background: var(--glass-strong); color: var(--text); box-shadow: inset 0 0 0 .5px var(--line); }
.chip.primary { padding-inline: 15px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 99px; white-space: nowrap; flex: none;
}
.pill svg { width: 12px; height: 12px; }
.pill.taken { background: rgba(48, 209, 88, .16); color: var(--ok); }
.pill.skipped { background: rgba(255, 255, 255, .1); color: var(--muted); }
.pill.late { background: rgba(255, 159, 10, .16); color: var(--late); }
.pill.due { background: rgba(71, 199, 217, .14); color: var(--brand); }
.sub .pill { margin-top: 4px; }

footer { text-align: center; margin-top: 26px; }
footer .muted { margin-bottom: 10px; }

[dir="rtl"] .person::before { border-radius: 3px 0 0 3px; }

/* All medicines, under each person */
.meds { border-top: .5px solid var(--line); padding: 4px 0 12px; }
.disclosure {
  display: flex; justify-content: space-between; align-items: center; width: 100%; margin: 0;
  background: none; box-shadow: none; color: var(--text); padding: 12px 18px; border-radius: 0; font-size: 15px;
}
.chev { color: var(--faint); font-size: 22px; line-height: 1; transition: transform .2s; }
.meds.open .disclosure .chev { transform: rotate(90deg); }
/* › mirrors to ‹ in RTL, so it turns the other way to point down. */
[dir="rtl"] .meds.open .disclosure .chev { transform: rotate(-90deg); }
.med-list { display: none; }
.meds.open .med-list { display: block; }
.meds .add-med { display: none; margin: 8px 18px 0; }
.meds.open .add-med { display: inline-flex; }
.med-row {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 10px 16px 10px 18px;
  background: none; box-shadow: none; border-radius: 0; color: var(--text); text-align: start; font-weight: 400;
}
button.med-row:active { background: rgba(255, 255, 255, .05); transform: none; }
.med-icon.small { width: 32px; height: 32px; }
.med-icon.small svg { width: 17px; height: 17px; }

/* The sheet for adding or changing a medicine */
dialog {
  border: 0; padding: 0; color: var(--text); width: min(560px, 100%); max-height: 92vh;
  margin: auto auto 0; border-radius: var(--r-large) var(--r-large) 0 0;
  background: linear-gradient(180deg, #121a36, #0a1024); box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
}
@media (min-width: 600px) { dialog { margin: auto; border-radius: var(--r-large); } }
dialog::backdrop { background: rgba(2, 4, 12, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog[open] { animation: rise .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
#med-form { padding: 6px 18px max(22px, env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92vh; }
.sheet-head {
  position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 12px 0; background: #121a36;
}
.sheet-head h2 { font-size: 17px; text-align: center; }
.sheet-head .link { margin: 0; justify-self: start; }
.sheet-head .link.strong { justify-self: end; font-weight: 700; }
select {
  width: 100%; font: inherit; padding: 13px 16px; border-radius: var(--r-control); border: 0; color: var(--text);
  background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 .5px var(--line); appearance: none;
}
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.segmented button, .days button {
  margin: 0; padding: 9px 6px; font-size: 14px; background: none; box-shadow: none; color: var(--muted); flex: 1;
}
.segmented button.on { background: rgba(255, 255, 255, .16); color: var(--text); }
.days { display: flex; gap: 6px; }
.days button { width: 40px; height: 40px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.days button.on { background: var(--brand); color: #04212a; }
.time-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.time-row input { flex: 1; }
.time-row .chip { flex: none; }
.add-time { margin-top: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button {
  width: 32px; height: 32px; padding: 0; margin: 0; border-radius: 50%; background: var(--tint); box-shadow: none;
}
.swatches button.on { box-shadow: 0 0 0 2px #0a1024, 0 0 0 4px var(--tint); }
button.danger { background: rgba(255, 69, 58, .14); color: #ff6961; box-shadow: none; margin-top: 22px; }
dialog:focus, dialog:focus-visible { outline: none; }

/* The lock screen, every visit */
.lock-card { text-align: center; padding: 28px 20px; }
.avatar.lock { margin: 0 auto 12px; width: 64px; height: 64px; font-size: 28px; }
.lock-card .code { margin-top: 18px; }
.private-note { text-align: center; color: var(--faint); font-size: 13px; margin: 22px 0 0; }

/* ---- Easier to use ---- */

/* Every tappable thing is at least 44pt, the size a thumb needs. */
.chip { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.chip svg { width: 15px; height: 15px; }
button.link { min-height: 44px; }
.days button { width: 44px; height: 44px; }
.swatches button { width: 36px; height: 36px; }

/* Keyboard users can see where they are. */
button:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 3px;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; }

/* What this page is for, when someone lands here without an invite. */
.points { list-style: none; padding: 0; margin: 14px 0 2px; display: grid; gap: 10px; }
.points:empty { display: none; }
.points li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.points svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--brand); }

/* Loading says it's working. */
.loading { display: flex; align-items: center; gap: 12px; }
.loading p { margin: 0; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255, 255, 255, .15); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* The late dose is the one that needs doing: make it stand out. */
.dose.late { background: rgba(255, 159, 10, .06); }

/* Errors read as errors, with room to breathe. */
.error:not(.hidden) { line-height: 1.4; }
.card.error { color: var(--late); background: rgba(255, 159, 10, .1); }

/* Narrow phones: keep both dose buttons on the row. */
@media (max-width: 380px) {
  .dose { gap: 10px; padding-inline: 14px 12px; }
  .chip { padding: 8px 11px; font-size: 13px; }
  .large-title { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .spinner { border-top-color: var(--brand); }
}

/* ---- Privacy and support pages ---- */
.doc a { color: var(--brand); }
.doc .brand { color: var(--text); text-decoration: none; }
.doc article { line-height: 1.55; }
.doc article h1 { font-size: 28px; line-height: 1.2; margin: 4px 0 12px; }
.doc article h2 { font-size: 20px; margin: 28px 0 8px; }
.doc article h3 { font-size: 17px; margin: 20px 0 4px; }
.doc article p, .doc article li { color: rgba(242, 245, 250, .86); }
.doc article ul { padding-inline-start: 22px; }
.doc article li { margin: 6px 0; }
.doc-links { text-align: center; color: var(--faint); font-size: 14px; margin-top: 18px; }
