/* Daily Start, warm, calm, uncluttered. One screen, one answer.
   Brand system: Morning Coral + paper cream, the "Sunrise" mark, pill
   buttons, Source Serif 4 for the human display moments. Photographic
   heroes carry the warmth; content below stays quiet and readable. */

:root {
  /* surfaces & ink */
  --bg: #FAF7F1;        /* cream page */
  --card: #F3EEE4;      /* paper cards */
  --ink: #2E3430;       /* ink text */
  --muted: #6E655C;     /* secondary text */
  --faint: #9A9186;     /* tertiary / timestamps */
  --border: #E7E0D3;    /* hairlines */
  --dashed: #C9BFAF;    /* dashed "add" outlines */

  /* brand */
  --primary: #D9704A;       /* Morning Coral */
  --primary-dark: #B5714C;  /* hover/pressed, eyebrow labels */
  --accent-soft: rgba(217, 112, 74, 0.14); /* soft coral wash */

  /* status (semantic, never decorative) */
  --green: #3F8F5F;   /* day has started */
  --grey:  #8B8A82;   /* quiet so far */
  --amber: #C68A2E;   /* sensors offline, calm, not alarming */
  --blue:  #3E6FA3;   /* away / the Family section accent */
  --blue-dark: #345E88;
  --error: #B23B3B;

  --paper: #FAF7F1;   /* fields on cards */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #EDEAE2;
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.muted.small { font-size: 0.82rem; }
.center { text-align: center; }
a { color: var(--primary); }

/* ---- the Sunrise mark ---- */
.sun { display: block; color: var(--ink); }        /* horizon line = currentColor */
.sun-lg { width: 88px; height: 40px; }

/* ============================================================
   LOGIN & NO-HOUSEHOLD (padded card views)
   ============================================================ */
.pad-view {
  padding: calc(44px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom));
}

.brand {
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-bottom: 26px;
}
.brand .sun-lg { margin: 0 auto; }
.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.01em;
}
.tagline {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15.5px;
  color: var(--muted);
}

.nh-head { display: flex; align-items: center; margin-bottom: 22px; }
.hero-brand.light .sun { color: var(--ink); width: 34px; height: 15px; }
.nh-word { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-left: 10px; }

/* ============================================================
   HERO (photographic header on each in-app screen)
   ============================================================ */
.hero {
  position: relative;
  background: #3A423C center / cover no-repeat;
  display: flex;
  min-height: 200px;
}
.hero-home { min-height: 292px; }
.hero-home     { background-image: url("img/hero-home.jpg"); }
.hero-activity { background-image: url("img/hero-activity.jpg"); }
.hero-away     { background-image: url("img/hero-away.jpg"); }
.hero-family   { background-image: url("img/hero-family.jpg"); background-color: #31567F; }
.hero-messages { min-height: 152px; }   /* solid, no photo, uses the .hero base colour + scrim */

.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(30,34,31,0.32) 0%, rgba(24,28,25,0.52) 55%, rgba(20,24,21,0.82) 100%);
}
.hero-family::before {
  background: linear-gradient(180deg,
    rgba(49,86,127,0.35) 0%, rgba(45,78,115,0.55) 55%, rgba(38,66,98,0.86) 100%);
}

.hero-inner {
  position: relative; z-index: 1;
  flex: 1;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(40px + env(safe-area-inset-top)) 20px 22px;
  color: #FAF7F1;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-brand { display: flex; align-items: center; gap: 9px; }
.hero .sun { color: #FAF7F1; width: 33px; height: 15px; }
.hero-hh { font-size: 15px; font-weight: 600; color: #FAF7F1; }

/* header bell -> Messages, with an unread dot */
.hero-bell {
  position: relative;
  background: none; border: 0; padding: 6px;
  color: #FAF7F1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
/* the right-hand header controls (bell + account cog), grouped so
   space-between keeps them together on the right */
.hero-actions { display: flex; align-items: center; gap: 2px; }
.hero-cog {
  background: none; border: 0; padding: 6px;
  color: #FAF7F1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.hero-cog svg { width: 23px; height: 23px; }
/* solid header, no photo — same treatment as Messages */
.hero-account { min-height: 152px; }
.bell-ico { width: 23px; height: 23px; display: block; }
.bell-dot {
  position: absolute; top: 2px; right: 2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--primary); border: 2px solid #FAF7F1;
}
/* back chevron on the Messages hero */
.hero-back {
  background: none; border: 0; padding: 0; margin-left: -2px;
  color: #FAF7F1; cursor: pointer; display: flex; align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.hero-back svg { width: 22px; height: 22px; display: block; }

.hero-title h2 {
  margin: 0 0 5px;
  font-size: 24px; font-weight: 600; color: #FAF7F1;
}
.hero-title p {
  margin: 0;
  font-size: 13.5px; line-height: 1.5;
  color: rgba(250, 247, 241, 0.85);
}

/* status block lives at the foot of the Home hero */
.status-dot {
  width: 60px; height: 60px; border-radius: 50%;
  margin-bottom: 16px;
  transition: background-color 0.4s, box-shadow 0.4s;
}
.status-dot.green { background: var(--green); box-shadow: 0 0 0 9px rgba(63, 143, 95, 0.28); }
.status-dot.amber { background: var(--amber); box-shadow: 0 0 0 9px rgba(198, 138, 46, 0.28); }
.status-dot.grey  { background: var(--grey);  box-shadow: 0 0 0 9px rgba(139, 138, 130, 0.28); }
.status-dot.blue  { background: var(--blue);  box-shadow: 0 0 0 9px rgba(62, 111, 163, 0.28); }
#status-headline {
  margin: 0 0 6px;
  font-size: 22px; font-weight: 600; line-height: 1.25;
  color: #FAF7F1; max-width: 300px;
}
#status-detail {
  margin: 0;
  font-size: 14.5px; line-height: 1.45;
  color: rgba(250, 247, 241, 0.85);
}

/* ============================================================
   TAB BODY & CARDS
   ============================================================ */
.tab-body {
  padding: 16px 16px calc(104px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
}
.card h2 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; margin: 0 0 6px; }
.card h3 { margin: 0 0 12px; font-size: 15.5px; font-weight: 600; color: var(--ink); }
.top-note { margin: 0 0 14px; line-height: 1.5; }

/* ============================================================
   FORMS & BUTTONS
   ============================================================ */
label {
  display: block;
  font-size: 13px; color: var(--muted); font-weight: 500;
  margin: 14px 0 6px;
}
.card > form > label:first-child,
.inner-form > label:first-child { margin-top: 0; }

input, select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  font-size: 15px;
  color: var(--ink);
  font-family: inherit;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button[type="submit"], .big-btn {
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  border: 0;
  border-radius: 100px;
  background: var(--primary);
  color: #FAF7F1;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.15s, filter 0.15s;
}
button[type="submit"]:hover, .big-btn:hover { filter: brightness(0.96); }
button[type="submit"]:active, .big-btn:active { filter: brightness(0.92); }
.big-btn { margin-top: 0; }

.ico { width: 17px; height: 17px; }

.secondary-btn {
  margin-top: 14px;
  padding: 11px 18px;
  border: 1px solid var(--dashed);
  border-radius: 100px;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.secondary-btn:hover { background: rgba(46, 52, 48, 0.04); }

.add-btn {
  width: 100%;
  margin-top: 12px;
  padding: 13px 0;
  border: 1.5px dashed var(--dashed);
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 14.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.add-btn:hover { border-color: var(--muted); color: var(--ink); }

.link-btn {
  background: none; border: 0; color: var(--faint);
  cursor: pointer; font-size: 13px; font-family: inherit;
}
.link-btn:hover { color: var(--muted); }

.inner-form {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

.auth-toggle { text-align: center; color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.auth-toggle a { color: var(--primary); font-weight: 600; text-decoration: none; }
.error { color: var(--error); font-size: 0.9rem; text-align: center; margin: 12px 0 0; }

/* delete-household: quiet by default, only the final button is loud */
.danger-card { border: 1px solid rgba(178, 59, 59, 0.35); }
.danger-card h3 { color: var(--error); }
#danger-confirm { margin-top: 14px; }
.danger-btn {
  background: var(--error); color: #FAF7F1; border: 0;
  border-radius: 10px; padding: 12px 16px; font-family: inherit;
  font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.danger-btn:hover:not(:disabled) { background: #9A3030; }
.danger-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   HOME, alert / called / messages / lists
   ============================================================ */
.alert-card { background: var(--primary); color: #FAF7F1; }
.alert-card h3 { color: #FAF7F1; font-size: 17px; margin: 0 0 8px; }
.alert-plan {
  margin: 0 0 16px;
  font-size: 14px; line-height: 1.5;
  color: rgba(250, 247, 241, 0.9);
}
.claim-btn {
  background: #FAF7F1; color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.claim-btn:hover { filter: none; background: #fff; }
.claim-btn .ico { width: 16px; height: 16px; }
.alert-note { font-size: 12.5px; color: rgba(250, 247, 241, 0.78); margin: 14px 0 8px; }
#outcome-done, #claim-status { margin-bottom: 0; }
.outcome-btns { display: flex; gap: 8px; }
.outcome-btns button {
  flex: 1; min-width: 0;
  padding: 9px 4px;
  border: 1px solid rgba(250, 247, 241, 0.5);
  border-radius: 100px;
  background: transparent; color: #FAF7F1;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.outcome-btns button:hover { background: rgba(255, 255, 255, 0.12); }

/* the everyday "I called" log, a soft blue wash (blue = connection),
   distinct from the solid-coral alert action */
.btn-called {
  background: rgba(62, 111, 163, 0.14);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center; gap: 9px;
}
.btn-called:hover { filter: none; background: rgba(62, 111, 163, 0.20); }
/* once logged today: a clear solid-green "done" state */
.btn-called.logged { background: var(--green); color: #FAF7F1; }
.btn-called.logged:hover { filter: brightness(0.96); background: var(--green); }
.called-card .center { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

/* recent messages history (its own screen, reached by the header bell) */
.messages-card { padding: 0; overflow: hidden; }
#messages-list { padding: 6px 18px 10px; }
#messages-empty { padding: 22px 10px; font-size: 14px; line-height: 1.55; }

/* ---- shared list rows (.activity) ---- */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
  font-size: 14px; color: var(--ink);
}
.activity li:first-child { border-top: 0; }
.activity li.muted { color: var(--muted); }
.activity .when { color: var(--faint); font-size: 13px; white-space: nowrap; }

/* messages: two-line items with a calm coral "new" dot */
.messages li { flex-direction: column; gap: 3px; }
.msg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.msg-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.messages li.msg-new .msg-title::before {
  content: ""; display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary);
  margin-right: 7px; vertical-align: middle;
}
.msg-body { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.messages .when { font-size: 12px; }

/* activity timeline day headings */
.timeline .day-heading {
  border-top: 0;
  padding: 16px 0 4px;
  font-weight: 700; color: var(--faint);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
}
.timeline .day-heading:first-child { padding-top: 2px; }
.timeline .day-heading + li { border-top: 0; }

/* away list rows */
.away-list li { align-items: center; }
.row-del {
  border: 0; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(178, 59, 59, 0.08);
  color: var(--error);
  cursor: pointer; font-size: 0.85rem;
}
.row-del:hover { background: rgba(178, 59, 59, 0.16); }

.day-boxes { display: flex; flex-wrap: wrap; gap: 6px; }
.day-boxes label {
  display: flex; align-items: center; gap: 5px;
  margin: 0; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 100px;
  font-size: 13px; color: var(--ink); cursor: pointer; font-weight: 500;
}
.day-boxes input { width: auto; }
.day-boxes label:has(input:checked) {
  border-color: var(--primary); background: var(--accent-soft);
  color: var(--primary-dark); font-weight: 600;
}

.preview {
  margin-top: 14px;
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--primary-dark);
  font-size: 14px; font-style: italic;
}

.accept-btn {
  border: 0; border-radius: 100px; padding: 8px 18px;
  background: var(--primary); color: #fff; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.accept-btn:hover { filter: brightness(0.96); }

/* ============================================================
   FAMILY, avatars, invite row, notification cards, blue accent
   ============================================================ */
/* Re-point the accent tokens for the whole Family section, so every
   control built on them (invite button, focus rings, selected states)
   turns the calm connection-blue in one place. */
#tab-family {
  --primary: #3E6FA3;
  --primary-dark: #345E88;
  --accent-soft: rgba(62, 111, 163, 0.14);
}

#family-list li { justify-content: flex-start; align-items: center; gap: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(62, 111, 163, 0.16); color: #3E6FA3;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fam-name { flex: 1; font-size: 14.5px; color: var(--ink); }
.owner-badge {
  white-space: nowrap; font-size: 12px; font-weight: 600;
  color: var(--primary-dark); background: var(--accent-soft);
  padding: 2px 9px; border-radius: 999px;
}
.owner-note { margin: 12px 0 0; }

.invite-inline { display: flex; gap: 8px; }
.invite-inline input { flex: 1; }
.invite-inline button {
  width: auto; margin-top: 0;
  border: 0; border-radius: 12px;
  background: var(--blue); color: #fff;
  font-weight: 600; font-size: 13.5px; padding: 0 18px;
  cursor: pointer; font-family: inherit;
}
.invite-inline button:hover { filter: brightness(0.96); }

.radio-row {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 8px; padding: 13px 14px;
  border: 1.5px solid var(--border); border-radius: 14px;
  cursor: pointer;
}
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }
.radio-body { display: flex; flex-direction: column; gap: 2px; }
.radio-body strong { font-size: 14px; color: var(--ink); font-weight: 600; }
.radio-body .muted { font-size: 12.5px; }
.radio-row:has(input:checked) { border-color: var(--blue); background: rgba(62, 111, 163, 0.08); }
.radio-row:focus-within { box-shadow: 0 0 0 3px var(--accent-soft); }

/* subscription plan chooser — a stack of .radio-row options */
.plan-picker { margin: 14px 0 4px; }

.signout-row { text-align: center; margin-top: 4px; }

/* a calm, non-alarming notice (e.g. "check your email to confirm") —
   distinct from the red .error */
.notice {
  background: rgba(63, 143, 95, 0.12);
  color: var(--ink);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  margin-top: 12px;
}
/* onboarding: the "where each sensor goes" list — label then hint,
   stacked (override the flex space-between the activity list uses) */
.ob-place li { display: block; padding: 7px 0; }
.ob-place .place-what { font-weight: 600; }
.ob-place .place-where { color: var(--muted); display: block; font-size: 0.9rem; }
/* the name box: what this one gets called in the activity log */
.ob-place .place-name { display: block; width: 100%; margin-top: 7px; }
/* small top gap for stacked account fields */
.mt { margin-top: 15px; }
/* account: the intro line above the cards */
.acct-intro { margin: 2px 2px 14px; }

/* ============================================================
   BANNER (settling-in) & FOOTNOTE
   ============================================================ */
.banner {
  background: rgba(198, 138, 46, 0.12);
  border: 1px solid rgba(198, 138, 46, 0.3);
  color: #8A5F1F;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 13.5px; line-height: 1.5;
}

/* Return-from-Stripe banner: calm green, not the amber warning tint,
   and a row with a dismiss button. */
#checkout-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 14px 0;
  background: rgba(70, 130, 90, 0.12);
  border-color: rgba(70, 130, 90, 0.32);
  color: #2f6b45;
}
#checkout-banner button {
  margin-left: auto;
  flex: none;
  background: none; border: 0;
  font-size: 20px; line-height: 1;
  color: inherit; cursor: pointer;
  padding: 0 2px;
}

.footnote {
  color: var(--faint);
  font-size: 12px; line-height: 1.5;
  text-align: center;
  margin: 6px 6px 0;
}

/* ============================================================
   FLOATING TAB BAR
   ============================================================ */
#tabbar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: calc(100% - 28px);
  max-width: 452px;
  display: flex;
  padding: 9px 6px;
  background: rgba(250, 247, 241, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: 100px;
  box-shadow: 0 6px 24px rgba(43, 54, 48, 0.16);
  z-index: 20;
}
#tabbar button {
  flex: 1;
  background: none; border: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--faint);
  cursor: pointer; padding: 4px 0;
}
#tabbar .tab-ico { width: 21px; height: 21px; }
#tabbar button span { font-size: 10.5px; font-weight: 600; }
#tabbar button.active { color: var(--primary); }
#tabbar button[data-tab="family"].active { color: var(--blue); }

/* ============================================================
   "NEW VERSION READY" PROMPT (top banner, prompt-only)
   ============================================================ */
#update-bar {
  position: fixed;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex; align-items: center; gap: 10px;
  padding: calc(11px + env(safe-area-inset-top)) 14px 11px 18px;
  background: var(--primary); color: #FAF7F1;
  box-shadow: 0 2px 14px rgba(43, 54, 48, 0.22);
  z-index: 50;
  font-size: 14px;
}
#update-bar .update-text { flex: 1; font-weight: 600; line-height: 1.3; }
.update-btn {
  border: 0; border-radius: 100px;
  background: #FAF7F1; color: var(--primary-dark);
  font-weight: 700; font-size: 13.5px;
  padding: 8px 18px; cursor: pointer; font-family: inherit;
  flex-shrink: 0;
}
.update-btn:hover { background: #fff; }
.update-x {
  border: 0; background: transparent;
  color: rgba(250, 247, 241, 0.85);
  font-size: 15px; padding: 4px 6px; cursor: pointer;
  flex-shrink: 0;
}
.update-x:hover { color: #FAF7F1; }

/* ============================================================
   ONBOARDING (owner: morning check + consent)
   ============================================================ */
.big-btn:disabled { filter: none; opacity: 0.5; cursor: default; }
.ob-step {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--primary-dark); margin-bottom: 8px;
}
.ob-note {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 15px; margin-top: 14px;
}
.ob-note strong { font-size: 14.5px; }
.ob-note p { margin: 5px 0 0; }
.check-row {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 16px 0 0; font-size: 14px; color: var(--ink); line-height: 1.5;
}
.check-row input { width: auto; margin-top: 3px; flex-shrink: 0; }

/* per-member quiet-nudge control (Family -> My notifications) */
.nudge-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.nudge-block .check-row { margin-top: 0; }
.nudge-days { margin-top: 6px; }
.nudge-days select:disabled { opacity: 0.55; cursor: default; }
#nudge-lock-note { margin-top: 8px; }
