/* ============================================================
   Home Hub — "Linen & Sage" (LOCKED)
   Tokens and components derived from home-hub-linen-sage.jsx.
   Do not introduce new colors or fonts.
   ============================================================ */

:root {
  /* Color */
  --base:      #EEEAE0;  /* app background, oatmeal linen */
  --panel:     #F8F6F0;  /* card surface */
  --panel2:    #FCFBF7;  /* raised card (modals) */
  --ink:       #2F352B;  /* primary text */
  --ink-soft:  #7C8472;  /* secondary text */
  --line:      #E0DBCE;  /* hairlines, input borders */
  --sage:      #6E7C5A;  /* primary action */
  --sage-deep: #586647;  /* pressed / emphasis text */
  --sage-soft: #DDE3D2;  /* chips, borders */
  --sage-wash: #E7EBDE;  /* tinted info surfaces */

  /* Freshness scale (functional — the signature) */
  --fresh:  #6E7C5A;  /* >4 days */
  --soon:   #C2913F;  /* 2-4 days */
  --urgent: #A65A47;  /* <=1 day */

  /* Type */
  --display: 'Newsreader', Georgia, serif;
  --body:    'Inter', system-ui, sans-serif;

  /* Form */
  --r-card: 14px;
  --r-tile: 16px;
  --r-modal: 16px;
  --r-pill: 20px;
  --shadow-card:   0 2px 9px rgba(47,53,43,.045);
  --shadow-raised: 0 8px 28px rgba(47,53,43,.12);
  --shadow-sage:   0 6px 16px rgba(110,124,90,.3);
  --maxw: 460px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Inline SVG icons default to a sensible size; button/nav rules override below. */
.icon { width: 18px; height: 18px; flex-shrink: 0; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--base);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: 90px;       /* clears the fixed nav */
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: var(--ink); }
::-webkit-scrollbar { width: 0; height: 0; }

/* Visible keyboard focus (mouse users don't see it) */
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; border-radius: 6px; }

/* Motion, gated on user preference */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .4s cubic-bezier(.2,.7,.3,1) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- Layout ---------- */
.screen { padding: 0 16px; }
.screen-head { padding: 30px 6px 16px; }
.h1 { font-family: var(--display); font-weight: 500; font-size: 33px; margin: 0; line-height: 1.08; }
.h2 { font-family: var(--display); font-weight: 600; font-size: 21px; margin: 0; }
.subhead { color: var(--ink-soft); font-size: 14.5px; margin-top: 3px; }
.uplabel { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--sage-deep); }
.stack { display: grid; gap: 8px; }
.spacer-lg { height: 22px; }

/* ---------- Glance grid + tiles ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 22px; }
.tile {
  background: var(--panel); border-radius: var(--r-tile); padding: 16px 16px 14px;
  border-top: 3px solid var(--sage); box-shadow: 0 3px 12px rgba(47,53,43,.05);
}
.tile-num { font-family: var(--display); font-size: 38px; font-weight: 500; line-height: 1; }
.tile-label { color: var(--ink-soft); font-size: 13px; margin-top: 6px; font-weight: 500; }

/* ---------- Feed + line rows ---------- */
.feed-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 10px; }
.feed-more { color: var(--sage); font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }

.line {
  background: var(--panel); border-radius: var(--r-card); padding: 13px 15px;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-card);
}
.line-body { flex: 1; min-width: 0; }
.line-title { font-weight: 600; font-size: 15px; }
.line-sub { color: var(--ink-soft); font-size: 12.5px; }
.line-right { color: var(--ink-soft); font-weight: 600; font-size: 13.5px; font-family: var(--display); white-space: nowrap; }
.line-right-stack { text-align: right; }
.line-right-meta { color: var(--ink-soft); font-size: 11px; }

.dot { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; }
.dot--fresh  { background: var(--fresh); }
.dot--soon   { background: var(--soon); }
.dot--urgent { background: var(--urgent); }
.dot--sage   { background: var(--sage); }
.dot--soft   { background: var(--sage-soft); }
.c-fresh  { color: var(--fresh); }
.c-soon   { color: var(--soon); }
.c-urgent { color: var(--urgent); }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--r-card); padding: 14px 16px; font-weight: 600; font-size: 14.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.btn--sage { background: var(--sage); color: #fff; box-shadow: var(--shadow-sage); }
.btn--ink  { background: var(--ink); color: #fff; }
.btn--quiet { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-card); }
.btn--ghost { background: var(--base); color: var(--ink-soft); }
.btn:disabled { opacity: .55; cursor: default; }
.btn .icon { width: 17px; height: 17px; }

/* ---------- Inputs ---------- */
.field {
  width: 100%; font-size: 16px; padding: 12px 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.field:focus { border-color: var(--sage); }
.field--underline {
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  border-radius: 0; padding: 10px 0;
}
.label-sm { font-size: 13px; color: var(--ink-soft); margin-bottom: 7px; }

.pill {
  padding: 7px 13px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
  background: var(--sage-wash); color: var(--sage-deep);
}
.pill--on { background: var(--sage); color: #fff; }

/* ---------- Cards / panels ---------- */
.card { background: var(--panel); border-radius: var(--r-card); padding: 16px; box-shadow: var(--shadow-card); }
.card--raised { background: var(--panel2); border-radius: var(--r-modal); padding: 16px;
  box-shadow: var(--shadow-raised); border: 1px solid var(--line); }
.card--wash { background: var(--sage-wash); border-radius: var(--r-modal); padding: 16px; border: 1px solid var(--sage-soft); }
.card-quote { font-family: var(--display); font-size: 18px; line-height: 1.4; margin: 8px 0 0; }

/* Email Hub "not connected" + empty/placeholder blocks */
.placeholder { background: var(--sage-wash); border-radius: 18px; padding: 44px 24px; text-align: center; border: 1px solid var(--sage-soft); }
.placeholder-title { font-family: var(--display); font-size: 19px; margin: 0; color: var(--sage-deep); }
.placeholder-sub { color: var(--ink-soft); font-size: 13.5px; margin: 8px 0 0; line-height: 1.5; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw);
  background: rgba(238,234,224,.93); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; padding: 9px 4px 15px; z-index: 50;
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--ink-soft); padding: 2px 0; }
.nav-item.on { color: var(--sage); }
.nav-item .icon { width: 21px; height: 21px; }
.nav-label { font-size: 10.5px; font-weight: 500; }
.nav-item.on .nav-label { font-weight: 600; }

/* ---------- Auth / household join screens ---------- */
.auth-wrap { padding: 0 22px; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.auth-brand { font-family: var(--display); font-size: 40px; font-weight: 500; margin: 0 0 4px; }
.auth-tag { color: var(--ink-soft); font-size: 15px; margin: 0 0 28px; line-height: 1.45; }
.auth-field { margin-bottom: 12px; }
.auth-switch { text-align: center; color: var(--ink-soft); font-size: 13.5px; margin-top: 18px; }
.auth-switch button { color: var(--sage); font-weight: 600; }
.auth-error { background: #f6e9e6; color: var(--urgent); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.auth-note { color: var(--ink-soft); font-size: 12.5px; margin-top: 14px; text-align: center; line-height: 1.5; }
.seg { display: flex; gap: 8px; margin-bottom: 18px; }
.seg button { flex: 1; padding: 11px; border-radius: 12px; font-weight: 600; font-size: 14px; background: var(--panel); color: var(--ink-soft); box-shadow: var(--shadow-card); }
.seg button.on { background: var(--sage); color: #fff; }
.code-display { font-family: var(--display); font-size: 30px; letter-spacing: .12em; text-align: center; background: var(--panel); border-radius: 12px; padding: 16px; margin: 6px 0 4px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 600; z-index: 60; box-shadow: var(--shadow-raised);
  max-width: calc(var(--maxw) - 40px);
}

/* Loading dots */
.loading { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 40px 0; }

/* swatch row for picking a member color */
.swatches { display: flex; gap: 10px; margin: 6px 0 16px; }
.swatch { width: 34px; height: 34px; border-radius: 17px; border: 2px solid transparent; }
.swatch.on { border-color: var(--ink); }

/* ---------- Module additions (Checkpoint 2) ---------- */

/* Tile tints are set inline per tint (urgent/sage/soon/fresh) to match the prototype. */

/* "Tonight's idea" meal card (sage-wash) */
.idea-head { display: flex; justify-content: space-between; align-items: center; }
.idea-x { color: var(--ink-soft); display: inline-flex; }

/* Kitchen toolbar: suggest + add, search + camera */
.row-gap { display: flex; gap: 8px; margin-bottom: 12px; }
.search-wrap { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--panel);
  border-radius: 12px; padding: 0 12px; border: 1px solid var(--line); }
.search-wrap input { border: none; outline: none; background: transparent; padding: 11px 0; width: 100%; font-size: 14px; }
.icon-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 13px;
  display: flex; align-items: center; }

/* Food row hidden by search filter */
.food-row.hidden { display: none; }

/* Quick-add day chips reuse .pill; container */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

/* Rhythm strip */
.section-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); padding: 0 6px 9px; }
.rhythm-card { background: var(--panel); border-radius: var(--r-card); padding: 14px 15px;
  box-shadow: var(--shadow-card); display: flex; align-items: center; gap: 13px; }
.rhythm-main { flex: 1; min-width: 0; text-align: left; }
.rhythm-kind { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.rhythm-state { font-family: var(--display); font-size: 20px; font-weight: 500; margin-top: 2px; }
.rhythm-hint { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.rhythm-advance { background: var(--sage-wash); color: var(--sage-deep); border-radius: 12px;
  padding: 11px 14px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.claim-btn { background: var(--sage); color: #fff; border-radius: 12px; padding: 11px 14px;
  font-weight: 600; font-size: 13px; white-space: nowrap; box-shadow: var(--shadow-sage); }
.claimed { font-size: 12.5px; color: var(--sage-deep); font-weight: 600; white-space: nowrap; }

/* Soft nudge line on the dashboard */
.nudge { background: var(--sage-wash); border: 1px solid var(--sage-soft); border-radius: var(--r-card);
  padding: 12px 14px; font-size: 13.5px; color: var(--sage-deep); margin-bottom: 12px; line-height: 1.45; }

/* Settings toggle (nudges) */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--panel); border-radius: var(--r-card); padding: 14px 15px; box-shadow: var(--shadow-card); }
.toggle-text { font-size: 13.5px; }
.toggle-text .t-sub { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.toggle { width: 46px; height: 27px; border-radius: 14px; background: var(--sage-soft); position: relative; flex-shrink: 0; }
.toggle.on { background: var(--sage); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 11px; background: #fff; }
@media (prefers-reduced-motion: no-preference) { .toggle, .toggle .knob { transition: background .15s, left .15s; } }
.toggle.on .knob { left: 22px; }

/* Bottom sheet (add food, item actions) */
.overlay { position: fixed; inset: 0; background: rgba(47,53,43,.28); z-index: 70;
  display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: var(--maxw); background: var(--panel2);
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-raised); }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: sheet-up .26s cubic-bezier(.2,.7,.3,1) both; } }
@keyframes sheet-up { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-title { font-family: var(--display); font-size: 20px; margin: 0 0 14px; }
.sheet-inline { display: flex; gap: 8px; margin-bottom: 12px; }

/* Empty-state line inside a feed */
.empty-line { color: var(--ink-soft); font-size: 13.5px; padding: 4px 6px 2px; }

/* ---------- Calendar (Phase 2) ---------- */
.cal-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-month { font-family: var(--display); font-size: 20px; font-weight: 600; }
.cal-navs { display: flex; gap: 6px; }
.cal-nav { width: 34px; height: 34px; border-radius: 10px; background: var(--panel); box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-soft); padding: 2px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { aspect-ratio: 1 / 1; border-radius: 11px; background: var(--panel); box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; align-items: center; padding-top: 6px; gap: 3px; position: relative; }
.cal-cell .d { font-size: 13px; font-weight: 600; }
.cal-cell.other { background: transparent; box-shadow: none; }
.cal-cell.other .d { color: var(--ink-soft); opacity: .5; }
.cal-cell.today .d { color: #fff; background: var(--sage); width: 22px; height: 22px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.cal-cell.sel { outline: 2px solid var(--sage); outline-offset: -1px; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.cal-dot { width: 6px; height: 6px; border-radius: 3px; }
.cal-daytitle { font-family: var(--display); font-size: 18px; font-weight: 600; margin: 18px 0 10px; padding: 0 4px; }
.event-row { background: var(--panel); border-radius: var(--r-card); padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-card); width: 100%; text-align: left; }
.event-bar { width: 4px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.event-when { color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; font-family: var(--display); }
.agenda-day { font-size: 12px; font-weight: 600; color: var(--sage-deep); letter-spacing: .04em; text-transform: uppercase; padding: 14px 4px 8px; }

/* ---------- Shared lists ---------- */
.list-card { background: var(--panel); border-radius: var(--r-card); padding: 14px 15px; box-shadow: var(--shadow-card); margin-bottom: 12px; }
.list-name { font-family: var(--display); font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.list-item { display: flex; align-items: center; gap: 11px; padding: 7px 0; }
.list-check { width: 21px; height: 21px; border-radius: 6px; border: 2px solid var(--sage-soft); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.list-check.on { background: var(--sage); border-color: var(--sage); }
.list-item .t { flex: 1; font-size: 14.5px; }
.list-item.done .t { color: var(--ink-soft); text-decoration: line-through; }
.list-add { display: flex; align-items: center; gap: 8px; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.list-add input { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; }

/* ---------- Us ---------- */
.us-hero { background: var(--sage-wash); border: 1px solid var(--sage-soft); border-radius: var(--r-modal); padding: 22px 18px; text-align: center; margin-bottom: 18px; }
.us-num { font-family: var(--display); font-size: 46px; font-weight: 500; color: var(--sage-deep); line-height: 1; }
.us-sub { color: var(--ink-soft); font-size: 13.5px; margin-top: 6px; }
.cat-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.cat-tab { flex: 1; padding: 9px; border-radius: 11px; font-size: 13px; font-weight: 600; background: var(--panel); color: var(--ink-soft); box-shadow: var(--shadow-card); }
.cat-tab.on { background: var(--sage); color: #fff; }

/* ---------- Segmented view toggle ---------- */
.seg-sm { display: inline-flex; background: var(--panel); border-radius: 11px; padding: 3px; box-shadow: var(--shadow-card); }
.seg-sm button { padding: 6px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.seg-sm button.on { background: var(--sage); color: #fff; }

/* Mini chip for the who-picker / categories in sheets */
.pickrow { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- In-app recipe assistant (chat) ---------- */
.recipe-sheet { max-height: 88vh; display: flex; flex-direction: column; }
.chat-thread { overflow-y: auto; flex: 1; padding: 4px 2px 8px; min-height: 120px; }
.chat-asst { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; margin: 6px 0 14px; color: var(--ink); }
.chat-user { background: var(--sage); color: #fff; border-radius: 14px 14px 4px 14px; padding: 9px 13px;
  font-size: 14px; max-width: 85%; margin: 8px 0 8px auto; width: fit-content; }
.chat-pending { color: var(--ink-soft); font-size: 13.5px; padding: 2px 0 8px; }
.chat-input { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.chat-input input { flex: 1; }
