/* Daisy's Day: warm cream, bandana navy and red, tongue pink. Light theme only, on purpose. */
:root {
  --cream: #FBF5EC; --paper: #FFFFFF; --sand: #F3E8D8; --line: #E8DCC9;
  --ink: #1E2242; --muted: #6A6E86; --navy: #23305E; --navy-2: #2F3F78;
  --red: #D6423B; --pink: #F3A3B4; --green: #22865A; --green-bg: #E3F4EA; --amber: #B86A00; --amber-bg: #FFF1D9; --red-bg: #FDE7E5;
  --radius: 18px; --shadow: 0 1px 2px rgba(30,34,66,.06), 0 6px 20px rgba(30,34,66,.07);
  --display: "Fraunces", Georgia, serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--navy-2); outline-offset: 2px; border-radius: 8px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; line-height: 1.15; letter-spacing: -.01em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.pre { white-space: pre-wrap; margin: 0; }
.center { text-align: center; margin-top: 16px; }
.stack { display: grid; gap: 14px; }
.eyebrow { margin: 0 0 6px; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.eyebrow.light { color: var(--pink); }

/* ---------- buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 11px 18px; font-weight: 800; font-size: .95rem; transition: transform .08s ease, background .15s ease; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { background: var(--paper); color: var(--navy); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-good { background: var(--green); color: #fff; }
.btn-lg { padding: 14px 22px; font-size: 1.05rem; }
.btn-sm { padding: 7px 12px; font-size: .85rem; }
.linkbtn { background: none; border: 0; padding: 2px 4px; color: var(--navy-2); font-weight: 800; font-size: .88rem; text-decoration: underline; text-underline-offset: 3px; }
.iconbtn { background: var(--sand); border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; }
.field { display: grid; gap: 6px; font-weight: 700; font-size: .9rem; }
.field input, .field select, .field textarea { font: inherit; font-weight: 600; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; width: 100%; min-width: 0; }
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy-2); outline: none; box-shadow: 0 0 0 3px rgba(47,63,120,.15); }
.field small { font-weight: 600; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { margin: 0; color: var(--red); font-weight: 700; }

/* ---------- join ---------- */
.join { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(circle at 15% 10%, rgba(243,163,180,.35), transparent 40%), radial-gradient(circle at 90% 90%, rgba(47,63,120,.18), transparent 45%), var(--cream); }
.join-card { width: min(760px, 100%); background: var(--paper); border-radius: 28px; box-shadow: var(--shadow); display: grid; grid-template-columns: 220px 1fr; overflow: hidden; }
.join-dog { width: 100%; height: 100%; object-fit: contain; object-position: bottom; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); padding: 24px 16px 0; }
.join-body { padding: 32px 28px; }
.join h1 { font-size: 2.2rem; }
.lede { color: var(--muted); margin: 8px 0 20px; }
.fineprint { color: var(--muted); font-size: .82rem; margin: 16px 0 0; }
@media (max-width: 620px) {
  .join-card { grid-template-columns: 1fr; }
  .join-dog { height: 210px; padding-top: 16px; }
  .join-body { padding: 24px 20px; }
}

/* ---------- top bar & tabs ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  background: rgba(251,245,236,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--paper); box-shadow: 0 0 0 2px var(--red); }
.brand strong { display: block; font-family: var(--display); font-size: 1.15rem; line-height: 1.1; }
.brand span { font-size: .8rem; color: var(--muted); font-weight: 700; }
.tabs { display: flex; gap: 4px; background: var(--sand); padding: 4px; border-radius: 999px; }
.tab { position: relative; border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-weight: 800; font-size: .9rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.tab[aria-current="page"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(30,34,66,.12); }
.tab .ti { font-size: 1rem; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: .72rem; display: inline-grid; place-items: center; }

/* Phones: tabs move to a bottom bar */
@media (max-width: 720px) {
  /* backdrop-filter would trap the fixed tab bar inside the header, so phones get a solid header */
  .topbar { backdrop-filter: none; background: var(--cream); }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 0; background: var(--paper); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tab { flex-direction: column; gap: 2px; font-size: .72rem; padding: 6px 4px; flex: 1; border-radius: 14px; }
  .tab .ti { font-size: 1.35rem; }
  .tab[aria-current="page"] { background: var(--sand); box-shadow: none; }
  .tab .badge { position: absolute; top: 2px; right: calc(50% - 26px); }
  .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 20px max(18px, env(safe-area-inset-right)) 48px max(18px, env(safe-area-inset-left)); }
.page-title { font-size: 1.8rem; margin-bottom: 6px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.section-title { font-size: 1.2rem; margin: 26px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.section-title small { font-family: var(--body); font-size: .8rem; color: var(--muted); font-weight: 700; }
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-top: 16px; }
.card h3 { font-size: 1.15rem; margin-bottom: 8px; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 26px; color: #fff; padding: 24px 24px 22px; min-height: 170px; display: flex; align-items: center;
  background:
    radial-gradient(circle at 85% 20%, rgba(243,163,180,.35), transparent 35%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); box-shadow: var(--shadow); }
/* faint stars, a nod to Daisy's bandana */
.hero::before { content: ""; position: absolute; inset: 0; opacity: .12; pointer-events: none;
  background-image: radial-gradient(circle, #fff 1.2px, transparent 1.6px); background-size: 26px 26px; }
.hero-text { position: relative; max-width: calc(100% - 140px); }
.hero h1 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); }
.hero-sub { margin: 8px 0 0; color: #DCE1F5; font-weight: 600; }
.hero-dog { position: absolute; right: 10px; top: 14px; width: 150px; height: auto; filter: drop-shadow(0 8px 16px rgba(0,0,0,.3)); }
@media (max-width: 480px) { .hero-dog { width: 120px; right: -4px; top: 18px; } .hero-text { max-width: calc(100% - 100px); } }

/* ---------- quick log ---------- */
.quick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.qbtn { background: var(--paper); border: 0; border-radius: 18px; box-shadow: var(--shadow); padding: 14px 6px 12px; display: grid; justify-items: center; gap: 6px;
  transition: transform .1s ease, box-shadow .15s ease; }
.qbtn:hover { box-shadow: 0 0 0 2px var(--navy-2), var(--shadow); }
.qbtn:active { transform: scale(.95); }
.qbtn.flash { animation: flash .6s ease; }
@keyframes flash { 0% { background: var(--green-bg); } 100% { background: var(--paper); } }
.qi { font-size: 1.9rem; line-height: 1; }
.ql { font-weight: 800; font-size: .88rem; }
@media (max-width: 720px) { .quick { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- status cards ---------- */
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
@media (max-width: 860px) { .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.stat .k { font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--display); font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.stat .s { font-size: .85rem; color: var(--muted); font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.stat.warn { box-shadow: 0 0 0 2px var(--amber), var(--shadow); }
.stat.bad { box-shadow: 0 0 0 2px var(--red), var(--shadow); }
.meal-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mchip { font-size: .8rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--sand); color: var(--muted); }
.mchip.yes { background: var(--green-bg); color: var(--green); }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tl { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--sand); width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; }
.tl:first-child { border-top: 0; }
.tl:hover { background: #FFFBF4; }
.tl .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: var(--sand); }
.tl .what { font-weight: 800; }
.tl .what small { font-weight: 700; color: var(--muted); }
.tl .who { font-size: .85rem; color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.tl .when { font-weight: 800; font-size: .9rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); font-weight: 600; }
.empty img { width: 70px; height: 70px; border-radius: 50%; display: block; margin: 0 auto 8px; opacity: .9; }
.day-head { font-family: var(--display); font-size: 1.05rem; margin: 22px 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.day-head small { font-family: var(--body); font-weight: 700; color: var(--muted); font-size: .8rem; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.chip { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 12px; font-weight: 800; font-size: .85rem; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- care plan ---------- */
.care-list { display: grid; gap: 12px; margin-top: 16px; }
.care { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.care .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: var(--sand); }
.care h3 { font-size: 1.05rem; }
.care .meta { font-size: .85rem; color: var(--muted); font-weight: 600; }
.care .actions { display: flex; gap: 8px; align-items: center; }
.due { display: inline-block; font-size: .75rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; background: var(--sand); color: var(--muted); }
.due.over { background: var(--red-bg); color: var(--red); }
.due.today { background: var(--amber-bg); color: var(--amber); }
.due.soon { background: #EEF0FA; color: var(--navy-2); }
@media (max-width: 520px) { .care { grid-template-columns: 44px minmax(0, 1fr); } .care .actions { grid-column: 1 / -1; justify-content: flex-end; } }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- profile ---------- */
.profile { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: end; background: var(--paper); border-radius: 26px; box-shadow: var(--shadow); padding: 20px 24px 0; overflow: hidden; }
.profile-photo { align-self: end; background: radial-gradient(circle at 50% 70%, var(--pink) 0%, rgba(243,163,180,0) 60%); }
.profile-photo img { display: block; width: 170px; height: auto; margin: 0 auto; }
.profile-main { padding-bottom: 20px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 18px; margin: 14px 0 16px; }
.facts div { min-width: 0; }
.facts dt { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.facts a { color: var(--navy-2); }
@media (max-width: 620px) { .profile { grid-template-columns: 1fr; padding-top: 12px; } .profile-photo img { width: 130px; } .profile-main { padding-bottom: 18px; } }
.setting-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--sand); font-weight: 600; }
.setting-row code { font-size: .95rem; background: var(--sand); padding: 2px 8px; border-radius: 6px; }
.weight-chart svg { display: block; width: 100%; height: auto; max-height: 240px; }
.weight-chart .empty { padding: 14px 0; }

/* ---------- sheet (dialog) ---------- */
.sheet { border: 0; padding: 0; width: min(520px, 100%); max-height: 92vh; border-radius: 24px; background: var(--cream); color: var(--ink); box-shadow: 0 20px 60px rgba(30,34,66,.3); }
.sheet::backdrop { background: rgba(30,34,66,.45); }
.sheet-inner { padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-head h2 { font-size: 1.35rem; }
.sheet .actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-top: 4px; }
.sheet .actions .right { display: flex; gap: 10px; margin-left: auto; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice { border: 0; background: var(--paper); box-shadow: var(--shadow); border-radius: 16px; padding: 16px 8px; display: grid; justify-items: center; gap: 6px; font-weight: 800; }
.choice span:first-child { font-size: 1.8rem; }
.choice:hover { box-shadow: 0 0 0 2px var(--navy-2), var(--shadow); }
@media (max-width: 560px) {
  .sheet { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 24px 24px 0 0; }
}

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 10px 10px 18px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(30,34,66,.35); font-weight: 700; max-width: calc(100% - 24px); }
.toast > span { white-space: nowrap; }
.toast button { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 800; }
@media (max-width: 720px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }

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