/* Same palette as Home, so the family's apps feel like one set. */
:root {
  --bg: #F2F0EB;
  --card: #FBFAF7;
  --tile: #E9E6DF;
  --ink: #1C1B19;
  --muted: #77726A;
  --line: #E1DCD2;
  --field: #FFFFFF;
  --accent: #1F6F66;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEBE8;
  --warm: #B7791F;
  --warm-soft: #F6EBD6;
  --alert: #C2412A;
  --alert-soft: #F5DFD7;
  --shadow: 0 1px 2px rgb(40 30 10 / .05), 0 6px 18px rgb(40 30 10 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --card: #1A1918;
    --tile: #242320;
    --ink: #F1EEE7;
    --muted: #8D887F;
    --line: #2E2C29;
    --field: #232220;
    --accent: #5BB5A8;
    --accent-ink: #0D1917;
    --accent-soft: #17302C;
    --warm: #E2A94B;
    --warm-soft: #33291A;
    --alert: #F0775C;
    --alert-soft: #3A211B;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 32px) max(16px, env(safe-area-inset-left));
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { flex: none; display: block; }
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

/* ---------- header ---------- */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 8px 0 18px; }
.eyebrow { color: var(--muted); font-size: 14px; font-weight: 500; }
.top h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; margin-top: 2px; }
.top-actions { display: flex; gap: 6px; }
.iconbtn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--tile); }
.iconbtn.spin .ic { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- alerts ---------- */
.alerts { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.alert { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; font-size: 14px; background: var(--tile); }
.alert.alert-alert { background: var(--alert-soft); color: var(--alert); font-weight: 600; }
.alert.alert-warn { background: var(--warm-soft); }
.alert.alert-warn .ic { color: var(--warm); }
.alert .ic { color: var(--muted); }
.alert.alert-alert .ic { color: var(--alert); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 820px) { .grid { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 20px; letter-spacing: -.01em; flex: 1; }
.card-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.open { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 15px; font-weight: 600; text-decoration: none; padding: 8px 2px; }
.section { margin-top: 18px; }
.section:first-of-type { margin-top: 0; }
.section h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.empty { color: var(--muted); font-size: 15px; padding: 4px 0; }
.problem { background: var(--alert-soft); color: var(--alert); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.notice { background: var(--tile); border-radius: 14px; padding: 12px 14px; font-size: 15px; color: var(--muted); }

/* scenes */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 12px; border-radius: 22px; border: 0; background: var(--tile); font-weight: 600; font-size: 15px; }
.chip.primary { background: var(--accent); color: var(--accent-ink); }
.chip[aria-busy="true"] { opacity: .55; }

/* rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 2px; }
.row-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 18px; background: var(--tile); color: var(--muted); flex: none; }
.row-ic.lit { background: var(--warm-soft); color: var(--warm); }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { display: block; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { color: var(--muted); font-size: 14px; flex: none; text-align: right; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 0; background: var(--tile); font-weight: 600; font-size: 15px; flex: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.wide { width: 100%; min-height: 48px; border-radius: 14px; }

/* climate */
.readings { display: flex; flex-wrap: wrap; gap: 8px; }
.reading { background: var(--tile); border-radius: 14px; padding: 8px 12px; min-width: 0; }
.reading b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.reading small { color: var(--muted); font-size: 13px; }

/* search */
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; min-height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); padding: 0 14px; font-size: 17px; }
.answer { margin-top: 10px; background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.stats { color: var(--muted); font-size: 14px; margin-top: 10px; }

/* footer */
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }

/* login */
.login { max-width: 360px; margin: 14vh auto 0; text-align: center; }
.brand { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); }
.login h1 { font-size: 30px; letter-spacing: -.02em; }
.login p { color: var(--muted); margin: 6px 0 20px; }
.login input { width: 100%; min-height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); padding: 0 14px; font-size: 18px; text-align: center; margin-bottom: 10px; }
.err { color: var(--alert); font-size: 15px; min-height: 22px; margin-top: 10px; }

/* sheet */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; background: var(--card); color: var(--ink); }
@media (min-width: 600px) { .sheet { margin: auto; border-radius: 22px; } }
.sheet::backdrop { background: rgb(0 0 0 / .35); }
.sheet-body { padding: 18px 18px calc(env(safe-area-inset-bottom) + 20px); display: flex; flex-direction: column; gap: 12px; }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet-head h3 { flex: 1; font-size: 20px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgb(0 0 0 / .2); z-index: 10; }
