/* Segment stylesheet: plan. Owned by the plan segment; shared tokens and components live in /static/gw.css.
   Colours only via var(--gw-*) tokens. Mobile 390 is the target; every rule is scoped to /plan markup. */

/* ---------------------------------------------------------------- hero: page head + week strip in one card */
.gw-planhero{position:relative;overflow:hidden;isolation:isolate;margin:0 0 4px;padding:16px 16px 14px;border-radius:var(--gw-r-card);background:var(--gw-hero-teal);border:1px solid var(--gw-line);box-shadow:var(--gw-shadow-card)}
.gw-planhero.is-shotday{background:var(--gw-hero-teal)}
.gw-planhero-head{display:flow-root;margin-bottom:12px}
/* art floats top-right; text wraps around its circle instead of running under it (ground is transparent, no mask) */
.gw-planhero-art{float:right;width:80px;height:80px;margin:-6px -8px 0 6px;shape-outside:circle(40% at 55% 50%);pointer-events:none}
.gw-planhero-head .gw-eyebrow{margin:0;font-size:13px;line-height:18px;letter-spacing:.02em}
.gw-planhero-head .gw-h1{font-size:28px;line-height:34px;margin:2px 0 0}
.gw-planhero-sub{margin:4px 0 0;font-size:15px;line-height:21px;color:var(--gw-muted);text-wrap:pretty}
.gw-planhero-status{display:flex;width:fit-content;max-width:100%;clear:both;align-items:center;gap:6px;margin:8px 0 0;padding:5px 12px 5px 9px;border-radius:999px;background:var(--gw-surface);border:1px solid var(--gw-line);font-size:14px;line-height:18px;font-weight:700;color:var(--gw-ink)}
.gw-planhero-status .gw-icon{color:var(--gw-accent)}
.gw-planhero-status.is-done{background:var(--gw-pos-bg);border-color:transparent;color:var(--gw-pos-fg)}
.gw-planhero-status.is-done .gw-icon{color:var(--gw-pos-fg)}
.gw-planhero-status.is-due{background:var(--gw-mint);border-color:transparent;color:var(--gw-accent-deep)}
.gw-planhero-status.is-due .gw-icon{color:var(--gw-accent-deep)}
/* shot day, dose not logged: the pill is the jump to the Shot row (the week's one must-do) */
a.gw-planhero-status.is-link{min-height:44px;padding:11px 14px 11px 10px;text-decoration:none;border:1.5px solid var(--gw-accent);background:var(--gw-surface);color:var(--gw-accent-deep)!important;box-shadow:var(--gw-shadow-1);transition:transform var(--gw-dur-press) var(--gw-ease-out),background-color var(--gw-dur-state)}
a.gw-planhero-status.is-link:active{transform:scale(.97);background:var(--gw-mint)}
a.gw-planhero-status.is-link:focus-visible{outline:2px solid var(--gw-accent);outline-offset:2px}
a.gw-planhero-status.is-link>.gw-icon:last-child{width:16px;height:16px;margin-left:2px}
#gw-qlog-today{scroll-margin-top:16px;scroll-margin-bottom:calc(var(--gw-nav-h) + env(safe-area-inset-bottom,0px) + 16px)}
/* done: the shot-logged mark pops in once on first paint (.gw-pop, off under reduced motion) */
.gw-planhero-status.is-done{min-height:44px;padding:9px 14px 9px 8px;gap:8px}
.gw-planhero-status.is-done .gw-spot--inline{vertical-align:middle}

/* Week strip inside the hero: a 7-column grid that never overflows, even at very large text */
.gw-planhero .gw-weekcard{padding:0;container-type:inline-size;container-name:gwweek}
.gw-planhero .gw-week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px}
.gw-planhero .gw-day{max-width:none;min-width:0;height:auto;min-height:58px;padding-block:7px;overflow:hidden;transition:transform .18s var(--gw-ease-out)}
.gw-planhero .gw-day small{display:block;max-width:100%;font-size:min(11px,2.8vw);white-space:nowrap}
/* numbers are sized from the strip (.gw-week is a size container), never the viewport */
.gw-planhero .gw-week b{font-size:clamp(15px,5.4cqi,20px);font-variant-numeric:tabular-nums}
.gw-planhero .gw-day .gw-day-s{display:none}
.gw-planhero .gw-day.is-past:not(.is-today){background:var(--gw-bg);border-color:var(--gw-line);color:var(--gw-muted);box-shadow:none}
.gw-planhero .gw-day.is-past:not(.is-today) small{color:var(--gw-subtle)}
.gw-planhero .gw-day.is-past.is-shot:not(.is-today){border:1.5px solid var(--gw-accent);color:var(--gw-accent-ink)}
.gw-planhero .gw-day.is-today{outline-offset:2px}
.gw-planhero .gw-day:active{transform:scale(.96)}
/* very large text: one-letter weekday so the label always fits its chip */
@container gwweek (max-width:17em){
  .gw-planhero .gw-day .gw-day-l{display:none}
  .gw-planhero .gw-day .gw-day-s{display:inline}
  .gw-planhero .gw-week{gap:4px}
  .gw-planhero .gw-day{border-radius:10px;padding-inline:3px}
  /* the numeral is capped to its chip at any text scale (wins over inline/zoomed sizes): a date that touches its
     neighbours or the today ring is unreadable, a 2px-smaller one is not */
  .gw-planhero .gw-day b{font-size:clamp(14px,5.6cqi,18px)!important;line-height:1.15!important;letter-spacing:-.02em}
  .gw-planhero .gw-day small{font-size:clamp(10px,3.4cqi,12px)!important;line-height:1.1!important}
  .gw-planhero .gw-day.is-today{outline-offset:1px}
}
.gw-weektrack{position:relative;height:4px;margin:12px 2px 0;border-radius:2px;background:var(--gw-line);overflow:hidden}
.gw-weektrack>span{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--gw-accent);transform-origin:left center;animation:gw-plan-track .9s var(--gw-ease-out) .2s both}
@keyframes gw-plan-track{from{transform:scaleX(0)}to{transform:scaleX(1)}}
/* no shot day yet: the strip shows only "today", never an inferred rhythm */
.gw-planhero.is-setup .gw-day:not(.is-today){background:var(--gw-surface);border-color:var(--gw-line);color:var(--gw-ink);box-shadow:none}
.gw-planhero.is-setup .gw-day:not(.is-today) small{color:var(--gw-subtle)}
.gw-planhero.is-setup .gw-day.is-today:not(.is-shot){background:var(--gw-mint);border-color:var(--gw-mint)}
.gw-planhero.is-setup .gw-legend{display:none}
.gw-planhero .gw-legend{justify-content:center;gap:6px 14px;margin-top:8px;font-size:13px;line-height:18px}
/* very large text: a smaller hero mark and a one-line legend keep Today's lead row in the first viewport.
   The hero is its own size container (the art sits outside the week strip's container). */
.gw-planhero{container-type:inline-size;container-name:gwhero}
@container gwhero (max-width:17em){
  .gw-planhero-art{width:56px;height:56px;margin:-4px -6px 0 4px}
  .gw-planhero-head{margin-bottom:10px}
  .gw-planhero .gw-legend{flex-wrap:nowrap;justify-content:center;gap:4px 10px;column-gap:10px;font-size:13px!important;line-height:18px!important}
  .gw-planhero .gw-legend span{white-space:nowrap;font-size:13px!important;line-height:18px!important}
  /* today's chip already marks the shot day */
  .gw-planhero.is-shotday .gw-legend>:first-child{display:none}
}

/* ---------------------------------------------------------------- setup / notice under the hero */
.gw-plan-pre{margin-top:16px}
.gw-setup--art{align-items:center;gap:12px;padding:16px 16px 16px 12px}
.gw-setup-art{flex:none;width:80px;height:80px;align-self:flex-start}

/* ---------------------------------------------------------------- Today head + help pill */
.gw-section-head{align-items:center}
.gw-help-link{min-height:36px;padding:0 12px;gap:6px;border:1px solid var(--gw-line);border-radius:999px;background:var(--gw-surface);font-size:13px;line-height:16px;font-weight:700;color:var(--gw-warn-fg)!important;white-space:nowrap;position:relative}
.gw-help-link .gw-icon{color:var(--gw-warn-fg)}
.gw-help-link::after{content:"";position:absolute;inset:-5px 0}/* 44px tap target */

/* ---------------------------------------------------------------- task list: status ring only where a tile ticks it */
.gw-daycard .gw-task{align-items:flex-start;gap:12px}
.gw-daycard .gw-task>span:nth-child(2){flex:1;min-width:0}
.gw-daycard .gw-tick{width:22px;height:22px;margin-top:0;border:1.5px dashed var(--gw-control-ring);background:transparent}
.gw-daycard .gw-task.is-done .gw-tick{border:0;background:var(--gw-accent);animation:gw-pop var(--gw-dur-pop) var(--gw-ease-out) both}
.gw-task-dot{flex:none;width:22px;height:22px;display:flex;align-items:center;justify-content:center}
.gw-task-dot::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--gw-seaglass)}
.gw-task-state{flex:none;max-width:30%;margin-top:2px;padding:1px 0 0;font-size:13px;line-height:18px;font-weight:700;color:var(--gw-subtle);white-space:normal;text-align:right}
.gw-task.is-done .gw-task-state{color:var(--gw-accent-ink)}
.gw-daycard .gw-task.is-done>span:nth-child(2){color:var(--gw-muted)}

/* ---------------------------------------------------------------- today card */
.gw-daycard.is-today{box-shadow:var(--gw-shadow-lift)}
.gw-daycard.is-today>summary{min-height:72px}
.gw-daycard.is-today .gw-daycard-date{width:auto;min-width:44px;height:auto;min-height:48px;padding:6px 8px}
.gw-daycard.is-today .gw-daycard-date small{font-size:min(11px,2.8vw)}
.gw-daycard.is-today .gw-daycard-date b{font-size:min(20px,5.4vw)}
.gw-daycard-meta b{font-weight:700}

/* ---------------------------------------------------------------- quick-log */
.gw-daycard .gw-qlog{gap:8px}
.gw-daycard .gw-qlog button{min-height:76px;padding:10px 2px 8px;gap:6px;transition:transform .18s var(--gw-ease-out),background-color .16s,border-color .16s}
.gw-daycard .gw-qlog button:active{transform:scale(.97)}
.gw-daycard .gw-qlog button:focus-visible{outline:2px solid var(--gw-accent);outline-offset:2px}
.gw-daycard .gw-qlog button[aria-pressed="true"]{background:var(--gw-done-bg);border:1.5px solid var(--gw-done-border);color:var(--gw-accent-ink)}
.gw-daycard .gw-qlog button[aria-pressed="true"]>.gw-icon{background:var(--gw-surface)}
.gw-daycard .gw-qlog button[aria-pressed="true"]::after{width:16px;height:16px;top:6px;right:6px;animation:gw-pop var(--gw-dur-pop) var(--gw-ease-out) both}
/* lead: the shot as one full-width ink row, the other three tiles beneath it */
.gw-qlog--lead{grid-template-columns:repeat(3,minmax(0,1fr))}
.gw-daycard .gw-qlog--lead>button:first-child{grid-column:1/-1;flex-direction:row;justify-content:flex-start;gap:12px;min-height:56px;padding:6px 16px 6px 8px;border-color:var(--gw-ink);background:var(--gw-ink);color:var(--gw-surface);font-size:17px;line-height:22px;box-shadow:var(--gw-shadow-lift)}
.gw-daycard .gw-qlog--lead>button:first-child>.gw-icon{padding:8px;background:var(--gw-accent);color:var(--gw-surface)}
/* logged: the same row, calm. Mint ground, teal mark, "Logged today" -- no ink, no corner badge (the hint says it) */
.gw-daycard .gw-qlog--lead.is-logged>button:first-child{border:1.5px solid var(--gw-done-border);background:var(--gw-done-bg);color:var(--gw-accent-ink);box-shadow:none}
.gw-daycard .gw-qlog--lead.is-logged>button:first-child>.gw-icon{background:var(--gw-surface);color:var(--gw-accent)}
.gw-daycard .gw-qlog--lead.is-logged>button:first-child::after{display:none}
.gw-qlog--lead.is-logged .gw-qlog-hint{gap:5px;color:var(--gw-accent-ink)}
.gw-qlog--lead.is-logged .gw-qlog-hint .gw-icon{animation:gw-pop var(--gw-dur-pop) var(--gw-ease-out) both}
.gw-qlog-l{flex:1;text-align:left}
.gw-qlog-hint{display:inline-flex;align-items:center;gap:2px;font-size:14px;line-height:18px;font-weight:700;color:var(--gw-seaglass)}
.gw-qlog-hint .gw-icon{width:16px;height:16px}

/* today, dose still to log: intro tightened so the lead row lands in the first viewport */
.gw-daycard.is-today .gw-daycard-body.has-lead{gap:12px}
.gw-daycard.is-today .gw-daycard-body.has-lead>.gw-expect{font-size:16px;line-height:23px}
.gw-daycard-body.has-lead>.gw-qlog{margin-bottom:4px}
.gw-daycard.is-today .gw-daycard-body.has-lead>.gw-tasks{padding-top:12px;border-top:1px solid var(--gw-line)}
/* dose still due: the ink lead row already says "log it", so the dose task is its title alone (the detail comes back
   once Logged; it stays in the DOM) */
.gw-task--led small{display:none}
/* very large text: the four lines of "what to expect" would push today's log row under the nav, so the row moves up
   right under the day's header (visual order only; nothing focusable is skipped -- the intro is plain text) */
.gw-daycard.is-today{container-type:inline-size;container-name:gwtoday}
@container gwtoday (max-width:19em){
  .gw-daycard-body.has-lead::before{order:-2}
  .gw-daycard-body.has-lead>.gw-qlog{order:-1;margin-bottom:0}
}

/* ---------------------------------------------------------------- reminder card (#gw-remind) */
#gw-remind{display:grid;grid-template-columns:40px minmax(0,1fr);column-gap:14px;row-gap:4px;align-items:start;margin-top:4px;padding:16px}
#gw-remind>.gw-chip{grid-row:1/3;background:var(--gw-mint);color:var(--gw-accent-ink)}
#gw-remind>div:not([hidden]){display:contents}
#gw-remind .gw-title{grid-column:2;font-size:17px;line-height:22px}
#gw-remind .gw-smallprint{grid-column:2;font-size:15px;line-height:21px;margin:0;color:var(--gw-muted)}
/* permission ask is secondary to the day's log: outline, never a second filled CTA */
#gw-remind .gw-btn{grid-column:1/-1;width:100%;min-height:48px;margin-top:12px;background:var(--gw-surface);border:1.5px solid var(--gw-accent);color:var(--gw-accent-ink)!important;box-shadow:none}
#gw-remind .gw-btn:active{background:var(--gw-mint)}

/* ---------------------------------------------------------------- pill routine: sand card + connected steps */
.gw-rules--sand{background:var(--gw-sand-soft);border-color:transparent;box-shadow:none;padding:20px 18px}
.gw-rules--sand>.gw-title{font-family:var(--gw-font-display);font-weight:600;font-size:20px;line-height:26px}
.gw-rules--sand ol{gap:16px}
.gw-rules--sand li{position:relative}
.gw-rules--sand li:not(:last-child)::before{content:"";position:absolute;left:13px;top:30px;bottom:-16px;width:2px;border-radius:1px;background:var(--gw-sand)}
.gw-rules--sand .gw-rules-n{position:relative;background:var(--gw-surface);color:var(--gw-accent-ink);font-weight:700;box-shadow:inset 0 0 0 1.5px var(--gw-sand)}

/* ---------------------------------------------------------------- rest of the week: one inset-grouped list */
.gw-days--grouped{gap:0;background:var(--gw-surface);border:1px solid var(--gw-line);border-radius:var(--gw-r-card);box-shadow:var(--gw-shadow-card);overflow:hidden}
.gw-days--grouped>.gw-daycard{position:relative;border:0;border-radius:0;box-shadow:none;background:transparent}
.gw-days--grouped>.gw-daycard+.gw-daycard::before{content:"";position:absolute;top:0;left:70px;right:0;height:1px;background:var(--gw-line)}
.gw-days--grouped>.gw-daycard>summary{min-height:64px;padding:10px 16px;gap:14px;border-radius:0}
.gw-days--grouped .gw-daycard-date{width:auto;min-width:40px;height:auto;min-height:44px;padding:4px 3px;border-radius:11px}
.gw-days--grouped .gw-daycard-date small{font-size:11px;line-height:12px}
.gw-days--grouped .gw-daycard-date b{font-size:17px;line-height:19px}
.gw-days--grouped .gw-daycard-title{font-size:16px;line-height:21px}
.gw-days--grouped .gw-daycard-meta{font-size:13px;line-height:17px}
.gw-days--grouped>.gw-daycard[open]{background:var(--gw-bg)}
.gw-days--grouped .gw-daycard-body{padding:0 16px 16px 70px}
.gw-days--grouped .gw-daycard-body::before{display:none}
.gw-days--grouped .gw-expect{font-size:15px;line-height:22px}
.gw-days--grouped .gw-task{font-size:15px;line-height:21px}
.gw-days--grouped .gw-task small{font-size:13px;line-height:18px}
.gw-days--grouped .gw-recipe-link{background:var(--gw-surface);border:1px solid var(--gw-line)}
/* days already behind you: same layout, quieter date chip and title (text stays AA) */
.gw-days--grouped>.gw-daycard.is-past .gw-daycard-date{background:transparent;border:1px dashed var(--gw-control-ring);color:var(--gw-muted);box-shadow:none}
.gw-days--grouped>.gw-daycard.is-past .gw-daycard-meta{display:flex;align-items:center;gap:5px}
.gw-daycard-meta>.gw-icon{flex:none;width:14px;height:14px;color:var(--gw-subtle)}
.gw-days--grouped>.gw-daycard.is-past .gw-daycard-date small{color:var(--gw-subtle)}
.gw-days--grouped>.gw-daycard.is-past .gw-daycard-title{color:var(--gw-muted);font-weight:600}
.gw-days-divider{margin:0;padding:14px 16px 8px;background:var(--gw-bg);border-top:1px solid var(--gw-line);border-bottom:1px solid var(--gw-line);font-size:13px;line-height:16px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--gw-subtle)}
.gw-days-divider+.gw-daycard::before{display:none}

/* ---------------------------------------------------------------- safety: red-flag card + prescriber-soon */
#red-flag.gw-redflag--card{display:block;margin-top:32px;padding:16px 16px 16px 20px;background:var(--gw-surface);color:var(--gw-ink);border:1px solid var(--gw-line);border-radius:var(--gw-r-card);box-shadow:var(--gw-shadow-card);scroll-margin-top:24px;scroll-margin-bottom:calc(var(--gw-nav-h) + 32px)}
#red-flag.gw-redflag--card>div{gap:10px}
#red-flag .gw-redflag-title{display:flex;align-items:flex-start;gap:8px;margin:0}
#red-flag .gw-redflag-title .gw-icon{width:20px;height:20px;margin:2px 0 0;color:var(--gw-warn-fg)}
#red-flag .gw-redflag-title b{font-family:var(--gw-font-display);font-weight:600;font-size:20px;line-height:24px;color:var(--gw-ink)}
#red-flag .gw-redflag-action{margin:0;padding:10px 12px;border-radius:12px;background:var(--gw-warn-bg);font-size:15px;line-height:21px;text-wrap:pretty}
#red-flag .gw-redflag-action b{color:var(--gw-warn-fg);font-weight:700}
#red-flag ul{margin:0;padding:0;list-style:none;gap:6px}
#red-flag li{position:relative;padding-left:14px;font-size:15px;line-height:20px;color:var(--gw-ink)}
#red-flag li::before{content:"";position:absolute;left:0;top:7px;width:6px;height:6px;border-radius:50%;background:var(--gw-warn-rule)}
.gw-redflag-call{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;margin-top:2px;border:1.5px solid var(--gw-sev-3-bg);border-radius:var(--gw-r-field);background:var(--gw-surface);color:var(--gw-warn-fg)!important;font-size:16px;line-height:20px;font-weight:700;text-decoration:none;transition:background-color .16s}
.gw-redflag-call:active{background:var(--gw-warn-soft)}
.gw-redflag-call .gw-icon{color:var(--gw-warn-fg)}

.gw-soon{position:relative;margin-top:12px;padding:16px 16px 16px 20px;gap:8px;border-radius:var(--gw-r-card)}
/* straight 4px rules via ::before (an inset shadow on a 20px radius draws a crescent at the corners) */
#red-flag.gw-redflag--card{position:relative}
#red-flag.gw-redflag--card::before,.gw-soon::before{content:"";position:absolute;left:0;top:18px;bottom:18px;width:4px;border-radius:0 4px 4px 0;background:var(--gw-warn-rule)}
.gw-soon::before{background:var(--gw-apricot)}
.gw-soon>.gw-title{font-family:var(--gw-font-display);font-weight:600;font-size:19px;line-height:24px}
.gw-soon ul{padding:0;list-style:none;gap:6px;font-size:15px;line-height:20px}
.gw-soon li{position:relative;padding-left:14px}
.gw-soon li::before{content:"";position:absolute;left:0;top:7px;width:6px;height:6px;border-radius:50%;background:var(--gw-apricot)}

.gw-notes{margin-top:20px;padding:0 4px}
.gw-sources{padding:0 4px}

@media (prefers-reduced-motion:reduce){
  .gw-weektrack>span,.gw-daycard .gw-task.is-done .gw-tick{animation:none!important}
  .gw-daycard .gw-qlog button[aria-pressed="true"]::after,.gw-qlog--lead.is-logged .gw-qlog-hint .gw-icon{animation:none!important}
  .gw-planhero .gw-day,.gw-daycard .gw-qlog button,.gw-redflag-call,a.gw-planhero-status.is-link{transition:none!important}
}

/* Content fix 2026-11-20: red-flag tiers, the one-time kidney question, the profile radio group */
.gw-redflag-tier{margin-top:4px}
#red-flag .gw-redflag-action.gw-redflag-tier{background:var(--gw-tint)}
#red-flag .gw-redflag-action.gw-redflag-tier b{color:var(--gw-ink)}
.gw-redflag-sugar{margin:0;font-size:15px;line-height:21px;color:var(--gw-ink)}
.gw-redflag-sugar b{color:var(--gw-ink)}
.gw-protein-ask{display:flex;flex-direction:column;gap:10px}
.gw-protein-ask .gw-title,.gw-protein-ask .gw-body,.gw-protein-ask .gw-smallprint{margin:0}
.gw-protein-limit legend{padding:0;margin:0 0 8px}
/* Optional step-up card (daily meds): date field + Save / Skip, moved out of onboarding */
.gw-stepup-form{display:flex;flex-direction:column;gap:8px}
.gw-stepup-form .gw-field-error{margin:0}
.gw-stepup-actions{display:flex;gap:8px;flex-wrap:wrap}
.gw-stepup-actions .gw-btn{flex:1 1 120px}
