/* The iOS Native theme on the web: ThemePalettes.native, NativeCard, NativeCardHeader, NativeBigValue.
   Loaded last, so it overrides the older look in app.css and typography.css. */
:root {
  --bg: #f2f2f7;
  --surface: #fff;
  --ink: #111114;
  --muted: #6c6c72;
  --line: #e5e5ea;
  --soft: #eeeef0;
  --accent: #16b05a;
  --accent-ink: #0d8744;
  --accent-soft: #16b05a22;
  --eating: #007aff;
  --blue: #0d8744;
  --yellow: #16b05a;
  --track: #e6e6eb;
  --radius: 26px;
}

/* Cards: white, no outline, tight. */
.panel, .nutrition-panel, .fasting-panel, .water-panel, .feature-grid > .water-panel {
  background: var(--surface);
  border: 0;
  box-shadow: none;
}
.panel { border-radius: var(--radius); }
.feature-panel { padding: 20px; }
.feature-grid { gap: 12px; }
.track { height: 6px; background: var(--track); border-radius: 3px; }
.track > span { background: var(--tint, var(--accent)); border-radius: 3px; }
.feature-row { border-bottom-color: var(--line); padding: 11px 0; }

/* Buttons: capsules, the main one in the accent colour. */
.btn { min-height: 44px; padding: 10px 18px; border-radius: 999px; font-weight: 600; }
.btn-yellow, .btn-ink { background: var(--accent); color: #fff; }
.btn-yellow:hover, .btn-ink:hover { color: #fff; background: var(--accent-ink); }
.btn-outline { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn-soft { background: var(--soft); color: var(--ink); }
.btn-tint { min-height: 36px; padding: 7px 14px; background: var(--tint-soft, var(--accent-soft)); color: var(--tint-ink, var(--accent-ink)); font-size: .9375rem; }
.btn-tint:hover { color: var(--tint-ink, var(--accent-ink)); filter: brightness(.97); }
.text-button { color: var(--muted); font-weight: 500; }
.text-button:hover { color: var(--accent-ink); }
.round-button { display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--tint-soft, var(--accent-soft)); color: var(--tint-ink, var(--accent-ink)); }
.round-button .icon { width: 17px; height: 17px; }
.round-button:hover { filter: brightness(.96); }

/* Navigation: the selected item is a green tint, like the iOS tab bar. */
.sidebar { background: var(--surface); border-inline-end-color: var(--line); }
.nav-item.active, .mobile-nav .nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-item.active .icon, .mobile-nav .nav-item.active .icon { color: var(--accent-ink); }
.sync-status { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); }
.sync-status .icon { width: 15px; height: 15px; color: var(--accent); }
.sync-status[data-state="offline"] .icon { display: none; }

/* Colour of each tile: ThemePalettes.native through Palette.tint(_:). --tint-ink stays readable on white. */
[data-tile="calories"] { --tint: #ff9500; --tint-ink: #b85c00; --tint-soft: #ff950022; }
[data-tile="water"] { --tint: #32ade6; --tint-ink: #0a7fb5; --tint-soft: #32ade622; }
[data-tile="meals"] { --tint: #34c759; --tint-ink: #16803c; --tint-soft: #34c75922; }
[data-tile="activity"] { --tint: #00c7be; --tint-ink: #00807a; --tint-soft: #00c7be22; }
[data-tile="steps"] { --tint: #34c759; --tint-ink: #16803c; --tint-soft: #34c75922; }
[data-tile="sleep"], [data-tile="weight"] { --tint: #5856d6; --tint-ink: #4845c4; --tint-soft: #5856d620; }
[data-tile="vitamins"], [data-tile="poo"] { --tint: #30b0c7; --tint-ink: #0b7d91; --tint-soft: #30b0c722; }
[data-tile="coffee"] { --tint: #a2845e; --tint-ink: #84673f; --tint-soft: #a2845e24; }
[data-tile="sweet"] { --tint: #ff2d55; --tint-ink: #d3123e; --tint-soft: #ff2d551f; }
[data-tile="alcohol"] { --tint: #af52de; --tint-ink: #9a3ccb; --tint-soft: #af52de20; }
[data-tile="smoking"] { --tint: #8e8e93; --tint-ink: #6c6c70; --tint-soft: #8e8e9324; }
[data-tile="quickActions"] { --tint: #16b05a; --tint-ink: #0d8744; --tint-soft: #16b05a22; }

/* Tiles: wide ones take a row, narrow ones go in pairs. Four columns where the screen has room. */
.tile-heading { margin: 22px 4px 10px; }
.tile-heading h2 { font-size: 1.375rem; font-weight: 700; }
.tile-heading .text-button { color: var(--accent-ink); font-size: 1.0625rem; font-weight: 400; }
.tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: 10px; margin-bottom: 14px; }
.tile-grid > .feature-tile, .tile-grid > .panel { padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tile-grid > .tile-wide, .tile-grid > .panel:not(.feature-tile) { grid-column: span 2; }
.feature-tile > .panel-top { margin: 0; color: var(--tint-ink, var(--ink)); font-size: .9375rem; font-weight: 600; }
.feature-tile > .panel-top > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.feature-tile > .panel-top .icon { width: 16px; height: 16px; color: var(--tint, currentColor); }
.feature-tile > .panel-top > b { color: var(--muted); font-weight: 400; }
.feature-tile .feature-number { font-size: 1.875rem; font-weight: 600; line-height: 1.1; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.feature-tile .feature-number small { color: var(--muted); font-size: .9375rem; font-weight: 600; }
.feature-tile p { margin: 0; color: var(--muted); font-size: .8125rem; }
.feature-tile .track { margin: 0; }
.feature-tile .feature-actions { margin: auto 0 0; gap: 8px 12px; }
.feature-tile .text-button { font-size: .875rem; min-height: 0; }
.feature-tile .feature-row { padding: 8px 0; }
.library-link { display: block; padding: 6px 0 2px; color: var(--muted); font-size: .9375rem; font-weight: 500; text-align: center; }

/* Calories: ring on the left, the sum on the right, macros below. */
.calorie-body { display: flex; align-items: center; gap: 18px; }
.calorie-ring { position: relative; flex: 0 0 auto; width: 118px; height: 118px; }
.calorie-ring svg { display: block; width: 100%; height: 100%; }
.calorie-ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.calorie-ring .ring-track { stroke: var(--track); }
.calorie-ring > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.calorie-ring strong { font-size: 1.625rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.calorie-ring small { font-size: .8125rem; font-weight: 500; }
.ring-left { color: #16803c; }
.ring-over { color: #d7261c; }
.calorie-lines { flex: 1; min-width: 0; display: grid; gap: 9px; }
.calorie-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9375rem; }
.calorie-line .icon { width: 15px; height: 15px; }
.calorie-line b { margin-inline-start: auto; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
[data-tile="calories"] .macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
[data-tile="calories"] .macro { display: grid; gap: 4px; font-size: .8125rem; color: var(--muted); }
[data-tile="calories"] .macro > span:first-child { color: var(--ink); font-weight: 600; }
[data-tile="calories"] .macro .track { margin: 0; }
[data-tile="calories"] .sugar-line { display: flex; justify-content: space-between; color: var(--muted); font-size: .8125rem; }

/* Fast block: sits on the page background, like NativeHeroLine. */
.fast-hero { margin: 0 4px; display: grid; gap: 10px; }
.fast-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.fast-readout { min-width: 0; }
.fast-label { margin: 0; color: var(--accent-ink); font-size: 1.0625rem; font-weight: 600; }
.fast-hero[data-phase="eating"] .fast-label { color: var(--eating); }
#fast-timer { display: block; color: var(--ink); font-family: var(--font-display); font-size: 3.5rem; font-weight: 600; line-height: 1.08; font-variant-numeric: tabular-nums; }
.fast-first-icon { display: block; color: var(--accent); }
.fast-first-icon .icon { width: 34px; height: 34px; }
.fast-hero h2 { margin: 4px 0 0; font-size: 1.625rem; font-weight: 700; }
.fast-cta { flex-shrink: 0; min-height: 48px; margin-bottom: 8px; padding-inline: 22px; font-size: 1.0625rem; box-shadow: 0 6px 16px #16b05a40; }
.fast-cta .icon { width: 17px; height: 17px; }
.fast-track { height: 14px; border-radius: 7px; }
.fast-track > span { background: linear-gradient(90deg, #7cf0b4, #14c76a); border-radius: 7px; }
.fast-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fast-foot .muted { font-size: .9375rem; font-variant-numeric: tabular-nums; }
.plan-pill { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 5px 12px 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .9375rem; font-weight: 500; }
.plan-pill .icon { width: 13px; height: 13px; }
.fast-times { display: grid; grid-template-columns: 1fr 1fr; padding: 12px; text-align: center; }
.fast-times > div + div { border-inline-start: 1px solid var(--line); }
.fast-times small { display: block; color: var(--accent-ink); font-size: .8125rem; font-weight: 600; }
.fast-times b { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.fast-links { display: flex; gap: 16px; }
.fast-links .text-button { min-height: 0; font-size: .875rem; }

/* Friends: NativeFriendCard. The cards sit straight on the page background, not inside another card. */
.together-panel { padding: 0; background: transparent; }
.social-tabs { gap: 6px; margin-bottom: 18px; }
.social-tabs .btn { min-height: 36px; padding: 6px 14px; border: 0; background: var(--surface); color: var(--ink); font-size: .9375rem; font-weight: 500; }
.social-tabs .btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.friend-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.friend-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); }
.friend-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0; text-align:start; }
.friend-head .avatar { width: 46px; height: 46px; flex-shrink: 0; overflow: hidden; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--avatar, var(--accent)) 22%, white); color: var(--ink); font-size: 1.375rem; font-weight: 600; }
.friend-head > .icon { width: 13px; height: 13px; color: #b5b5ba; }
.friend-title { flex: 1; min-width: 0; display: grid; gap: 1px; }
.friend-title b { overflow: hidden; font-size: 1.0625rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.friend-title small { color: var(--muted); font-size: .8125rem; }
.friend-card .friend-day { margin: -8px 0 -6px; font-size: .8125rem; }
.friend-card p, .friend-card ul { margin: 0; color: var(--muted); font-size: .8125rem; }
.friend-card ul { padding-inline-start: 18px; }
.friend-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0; }
.friend-facts .friend-metric { display: grid; gap: 6px; }
.friend-facts .friend-metric-top { display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
.friend-facts .track { display: block; }
.friend-metric-top .icon { width: 14px; height: 14px; color: var(--tint-ink); }
.friend-metric-top > span { color: var(--ink); font-size: .9375rem; font-weight: 600; }
.friend-metric-top small { overflow: hidden; color: var(--muted); font-size: .8125rem; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.friend-metric-top b { margin-inline-start: auto; color: var(--muted); font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.friend-metric[data-metric="fast"] { --tint: #16b05a; --tint-ink: #0d8744; }
.friend-metric[data-metric="food"] { --tint: #ff9500; --tint-ink: #b85c00; }
.friend-metric[data-metric="water"] { --tint: #32ade6; --tint-ink: #0a7fb5; }
.friend-metric[data-metric="steps"] { --tint: #34c759; --tint-ink: #16803c; }
.friend-facts .friend-weight { display: grid; gap: 4px; }
.friend-facts .friend-weight > div { display: flex; flex-direction: row; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .8125rem; }
.friend-weight b { color: var(--ink); font-weight: 500; }
.friend-reactions { display: flex; gap: 8px; margin-top: auto; }
.btn-react { flex: 1; min-height: 38px; padding: 7px 8px; font-size: .9375rem; white-space: nowrap; }
.friend-reactions .btn-react-cheer { background: var(--accent-soft); color: var(--accent-ink); }
.friend-reactions .btn-react-nudge { background: #007aff1c; color: #0060cc; }
.btn-react:hover { filter: brightness(.97); }
.together-panel .social-self, .together-panel > details { margin-bottom: 10px; padding: 14px 16px; border: 0; border-radius: var(--radius); background: var(--surface); }

@media (max-width: 1250px) {
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  /* app.css makes feature grids one column here; tiles keep their pairs. */
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-grid > .feature-tile { padding: 16px; }
  .feature-tile .feature-actions { width: auto; }
  .feature-tile .feature-actions .btn { width: auto; }
  #fast-timer { font-size: 3rem; }
  .friend-grid { grid-template-columns: minmax(0, 1fr); }
}
