/* One stylesheet for the whole app. Written for a phone first; a wider screen
   just gets the same column, centred. */

:root {
  --paper: #fbf6f2;
  --card: #ffffff;
  --ink: #2b2430;
  --muted: #6f6470;
  --line: #e7dcd6;
  --accent: #a83a63;
  --accent-soft: #f7e4ec;
  --good: #256b4d;
  --good-soft: #e4f3ec;
  --bad: #9c2b2b;
  --bad-soft: #fbe9e7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 34rem;
  margin: 0 auto;
  /* Room at the bottom for the tab bar, and for the iPhone's home indicator. */
  padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom));
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); }
small, .aside { color: var(--muted); font-size: 0.85rem; }

/* The bar at the top: the app's name and the sign-out button. */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.25rem;
}
.brand { font-weight: 700; color: var(--accent); text-decoration: none; }

/* Forms. Inputs are 16px or more so iPhone Safari does not zoom in on focus. */
label { display: block; font-weight: 600; margin-bottom: 0.9rem; }
label small { display: block; font-weight: 400; margin-top: 0.25rem; }
input, textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label.check { display: flex; align-items: center; gap: 0.6rem; font-weight: 400; }
label.check input { width: 1.3rem; height: 1.3rem; margin: 0; accent-color: var(--accent); }

button, .button {
  display: block;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.6rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.small { width: auto; min-height: 2.4rem; padding: 0.35rem 0.9rem; font-size: 0.9rem; }
button.quiet {
  width: auto;
  min-height: 2.4rem;
  padding: 0.3rem 0.6rem;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9rem;
}
button:disabled { opacity: 0.5; cursor: default; }

.card {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
}

.hero { padding-top: 2rem; }
.hero .button { margin-top: 0.75rem; }

.notice { padding: 0.75rem 1rem; border-radius: 0.6rem; }
.notice.error { background: var(--bad-soft); color: var(--bad); }
.notice.info { background: var(--accent-soft); }
.notice.good { background: var(--good-soft); color: var(--good); }

/* The invite code, large enough to read aloud. */
.code {
  font: 700 1.8rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.15em;
  text-align: center;
}

/* Home: one tile for each section. */
.tiles { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.tile {
  display: block;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
}
.tile strong { display: block; color: var(--accent); }
.tile span { color: var(--muted); font-size: 0.9rem; }

/* A list of entries, items or rewards: one row each. */
.rows { list-style: none; margin: 0 0 1rem; padding: 0; }
.rows li {
  margin-bottom: 0.6rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
}
.rows .meta { display: block; color: var(--muted); font-size: 0.85rem; }
.rows .body { margin: 0.3rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rows li.done { background: var(--good-soft); border-color: transparent; }
.rows form { margin-top: 0.5rem; }
.row-line { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.tag {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 1rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
}

.balance { font-size: 2rem; font-weight: 700; color: var(--accent); margin: 0; }

/* The guided conversation: the person's words on the right, the AI's on the left. */
.bubble {
  max-width: 88%;
  margin-bottom: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.user { margin-left: auto; background: var(--accent-soft); }
.bubble.assistant { background: var(--card); border: 1px solid var(--line); }
.bubble small { display: block; margin-top: 0.5rem; white-space: normal; }
.helplines { background: var(--bad-soft); border-color: transparent; }
.helplines a { color: var(--bad); font-weight: 700; }

/* The tab bar, fixed to the bottom of the screen like a phone app's. */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--card);
}
.tabs a {
  flex: 1;
  padding: 0.9rem 0.2rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  text-decoration: none;
}
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 700; }
