/* Mobile-first. A parent checks this standing in a kitchen, one-handed. */
:root {
  --ink: #16202b;
  --ink-2: #4a5866;
  --ink-3: #75828f;
  --line: #e2e7ec;
  --bg: #f6f8fa;
  --card: #ffffff;
  --brand: #1f5f8b;
  --brand-ink: #10405f;
  --overdue: #a3231f;
  --overdue-bg: #fdecea;
  --week: #8a4b00;
  --week-bg: #fff4e2;
  --soon: #1f5f8b;
  --soon-bg: #eaf3f9;
  --later: #5a6672;
  --later-bg: #f0f2f5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22,32,43,.06), 0 4px 12px rgba(22,32,43,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .wrap { padding-top: 14px; padding-bottom: 12px; }
.brand { display: flex; gap: 12px; align-items: center; }
.mark {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #2c7fb3);
}
h1 { font-size: 1.05rem; margin: 0; letter-spacing: -0.01em; }
.sub { margin: 1px 0 0; font-size: .8rem; color: var(--ink-3); }

.childbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 7px 13px; border-radius: 999px; font-size: .85rem; cursor: pointer;
  font-weight: 500; min-height: 36px;
}
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.add { border-style: dashed; color: var(--ink-3); }

.tabs { display: flex; gap: 2px; margin-top: 14px; overflow-x: auto; }
.tab {
  border: 0; background: none; padding: 10px 14px; font-size: .9rem; font-weight: 600;
  color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab.is-active { color: var(--brand-ink); border-bottom-color: var(--brand); }

main { padding-bottom: 32px; padding-top: 6px; }
.loading { color: var(--ink-3); padding: 24px 0; }

.group { margin-top: 22px; }
.group > h2 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); margin: 0 0 8px; font-weight: 700;
}
.count { color: var(--ink-3); font-weight: 600; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.card.overdue { border-left: 3px solid var(--overdue); }
.card.this-week { border-left: 3px solid var(--week); }

.when {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 8px;
  border-radius: 6px; margin-bottom: 8px; letter-spacing: .01em;
}
.when.overdue { background: var(--overdue-bg); color: var(--overdue); }
.when.this-week { background: var(--week-bg); color: var(--week); }
.when.soon { background: var(--soon-bg); color: var(--soon); }
.when.later { background: var(--later-bg); color: var(--later); }

.card h3 { margin: 0 0 4px; font-size: 1rem; line-height: 1.35; }
.card .do { margin: 0; color: var(--ink-2); font-size: .92rem; }
.card .meta { margin: 8px 0 0; font-size: .78rem; color: var(--ink-3); }
.years { font-size: .72rem; color: var(--ink-3); font-weight: 600; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 13px; border-radius: 9px; font-size: .86rem; font-weight: 600;
  cursor: pointer; min-height: 40px;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-quiet { background: #fff; color: var(--ink-2); }
.btn:active { transform: translateY(1px); }

/* Honesty notice. Deliberately visible: this product must never imply certainty
   it does not have. */
.caveat {
  margin: 10px 0 0; padding: 8px 10px; background: #fffbef; border: 1px solid #f0e2bd;
  border-radius: 8px; font-size: .78rem; color: #6b5514;
}
.caveat strong { font-weight: 700; }

.note {
  background: #eaf3f9; border: 1px solid #cfe2ee; color: var(--brand-ink);
  padding: 12px 14px; border-radius: var(--radius); font-size: .87rem; margin: 16px 0;
}
.note h2 { margin: 0 0 6px; font-size: .92rem; }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.note li { margin: 3px 0; }

.empty { color: var(--ink-3); padding: 28px 4px; text-align: center; }

.app { display: flex; gap: 12px; align-items: flex-start; }
.app .body { flex: 1 1 auto; min-width: 0; }
.app h3 { margin: 0 0 2px; }
.badge {
  font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 5px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.badge.confirmed { background: #e7f4ec; color: #1d6b3a; }
.badge.reported { background: #fff4e2; color: var(--week); }
.badge.inferred { background: var(--later-bg); color: var(--later); }

.day { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.day:last-child { border-bottom: 0; }
.day .date { flex: 0 0 76px; font-size: .78rem; font-weight: 700; color: var(--ink-2); }
.day .what { flex: 1 1 auto; min-width: 0; }
.day .what p { margin: 0; font-size: .93rem; }
.day .what small { color: var(--ink-3); font-size: .76rem; }

dialog {
  border: 0; border-radius: 14px; padding: 20px; max-width: 360px; width: calc(100% - 32px);
  box-shadow: 0 10px 40px rgba(22,32,43,.22);
}
dialog::backdrop { background: rgba(22,32,43,.45); }
dialog h2 { margin: 0 0 14px; font-size: 1.05rem; }
dialog label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }
dialog input, dialog select {
  width: 100%; margin-top: 5px; padding: 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 1rem; font-family: inherit;
}
dialog .hint { font-size: .76rem; color: var(--ink-3); margin: 0 0 14px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; margin: 0; padding: 0; }

.foot { color: var(--ink-3); font-size: .76rem; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.foot p { margin: 0 0 18px; }

@media (min-width: 600px) {
  h1 { font-size: 1.2rem; }
  .card { padding: 16px; }
}

/* --- Month calendar --------------------------------------------------- */
.cal { margin-top: 16px; }
.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.cal-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.cal-nav {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  width: 40px; height: 40px; border-radius: 10px; font-size: 1.3rem; line-height: 1;
  cursor: pointer;
}
.cal-nav:active { background: var(--bg); }

.cal-days {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-bottom: 4px;
}
.cal-days span {
  text-align: center; font-size: .7rem; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1; border: 1px solid var(--line);
  background: var(--card); border-radius: 9px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 0; font: inherit; color: var(--ink);
  /* A phone tap target must not be smaller than this. */
  min-height: 42px;
}
.cal-cell.is-empty { border: 0; background: none; cursor: default; }
.cal-cell.has-items { background: #fff; border-color: #cfe2ee; }
.cal-cell.is-today { border-color: var(--brand); border-width: 2px; }
.cal-cell.is-selected { background: var(--brand); border-color: var(--brand); }
.cal-cell.is-selected .cal-num { color: #fff; }
.cal-cell.is-selected .cal-dot { background: #fff; }
.cal-num { font-size: .85rem; font-weight: 600; }
.cal-cell.is-today .cal-num { color: var(--brand-ink); font-weight: 800; }

.cal-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--soon);
  display: inline-block;
}
.cal-dot.is-action { background: var(--week); }

.cal-key {
  display: flex; gap: 16px; justify-content: center; margin-top: 12px;
  font-size: .74rem; color: var(--ink-3);
}
.cal-key span { display: inline-flex; align-items: center; gap: 5px; }
.cal-key i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--soon); }
.cal-key i.is-action { background: var(--week); }

/* --- App picker & accounts -------------------------------------------- */
.warn {
  background: #fdf3e3; border: 1px solid #e8cf9f; color: #6b4a14;
  padding: 12px 14px; border-radius: var(--radius); margin: 16px 0; font-size: .87rem;
}
.warn h3 { margin: 0 0 6px; font-size: .92rem; }
.warn p { margin: 0 0 6px; }
.warn p:last-child { margin-bottom: 0; }

.search {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 1rem; font-family: inherit; background: #fff;
  margin-bottom: 14px; -webkit-appearance: none;
}
.search:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }

.card-flush { padding: 0; overflow: hidden; }

.pick-head {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 700; margin: 16px 0 6px;
}

/* A whole row is the tap target. Small buttons on a phone get missed. */
.pick {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; text-align: left; font: inherit; color: var(--ink);
  cursor: pointer; min-height: 60px;
}
.pick:last-child { border-bottom: 0; }
.pick:active { background: var(--bg); }
.pick.is-saved { cursor: default; }
.pick-body { flex: 1 1 auto; min-width: 0; }
.pick-name { margin: 0 0 2px; font-weight: 600; font-size: .95rem; }
.pick-body small {
  color: var(--ink-3); font-size: .78rem; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.pick-add {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--soon-bg); color: var(--brand); font-size: 1.2rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.btn-sm { padding: 6px 11px; font-size: .8rem; min-height: 34px; }

dialog .hint#credentialFor { font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }

/* Form fields inside a card, not just inside a dialog. */
.card label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--ink-2); margin-bottom: 12px;
}
.card label input, .card label select {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 1rem; font-family: inherit; -webkit-appearance: none;
}
.card label input:focus {
  outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand);
}

/* The hidden attribute must win.
   `display: block` on a label beats the browser's default [hidden] rule, so
   fields meant to be hidden were showing. This is the fix, and it has to stay
   after the rules that set display. */
[hidden] { display: none !important; }
