/* Sitaray: a cool, quiet app around one bold thing, the child's night sky of stars. */
:root {
  --bg: #f3f5fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --text: #172036;
  --muted: #586380;
  --line: #dde2ee;
  --accent: #3b41a8;          /* indigo: links and buttons */
  --accent-ink: #ffffff;
  --accent-soft: #e6e8fa;
  --night: #1b1f4b;           /* the child's sky, the same in both themes */
  --night-ink: #eef0ff;
  --night-muted: #c3c7ee;
  --gold: #f5b301;            /* stars */
  --gold-ink: #8a5a00;        /* star numbers on light surfaces */
  --good: #1c6b3a;            /* flag green: earned, approve */
  --good-ink: #ffffff;
  --good-soft: #e1f1e6;
  --warn: #8a5a00;
  --warn-soft: #fcf0d2;
  --bad: #b8322a;
  --bad-soft: #fbe3e1;
  --shadow: 0 1px 2px rgba(23, 32, 54, .06);
  --radius: 14px;
  --display: "Baloo Bhaijaan 2", ui-rounded, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10132b; --surface: #181c3a; --surface-2: #222750; --text: #eceefb; --muted: #a3a9cc; --line: #2e3463;
    --accent: #a4abff; --accent-ink: #10132b; --accent-soft: #2a2f63; --night: #0b0e26;
    --gold-ink: #f5c542; --good: #4cc17a; --good-ink: #0b1f13; --good-soft: #15321f;
    --warn: #f5c542; --warn-soft: #3a2f14; --bad: #ff8a80; --bad-soft: #3d1c1c; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10132b; --surface: #181c3a; --surface-2: #222750; --text: #eceefb; --muted: #a3a9cc; --line: #2e3463;
  --accent: #a4abff; --accent-ink: #10132b; --accent-soft: #2a2f63; --night: #0b0e26;
  --gold-ink: #f5c542; --good: #4cc17a; --good-ink: #0b1f13; --good-soft: #15321f;
  --warn: #f5c542; --warn-soft: #3a2f14; --bad: #ff8a80; --bad-soft: #3d1c1c; --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* layout rules below (flex, grid) must not bring hidden things back */
html { -webkit-text-size-adjust: 100%; background: var(--bg); min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.005em; }
h1 { font-size: 1.85rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; margin-top: 1.5em; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: .4em 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.page-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }

/* ---- top bar and navigation ---- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-weight: 800; font-size: 1.35rem; text-decoration: none; color: var(--text); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.beta {
  font-family: system-ui, sans-serif; font-size: .7rem; font-weight: 700; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn);
}
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 7px 11px; border-radius: 8px; text-decoration: none; color: var(--muted); white-space: nowrap; font-weight: 600; font-size: .95rem;
}
.nav a:hover { color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.feedback { display: flex; gap: 2px; margin-left: auto; }
.icon-link {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; font-size: 1.15rem; line-height: 1;
  text-decoration: none; filter: grayscale(.4); opacity: .8;
}
.icon-link:hover, .icon-link:focus-visible { background: var(--surface-2); filter: none; opacity: 1; }
.badge { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 6px; font-size: .72rem; font-weight: 700; margin-left: 4px; }

/* Phones: the menu moves to a tab bar along the bottom, within thumb reach. */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px env(safe-area-inset-bottom);
}
.tabbar a, .tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 56px; position: relative;
  color: var(--muted); text-decoration: none; font: 600 .72rem/1.2 system-ui, sans-serif; background: none; border: 0; border-radius: 10px; cursor: pointer;
}
.tabbar .ic { font-size: 1.3rem; line-height: 1; filter: grayscale(1); opacity: .75; }
.tabbar .on { color: var(--accent); }
.tabbar .on .ic { filter: none; opacity: 1; }
.tabbar .badge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; }
.more-list { display: grid; gap: 4px; }
.more-list a { display: block; padding: 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600; background: var(--surface-2); }
.more-list a.on { color: var(--accent); background: var(--accent-soft); }

.page { max-width: 960px; margin: 0 auto; padding: 24px 16px 80px; }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.list > * + * { margin-top: 10px; }

/* Lists of things to act on: one surface, rows split by hairlines. */
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.item { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 12px; align-items: center; padding: 14px 16px; }
.item + .item { border-top: 1px solid var(--line); }
.item > .emoji { align-self: start; padding-top: 2px; }
.item .title { font-weight: 650; }
.item .meta { color: var(--muted); font-size: .875rem; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- controls ---- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 650;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; justify-content: center;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.good { background: var(--good); color: var(--good-ink); }
.btn.bad { background: var(--bad-soft); color: var(--bad); }
.btn.danger { background: transparent; color: var(--bad); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn.big { font-size: 1.1rem; padding: 14px 22px; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-height: 44px;
}
input::placeholder { text-transform: none; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
textarea { min-height: 80px; }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 8px 0; }
.hint { font-size: .85rem; color: var(--muted); font-weight: 400; margin-top: 4px; }
.error { color: var(--bad); }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 650;
  background: var(--surface-2); color: var(--muted);
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.emoji { font-size: 1.8rem; line-height: 1; }
.avatar { font-size: 2rem; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); flex: none; }
.avatar.sm { font-size: 1.6rem; width: 44px; height: 44px; }
.pts { font-family: var(--display); font-weight: 800; color: var(--gold-ink); white-space: nowrap; font-size: 1.1rem; line-height: 1; }
.pts.big { font-size: 1.5rem; }
.need { color: var(--muted); font-size: .9rem; font-weight: 600; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--good); border-radius: 999px; transition: width .3s; }
.goal { margin-top: 10px; }
.goal .progress { margin: 6px 0 4px; }
.goal.done .progress > i { background: var(--gold); }

/* ---- the child's sky ---- */
.sky {
  position: relative; overflow: hidden; border-radius: 20px; background: var(--night); color: var(--night-ink); border: 1px solid var(--line);
  padding: 84px 20px 20px; min-height: 240px; display: flex; flex-direction: column; justify-content: flex-end;
}
.sky .stars { position: absolute; inset: 0; }
.sky .stars svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky .star { position: absolute; top: var(--y); width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: .25; transform: translate(-50%, -50%); }
.sky .star.lit { width: 7px; height: 7px; background: var(--gold); opacity: 1; box-shadow: 0 0 8px 1px rgba(245, 179, 1, .65); }
.sky .line { stroke: var(--gold); stroke-width: 1.5; stroke-opacity: .5; fill: none; }
.sky .line.wide { display: none; }
.sky > :not(.stars) { position: relative; }
.sky .hi { color: var(--night-muted); font-weight: 600; }
.sky .balance { font-family: var(--display); font-size: 3.6rem; font-weight: 800; line-height: 1; display: flex; align-items: baseline; gap: 8px; margin: 2px 0 4px; }
.sky .balance small { font-size: 1.1rem; font-weight: 700; color: var(--gold); font-family: var(--display); }
.sky .goal { max-width: 420px; }
.sky .goal .muted, .sky .goal-link { color: var(--night-muted); }
.sky .goal .pts { color: var(--gold); }
.sky .progress { background: rgba(255, 255, 255, .15); }
.sky .progress > i { background: var(--gold); }
.sky .goal-link { font-size: .9rem; }
.sky .goal-link a { color: #fff; }
/* On wider screens the words sit on the left and the stars fill the rest, instead of a strip along the top. */
@media (min-width: 721px) {
  .sky { padding: 32px; min-height: 230px; justify-content: center; }
  .sky > :not(.stars) { max-width: calc(45% - 32px); }
  .sky .stars { left: 45%; }
  .sky .star { top: var(--yw); }
  .sky .line.narrow { display: none; }
  .sky .line.wide { display: inline; }
}
/* One moment when the screen opens: the lit stars twinkle in, one after another. */
@media (prefers-reduced-motion: no-preference) {
  .sky .star.lit { animation: twinkle-in .6s both; animation-delay: calc(var(--i) * 45ms); }
}
@keyframes twinkle-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1.5); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}


/* ---- task and reward cards for children ---- */
.task-card .head, .reward-card .head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.task-card h3, .reward-card h3 { margin: 0; }
.reward-card .actions, .task-card .actions { margin-top: 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Filter buttons: one line that scrolls sideways on a phone. */
.chips { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; scrollbar-width: thin; }
.chips button {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; min-height: 36px; white-space: nowrap;
}
.chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chips .count { margin-left: 6px; color: var(--muted); font-weight: 500; font-size: .8rem; }
.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice {
  border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 14px; cursor: pointer; text-align: left;
  font: inherit; color: var(--text);
}
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice-grid .choice { position: relative; }
.choice-grid .choice.on::after {
  content: "✓"; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: .8rem; font-weight: 800;
}
.choice .emoji { display: block; margin-bottom: 6px; }

.wait-options { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.wait-options .choice { text-align: center; }
.wait-options .bonus { color: var(--good); font-weight: 800; }
.nudge { background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }

.login-hero { text-align: center; margin: 12px 0 20px; }
.login-hero h1 { font-size: 2.4rem; margin: 4px 0 0; }

.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; margin-top: 12px; }
.pin-pad button { height: 64px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 700 1.5rem var(--display); cursor: pointer; }
.pin-dots { text-align: center; font-size: 2rem; letter-spacing: .3em; min-height: 2.6rem; }

dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(10, 14, 40, .35);
}
dialog::backdrop { background: rgba(11, 14, 38, .5); }
dialog .dlg-body { padding: 20px; overflow-y: auto; max-height: calc(100dvh - 120px); }
dialog .dlg-actions { padding: 12px 20px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
dialog .dlg-actions .danger { margin-right: auto; } /* removing sits apart from saving */

/* Hidden toasts are invisible, not just moved, so nothing peeks over the bottom edge. */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 12px); opacity: 0; visibility: hidden;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600;
  transition: transform .2s, opacity .2s, visibility .2s; max-width: calc(100vw - 32px); z-index: 50;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.bad { background: var(--bad); color: #fff; }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; font-size: .95rem; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.ledger td:first-child { width: 32px; }
.code { font-family: ui-monospace, monospace; font-size: 1.3rem; font-weight: 800; letter-spacing: .1em; }

/* help page */
.steps { margin: 0; padding-left: 1.3em; max-width: 70ch; }
.steps > li + li { margin-top: 8px; }
.code.inline { display: inline; font-size: inherit; }
details.help { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; margin-top: 8px; }
details.help > summary { cursor: pointer; font-weight: 600; padding: 12px 0; min-height: 44px; }
details.help[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 4px; }
details.help > p { margin: 8px 0 12px; max-width: 70ch; }

/* Phones and tablets get the tab bar: below about 1024px the full top menu no longer fits on one line. */
@media (max-width: 1023px) {
  .nav { display: none; }
  .tabbar:not([hidden]) ~ .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (min-width: 1024px) { .tabbar { display: none; } }
@media (max-width: 720px) {
  h1 { font-size: 1.6rem; }
  .sky .balance { font-size: 3rem; }
  .pin-pad { grid-template-columns: repeat(3, 64px); }
  /* Actions drop under the text so long titles get the full width. */
  .item { grid-template-columns: 36px 1fr; }
  .item .actions { grid-column: 2; justify-content: flex-start; }
  .item .side { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* first-time setup walkthrough: three steps, shown as a bar that fills as you go */
.setup-steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0; margin: 8px 0 20px; }
.setup-steps li { border-top: 4px solid var(--line); padding-top: 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.setup-steps li.done { border-color: var(--good); }
.setup-steps li.on { border-color: var(--accent); color: var(--text); }
.setup-nav { margin-top: 20px; }
.avatars .choice { padding: 6px 10px; font-size: 1.5rem; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { flex: 1; min-width: 0; font-size: .9rem; }

/* prayer times */
.prayer-times { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.prayer-times > div { background: var(--surface-2); border-radius: 10px; padding: 8px 6px; text-align: center; display: flex; flex-direction: column; }
.prayer-times > div span { font-size: .8rem; color: var(--muted); }
.prayer-times > div strong { font-family: var(--display); font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prayer-times > div.on { background: var(--accent-soft); outline: 2px solid var(--accent); }
.prayer-times > div.on span { color: var(--accent); }
.prayer-times em { font-style: normal; }
/* Phones: five times don't fit across, so they become a list. */
@media (max-width: 520px) {
  .prayer-times { grid-template-columns: 1fr; gap: 4px; }
  .prayer-times > div { flex-direction: row; justify-content: space-between; align-items: baseline; padding: 8px 12px; text-align: left; }
  .prayer-times > div span { font-size: .95rem; color: var(--text); }
}
.sky .next-prayer { margin: 10px 0 0; color: var(--night-muted); font-size: .92rem; position: relative; }
.nudge-card { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.nudge-card > .grow { flex: 1 1 200px; }
.nudge-card > .emoji { font-size: 1.6rem; }

/* ---- the family assistant: a night-sky button, and a chat panel docked at the bottom right (full screen on phones) ---- */
.assistant-fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 25; display: flex; align-items: center; gap: 8px;
  padding: 10px 18px 10px 12px; min-height: 48px; border: 1px solid var(--night); border-radius: 999px; cursor: pointer;
  background: var(--night); color: var(--night-ink); font: 700 1rem/1 var(--display); box-shadow: 0 6px 20px rgba(11, 14, 38, .28);
}
/* On a dark page the night-blue button would disappear, so it takes a lighter fill and an outline there. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .assistant-fab { background: var(--accent-soft); color: var(--text); border-color: var(--accent); box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
}
:root[data-theme="dark"] .assistant-fab { background: var(--accent-soft); color: var(--text); border-color: var(--accent); box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
/* A gold dot when an answer arrived while the panel was closed. */
.assistant-fab.unread::after {
  content: ""; position: absolute; top: 2px; right: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--surface);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.assistant-fab .star { font-size: 1.3rem; line-height: 1; }
.assistant-fab:hover { filter: brightness(1.15); }
.assistant {
  position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column;
  width: min(420px, calc(100vw - 32px)); height: min(680px, calc(100dvh - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 12px 40px rgba(11, 14, 38, .25);
}
.assistant-head { display: flex; align-items: center; gap: 4px; padding: 12px 8px 12px 16px; background: var(--night); color: var(--night-ink); }
.assistant-head h2 { margin: 0; font-size: 1.15rem; }
.assistant-head p { margin: 0; font-size: .82rem; color: var(--night-muted); }
.assistant-head .icon-btn {
  appearance: none; border: 0; background: transparent; color: var(--night-ink); font-size: 1.15rem; width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
}
.assistant-head .head-btn {
  appearance: none; font: 600 .88rem/1 system-ui, sans-serif; color: var(--night-ink); background: transparent; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 0 12px; min-height: 36px; white-space: nowrap;
}
.assistant-head .icon-btn:hover, .assistant-head .head-btn:hover { background: rgba(255, 255, 255, .12); }
.assistant-head .icon-btn:focus-visible, .assistant-head .head-btn:focus-visible { outline-color: var(--gold); }
.assistant-log .day { align-self: center; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 2px 10px; border-radius: 999px; background: var(--surface-2); }
.assistant-log code { font-size: .9em; background: var(--surface); padding: 0 4px; border-radius: 4px; }
.assistant-log .msg.me.failed { opacity: .7; }
.send-error { align-self: flex-end; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; color: var(--bad); font-size: .9rem; max-width: 88%; text-align: right; }
.assistant-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.assistant-log .msg { max-width: 88%; padding: 9px 13px; border-radius: 16px; overflow-wrap: anywhere; }
.assistant-log .msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.assistant-log .msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.assistant-log .msg.note { align-self: center; background: none; color: var(--muted); font-size: .88rem; text-align: center; }
.assistant-log .msg p { margin: 0; }
.assistant-log .msg p + p, .assistant-log .msg p + ul, .assistant-log .msg p + ol, .assistant-log .msg ul + p, .assistant-log .msg ol + p { margin-top: 8px; }
.assistant-log ul, .assistant-log ol { margin: 4px 0 0; padding-left: 1.25em; }
.assistant-log li + li { margin-top: 2px; }
.assistant-empty p { color: var(--muted); margin: 0 0 12px; }
.starters { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.chip {
  appearance: none; font: inherit; font-size: .92rem; text-align: left; cursor: pointer; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--accent); font-weight: 600;
}
.chip:hover { background: var(--accent-soft); }
.checkin { border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 12px; padding: 10px 14px; background: var(--surface); }
.checkin-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.checkin-head span { color: var(--muted); font-size: .85rem; }
.checkin p { margin: 0; }
.checkin p + p { margin-top: 8px; }
.proposal { align-self: stretch; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.proposal.pending { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.proposal-title { font-size: .8rem; font-weight: 700; color: var(--accent); }
.proposal:not(.pending) .proposal-title { color: var(--muted); }
.proposal-subject { font-weight: 700; font-size: 1.05rem; margin: 2px 0 6px; }
.proposal dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 10px; font-size: .9rem; }
.proposal dt { color: var(--muted); }
.proposal dd { margin: 0; }
.proposal input { max-width: 10em; }
.proposal .row { margin-top: 10px; }
.proposal.pending.danger { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.proposal.pending.danger .proposal-title { color: var(--bad); }
.proposal .error { margin: 8px 0 0; }
.typing { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px !important; }
.typing .dots { display: flex; gap: 4px; }
.typing .slow { font-size: .85rem; color: var(--muted); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; }
@media (prefers-reduced-motion: no-preference) {
  .typing i { animation: typing 1.2s infinite ease-in-out; }
  .typing i:nth-child(2) { animation-delay: .15s; }
  .typing i:nth-child(3) { animation-delay: .3s; }
}
@keyframes typing { 40% { opacity: 1; transform: translateY(-3px); } }
.assistant-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 6px; border-top: 1px solid var(--line); }
.assistant-compose textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; line-height: 1.4; overflow-y: hidden; }
.assistant-foot { margin: 0; padding: 0 12px 10px; font-size: .78rem; color: var(--muted); }
/* Phones and tablets: the button sits above the tab bar; on phones the panel takes the whole screen. */
@media (max-width: 1023px) {
  .assistant-fab { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .assistant { bottom: calc(76px + env(safe-area-inset-bottom)); height: min(680px, calc(100dvh - 108px - env(safe-area-inset-bottom))); }
}
@media (max-width: 720px) {
  .assistant { inset: 0; width: auto; height: 100dvh; border: 0; border-radius: 0; padding-bottom: env(safe-area-inset-bottom); }
  body.assistant-open { overflow: hidden; }
  .assistant-fab { right: 12px; }
}
@media (max-width: 1023px) { body.has-assistant .page { padding-bottom: calc(150px + env(safe-area-inset-bottom)); } }
#help-assistant { scroll-margin-top: 72px; } /* the sticky top bar would cover its heading */

/* Face ID and fingerprint sign-in */
.passkey-btn { width: 100%; }
.passkeys { list-style: none; padding: 0; margin: 0 0 12px; }
.passkeys li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.passkeys li:first-child { border-top: 0; }
.passkeys:last-child { margin-bottom: 0; }
.passkeys strong { margin-right: 8px; }
