/* inteligync v2 dashboard (M3). Phone first (390 px), matching the approved mockup.
   Colours come from the theme via CSSOM custom properties (app.js); these are the mockup defaults. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/v2/fonts/fraunces-latin-ext-opsz-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/v2/fonts/fraunces-latin-opsz-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 100 1000;
  src: url('/v2/fonts/dm-sans-latin-ext-opsz-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 100 1000;
  src: url('/v2/fonts/dm-sans-latin-opsz-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #FBF6EE;
  --card: #FFFFFF;
  --text: #3A2A21;
  --muted: #7A6656;
  --accent: #A3355B;
  --accent-soft: #F7E3E6;
  --accent-ink: #A3355B;
  --border: #EEE2D3;
  --line: #F1E7DA;
  --track: #F1E7DA;
  --panel: #FBF6EE;
  --ok-fg: #3F6B2E;  --ok-bg: #E3EDD9;
  --warn-fg: #8A5300; --warn-bg: #F8EBCF;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
:root[data-mode="dark"] {
  --ok-fg: #A9D18E;  --ok-bg: #26361D;
  --warn-fg: #F0C27A; --warn-bg: #3B2C13;
  color-scheme: dark;
}
/* `classic` and `clean` fall back to system faces until their fonts are self-hosted. */
:root[data-font="classic"] { --display: 'Lora', Georgia, 'Times New Roman', serif; --body: 'Source Sans 3', 'Source Sans Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; }
:root[data-font="clean"]   { --display: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
:root[data-font="system"]  { --display: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
h1, h2, h3, p { margin: 0; }
.is-hidden { display: none !important; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wrap--narrow { max-width: 440px; padding-top: 48px; }

/* ── Header ─────────────────────────────────────────────── */
.top { display: flex; flex-direction: column; gap: 16px; padding: 4px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
}
.logo--image { background: var(--card); border: 1px solid var(--border); overflow: hidden; }
.logo-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.pill-link {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.pill-link svg { width: 16px; height: 16px; }
.greeting {
  font-family: var(--display);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.today { margin-top: 6px; color: var(--muted); font-size: 15px; }

.banner {
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: 14px;
}

/* ── Card grid ──────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 360px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards > * { grid-column: 1 / -1; }
  .cards > .card--half { grid-column: auto; }
}

.card {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card--half { padding: 16px; gap: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.section-heading {
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.2;
  padding: 8px 4px 0;
  overflow-wrap: anywhere;
}
.badge {
  flex: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 10px;
}
.count {
  flex: none;
  min-width: 24px; height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.time { flex: none; font-size: 13px; color: var(--muted); }
.note { font-size: 13px; line-height: 1.5; color: var(--muted); }
.body-text { font-size: 15px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }

.btn {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px;
  text-align: center;
  cursor: pointer;
}
.btn--primary { min-height: 48px; border-color: var(--accent); background: var(--accent); color: #FFFFFF; font-weight: 600; }
.btn:disabled { opacity: 0.6; cursor: default; }
.is-disabled { opacity: 0.5; }

/* goal */
.goal-number { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.goal-current { font-family: var(--display); font-size: 56px; font-weight: 600; line-height: 1; }
.goal-of { color: var(--muted); font-size: 16px; }
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress-track { height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress-fill { height: 10px; border-radius: 999px; background: var(--accent); width: 0; }
.milestones { display: grid; font-size: 12px; color: var(--muted); text-align: right; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { flex: 1 1 120px; background: var(--panel); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.stat-value { font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* briefing */
.brief { display: flex; gap: 14px; }
.brief-icon {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
}
.brief-icon svg { width: 18px; height: 18px; }
.brief-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.item-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

/* approvals */
.approval { display: flex; flex-direction: column; gap: 8px; }
.approval .item-title { font-size: 14px; }
.panel-text { background: var(--panel); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; background: var(--panel); border-radius: 999px; padding: 6px 10px; overflow-wrap: anywhere; }
.tag--more { background: transparent; color: var(--muted); padding: 6px 4px; }
.inline-link { align-self: flex-start; font-size: 14px; font-weight: 600; color: var(--accent-ink); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }

/* plan, status, calendar rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row-day { flex: none; width: 36px; font-size: 13px; font-weight: 600; color: var(--muted); }
.row--today .row-day { color: var(--accent-ink); }
.row-text { flex: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
.row-badge { flex: none; font-size: 12px; font-weight: 500; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 3px 8px; }
.row--status { justify-content: space-between; }
.state-pill { flex: none; font-size: 13px; font-weight: 500; border-radius: 999px; padding: 4px 10px; }
.state-pill--ok { color: var(--ok-fg); background: var(--ok-bg); }
.state-pill--warn { color: var(--warn-fg); background: var(--warn-bg); }
.state-pill--off { color: var(--muted); background: var(--panel); }
.row .inline-link { min-height: 44px; }

/* photo */
.photo-slot {
  height: 210px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: var(--panel);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 12px;
}
.card--half .photo-slot { height: 140px; }
.photo-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  border-radius: 14px;
  background: var(--panel);
}
.card--half .photo-img { max-height: 220px; }
.steps { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.step-text { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; min-width: 0; }

/* table: scrolls sideways inside its card, never the page */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.table { border-collapse: collapse; min-width: 100%; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.table tr:last-child td { border-bottom: 0; }
.table-empty { font-size: 14px; color: var(--muted); }

/* table views: filter buttons, pager, highlighted cells */
.tview { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tview-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 36px;
  max-width: 100%;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pager-btn {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.pager-btn:disabled { opacity: 0.35; cursor: default; }
.pager-label { flex: 1; min-width: 0; text-align: center; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.tview-note { font-size: 13px; color: var(--muted); }
.table td.cell--warn { font-weight: 700; }
.cell-mark { color: var(--warn-fg); background: var(--warn-bg); border-radius: 6px; padding: 2px 6px; margin-left: -6px; }

/* collections: a list of titles; each opens its own page inside the card (recipes first) */
.coll { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.coll-titles { list-style: none; margin: 0; padding: 0; }
.coll-title-btn {
  width: 100%;
  min-height: 52px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.coll-titles li:last-child .coll-title-btn { border-bottom: 0; }
.coll-title-text { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.coll-title-detail { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.coll-page { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.coll-back {
  align-self: flex-start;
  max-width: 100%;
  min-height: 44px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.coll-item-title { font-family: var(--display); font-weight: 500; font-size: 26px; line-height: 1.2; overflow-wrap: anywhere; }
.coll-item-title:focus { outline: none; }
.coll-details { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.coll-section { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; min-width: 0; }
.coll-section-head { margin: 0; font-family: var(--display); font-size: 21px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.coll-sub { margin: 4px 0 0; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
.coll-list { margin: 0; padding-left: 1.5em; }
.coll-list li { font-size: 17px; line-height: 1.5; padding-left: 4px; white-space: pre-line; overflow-wrap: anywhere; }
.coll-list li + li { margin-top: 6px; }
.coll-list li::marker { color: var(--accent-ink); font-weight: 600; }
.coll-para { font-size: 17px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }

/* checklist (view only: Becky ticks items) */
.checks { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.check { display: flex; align-items: flex-start; gap: 12px; }
.check-box {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: #FFFFFF;
  margin-top: 1px;
}
.check-box svg { width: 14px; height: 14px; }
.check--done .check-box { background: var(--accent); border-color: var(--accent); }
.check-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.check-text { font-size: 15px; overflow-wrap: anywhere; }
.check--done .check-text { color: var(--muted); text-decoration: line-through; }

/* numbers */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tiles--one { grid-template-columns: minmax(0, 1fr); }
.card--half .tiles { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.card--half .tile { padding: 10px 12px; }
.card--half .tile-value { font-size: 22px; }
.tile { background: var(--panel); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.tile-value { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; display: flex; align-items: baseline; gap: 6px; }
.tile-trend { font-family: var(--body); font-size: 14px; font-weight: 600; color: var(--muted); }
.tile-trend--up { color: var(--ok-fg); }
.tile-trend--down { color: var(--accent-ink); }
.tile-label { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

/* links */
.link-list { display: flex; flex-direction: column; gap: 10px; }
.link-btn {
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  color: var(--text);
  text-decoration: none;
  display: flex; flex-direction: column; justify-content: center;
  min-width: 0;
}
.link-label { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.link-domain { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.link-domain--check { color: var(--warn-fg); }

/* calendar */
.cal-day { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cal-day:last-child { border-bottom: 0; }
.cal-date { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.cal-day--today .cal-date { color: var(--accent-ink); }
.cal-item { display: flex; gap: 12px; font-size: 15px; }
.cal-time { flex: none; width: 64px; color: var(--muted); font-size: 14px; }
.cal-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cal-empty { font-size: 14px; color: var(--muted); }

.updated { text-align: center; font-size: 13px; color: var(--muted); padding: 4px 0; }

/* state messages + sign-in page */
.state-title, .login-title { font-family: var(--display); font-weight: 500; font-size: 24px; line-height: 1.2; }
.state-text, .login-text { font-size: 15px; color: var(--muted); }
.login { gap: 18px; }
.login .note { background: var(--warn-bg); color: var(--warn-fg); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.note-title { font-weight: 600; font-size: 14px; }
.note-text { font-size: 14px; }
.login-status { font-size: 14px; color: var(--muted); min-height: 1.5em; }

/* Desktop: cards flow in rows like the desktop mockup; half cards are narrower. */
@media (min-width: 900px) {
  .wrap { padding: 32px 24px 48px; gap: 24px; }
  .greeting { font-size: 40px; line-height: 1.1; }
  .today { font-size: 16px; }
  .cards { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
  .cards > .card { flex: 2 1 560px; padding: 24px; }
  .cards > .card--half { flex: 1 1 340px; }
  .cards > .section-heading { flex: 1 1 100%; }
  .goal-current { font-size: 64px; }
  .progress-track, .progress-fill { height: 12px; }
}
