/* ==========================================================================
   Bowl — the Feeding OS interface language. Tokens and components.
   Documented in /ui-language. Screens live in app.css.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --bg-a: #F8F6F3; --bg-b: #F3F0EC;
  --surface-a: #FFFFFF; --surface-b: #FDFCFA;
  --surface-2: #F2EFEA;
  --ink: 24 50 74;
  --label: rgb(var(--ink));
  --label-2: rgb(var(--ink) / .62);
  --label-3: rgb(var(--ink) / .38);
  --label-4: rgb(var(--ink) / .2);
  --fill-1: rgb(var(--ink) / .05);
  --fill-2: rgb(var(--ink) / .09);
  --fill-3: rgb(var(--ink) / .14);
  --separator: rgb(var(--ink) / .11);
  --hairline: 0.5px;

  --red: #D93F50; --red-bg: #FCE5E8;
  --green: #2E6A42; --green-bg: #E6F5E8;
  --blue: #185B88; --blue-bg: #E6F3FB;
  --orange: #E86722; --orange-bg: #FFE8D5;
  --amber: #9A6700; --amber-bg: #FFF5CF;
  --pink: #F8DDE0; --pink-bg: #FFF7F8;

  --phase-bg: #F1ECE6; --phase-fg: #766F68;

  --font: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;

  --r-xs: 8px; --r-s: 12px; --r-m: 16px; --r-l: 22px; --r-xl: 28px; --r-sheet: 36px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --margin: 16px;

  --shadow-float: 0 1px 2px rgb(var(--ink) / .06), 0 12px 32px rgb(var(--ink) / .10);
  --shadow-modal: 0 -2px 24px rgb(var(--ink) / .10);
  --edge: 0 0 0 var(--hairline) rgb(var(--ink) / .06);
  --material: rgb(248 246 243 / .74);
  --blur: saturate(180%) blur(24px);

  --spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.012 55.3%, 1.007 63.7%, 1 76.6%);
  --spring-snap: linear(0, 0.008 1.1%, 0.031 2.2%, 0.129 4.8%, 0.257 7.2%, 0.671 14.2%, 0.789 16.5%, 0.881 18.6%, 0.957 20.7%, 1.019 22.9%, 1.063 25.1%, 1.094 27.4%, 1.114 30.7%, 1.112 34.5%, 1.018 49.9%, 0.99 59.1%, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --d-1: 120ms; --d-2: 220ms; --d-3: 360ms; --d-4: 520ms; --d-5: 800ms;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --nav-h: 52px;
  --tabbar-h: 64px;
  --composer-h: 52px;
  --dock-h: calc(var(--tabbar-h) + var(--composer-h) + 34px + var(--sab));
  --icon-cut: #fff;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--bg-a) 0%, var(--bg-b) 100%) fixed;
  color: var(--label);
  font-family: var(--font);
  font-size: 17px; line-height: 22px; letter-spacing: -.2px;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }
::selection { background: var(--pink); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: var(--r-xs); }
.ic { width: 24px; height: 24px; display: inline-block; vertical-align: -.2em; flex: none; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.balance { text-wrap: balance; }
.pretty { text-wrap: pretty; max-width: 36em; }
@supports (corner-shape: squircle) {
  .card, .group, .tile, .sheet-panel, .seg, .app-icon, .lead, .datebox { corner-shape: squircle; }
}

/* ---------- type ---------- */
.t-large { font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -.6px; text-wrap: balance; }
.t-1 { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -.5px; text-wrap: balance; }
.t-2 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.35px; text-wrap: balance; }
.t-3 { font-size: 20px; line-height: 25px; font-weight: 600; letter-spacing: -.25px; }
.t-headline { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.2px; }
.t-body { font-size: 17px; line-height: 22px; font-weight: 400; letter-spacing: -.2px; }
.t-callout { font-size: 16px; line-height: 21px; letter-spacing: -.15px; }
.t-sub { font-size: 15px; line-height: 20px; letter-spacing: -.1px; }
.t-foot { font-size: 13px; line-height: 18px; letter-spacing: 0; }
.t-cap { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0; }
.t-num-xl { font-size: 56px; line-height: 60px; font-weight: 600; letter-spacing: -1.6px; font-variant-numeric: tabular-nums; }
.t-num-l { font-size: 34px; line-height: 38px; font-weight: 600; letter-spacing: -.9px; font-variant-numeric: tabular-nums; }
.t-num { font-size: 22px; line-height: 26px; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.c-2 { color: var(--label-2); } .c-3 { color: var(--label-3); } .c-4 { color: var(--label-4); }
.c-red { color: var(--red); } .c-green { color: var(--green); } .c-blue { color: var(--blue); } .c-orange { color: var(--orange); }
.unit { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--label-2); margin-left: 3px; letter-spacing: 0; }

/* ---------- motion primitives ---------- */
.pressable { transition: transform var(--d-1) var(--ease-out), opacity var(--d-1) var(--ease-out); }
.pressable:active { transform: scale(.96); transition-duration: 60ms; }
.pressable:not(:active) { transition: transform var(--d-4) var(--spring-snap); }
.rise { animation: rise var(--d-3) var(--spring) both; }
.stagger > * { animation: rise var(--d-3) var(--spring) both; animation-delay: calc(var(--i, 0) * 32ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 30% { transform: scale(.86); } 65% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -18px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes lift { to { opacity: 0; transform: translate(-50%, -12px); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(48px); opacity: .6; } }
@keyframes dialogIn { from { transform: translate(-50%, -50%) scale(.96); opacity: 0; } }

/* ---------- nav bar ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--sat)); padding: var(--sat) var(--margin) 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: transparent;
  transition: background var(--d-2) var(--ease-out), box-shadow var(--d-2) var(--ease-out);
}
.nav::before { content: ""; position: absolute; inset: 0; background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); opacity: 0; transition: opacity var(--d-2) var(--ease-out); z-index: -1; }
.nav::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--hairline); background: var(--separator); opacity: 0; transition: opacity var(--d-2); }
.nav.scrolled::before, .nav.scrolled::after { opacity: 1; }
.nav-title { grid-column: 2; font-size: 17px; font-weight: 600; letter-spacing: -.2px; opacity: 0; transform: translateY(8px); transition: opacity var(--d-2) var(--ease-out), transform var(--d-2) var(--ease-out); white-space: nowrap; }
.nav.scrolled .nav-title { opacity: 1; transform: none; }
.nav-lead { grid-column: 1; display: flex; gap: 6px; }
.nav-actions { grid-column: 3; display: flex; justify-content: flex-end; gap: 6px; }
.nav-btn { width: 36px; height: 36px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--fill-1); color: var(--label); transition: background var(--d-1), transform var(--d-4) var(--spring-snap); }
.nav-btn .ic { width: 20px; height: 20px; }
.nav-btn:active { transform: scale(.92); background: var(--fill-2); transition-duration: 60ms; }
.nav-btn.text { width: auto; padding: 0 12px; font-size: 15px; font-weight: 600; gap: 6px; display: inline-flex; align-items: center; }

/* ---------- page ---------- */
.page { padding: calc(var(--nav-h) + var(--sat) + 4px) var(--margin) var(--dock-h); max-width: 640px; margin: 0 auto; width: 100%; min-width: 0; }
.wash { position: fixed; left: 0; right: 0; top: 0; height: 360px; z-index: -1; pointer-events: none; background: linear-gradient(180deg, color-mix(in srgb, var(--phase-bg) 62%, transparent) 0%, transparent 100%); transition: opacity var(--d-4) var(--ease-out); }
.page-head { padding: 6px 0 16px; }
.eyebrow { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--label-2); margin-bottom: 4px; }
.page-head .t-large { margin: 0; }
.page-head .t-sub { color: var(--label-2); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.section-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 28px 4px 10px; }
.section-h .t-3 { flex: 1; }
.link { color: var(--blue); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.link .ic { width: 16px; height: 16px; }

/* ---------- tab bar (floating capsule) ---------- */
.tabbar {
  position: fixed; left: var(--margin); right: var(--margin); bottom: calc(12px + var(--sab)); z-index: 30;
  height: var(--tabbar-h); border-radius: var(--r-pill);
  background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-float), inset 0 0 0 var(--hairline) rgb(255 255 255 / .7);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px;
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: var(--r-pill); color: var(--label-3); font-size: 11px; line-height: 13px; font-weight: 600; letter-spacing: .1px; transition: color var(--d-2) var(--ease-out); }
.tab .ic { width: 24px; height: 24px; }
.tab .ic-fill { display: none; }
.tab.active { color: var(--label); }
.tab.active .ic-line { display: none; }
.tab.active .ic-fill { display: block; }
.tab.active::before { content: ""; position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--fill-1); animation: fade var(--d-2) var(--ease-out); }
.tab.popping .ic { animation: pop var(--d-4) var(--spring-snap); }
.tab > * { position: relative; }

/* ---------- composer ---------- */
.dock { position: fixed; left: var(--margin); right: var(--margin); bottom: calc(12px + var(--tabbar-h) + 10px + var(--sab)); z-index: 29; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.composer {
  display: flex; align-items: center; gap: 4px; height: var(--composer-h); padding: 4px 4px 4px 6px; border-radius: var(--r-pill);
  background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-float), inset 0 0 0 var(--hairline) rgb(255 255 255 / .7);
  transition: box-shadow var(--d-2) var(--ease-out), transform var(--d-2) var(--ease-out);
}
.composer:focus-within { box-shadow: var(--shadow-float), inset 0 0 0 1.5px var(--label-4); transform: translateY(-1px); }
.composer-open { width: 40px; height: 40px; border-radius: var(--r-pill); display: grid; place-items: center; color: var(--orange); background: var(--orange-bg); flex: none; }
.composer-open .ic { width: 20px; height: 20px; }
.composer-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 8px 6px; letter-spacing: -.1px; }
.composer-input::placeholder { color: var(--label-3); }
.composer-send { width: 40px; height: 40px; border-radius: var(--r-pill); background: var(--label); color: #fff; display: grid; place-items: center; flex: none; transform: scale(0); opacity: 0; transition: transform var(--d-4) var(--spring-snap), opacity var(--d-2) var(--ease-out); }
.composer-send .ic { width: 20px; height: 20px; }
.composer.has-text .composer-send { transform: scale(1); opacity: 1; }
.composer.busy .composer-send { opacity: .5; }
.reply {
  position: relative; padding: 12px 40px 12px 16px; border-radius: var(--r-l);
  background: linear-gradient(180deg, var(--surface-a), var(--surface-b)); box-shadow: var(--shadow-float), var(--edge);
  font-size: 15px; line-height: 20px; letter-spacing: -.1px; white-space: pre-wrap; animation: rise var(--d-4) var(--spring) both;
}
.reply .src { display: block; margin-top: 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--label-3); }
.reply .src.rules { color: var(--green); } .reply .src.ai, .reply .src.claude { color: var(--orange); } .reply .src.err { color: var(--red); }
.reply .reply-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: var(--r-pill); display: grid; place-items: center; color: var(--label-3); background: var(--fill-1); }
.reply .reply-close .ic { width: 16px; height: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; letter-spacing: -.1px; white-space: nowrap; color: var(--label);
  background: var(--fill-1);
  transition: transform var(--d-4) var(--spring-snap), background var(--d-1) var(--ease-out), opacity var(--d-1);
}
.btn .ic { width: 20px; height: 20px; }
.btn:active { transform: scale(.96); transition-duration: 60ms; background: var(--fill-2); }
.btn-l { height: 50px; padding: 0 22px; font-size: 17px; }
.btn-s { height: 34px; padding: 0 14px; font-size: 14px; }
.btn-s .ic { width: 17px; height: 17px; }
.btn-fill { background: linear-gradient(180deg, color-mix(in srgb, var(--label) 88%, white), var(--label)); color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-fill:active { background: var(--label); }
.btn-tint { background: color-mix(in srgb, var(--tint, var(--label)) 12%, transparent); color: var(--tint, var(--label)); }
.btn-tint:active { background: color-mix(in srgb, var(--tint, var(--label)) 20%, transparent); }
.btn-plain { background: transparent; color: var(--blue); padding: 0 10px; }
.btn-plain:active { background: var(--fill-1); }
.btn-plain.danger { color: var(--red); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.on { background: color-mix(in srgb, var(--tint, var(--label)) 14%, transparent); color: var(--tint, var(--label)); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: var(--r-pill); display: grid; place-items: center; color: var(--label-2); transition: background var(--d-1), transform var(--d-4) var(--spring-snap); }
.icon-btn:active { background: var(--fill-1); transform: scale(.92); transition-duration: 60ms; }
.icon-btn.s { width: 32px; height: 32px; } .icon-btn.s .ic { width: 18px; height: 18px; }

/* ---------- tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11px; line-height: 13px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; background: color-mix(in srgb, var(--tint, var(--label)) 12%, transparent); color: var(--tint, var(--label)); white-space: nowrap; }
.tag .ic { width: 13px; height: 13px; }
.tag-new { --tint: var(--orange); }
.tag-done { --tint: var(--green); }
.tag-refused { --tint: var(--red); }
.tag-today { background: var(--label); color: #fff; }
.tag-phase { background: var(--phase-bg); color: var(--phase-fg); text-transform: none; letter-spacing: -.1px; font-size: 12px; height: 24px; padding: 0 10px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- cards ---------- */
.card { position: relative; background: linear-gradient(180deg, var(--surface-a), var(--surface-b)); border-radius: var(--r-l); padding: 20px; box-shadow: var(--edge); margin-bottom: 12px; }
.card-xl { border-radius: var(--r-xl); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--label-2); }
.card-kind .ic { width: 18px; height: 18px; }
.card-title { margin-top: 2px; }
.card-title.empty { color: var(--label-3); font-weight: 500; }
.card .note { margin-top: 14px; padding-top: 12px; border-top: var(--hairline) solid var(--separator); display: flex; gap: 8px; font-size: 15px; line-height: 20px; color: var(--label-2); }
.card .note .ic { width: 18px; height: 18px; color: var(--label-3); margin-top: 1px; }

/* ---------- hero (lunch) ---------- */
.hero-top { display: grid; grid-template-columns: 104px 1fr; gap: 16px; align-items: center; margin: 4px 0 12px; }
.ring-wrap { position: relative; width: 104px; height: 104px; }
.ring { width: 104px; height: 104px; display: block; }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset var(--d-5) var(--spring), stroke var(--d-2); }
.ring .track { stroke: var(--fill-1); }
.ring .s1 { stroke: var(--phase-fg); }
.ring .s2 { stroke: color-mix(in srgb, var(--phase-fg) 55%, white); }
.ring .s3 { stroke: color-mix(in srgb, var(--phase-fg) 35%, white); }
.ring.done .s1, .ring.done .s2, .ring.done .s3 { stroke: var(--green); }
.ring.refused .track { stroke: var(--red-bg); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .v { font-size: 26px; line-height: 28px; font-weight: 600; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.ring-center .v.dim { color: var(--label-3); }
.ring-center .u { font-size: 11px; line-height: 13px; font-weight: 600; color: var(--label-2); margin-top: 1px; }
.ring-badge { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-a); display: grid; place-items: center; color: var(--green); box-shadow: var(--edge); animation: pop var(--d-4) var(--spring-snap); }
.ring-badge .ic { width: 22px; height: 22px; }
.hero-sum { display: flex; align-items: baseline; gap: 6px; margin-top: 8px; }
.hero-sum .big { font-size: 30px; line-height: 34px; font-weight: 600; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.hero-sum .of { font-size: 15px; color: var(--label-2); }
.hero-sum .ok { font-size: 15px; font-weight: 600; color: var(--green); }
.hero-sum .no { font-size: 15px; font-weight: 600; color: var(--red); }

/* ---------- hero list (editable figures beside the ring) ---------- */
.hero-list { display: flex; flex-direction: column; min-width: 0; }
.hrow { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 0; width: 100%; text-align: left; border-top: var(--hairline) solid var(--separator); transition: opacity var(--d-1); }
.hrow:first-child { border-top: 0; }
.hrow:active { opacity: .6; }
.hrow .hl { flex: 1; font-size: 14px; line-height: 18px; color: var(--label-2); letter-spacing: -.1px; white-space: nowrap; }
.hrow .hv { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hrow .hv.dim { color: var(--label-4); font-weight: 400; }
.hrow .chev { color: var(--label-4); margin-right: -6px; display: inline-flex; }
.hrow .chev .ic { width: 18px; height: 18px; }
.hero-status { font-size: 15px; line-height: 20px; font-weight: 500; color: var(--label-2); margin: 2px 0 14px; display: flex; align-items: center; gap: 6px; }
.hero-status .ic { width: 20px; height: 20px; }
.hero-status b { color: var(--label); font-weight: 600; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hero-actions .btn-fill { grid-column: 1 / -1; }
.hero-actions .btn { padding: 0 12px; }

/* ---------- figure row ---------- */
.figrow { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: var(--r-m); padding: 4px; margin: 12px 0 14px; gap: 4px; }
.fig { text-align: center; padding: 10px 6px 9px; border-radius: var(--r-s); transition: background var(--d-1), transform var(--d-4) var(--spring-snap); }
.fig:active { background: var(--surface-a); transform: scale(.97); transition-duration: 60ms; }
.fig .v { display: block; font-size: 22px; line-height: 26px; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.fig .v.dim { color: var(--label-4); }
.fig .v .unit { margin-left: 2px; }
.fig .l { display: block; margin-top: 2px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--label-2); }
.figrow.n4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- segmented ---------- */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: var(--r-s); padding: 2px; height: 36px; }
.seg .thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / var(--n, 2)); transform: translateX(calc(var(--k, 0) * 100%)); border-radius: 10px; background: var(--surface-a); box-shadow: 0 1px 3px rgb(var(--ink) / .12), var(--edge); transition: transform var(--d-3) var(--spring); }
.seg.none .thumb { opacity: 0; }
.seg button { position: relative; padding: 0 4px; font-size: 13px; line-height: 16px; font-weight: 500; color: var(--label-2); border-radius: 10px; transition: color var(--d-2), font-weight var(--d-2); display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.seg button .ic { width: 15px; height: 15px; }
.seg button.on { color: var(--label); font-weight: 600; }
.seg button.on.green { color: var(--green); } .seg button.on.red { color: var(--red); }

/* ---------- list groups ---------- */
.group { background: linear-gradient(180deg, var(--surface-a), var(--surface-b)); border-radius: var(--r-m); box-shadow: var(--edge); overflow: hidden; margin-bottom: 12px; }
.group-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 8px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--label-2); }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; width: 100%; text-align: left; color: var(--label); transition: background var(--d-1); }
.row + .row::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: var(--hairline); background: var(--separator); }
.row.with-lead + .row.with-lead::before { left: 56px; }
.row.pressable:active { background: var(--fill-1); transform: none; }
.row .lead { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.row .lead .ic { width: 17px; height: 17px; }
.row .main { flex: 1; min-width: 0; }
.row .title { display: block; font-size: 17px; line-height: 22px; letter-spacing: -.2px; }
.row .sub { display: block; font-size: 15px; line-height: 20px; color: var(--label-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .val { font-size: 15px; line-height: 20px; color: var(--label-2); text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.row .val b { color: var(--label); font-weight: 600; }
.row .chev { color: var(--label-4); flex: none; margin-right: -6px; }
.row .chev .ic { width: 20px; height: 20px; }
.row.add { color: var(--blue); font-weight: 500; }
.row.add .lead { background: var(--blue); }
.row .del { color: var(--label-3); width: 32px; height: 32px; border-radius: var(--r-pill); display: grid; place-items: center; margin-right: -8px; }
.row .del .ic { width: 18px; height: 18px; }
.row .del:active { background: var(--fill-1); }
.datebox { width: 44px; height: 44px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; background: var(--phase-bg); color: var(--phase-fg); }
.datebox .d { font-size: 17px; line-height: 19px; font-weight: 700; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.datebox .w { font-size: 10px; line-height: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; opacity: .85; }
.row.cal + .row.cal::before { left: 72px; }
.row.cal.today { box-shadow: inset 3px 0 0 var(--label); }

/* ---------- tiles ---------- */
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; margin: 0 calc(-1 * var(--margin)); padding-left: var(--margin); padding-right: var(--margin); scrollbar-width: none; scroll-snap-type: x proximity; }
.strip::-webkit-scrollbar { display: none; }
.tile { flex: none; width: 150px; text-align: left; border-radius: var(--r-l); padding: 14px 14px 12px; background: linear-gradient(180deg, var(--surface-a), var(--surface-b)); box-shadow: var(--edge); scroll-snap-align: start; display: flex; flex-direction: column; gap: 3px; transition: transform var(--d-4) var(--spring-snap); }
.tile:active { transform: scale(.97); transition-duration: 60ms; }
.tile.phase { background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 70%, white), color-mix(in srgb, var(--tint) 88%, white)); box-shadow: none; color: var(--tfg); }
.tile .d { font-size: 22px; line-height: 26px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.tile .w { font-size: 11px; line-height: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; opacity: .8; margin-bottom: 6px; }
.tile .m { font-size: 13px; line-height: 17px; font-weight: 500; color: var(--label); }
.tile .m.dim { color: var(--label-3); font-weight: 400; }
.tile .tag { margin-top: 8px; align-self: flex-start; }
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile-food { width: auto; min-height: 132px; border-radius: var(--r-xl); padding: 18px 16px 14px; }
.tile-food .em { font-size: 32px; line-height: 36px; margin-bottom: 10px; }
.tile-food .nm { font-size: 17px; line-height: 21px; font-weight: 600; letter-spacing: -.2px; }
.tile-food .dt { font-size: 13px; line-height: 17px; color: var(--label-2); margin-top: 2px; }
.tile-food .tag { margin-top: auto; padding-top: 0; }
.tile-food .st { margin-top: 10px; }
.tile-food .rx { position: absolute; top: 14px; right: 14px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.tile-food .rx .ic { width: 22px; height: 22px; }
.tile-food.avoid { background: linear-gradient(180deg, #FFF7F8, #FFF2F4); }
.tile-food { position: relative; }

/* ---------- phase header (calendar) ---------- */
.phase-h { display: flex; align-items: center; gap: 10px; padding: 24px 4px 10px; }
.phase-h .pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px 0 10px; border-radius: var(--r-pill); background: var(--tint); color: var(--tfg); font-size: 13px; font-weight: 600; letter-spacing: -.1px; }
.phase-h .pill .dot { width: 8px; height: 8px; }
.phase-h .sub { font-size: 13px; color: var(--label-2); }
.phase-h .r { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--label-3); white-space: nowrap; }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(var(--ink) / .3); animation: fade var(--d-2) var(--ease-out); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: linear-gradient(180deg, var(--bg-a), var(--bg-b)); border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding: 8px 20px calc(20px + var(--sab)); box-shadow: var(--shadow-modal); animation: sheetUp var(--d-4) var(--spring); }
.sheet-grip { width: 36px; height: 5px; border-radius: var(--r-pill); background: var(--label-4); margin: 4px auto 16px; }
.sheet-title { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: -.45px; }
.sheet-sub { color: var(--label-2); font-size: 15px; line-height: 20px; margin-top: 2px; }
.sheet-body { margin-top: 18px; }
.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.sheet-actions .grow { flex: 1; }
.form .row { padding: 8px 16px; min-height: 50px; }
.form .row .lbl { flex: none; width: 42%; font-size: 15px; line-height: 20px; color: var(--label-2); }
.form .row .ctl { flex: 1; min-width: 0; display: flex; justify-content: flex-end; }
.form input[type="text"], .form input[type="password"], .form input[type="number"], .form input[type="date"], .form select, .form textarea { width: 100%; border: 0; background: transparent; outline: 0; font-size: 17px; line-height: 22px; letter-spacing: -.2px; text-align: right; padding: 0; color: var(--label); }
.form textarea { text-align: left; min-height: 66px; resize: none; }
.form .row.stack { flex-direction: column; align-items: stretch; gap: 4px; }
.form .row.stack .lbl { width: auto; font-size: 13px; line-height: 18px; }
.form select { appearance: none; -webkit-appearance: none; padding-right: 22px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318324A' stroke-opacity='.4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right center; background-size: 18px; }
.form .toggle { width: 44px; height: 26px; appearance: none; -webkit-appearance: none; border-radius: var(--r-pill); background: var(--fill-3); position: relative; transition: background var(--d-2) var(--ease-out); cursor: pointer; margin: 0; }
.form .toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgb(var(--ink) / .2); transition: transform var(--d-3) var(--spring); }
.form .toggle:checked { background: var(--orange); }
.form .toggle:checked::after { transform: translateX(18px); }
.form .hint { font-size: 13px; line-height: 18px; color: var(--label-3); padding: 6px 4px 0; }
.form input.big-input, .big-input { width: 100%; border: 0; background: transparent; outline: 0; text-align: center; font-size: 60px; line-height: 64px; font-weight: 600; letter-spacing: -1.8px; font-variant-numeric: tabular-nums; padding: 6px 0 2px; color: var(--label); caret-color: var(--orange); }
.field-big { padding: 8px 0 4px; }
.big-input::placeholder { color: var(--label-4); }
.big-unit { text-align: center; font-size: 15px; font-weight: 500; color: var(--label-2); margin-top: -2px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 16px; }
.quick .btn { height: 38px; padding: 0 8px; font-size: 14px; }

/* ---------- chat ---------- */
.chat { position: fixed; inset: 0; z-index: 50; background: linear-gradient(180deg, var(--bg-a), var(--bg-b)); display: flex; flex-direction: column; animation: rise var(--d-3) var(--spring); }
.chat-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: calc(8px + var(--sat)) var(--margin) 8px; min-height: calc(var(--nav-h) + var(--sat)); background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 var(--hairline) 0 var(--separator); }
.chat-head .ttl { grid-column: 2; font-size: 17px; font-weight: 600; letter-spacing: -.2px; text-align: center; }
.chat-head .done { grid-column: 3; justify-self: end; color: var(--blue); font-size: 17px; font-weight: 600; padding: 6px 4px; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px var(--margin) calc(var(--composer-h) + 70px + var(--sab)); display: flex; flex-direction: column; gap: 6px; max-width: 680px; width: 100%; margin: 0 auto; }
.msg { max-width: 82%; padding: 9px 14px; font-size: 16px; line-height: 21px; letter-spacing: -.15px; white-space: pre-wrap; border-radius: var(--r-l); animation: rise var(--d-3) var(--spring) both; }
.msg.user { align-self: flex-end; background: var(--label); color: #fff; border-bottom-right-radius: var(--r-xs); }
.msg.assistant { align-self: flex-start; background: var(--fill-1); color: var(--label); border-bottom-left-radius: var(--r-xs); }
.msg .via { display: block; margin-top: 4px; font-size: 11px; line-height: 14px; font-weight: 600; color: var(--label-3); }
.msg.rules .via { color: var(--green); } .msg.ai .via, .msg.claude .via { color: var(--orange); } .msg.error .via, .msg.help .via { color: var(--red); }
.msg.thinking { color: var(--label-3); }
.msg.thinking i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 4px; animation: blink 1.2s infinite; }
.msg.thinking i:nth-child(2) { animation-delay: .2s; } .msg.thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px var(--margin) 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 13px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--blue) 10%, transparent); color: var(--blue); font-size: 14px; font-weight: 500; white-space: nowrap; }
body.chat-open .tabbar { visibility: hidden; }
body.chat-open .dock { z-index: 55; bottom: calc(12px + var(--sab)); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; top: calc(var(--nav-h) + var(--sat) + 8px); transform: translateX(-50%); z-index: 70; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border-radius: var(--r-pill); background: var(--material); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow-float), inset 0 0 0 var(--hairline) rgb(255 255 255 / .7); font-size: 15px; font-weight: 600; letter-spacing: -.1px; white-space: nowrap; animation: drop var(--d-4) var(--spring-snap) both; }
.toast .ic { width: 20px; height: 20px; color: var(--green); }
.toast.err .ic { color: var(--red); }
.toast.leaving { animation: lift var(--d-2) var(--ease-in) forwards; }

/* ---------- skeleton & empty ---------- */
.skel { background: linear-gradient(90deg, var(--fill-1) 25%, var(--fill-2) 50%, var(--fill-1) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-s); }
.empty-state { text-align: center; padding: 36px 20px; color: var(--label-2); }
.empty-state .ic { width: 30px; height: 30px; color: var(--label-3); margin-bottom: 8px; }
.empty-state .t-3 { color: var(--label); margin-bottom: 4px; }
.empty-state .btn { margin-top: 16px; }

/* ---------- table (desktop calendar) ---------- */
.table-wrap { display: none; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; letter-spacing: 0; background: var(--surface-a); border-radius: var(--r-m); box-shadow: var(--edge); overflow: hidden; }
.table th { background: var(--pink); color: var(--label); font-weight: 600; font-size: 12px; padding: 12px 8px; text-align: center; position: sticky; top: 0; z-index: 2; }
.table td { padding: 10px 8px; border-bottom: var(--hairline) solid var(--separator); text-align: center; vertical-align: middle; }
.table td.l { text-align: left; }
.table td.phase { font-weight: 600; text-align: left; white-space: pre-line; }
.table tr.today td { box-shadow: inset 0 0 0 1.5px var(--label); }
.table td.new { background: var(--orange-bg); color: var(--orange); font-weight: 600; }
.table td.done { background: var(--green-bg); color: var(--green); font-weight: 600; }
.table td.left { color: var(--label-2); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { filter: brightness(.975); }

/* ---------- login ---------- */
.login { min-height: 100dvh; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; gap: 28px; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.app-icon { width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 18px; background: linear-gradient(160deg, #FFE1E5, #F8DDE0 55%, #FBD1D6); display: grid; place-items: center; color: var(--label); box-shadow: var(--edge), 0 10px 26px rgb(var(--ink) / .10); }
.app-icon .ic { width: 40px; height: 40px; }
.login .t-large { margin-bottom: 4px; }
.login-form { text-align: left; margin-top: 26px; }
.login-error { margin-top: 12px; color: var(--red); font-weight: 600; font-size: 14px; text-align: center; }
.login-foot { color: var(--label-2); font-size: 14px; }
.login-unconfigured { display: none; font-size: 14px; color: var(--label-2); margin-top: 18px; line-height: 20px; }
body[data-state="unconfigured"] .login-form { display: none; }
body[data-state="unconfigured"] .login-unconfigured { display: block; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--fill-1); padding: 1px 6px; border-radius: 6px; }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  :root { --margin: 32px; --tabbar-h: 0px; --dock-h: calc(var(--composer-h) + 40px); }
  body.shell { display: grid; grid-template-columns: 232px 1fr; }
  .nav { left: 232px; padding: 0 var(--margin); }
  .tabbar { position: fixed; left: 0; top: 0; bottom: 0; right: auto; width: 232px; height: auto; border-radius: 0; box-shadow: none; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; display: flex; flex-direction: column; gap: 2px; padding: 84px 16px 24px; border-right: var(--hairline) solid var(--separator); }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 14px; font-size: 15px; line-height: 20px; height: 44px; border-radius: var(--r-s); }
  .tab.active::before { border-radius: var(--r-s); }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0 14px 22px; font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
  .brand .app-icon { width: 30px; height: 30px; border-radius: 9px; margin: 0; box-shadow: none; }
  .brand .app-icon .ic { width: 17px; height: 17px; }
  .page { grid-column: 2; max-width: 960px; margin: 0; padding-left: var(--margin); padding-right: var(--margin); }
  .dock { left: calc(232px + var(--margin)); right: auto; width: min(calc(100% - 232px - 2 * var(--margin)), 896px); bottom: 20px; }
  .toast { left: calc(50% + 116px); }
  .chat { left: 232px; }
  .chat-body { padding-bottom: calc(var(--composer-h) + 60px); }
  .tile-grid { grid-template-columns: repeat(4, 1fr); }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .two-col > .span { grid-column: 1 / -1; }
  .sheet-panel { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); border-radius: var(--r-xl); max-height: 86dvh; padding: 24px 26px 24px; animation: dialogIn var(--d-3) var(--spring); box-shadow: 0 24px 64px rgb(var(--ink) / .18); }
  .sheet-grip { display: none; }
  body.chat-open .tabbar { visibility: visible; }
  body.chat-open .dock { bottom: 20px; }
  .list-cal { display: none; }
  .table-wrap { display: block; overflow-x: auto; }
  [data-view="calendar"] .page { max-width: 1180px; }
}
@media (max-width: 899px) { .brand { display: none; } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .pressable:active, .btn:active, .tile:active, .fig:active { transform: none; }
}
