*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 500 1rem/1.5 var(--font); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, .button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .55; cursor: default; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.16; letter-spacing: -.035em; }
svg { width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(var(--max-width), calc(100% - 48px)); margin-inline: auto; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 76px; gap: 16px; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-size: 1.13rem; font-weight: 800; letter-spacing: -.045em; white-space: nowrap; }
.brand-light { font-weight: 650; }
.brand-icon { background: var(--primary); color: var(--signal); border-radius: 11px; display: grid; place-items: center; width: 39px; height: 39px; }
.brand-icon svg { width: 25px; height: 25px; }
nav { display: flex; gap: 4px; align-items: center; }
nav a { padding: 9px 13px; border-radius: var(--control-radius); font-weight: 700; color: var(--muted); font-size: .9rem; }
nav a[aria-current] { background: var(--tint); color: var(--accent); }
#app { padding-block: 37px 65px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 23px; }
.page-head h1 { font-size: clamp(2.1rem, 5vw, 3.05rem); font-weight: 800; }
.page-head p { color: var(--muted); margin-top: 5px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; border: 1px solid var(--line); padding: 8px 13px; border-radius: var(--control-radius); background: var(--paper); color: var(--ink); font-size: .9rem; font-weight: 750; white-space: nowrap; }
.button:hover { box-shadow: 0 0 0 2px var(--line); }
.button.primary { background: var(--action); color: var(--on-primary); border-color: var(--action); }
.button.ghost { background: transparent; border-color: transparent; }
.button.icon { width: 42px; padding: 0; }
.button.danger { color: var(--danger); }
.metric-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.hero, .card { border-radius: var(--card-radius); padding: 24px; box-shadow: var(--shadow); min-width: 0; }
.hero { color: var(--on-primary); background: linear-gradient(118deg, var(--primary) 25%, var(--primary-end)); position: relative; overflow: hidden; min-height: 205px; isolation: isolate; }
.hero::after { content: ""; position: absolute; z-index: -1; inset: -40px -100px -60px 45%; opacity: .26; transform: rotate(-23deg); background: repeating-radial-gradient(ellipse at 80% 15%, transparent 0 13px, var(--primary-muted) 14px, transparent 15px 24px); mask-image: linear-gradient(80deg, transparent, #000); pointer-events: none; }
.hero h2, .card h2 { font-size: 1.3rem; display: flex; align-items: center; gap: 8px; }
.hero h2 svg { color: var(--signal); }
.hero p { color: var(--primary-muted); }
.hero-items { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; margin: 18px 0 13px; }
.hero-item { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 9px; background: var(--highlight); color: var(--highlight-ink); font-weight: 800; }
.hero-item svg { width: 17px; height: 17px; }
.card { background: var(--paper); border: 1px solid var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.goals { display: flex; flex-wrap: wrap; gap: 18px 26px; margin-block: 18px 10px; }
.goal strong { display: block; font-size: 1.85rem; letter-spacing: -.055em; line-height: 1; }
.goal small { display: block; margin-top: 5px; }
.small, small { color: var(--muted); font-size: .875rem; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.stack { display: grid; gap: var(--gap); min-width: 0; }
.field { display: grid; gap: 5px; min-width: 0; }
.field span, legend { font-weight: 750; font-size: .87rem; }
input:not([type=checkbox]), select { width: 100%; border: 1px solid var(--line); border-radius: var(--control-radius); padding: 9px 11px; min-height: 44px; color: var(--ink); background: var(--page); }
select { appearance: none; padding-right: 31px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.fields { display: grid; gap: 12px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented { display: flex; align-items: stretch; gap: 4px; background: var(--page); padding: 4px; border-radius: 11px; margin-bottom: 14px; }
.segmented button { flex: 1; border: 1px solid transparent; background: none; color: var(--muted); border-radius: 8px; font-weight: 750; padding: 7px; }
.segmented button[aria-pressed=true] { background: var(--paper); border-color: var(--line); color: var(--accent); box-shadow: var(--shadow); }
.form-gap { margin-top: 13px; }
.list { margin: 0; padding: 0; list-style: none; }
.row { display: flex; align-items: center; gap: 10px; padding-block: 11px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-main strong, .row-main small { display: block; }
.row-icon { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 auto; border-radius: 10px; background: var(--tint); color: var(--accent); overflow: hidden; }
.row-icon img { width: 100%; height: 100%; object-fit: cover; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; flex: 0 0 auto; margin: 0; }
.timeline { padding-left: 0; list-style: none; margin: 0; }
.leg { position: relative; border-left: 2px solid var(--line); margin-left: 7px; padding: 0 0 18px 18px; }
.leg:last-child { padding-bottom: 0; }
.leg::before { content: ""; position: absolute; left: -6px; top: 4px; background: var(--accent); width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 3px var(--paper); }
.leg h3 { margin-bottom: 4px; font-size: 1rem; overflow-wrap: anywhere; }
.leg p { margin-top: 4px; overflow-wrap: anywhere; }
.leg .take { background: var(--tint); padding: 8px 10px; border-radius: 8px; margin-top: 8px; }
.warn { background: var(--warning-bg); color: var(--warning); border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
dialog { width: min(520px, calc(100% - 28px)); max-height: min(88vh, 780px); padding: 22px; border: 1px solid var(--line); border-radius: var(--card-radius); color: var(--ink); background: var(--paper); }
dialog::backdrop { background: var(--overlay); }
.dialog-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
#status:not(:empty) { position: fixed; inset: auto 18px max(16px, env(safe-area-inset-bottom)) auto; max-width: calc(100vw - 36px); background: var(--primary); color: var(--on-primary); padding: 10px 15px; border-radius: var(--control-radius); z-index: 3; }
.empty { color: var(--muted); padding-block: 8px; }
.badge { font-size: .79rem; font-weight: 750; color: var(--accent); background: var(--tint); padding: 3px 8px; border-radius: 12px; }
details > summary { cursor: pointer; font-weight: 750; }
details > ul { margin-top: 6px; }
#print { display: none; }
@media (max-width: 790px) {
  .shell { width: calc(100% - 32px); }
  .hero, .card { padding: 19px; }
  .metric-layout, .workspace { gap: 14px; }
  .stack { gap: 14px; }
}
@media (max-width: 650px) {
  #app { padding-top: 22px; }
  .topbar-inner { min-height: 62px; gap: 5px; }
  nav a { padding: 7px; font-size: .79rem; }
  .brand { font-size: .94rem; gap: 6px; white-space: normal; line-height: 1.03; }
  .brand-icon { width: 35px; height: 35px; flex: 0 0 35px; }
  .page-head, .workspace, .metric-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
  .metric-layout { margin-bottom: 14px; }
  .hero { min-height: 0; }
  .fields.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  input:not([type=checkbox]), select { font-size: 16px; }
}
@media print {
  @page { margin: 15mm; }
  body { background: white; }
  body > :not(#print) { display: none !important; }
  #print { display: block; }
  #print h1, #print h2, #print h3 { margin-block: 0 8px; }
  #print h1 { color: var(--primary); }
  #print article { margin-top: 17px; border-top: 1px solid #a0a0a0; padding-top: 10px; break-inside: avoid; }
}
[hidden] { display: none !important; }
fieldset.food-options { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
input[aria-invalid=true] { border-color: var(--danger); }
