:root {
  --ink: #24332F;
  --ink-soft: #4A5C56;
  --paper: #F4EFE6;
  --card: #FFFCF7;
  --line: #E2D8C8;
  --sage: #2C5A4C;
  --sage-hover: #244B3F;
  --sage-mist: #E6EFEA;
  --gold: #B0894A;
  --danger: #8F3A32;
  --ok: #2A6A4F;
  --p0-bg: #F6E4DC;
  --p0-fg: #6E3328;
  --p1-bg: #E4EEE8;
  --p1-fg: #2A4F43;
  --over-bg: #F3D8D2;
  --over-fg: #7A322A;
  --pro-bg: #E8E6F2;
  --pro-fg: #3D3A5C;
  --header-1: #1C3A34;
  --header-2: #2A5248;
  --header-3: #3A6558;
  --shadow: 0 8px 24px rgba(36, 51, 47, 0.07), 0 1px 3px rgba(36, 51, 47, 0.05);
  --shadow-lift: 0 12px 28px rgba(36, 51, 47, 0.1), 0 2px 6px rgba(36, 51, 47, 0.06);
  --radius-card: 18px;
  --radius-ctl: 14px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-brand: "Iowan Old Style", Palatino, "Palatino Linotype", "Times New Roman", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
}

header.app {
  position: sticky;
  top: 0;
  z-index: 5;
  color: #fff;
  padding: 18px 16px 0;
  background:
    radial-gradient(ellipse 90% 80% at 100% -10%, rgba(180, 210, 190, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 90% at 0% 80%, rgba(20, 50, 44, 0.35), transparent 50%),
    linear-gradient(165deg, var(--header-1) 0%, var(--header-2) 52%, var(--header-3) 100%);
}

header.app::after {
  content: "";
  display: block;
  height: 26px;
  margin: 0 -16px -1px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 390 28' preserveAspectRatio='none'%3E%3Cpath fill='%23F4EFE6' d='M0 18C48 28 96 4 156 10C216 16 258 28 312 20C350 14 372 10 390 12V28H0Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: 100% 100%;
  pointer-events: none;
}

.brand { padding: 0 4px; }

header.app h1 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mark {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 7px;
  background-color: #F4EFE6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' rx='6.5' fill='%23F4EFE6'/%3E%3Cpath d='M12 0h5.5A6.5 6.5 0 0 1 24 6.5V12L12 0z' fill='%232C5A4C'/%3E%3Cpath d='M12 0L24 12' stroke='%23F4EFE6' stroke-width='1.15' stroke-linecap='round' opacity='.4'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

header.app p {
  margin: 4px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.01em;
}

nav.tabs {
  display: flex;
  gap: 6px;
  padding: 14px 0 8px;
  background: transparent;
}

nav.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  padding: 8px 6px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

nav.tabs button.on {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

nav.tabs button:hover,
nav.tabs button:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

nav.tabs button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

nav.tabs button:active { transform: scale(0.97); }

main { padding: 6px 16px 96px; }

.card {
  background: var(--card);
  border: 1px solid rgba(226, 216, 200, 0.7);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card h2, .card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.card h2 { font-size: 17px; }

.muted { color: var(--ink-soft); font-size: 13px; line-height: 1.45; }

.row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }

.pill {
  font-size: 11px;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sage-mist);
  color: var(--p1-fg);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.pill.p0 { background: var(--p0-bg); color: var(--p0-fg); }
.pill.p1 { background: var(--p1-bg); color: var(--p1-fg); }
.pill.over { background: var(--over-bg); color: var(--over-fg); }
.pill.pro { background: var(--pro-bg); color: var(--pro-fg); }
.pill.soon { background: #F4E8D2; color: #6B4E22; }

h2.section-title {
  font-size: 15px;
  margin: 4px 4px 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#d-file-preview { margin-top: 6px; }

.fields-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.card.compact textarea { min-height: 52px; }
.card.compact label { margin-top: 8px; }
.card.compact button.primary { margin-top: 10px; }
.card.compact p.muted { margin: 8px 0 0; }

label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  margin: 12px 0 5px;
  color: var(--ink);
}

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-ctl);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(44, 90, 76, 0.2);
}

textarea { min-height: 80px; resize: vertical; }

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--sage);
  flex-shrink: 0;
}

.checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-top: 14px;
}

.checks label {
  font-weight: 500;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

button.primary, button.ghost, button.danger {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  margin-top: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

button.primary {
  background: var(--sage);
  color: #fff;
  box-shadow: 0 4px 12px rgba(44, 90, 76, 0.28);
}

button.primary:hover { background: var(--sage-hover); }
button.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

button.ghost:hover { background: var(--paper); border-color: #d4c9b8; }
button.danger { background: var(--danger); color: #fff; }

button.primary:active,
button.ghost:active,
button.danger:active { transform: scale(0.98); }

button.primary:focus-visible,
button.ghost:focus-visible,
button.danger:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}

button.small {
  width: auto;
  padding: 8px 14px;
  margin: 8px 0 0;
  font-size: 13px;
  border-radius: 999px;
}

.card .row button.small { margin: 0; }

.card.task .row { align-items: flex-start; }
.card.task h3 { flex: 1; min-width: 0; }
.card.task .pill { margin-top: 2px; }

.card[onclick], .task { cursor: pointer; }
.card[onclick], .card.task {
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card[onclick]:hover, .card.task:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.card[onclick]:active, .card.task:active { transform: scale(0.99); }

.how { font-size: 13px; line-height: 1.5; color: var(--ink-soft); }

.empty {
  text-align: center;
  padding: 32px 14px;
  color: var(--ink-soft);
  font-size: 14px;
}

.hidden { display: none; }

.fab {
  position: fixed;
  right: calc(50vw - 248px);
  bottom: 18px;
  background: var(--sage);
  color: #fff;
  border: 0;
  border-radius: 28px;
  padding: 14px 18px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(44, 90, 76, 0.3);
}

@media (max-width: 540px) { .fab { right: 16px; } }

.banner {
  background: var(--sage-mist);
  border: 1px solid #c9ddd0;
  color: var(--ok);
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 12px;
  font-size: 13px;
}

h3.subhead {
  font-size: 12px;
  margin: 20px 0 0;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.row.actions { flex-wrap: wrap; margin-top: 8px; gap: 8px; }
.row.actions button.small { margin: 0; flex: 1; }

err { color: var(--danger); font-size: 13px; display: block; margin-top: 8px; }

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


.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.thumb {
  width: 76px;
  height: 76px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(36, 51, 47, 0.06);
}

button.thumb {
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  width: auto;
  margin: 8px 0 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.file-btn:hover { background: var(--paper); border-color: #d4c9b8; }

.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
  font-size: 0;
  border: 0;
  box-shadow: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(28, 58, 52, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 32px;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100dvh - 150px);
  border-radius: 16px;
  box-shadow: var(--shadow-lift);
  object-fit: contain;
  background: var(--card);
}

.lightbox-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  width: 100%;
  max-width: 360px;
}

.lightbox-actions button {
  flex: 1;
  margin-top: 0;
}

body.signed-out nav.tabs { display: none; }
body.signed-out main { padding-top: 10px; }

.auth-card h2 { font-family: var(--font-brand); font-size: 22px; letter-spacing: -0.03em; }
.auth-card > p.muted { margin: 0 0 4px; }

.auth-switch {
  text-align: center;
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

button.link {
  display: inline;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sage);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

button.link:hover { color: var(--sage-hover); }

.terms-box {
  margin-top: 16px;
  background: var(--sage-mist);
  border: 1px solid #c9ddd0;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.terms-box p { margin: 8px 0 0; }

.placeholder-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6B4E22;
  background: #F4E8D2;
  border-radius: 999px;
  padding: 3px 8px;
}

label.terms-accept {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

label.terms-accept input[type="checkbox"] { margin-top: 1px; }

.member-row,
.invite-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.member-row:last-of-type,
.invite-row:last-of-type { border-bottom: 0; }

.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--sage);
}

#account-card h3 { margin-bottom: 2px; }
#household-card > .muted { margin-bottom: 4px; }

/* ---------- Home photo icons ---------- */
.home-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-title h3 { margin-bottom: 2px; }
.home-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 60%;
  background: var(--sage-mist);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 4px 10px rgba(36, 51, 47, 0.10);
}
.home-icon.sm { width: 48px; height: 48px; }
.home-icon.lg { width: 96px; height: 96px; border-width: 3px; }
.home-icon.placeholder {
  color: var(--sage);
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.75), transparent 55%),
    linear-gradient(150deg, #DCE9E1 0%, #C7DCCF 100%);
}
.home-icon.placeholder svg { width: 52%; height: 52%; }
.home-icon.placeholder .initials {
  font-family: var(--font-brand);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.home-icon.sm .initials { font-size: 17px; }
.home-icon.lg .initials { font-size: 32px; }

.home-hero { position: relative; overflow: hidden; }
.home-hero::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 220, 205, 0.45), transparent 70%);
  pointer-events: none;
}
.hero-top { position: relative; display: flex; gap: 16px; align-items: center; }
.hero-photo { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hero-text { min-width: 0; }
.hero-text h2 { margin: 0 0 2px; font-family: var(--font-brand); font-size: 20px; }
.hero-text button.small { margin-top: 8px; }
.attribution { font-size: 10.5px; color: var(--ink-soft); opacity: 0.85; }
.home-icon-add { position: relative; display: inline-block; cursor: pointer; border-radius: 50%; }
.home-icon-add input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.home-icon-add .home-icon.placeholder { border-style: dashed; border-color: var(--sage); }
.home-icon-add .add-badge {
  position: absolute;
  right: 0;
  bottom: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  font-size: 20px;
  line-height: 26px;
  text-align: center;
  border: 2px solid var(--card);
  box-shadow: 0 2px 6px rgba(36, 51, 47, 0.2);
}
.home-icon-add:hover .add-badge { background: var(--sage-hover); }
.photo-prompt { margin: 14px 0 8px; }
.home-hero .file-btn.primary-file {
  display: flex;
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
  font-weight: 600;
}
.home-hero .file-btn.primary-file:hover { background: var(--sage-hover); }
.home-hero .file-btn.small { margin: 0; flex: 1; }
.home-hero .small-note { font-size: 12px; margin: 6px 0 0; }
.home-hero button.link { margin-top: 6px; }
.photo-hint { font-size: 13px; margin: 12px 0 0; }

/* Footer with legal links (every page) */
.site-footer {
  padding: 18px 16px 28px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}
.site-footer nav { display: flex; justify-content: center; gap: 8px; margin-bottom: 6px; }
.site-footer a { color: var(--sage); font-weight: 600; text-underline-offset: 2px; }
.site-footer p { margin: 0; }
main#app { padding-bottom: 24px; }

.legal-links { text-align: center; margin: 14px 0 0; font-size: 13px; color: var(--ink-soft); }
.legal-links a, .terms-line a { color: var(--sage); font-weight: 600; }
.terms-line { margin: 14px 0 0; font-size: 13px; line-height: 1.45; color: var(--ink-soft); }
.auth-card > p.small-note { font-size: 12px; margin: 10px 0 0; }
.brand-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }

/* Privacy Policy and Terms of Use pages */
.legal { padding: 14px 16px 40px; }
.legal .draft-note {
  display: block; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px;
  background: #F4E8D2; color: #6B4E22; font-size: 13px; font-weight: 700;
  border: 1px solid #E7D3AE;
}
.legal .updated { color: var(--ink-soft); font-size: 13px; margin: 0 0 6px; }
.legal h1 { font-family: var(--font-brand); font-size: 26px; letter-spacing: -0.03em; margin: 4px 0 8px; }
.legal h2 { font-family: var(--font-brand); font-size: 18px; margin: 22px 0 6px; color: var(--sage); }
.legal p, .legal li { font-size: 15px; line-height: 1.55; }
.legal ul { padding-left: 20px; margin: 6px 0; }
.legal .lead { font-size: 16px; }
.legal a { color: var(--sage); font-weight: 600; }
.legal .back { display: inline-block; margin-bottom: 10px; font-size: 14px; }

/* Small section headings on the More tab and the asset model field
   (were inline styles; moved here so the CSP can block inline styles). */
h2.list-heading { font-size: 15px; margin: 12px 4px 8px; }
h2.list-heading.spaced { margin-top: 16px; }
#a-model { margin-top: 8px; }
