/* ─── Design system: Cal.com-inspired monochrome ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Palette — purely grayscale */
  --bg:           #ffffff;
  --paper:        #ffffff;
  --paper-strong: #ffffff;
  --ink:          #242424;
  --deep:         #111111;
  --muted:        #898989;
  --subtle:       #f5f5f5;

  /* Keep --brand mapped to charcoal for JS-injected class compatibility */
  --brand:        #242424;
  --brand-strong: #111111;
  --brand-soft:   #f5f5f5;

  /* Shadow-border colour (ring shadow technique) */
  --ring:         rgba(34, 42, 53, 0.08);
  --line:         rgba(34, 42, 53, 0.08);

  /* Elevation levels */
  --shadow-ring:  rgba(34,42,53,0.08) 0px 0px 0px 1px;
  --shadow:       rgba(19,19,22,0.7) 0px 1px 5px -4px,
                  rgba(34,42,53,0.08) 0px 0px 0px 1px,
                  rgba(34,42,53,0.05) 0px 4px 8px 0px;
  --shadow-inset: rgba(0,0,0,0.16) 0px 1px 1.9px 0px inset;

  /* Button highlight */
  --btn-highlight: rgba(255,255,255,0.15) 0px 2px 0px inset;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #ffffff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ────────────────────────────────────────────────────────────── */

h1, h2, h3, p { margin-top: 0; }

h1 {
  font-size: clamp(2.3rem, 4.8vw, 4.7rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 14px;
}

h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.eyebrow,
.section-kicker,
.hero-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
}

.lede,
.muted,
.hint {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.6;
}

/* ─── Layout shell ──────────────────────────────────────────────────────────── */

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.hidden { display: none !important; }

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.auth-layout { grid-template-columns: 1fr; }

.content  { display: grid; gap: 18px; }

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────────── */

.hero-card,
.card {
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
  border: none;
}

.hero-card {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.hero-stat {
  padding: 16px;
  border-radius: 8px;
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
}

.hero-stat strong,
.hero-stat a {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

/* ─── Form elements ─────────────────────────────────────────────────────────── */

label {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input { width: auto; margin: 0; }

input, select, button {
  width: 100%;
  margin-top: 6px;
  border-radius: 8px;
  font: inherit;
}

input, select {
  padding: 11px 13px;
  border: none;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-ring);
  outline: none;
  transition: box-shadow 120ms ease;
}

input:focus, select:focus {
  box-shadow: rgba(34,42,53,0.15) 0px 0px 0px 2px;
}

button {
  border: none;
  padding: 11px 16px;
  cursor: pointer;
  background: var(--ink);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: var(--btn-highlight);
  transition: opacity 120ms ease;
}

button:hover { opacity: 0.75; }

button.secondary {
  background: var(--subtle);
  color: var(--ink);
  box-shadow: var(--shadow-ring);
}

button.secondary:hover { opacity: 1; background: #ebebeb; }

button.small { width: auto; }

.button-link {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--subtle);
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: var(--shadow-ring);
}

/* ─── Form groups ────────────────────────────────────────────────────────────── */

.button-stack,
.stack-form,
.inline-form {
  display: grid;
  gap: 12px;
}

.inline-form {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.compact-gap { margin-top: 14px; }

/* ─── Info / invite boxes ───────────────────────────────────────────────────── */

.invite-result,
.info-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
}

/* ─── Misc layout helpers ───────────────────────────────────────────────────── */

.calendar-layout { display: grid; gap: 14px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.full-width { grid-column: 1 / -1; }

.list-panel { display: grid; gap: 10px; }
.list-panel.empty { color: var(--muted); }

.list-item {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.list-item strong { display: block; margin-bottom: 6px; }

/* ─── Calendar picker buttons ───────────────────────────────────────────────── */

.cal-pick-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  border: none;
  margin: 0 0 8px;
  transition: background 100ms;
}

.cal-pick-btn:hover { background: var(--subtle); opacity: 1; }

.cal-pick-btn--active {
  background: var(--subtle);
  box-shadow: rgba(34,42,53,0.18) 0px 0px 0px 2px,
              rgba(34,42,53,0.05) 0px 4px 8px 0px;
}

.cal-pick-name { flex: 1; }

.cal-pick-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  background: var(--ink);
  color: #fff;
  flex-shrink: 0;
}

.cal-pick-badge--hint { background: var(--muted); }

/* ─── Chips ─────────────────────────────────────────────────────────────────── */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--subtle);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: var(--shadow-ring);
}

.chip.pending  { background: #f5f5f5; color: var(--muted); }
.chip.accepted { background: #f5f5f5; color: var(--ink); }
.chip.family   { background: var(--subtle); }
.chip.all-day  { background: var(--subtle); }

/* ─── Misc ──────────────────────────────────────────────────────────────────── */

.token-row {
  margin-top: 8px;
  word-break: break-all;
  color: var(--muted);
}

pre {
  margin: 0;
  padding: 16px;
  min-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 8px;
  background: var(--ink);
  color: #f5f5f5;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.9rem;
}

/* ─── Date picker (flatpickr) ──────────────────────────────────────────────── */
/* IMP-4: native <input type="date"> picks first-day-of-week from the OS locale,
   not from the page lang. flatpickr lets us pin Monday-first across every
   browser/OS. Style the alt input flatpickr generates so it matches the rest
   of the form inputs and shows the same calendar-icon look as before.       */

input.date-picker {
  display: block;
  width: 100%;
  padding: 11px 36px 11px 13px;
  border: none;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow-ring);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23898989' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

input.date-picker:focus {
  outline: none;
  box-shadow: rgba(34,42,53,0.15) 0px 0px 0px 2px;
}

/* flatpickr hides the original input via inline style; suppress the calendar
   icon there so we don't double-up if any layout shows it momentarily. */
.flatpickr-input.date-picker[type="hidden"] { background-image: none; }

/* ─── Time picker wrapper (24-hour display) ─────────────────────────────────── */

.time-picker-wrap {
  position: relative;
  margin-top: 6px;
}

.time-picker-display {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border: none;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow-ring);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0;
  letter-spacing: 0.03em;
}

.time-picker-display:focus {
  outline: none;
  box-shadow: rgba(34,42,53,0.15) 0px 0px 0px 2px;
}

.time-picker-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  margin: 0;
  padding: 0;
  font: inherit;
  z-index: 1;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .hero, .layout, .two-col, .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { padding-inline: 14px; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

/* ═════════════════════════════════════════════════════════════════════════════
   USER APP LAYOUT
═════════════════════════════════════════════════════════════════════════════ */

.app-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 680px;
  margin: 0 auto;
}

/* ─── App header ─────────────────────────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--paper);
  box-shadow: rgba(34,42,53,0.08) 0px 1px 0px 0px;
  flex-shrink: 0;
  gap: 10px;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.app-logo {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  box-shadow: var(--btn-highlight);
}

.app-family {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.app-user {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Main scrollable area ──────────────────────────────────────────────────── */

#appMain {
  flex: 1;
  overflow-y: auto;
}

/* ─── Tab panels ─────────────────────────────────────────────────────────────── */

.tab-panel {
  padding: 16px 16px 24px;
  display: grid;
  /* minmax(0, …): without it the column grows to the widest unbreakable row
     (task chips, long list names) and the whole tab scrolls sideways on phones. */
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.tab-panel.hidden { display: none; }

.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.tab-header h2 { margin: 0; font-size: 1.4rem; }

/* ─── Bottom tab bar ─────────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  align-items: stretch;
  box-shadow: rgba(34,42,53,0.08) 0px -1px 0px 0px;
  background: var(--paper);
  flex-shrink: 0;
}

.tab-btn {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 6px;
  font-size: 0.68rem;
  font-weight: 500;
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  min-height: 56px;
  border: none;
  box-shadow: none;
  transition: color 120ms ease, background 120ms ease;
}

.tab-btn.active {
  color: var(--ink);
  background: var(--subtle);
}

.tab-btn:hover:not(.active) {
  opacity: 1;
  background: rgba(34,42,53,0.04);
  color: var(--ink);
}

/* ─── Shopping items ─────────────────────────────────────────────────────────── */

.items-panel { display: grid; gap: 8px; }

.empty-hint {
  text-align: center;
  padding: 32px 16px;
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.shop-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
  transition: background 100ms ease;
  flex: 1;
  min-width: 0;
}

.shop-item:active { background: var(--subtle); }

.shop-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--ink);
  flex-shrink: 0;
}

.shop-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shop-item-name {
  font-size: 0.97rem;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-item-notes {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-item-name.done {
  text-decoration: line-through;
  color: var(--muted);
}

.shop-item-qty {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  flex-shrink: 0;
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  border: none;
}

.shop-item-qty:hover { color: var(--ink); opacity: 1; }

.shop-item-qty-input {
  width: 52px !important;
  margin: 0 !important;
  padding: 4px 6px !important;
  font-size: 0.85rem !important;
  border-radius: 6px !important;
  text-align: center;
  flex-shrink: 0;
}

.shop-item-delete {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: var(--shadow-ring);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  transition: background 100ms, color 100ms;
}

.shop-item-delete:hover {
  background: #fee2e2;
  box-shadow: rgba(220,38,38,0.15) 0px 0px 0px 1px;
  color: #dc2626;
  opacity: 1;
}

/* Divider between unchecked/checked items */
.items-divider {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0 2px;
}

/* ─── Quick-add bar ──────────────────────────────────────────────────────────── */

.quick-add-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--paper);
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  position: sticky;
  bottom: 0;
}

.quick-add-main {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quick-add-main textarea[name="name"] {
  flex: 1;
  margin: 0;
  border-radius: 8px;
  resize: none;
  overflow: hidden;
  min-height: 42px;
  max-height: 200px;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.4;
  padding: 11px 12px;
}

.quick-add-notes-row input { width: 100%; margin: 0; border-radius: 8px; font-size: 0.9rem; }

.qty-input {
  width: 60px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  flex-shrink: 0;
}

.quick-add-bar button { width: auto; padding: 11px 18px; margin: 0; flex-shrink: 0; }

.quick-add-notes-toggle {
  padding: 8px 10px !important;
  font-size: 0.78rem !important;
  border-radius: 6px !important;
}

/* ─── List selector ──────────────────────────────────────────────────────────── */

.list-selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-selector-bar select { flex: 1; min-width: 0; margin: 0; font-weight: 600; }

.btn-archive {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 8px;
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
  border: none;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 100ms;
  flex-shrink: 0;
  line-height: 1;
}

.btn-archive:hover { background: #ebebeb; opacity: 1; }

/* ─── Meal planner ───────────────────────────────────────────────────────────── */

.meal-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.meal-grid-inner {
  display: grid;
  grid-template-columns: 72px repeat(7, 1fr);
  gap: 4px;
  min-width: 520px;
}

.meal-grid-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: center;
  padding: 4px 2px 6px;
}

.meal-grid-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding-right: 4px;
}

.meal-cell {
  box-shadow: var(--shadow-ring);
  border: none;
  border-radius: 6px;
  background: var(--paper);
  min-height: 56px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  transition: background 100ms;
  overflow: hidden;
}

.meal-cell:active { background: var(--subtle); }

.meal-cell--filled {
  background: var(--subtle);
  box-shadow: rgba(34,42,53,0.15) 0px 0px 0px 1px;
}

.meal-cell-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meal-cell-empty { font-size: 1.1rem; color: var(--muted); line-height: 1; }

.meal-cell-link { font-size: 0.65rem; }

/* ─── Kids Budget ────────────────────────────────────────────────────────────── */

.budget-card {
  background: var(--paper);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.budget-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.budget-child-name { font-size: 1.05rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }

.budget-allowance-info { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

.budget-balance { font-size: 1.6rem; font-weight: 700; color: var(--ink); text-align: right; letter-spacing: -0.02em; }

.budget-balance--negative { color: #c0392b; }

.budget-balance-label { font-size: 0.72rem; color: var(--muted); text-align: right; }

.budget-actions { display: flex; gap: 8px; margin-top: 14px; }

.budget-adjust-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(34,42,53,0.08);
  display: none;
}

.budget-adjust-form.open { display: block; }

/* Global `button { width: 100% }` used to make Save swallow the row and
   squeeze Description to zero width — size each control explicitly. */
.budget-adjust-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.budget-adjust-row input { margin-top: 0; }
.budget-adjust-row input[type="number"] { flex: 0 0 120px; width: 120px; }
.budget-adjust-row input[type="text"] { flex: 1 1 160px; min-width: 0; width: auto; }
.budget-adjust-row button { flex: 0 0 auto; width: auto; margin-top: 0; }

.budget-allowance-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(34,42,53,0.08);
  display: none;
}

.budget-allowance-form.open { display: block; }

.budget-transactions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(34,42,53,0.08);
}

.budget-tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(34,42,53,0.06);
}

.budget-tx-row:last-child { border-bottom: none; }

.budget-tx-desc { color: var(--ink); }

.budget-tx-date { font-size: 0.72rem; color: var(--muted); }

.budget-tx-amount { font-weight: 600; white-space: nowrap; margin-left: 12px; }

.budget-tx-amount--pos { color: #27ae60; }
.budget-tx-amount--neg { color: #c0392b; }

.budget-history-btn { margin-top: 10px; }

.budget-history-panel {
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.budget-history-list { overflow-y: auto; margin: 8px 0 16px; -webkit-overflow-scrolling: touch; }

.budget-tx-right { text-align: right; margin-left: 12px; }
.budget-tx-right .budget-tx-amount { margin-left: 0; }
.budget-tx-balance { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

/* ─── Meal edit modal ────────────────────────────────────────────────────────── */

.meal-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0 0 env(safe-area-inset-bottom);
}

.meal-edit-panel {
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
}

/* ─── Auth screen ────────────────────────────────────────────────────────────── */

.auth-shell {
  max-width: 420px;
  margin: 0 auto;
  padding: 52px 20px 48px;
  display: grid;
  gap: 20px;
}

.auth-header h1 {
  font-size: clamp(2rem, 7vw, 3rem);
  margin-bottom: 10px;
  line-height: 1.0;
  letter-spacing: -0.03em;
}

.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(34,42,53,0.1);
}

.auth-tab {
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 10px 18px;
  width: auto;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: none;
}

.auth-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.auth-tab:hover {
  opacity: 1;
  background: var(--subtle);
  color: var(--ink);
}

.auth-card { padding: 20px; }

.health-badge {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

/* ─── Onboard screen ─────────────────────────────────────────────────────────── */

.onboard-shell {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 20px 40px;
  display: grid;
  gap: 16px;
}

.onboard-header { text-align: center; }

.onboard-header h2 {
  font-size: 1.8rem;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

/* ─── Landing page (#authScreen, logged-out visitors) ──────────────────────────
   Everything is prefixed .lp- so it cannot leak into the app screens.
   .lp--direct (invite / Telegram deep link) hides the marketing sections. */

.lp { min-height: 100dvh; }
.lp--direct .lp-marketing { display: none !important; }
.lp--direct .lp-join { padding-top: 24px; min-height: calc(100dvh - 60px); }
.lp--direct .lp-brand > span { display: inline !important; }

.lp-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: 20px;
}

.lp-wrap--narrow { max-width: 760px; }

.lp a { color: inherit; }

.lp code {
  font-size: 0.84em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
}

/* Buttons rendered as links (no global <button> width/margin rules) */
.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  box-shadow: var(--btn-highlight);
  transition: opacity 120ms ease;
  white-space: nowrap;
}

.lp-btn:hover { opacity: 0.75; }

.lp-btn--ghost {
  background: var(--subtle);
  color: var(--ink) !important;
  box-shadow: var(--shadow-ring);
}

.lp-btn--ghost:hover { opacity: 1; background: #ebebeb; }

.lp-btn--sm { padding: 8px 14px; font-size: 0.86rem; }

/* ─── Nav ─── */

.lp-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow: rgba(34,42,53,0.08) 0px 1px 0px 0px;
}

.lp-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}

.lp-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.lp-brand .app-logo { width: 32px; height: 32px; min-width: 32px; font-size: 0.72rem; }

.lp-nav-links { display: flex; gap: 22px; }

.lp-nav-links a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
}

.lp-nav-links a:hover { color: var(--ink); }

.lp-nav-actions { display: flex; gap: 8px; }

/* ─── Hero ─── */

.lp-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 48px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 72px;
}

.lp-hero h1 { letter-spacing: -0.035em; }

.lp-lede { font-size: 1.08rem; max-width: 34em; margin-bottom: 28px; }

.lp-cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }

.lp-ticks {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.lp-ticks li::before { content: "✓"; color: var(--ink); font-weight: 700; margin-right: 10px; }

.lp-hero-visual {
  position: relative;
  min-height: 520px;
}

/* Screenshot frame: a card with the app header cropped to the top edge */
.lp-shot {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow), rgba(34,42,53,0.10) 0px 24px 48px -12px;
}

.lp-shot img { display: block; width: 100%; height: auto; }

.lp-hero-visual .lp-shot { position: absolute; width: 300px; }
.lp-shot--front { right: 0; top: 40px; z-index: 2; }
.lp-shot--back  { left: 0; top: 0; transform: rotate(-4deg); opacity: 0.9; }

/* ─── Sections ─── */

.lp-section { padding-top: 80px; padding-bottom: 80px; }

.lp-hero + .lp-section { padding-top: 32px; }

.lp-section--tint {
  background: var(--subtle);
  box-shadow: inset rgba(34,42,53,0.06) 0px 1px 0px, inset rgba(34,42,53,0.06) 0px -1px 0px;
}

.lp-section-head { max-width: 640px; margin-bottom: 40px; }

.lp-section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin-bottom: 12px;
}

.lp-section-head .lede { margin: 0; }

.lp-h3 { font-size: 1.45rem; letter-spacing: -0.02em; line-height: 1.2; }

/* ─── Feature showcase ─── */

.lp-showcase {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px;
  align-items: start;
}

.lp-showcase-tabs { display: grid; gap: 8px; }

.lp-feature {
  display: grid;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  text-align: left;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-weight: 400;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.lp-feature:hover { opacity: 1; background: var(--subtle); }

.lp-feature.active { background: var(--paper); box-shadow: var(--shadow); }

.lp-feature-title { font-weight: 600; font-size: 1rem; }

.lp-feature-text { color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

.lp-showcase-shot { position: sticky; top: 84px; }

/* ─── Steps ─── */

.lp-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.lp-step { padding: 22px; }

.lp-step p { margin: 0; font-size: 0.92rem; }

.lp-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  border-radius: 9999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ─── Integrations ─── */

.lp-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: -16px 0 24px; }

.lp-pills .chip { text-decoration: none; padding: 6px 14px; font-size: 0.86rem; }

.lp-integration {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 56px;
  align-items: center;
  padding: 48px 0;
  scroll-margin-top: 72px;
}

.lp-integration + .lp-integration { box-shadow: rgba(34,42,53,0.08) 0px -1px 0px 0px; }

.lp-integration--flip .lp-integration-copy { order: 2; }

.lp-integration-visual .lp-shot { max-width: 340px; margin-inline: auto; }

.lp-list {
  margin: 0 0 22px;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.lp-howto {
  counter-reset: lp-howto;
  list-style: none;
  margin: 0;
  padding: 18px 20px;
  display: grid;
  gap: 14px;
  border-radius: 12px;
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
  font-size: 0.92rem;
  line-height: 1.5;
}

.lp-howto li {
  counter-increment: lp-howto;
  position: relative;
  padding-left: 36px;
}

.lp-howto li::before {
  content: counter(lp-howto);
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lp-note { font-size: 0.86rem; margin: 14px 0 0; }

/* Telegram chat mock-up */
.lp-chat {
  max-width: 380px;
  margin-inline: auto;
  border-radius: 16px;
  overflow: hidden;
  background: var(--subtle);
  box-shadow: var(--shadow), rgba(34,42,53,0.10) 0px 24px 48px -12px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.lp-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--paper);
  box-shadow: rgba(34,42,53,0.08) 0px 1px 0px 0px;
}

.lp-chat-head strong { display: block; font-size: 0.92rem; }
.lp-chat-head span:not(.lp-chat-avatar) { font-size: 0.76rem; color: var(--muted); }

.lp-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lp-chat-body { display: grid; gap: 8px; padding: 16px 14px 18px; }

.lp-bubble {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px 12px 12px 4px;
  background: var(--paper);
  box-shadow: var(--shadow-ring);
  justify-self: start;
}

.lp-bubble--me {
  justify-self: end;
  border-radius: 12px 12px 4px 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--btn-highlight);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}

.lp-link { color: var(--muted); word-break: break-all; }

.lp-kbd { display: grid; gap: 4px; margin-top: 10px; }

.lp-kbd span {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
}

/* Alice voice mock-up */
.lp-voice {
  max-width: 400px;
  margin-inline: auto;
  display: grid;
  gap: 10px;
}

.lp-voice-row {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.lp-voice-row p { margin: 0; font-size: 0.95rem; line-height: 1.45; }

.lp-voice-row--alice { background: var(--ink); color: #fff; margin-left: 28px; box-shadow: var(--btn-highlight); }

.lp-voice-who {
  display: block;
  margin-bottom: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.lp-voice-row--alice .lp-voice-who { color: rgba(255,255,255,0.6); }

/* ─── Roles cards & FAQ ─── */

.lp-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.lp-card { padding: 22px; }
.lp-card p { margin: 0; font-size: 0.92rem; }

.lp-faq { display: grid; gap: 10px; }

.lp-faq details { padding: 0; }

.lp-faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 44px 16px 18px;
  position: relative;
  font-weight: 600;
}

.lp-faq summary::-webkit-details-marker { display: none; }

.lp-faq summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 400;
}

.lp-faq details[open] summary::after { content: "–"; }

.lp-faq details p { margin: 0; padding: 0 18px 16px; font-size: 0.92rem; }

/* ─── Join (auth) ─── */

.lp-join { scroll-margin-top: 60px; }

.lp-join .auth-shell { padding-top: 0; padding-bottom: 0; }

.lp-join .info-box { margin-top: 0; }

.lp-join-title {
  font-size: clamp(1.7rem, 5vw, 2.2rem);
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 10px;
}

/* ─── Footer ─── */

.lp-footer { padding: 28px 0 36px; box-shadow: rgba(34,42,53,0.08) 0px -1px 0px 0px; }

.lp-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.86rem;
}

/* ─── Legal pages (/privacy, /terms) ─── */

.lp-legal-back { font-size: 0.9rem; color: var(--muted) !important; text-decoration: none; }
.lp-legal-back:hover { color: var(--ink) !important; }

.lp-legal { padding-top: 48px; padding-bottom: 64px; line-height: 1.65; }
.lp-legal h1 { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
.lp-legal h2 { font-size: 1.15rem; font-weight: 600; margin: 36px 0 8px; }
.lp-legal p, .lp-legal li { color: var(--ink); overflow-wrap: anywhere; }
.lp-legal ul { padding-left: 20px; }
.lp-legal li + li { margin-top: 6px; }
.lp-legal a { text-decoration: underline; text-underline-offset: 2px; }
.lp-footer a { text-decoration: none; }
.lp-footer a:hover { text-decoration: underline; }

/* ─── Landing responsive ─── */

@media (max-width: 960px) {
  .lp-nav-links { display: none; }
  .lp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-cards { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .lp-hero,
  .lp-integration { grid-template-columns: 1fr; gap: 32px; }
  .lp-hero { padding-top: 44px; padding-bottom: 48px; }
  .lp-hero-visual { display: none; }  /* the showcase screenshot follows right below */
  .lp-integration--flip .lp-integration-copy { order: 0; }
  .lp-integration { padding: 36px 0; }
  .lp-section { padding-top: 56px; padding-bottom: 56px; }
  .lp-section-head { margin-bottom: 28px; }

  /* Showcase becomes an accordion: JS moves the screenshot under the active item */
  .lp-showcase { grid-template-columns: 1fr; gap: 0; }
  .lp-showcase-shot { position: static; max-width: 300px; margin: 6px auto 14px; }
  .lp-feature:not(.active) .lp-feature-text { display: none; }
}

@media (max-width: 560px) {
  .lp-wrap { padding-inline: 16px; }
  .lp-steps { grid-template-columns: 1fr; }
  .lp-brand > span:last-child { display: none; }
  .lp-cta-row .lp-btn { flex: 1 1 100%; }
}

/* ─── Utilities ──────────────────────────────────────────────────────────────── */

.w-full  { width: 100%; }

.sidebar,
.section-card,
.log-card {
  padding: 20px;
}

.two-col-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.row-gap { display: flex; gap: 10px; }
.row-gap button { flex: 1; }

.top-pad { padding-top: 22px; }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 1000;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: rgba(19,19,22,0.3) 0px 4px 24px;
}

.toast.hidden { display: none; }
.toast.error  { background: #c0392b; }

/* ─── Calendar events ────────────────────────────────────────────────────────── */

.event-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.event-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: var(--ink);
  margin-top: 6px;
}

.event-dot.all-day { background: var(--muted); }

.event-body { flex: 1; }

.event-title { font-weight: 600; margin-bottom: 2px; font-size: 0.95rem; }

.event-time { font-size: 0.8rem; color: var(--muted); }

.event-desc { font-size: 0.84rem; color: var(--muted); margin-top: 4px; }

/* ─── Family tab — member / invite items ─────────────────────────────────────── */

.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.member-email { font-weight: 500; font-size: 0.92rem; }

/* ─── Telegram link pending bar ──────────────────────────────────────────────── */

.tg-link-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  flex-shrink: 0;
}

.tg-link-bar.hidden  { display: none; }
.tg-link-bar.success { background: #1a5c1a; }
.tg-link-bar.error   { background: #c0392b; }

.tg-link-dismiss {
  background: transparent;
  color: #fff;
  border: none;
  padding: 2px 6px;
  width: auto;
  font-size: 0.85rem;
  min-width: 0;
  opacity: 0.6;
  box-shadow: none;
}

.tg-link-dismiss:hover { opacity: 1; background: transparent; }

/* ─── Tasks tab ──────────────────────────────────────────────────────────────── */

.task-item { position: relative; flex-wrap: wrap; row-gap: 8px; }

/* Title shrinks to ~120px, then the chips wrap onto their own line. */
.task-item .shop-item-name { flex: 1 1 120px; min-width: 0; }

.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }

.task-due {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--subtle);
  padding: 2px 8px;
  border-radius: 9999px;
}

.task-due.overdue {
  background: #fde8e8;
  color: #c0392b;
  font-weight: 600;
}

.task-status-chip {
  font-size: 0.72rem;
  padding: 2px 8px;
  background: var(--subtle);
  color: var(--muted);
}

.assignee-chip {
  font-size: 0.72rem;
  padding: 2px 8px;
  background: var(--subtle);
  color: var(--ink);
}

.task-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-row .task-item { flex: 1; min-width: 0; margin-bottom: 0; }

.task-edit-btn {
  flex-shrink: 0;
  padding: 6px 8px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.task-edit-panel {
  background: var(--subtle);
  box-shadow: var(--shadow-ring);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 6px;
}

.task-edit-title { width: 100%; margin-top: 0; }

button.danger {
  background: #fef2f2;
  color: #c0392b;
  box-shadow: rgba(220,38,38,0.15) 0px 0px 0px 1px;
}

button.danger:hover { background: #fee2e2; opacity: 1; }

.show-done-row { font-size: 0.88rem; margin: 0; padding: 4px 0; }

/* ─── Tab badge (overdue counter) ────────────────────────────────────────────── */

.tab-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--ink);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
}

.tab-badge.hidden { display: none; }
