/* Nico 妮蔻 — tokens from brand-assets/08-tokens/tokens.css */
:root {
  --canvas: #FFF9EF;
  --surface: #FFFCF7;
  --ink: #292723;
  --butter: #F7DC78;
  --butter-soft: #FBEDB8;
  --lilac: #CEC5EE;
  --lilac-soft: #E9E4F8;
  --mint: #DDE8D2;
  --mint-soft: #EDF3E7;
  --link: #59408B;
  --critical: #8B3027;
  --border: 3px solid var(--ink);
  --hair: 1px solid rgba(41, 39, 35, .25);
  --r-panel: 24px;
  --r-ctl: 12px;
  --shadow: 3px 4px 0 rgba(41, 39, 35, .14);
  --font: ui-rounded, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --gutter: 32px;
  --header-h: 76px;
  --bottom-h: 0px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--header-h) + 12px); scroll-padding-bottom: calc(var(--bottom-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.65;
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; font-weight: 800; }
p { margin: 0; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 7px var(--lilac); border-radius: 6px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: var(--r-ctl); }
.skip:focus { top: 12px; }
.wrap { max-width: calc(1120px + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.icon { width: 40px; height: 40px; flex: none; }
.ext { width: .85em; height: .85em; margin-left: 3px; vertical-align: -1px; }
.sparkle { width: 26px; height: 26px; flex: none; }
.small { font-size: 14px; color: #4a463f; }
.tone-butter { background: var(--butter-soft); }
.tone-lilac { background: var(--lilac-soft); }
.tone-mint { background: var(--mint); }
.tone-mint-soft { background: var(--mint-soft); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--canvas); border-bottom: 1px solid rgba(41, 39, 35, .12); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 26px; letter-spacing: .5px; border-radius: var(--r-ctl); }
.brand img { width: 44px; height: 45px; object-fit: contain; }
.top-nav ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.top-nav a { display: block; padding: 8px 18px; border-radius: var(--r-ctl); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 17px; border: 2px solid transparent; }
.top-nav a:hover { background: var(--butter-soft); }
.top-nav a[aria-current="true"] { background: var(--butter); border-color: var(--ink); }

main { padding-top: 20px; padding-bottom: 32px; display: grid; gap: 28px; }

/* Hero */
.overview { display: grid; gap: 16px; }
.hero { position: relative; display: grid; grid-template-columns: 1.25fr 1fr; align-items: center; background: var(--butter); border-radius: var(--r-panel); padding: 40px 48px; min-height: 300px; overflow: hidden; }
.hero h1 { position: relative; display: inline-block; font-size: clamp(30px, 5vw, 56px); font-weight: 900; letter-spacing: 1px; padding-bottom: 14px; }
.swoosh { position: absolute; left: 45%; bottom: 0; width: 40%; height: 14px; }
.tagline { font-size: clamp(18px, 2.2vw, 26px); font-weight: 700; margin-top: 14px; letter-spacing: 2px; }
.hero-date { margin-top: 22px; font-size: 17px; font-weight: 600; }
.hero-stage { margin-top: 6px; font-size: 15px; display: inline-block; background: var(--surface); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 14px; }
.hero-art { position: relative; display: flex; justify-content: center; align-items: center; }
.mascot { width: min(380px, 100%); aspect-ratio: 720 / 714; object-fit: contain; filter: drop-shadow(0 10px 0 rgba(160, 120, 40, .18)); }
.badge { position: absolute; top: 0; right: 0; background: var(--lilac); border: var(--border); border-radius: 999px 999px 999px 8px; padding: 6px 18px; font-weight: 800; font-size: 20px; transform: rotate(6deg); }
.hero-paw { position: absolute; right: 4px; bottom: 6px; width: 46px; height: 46px; transform: rotate(-14deg); }

/* Metrics */
.metrics { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px 28px; background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r-panel); padding: 18px 28px; box-shadow: var(--shadow); }
.metrics-icon { width: 92px; height: 92px; }
.metric-list { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; }
.metric { text-align: center; padding: 0 12px; }
.metric + .metric { border-left: 2px solid var(--ink); }
.metric dt { font-weight: 800; font-size: 18px; }
.metric dd { margin: 0; font-size: 44px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metrics-basis { font-weight: 600; font-size: 15px; border-left: 2px solid var(--ink); padding-left: 20px; max-width: 13em; }
.metric-notes { display: grid; gap: 2px; font-size: 15px; padding: 0 8px; color: #3b3832; }
.metric-notes p::before { content: "· "; }
.viewing-note { font-weight: 800; color: var(--ink); background: var(--lilac); border-radius: var(--r-ctl); padding: 4px 12px; justify-self: start; }
.metric-notes .viewing-note::before { content: ""; }

/* Panels */
.panel { background: var(--surface); border: var(--border); border-radius: var(--r-panel); padding: 28px 32px; box-shadow: var(--shadow); }
.panel.tone-lilac { background: var(--lilac-soft); }
.panel.tone-mint-soft { background: var(--mint-soft); }
.tag-heading { display: inline-flex; align-items: center; gap: 10px; background: var(--lilac); border-radius: 999px; padding: 4px 22px 4px 10px; font-size: 24px; }
.tag-heading .icon { width: 38px; height: 38px; }
.section-heading { display: flex; align-items: center; gap: 12px; font-size: 28px; margin-bottom: 18px; }
.section-heading .icon { width: 44px; height: 44px; }
.panel-sub { margin-top: 10px; font-size: 14px; color: #4a463f; }

/* Feeding */
.feeding-care { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; }
.meals { list-style: none; margin: 18px 0 0; padding: 0 0 0 4px; position: relative; }
.meal { position: relative; display: grid; grid-template-columns: 30px minmax(4.5em, 1fr) 4em auto; column-gap: 18px; align-items: center; padding: 8px 0 8px 6px; }
.meal::before { content: ""; position: absolute; left: 20px; top: 0; bottom: 0; width: 3px; background: #B3A6E3; z-index: 0; }
.meal:first-child::before { top: 50%; }
.meal:last-child::before { bottom: 50%; }
.meal.is-reported + .meal.is-planned::before { top: 0; }
.mark { position: relative; z-index: 1; width: 28px; height: 28px; }
.meal-time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meal-g { font-size: 22px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.meal-note { grid-column: 2 / -1; font-size: 14px; color: #4a463f; line-height: 1.45; }
.pill { display: inline-block; justify-self: start; border-radius: 999px; padding: 2px 16px; font-weight: 700; font-size: 15px; border: 2px solid transparent; white-space: nowrap; }
.pill-mint { background: var(--mint); border-color: #9FBE8A; }
.pill-lilac { background: var(--lilac-soft); border-color: #B3A6E3; }
.pill-surface { background: var(--surface); border-color: rgba(41, 39, 35, .3); }
.legend { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; color: #3b3832; border-top: var(--hair); padding-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .mark { width: 18px; height: 18px; }
.care { display: flex; flex-direction: column; align-self: start; }
.care-list { list-style: none; margin: 22px 0 6px; padding: 0; display: grid; gap: 22px; align-content: start; }
.care-list li { display: flex; align-items: center; gap: 18px; font-size: 21px; font-weight: 700; }
.care-icon { width: 64px; height: 64px; }
.day-note { grid-column: 1 / -1; background: var(--mint); border-radius: var(--r-ctl); padding: 10px 18px; text-align: center; font-weight: 600; }

/* Calendar */
.calendar-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; align-items: start; }
.month { width: 100%; border-collapse: separate; border-spacing: 0 4px; text-align: center; font-variant-numeric: tabular-nums; }
.month caption { background: var(--lilac); border-radius: var(--r-ctl); font-weight: 800; font-size: 20px; padding: 6px; margin-bottom: 8px; }
.month th { font-weight: 700; padding: 4px 0; }
.month td { padding: 2px 0; height: 44px; font-size: 18px; }
.month .day { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; line-height: 1; }
.month .has-record .day { background: var(--butter); border: 2px solid var(--ink); font-weight: 800; }
.day-paw { width: 14px; height: 14px; margin-top: 1px; }
.phone-cal { display: none; }
.cal-hint { margin-top: 10px; font-size: 14px; color: #4a463f; }
.day-card { border-radius: 20px; padding: 22px; display: grid; gap: 12px; }
.day-card h3 { display: flex; align-items: center; gap: 10px; font-size: 24px; }
.day-card h3 .icon { width: 34px; height: 34px; }
.day-card-lead { font-weight: 800; font-size: 18px; }
.pending { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.pending li { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 2px solid rgba(41, 39, 35, .35); border-radius: 16px; padding: 8px 14px; }
.pending-icon { width: 34px; height: 34px; }

/* Records */
.weights { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.weight { border-radius: 20px; padding: 18px 18px 20px; text-align: center; border: 2px solid rgba(41, 39, 35, .18); }
.weight-icon { width: 48px; height: 48px; }
.weight-num { font-size: 40px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.weight-detail { margin-top: 10px; font-size: 14px; line-height: 1.55; text-align: left; }
.weight-when { font-weight: 700; }
.note-bar { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; background: var(--mint); border-radius: var(--r-ctl); padding: 8px 16px; font-weight: 600; text-align: center; }
.inline-icon { width: 24px; height: 24px; }
.sub-heading { font-size: 22px; margin: 24px 0 12px; }
.obs { border: 2px solid var(--ink); border-radius: 20px; padding: 18px 22px; background: var(--canvas); display: grid; gap: 6px; }
.obs h4 { font-size: 20px; }
.obs-when { font-size: 14px; color: #4a463f; font-weight: 600; }
.critical { color: var(--critical); font-weight: 700; }
.critical a { margin-left: 6px; font-weight: 600; }

/* Routine */
.routine-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.routine-card { border-radius: 20px; border: 2px solid rgba(41, 39, 35, .18); padding: 16px 20px 18px; background: var(--surface); }
.routine-card h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 20px; margin: -16px -20px 12px; padding: 10px 20px; border-radius: 18px 18px 0 0; }
.routine-card.tone-butter h3 { background: var(--butter-soft); }
.routine-card.tone-lilac h3 { background: var(--lilac-soft); }
.routine-card.tone-mint h3 { background: var(--mint); }
.routine-card.tone-butter, .routine-card.tone-lilac, .routine-card.tone-mint { background: var(--surface); }
.routine-card h3 .icon { width: 34px; height: 34px; }
.routine-title { font-size: 15px; font-weight: 700; color: #4a463f; }
.routine-card ul { margin: 0; padding-left: 1.2em; }
.routine-card li::marker { color: #8D7BCB; }

/* Manuals (native details) */
.manual { border: 2px solid var(--ink); border-radius: 20px; margin-top: 14px; overflow: clip; }
.manual.tone-butter { background: var(--butter-soft); }
.manual.tone-lilac { background: var(--lilac-soft); }
.manual.tone-mint { background: var(--mint); }
.manual > summary { list-style: none; display: flex; align-items: center; gap: 16px; padding: 12px 20px; min-height: 64px; cursor: pointer; border-radius: 18px; }
.manual > summary::-webkit-details-marker { display: none; }
.manual-icon { width: 52px; height: 52px; }
.manual-label { flex: 1; display: grid; }
.manual-name { font-size: 21px; font-weight: 800; }
.manual-full { font-size: 14px; color: #4a463f; }
.toggle { position: relative; width: 26px; height: 26px; flex: none; }
.toggle::before, .toggle::after { content: ""; position: absolute; left: 3px; right: 3px; top: 11px; height: 4px; border-radius: 2px; background: var(--ink); }
.toggle::after { transform: rotate(90deg); }
details[open] > summary .toggle::after { transform: rotate(0); }
@media (prefers-reduced-motion: no-preference) { .toggle::after { transition: transform .16s ease; } }
.manual-body { background: var(--surface); margin: 0 14px 14px; border-radius: 16px; padding: 20px 26px; }
.prose { max-width: 100%; }
.prose > * + * { margin-top: 12px; }
.prose h3 { font-size: 19px; margin-top: 24px; }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 0; }
.prose li + li { margin-top: 4px; }
.prose li::marker { color: #6E58B0; }
.manual-context { font-size: 14px; color: #4a463f; background: var(--canvas); border-left: 4px solid var(--lilac); padding: 8px 12px; border-radius: 0 10px 10px 0; }
.comic { margin: 16px 0 0; }
.comic img { display: block; width: 100%; max-width: 720px; border-radius: 16px; border: 2px solid var(--ink); background: var(--mint-soft); }
.comic figcaption { font-size: 14px; color: #4a463f; margin-top: 6px; max-width: 720px; }
.table-wrap { max-width: 100%; }
.stack-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.stack-table th, .stack-table td { border: 1px solid rgba(41, 39, 35, .28); padding: 8px 10px; text-align: left; vertical-align: top; }
.stack-table th { background: var(--lilac-soft); }
.daily-manual { margin-top: 8px; }
.collection-context { margin-top: 14px; font-size: 14px; color: #3b3832; background: var(--canvas); border-left: 4px solid var(--lilac); padding: 8px 12px; border-radius: 0 10px 10px 0; }

/* Sources */
.source-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 28px; margin-top: 12px; }
.source-group h3 { font-size: 17px; margin-bottom: 6px; }
.source-group ul { margin: 0; padding-left: 1.1em; font-size: 15px; }
.source-group li { margin: 4px 0; }

/* Footer */
.site-footer { border-top: var(--hair); padding: 18px 0 24px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; font-size: 15px; }
.footer-inner p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-inner img { width: 28px; height: 29px; }
.footer-inner a { display: inline-block; padding: 6px 0; }

.bottom-nav { display: none; }

/* Tablet */
@media (max-width: 1000px) {
  .metrics { grid-template-columns: auto 1fr; }
  .metrics-basis { grid-column: 1 / -1; border-left: 0; padding-left: 0; max-width: none; text-align: center; border-top: var(--hair); padding-top: 8px; }
  .hero { padding: 32px; }
  .calendar-grid { grid-template-columns: 1fr 1fr; }
  .feeding-care { grid-template-columns: 1.15fr 1fr; }
  .panel { padding: 24px; }
  .care-list li { font-size: 18px; gap: 12px; }
  .care-icon { width: 52px; height: 52px; }
  .meal { column-gap: 12px; }
  .routine-list { grid-template-columns: 1fr; gap: 10px; }
}

/* Phone */
@media (max-width: 699px) {
  :root { --gutter: 16px; --header-h: 60px; --bottom-h: 68px; }
  body { padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); }
  .top-nav { display: none; }
  .brand { font-size: 21px; }
  .brand img { width: 36px; height: 37px; }
  main { gap: 20px; padding-top: 12px; }
  .hero { grid-template-columns: 1fr minmax(120px, 42%); grid-template-areas: "title title" "tag art" "date art" "stage art" ". art"; align-items: start; padding: 20px 14px 16px 18px; min-height: 0; column-gap: 4px; }
  .hero-text { display: contents; }
  .hero h1 { grid-area: title; justify-self: start; font-size: clamp(28px, 8.6vw, 34px); padding-bottom: 10px; letter-spacing: 0; white-space: nowrap; }
  .tagline { grid-area: tag; }
  .hero-date { grid-area: date; }
  .hero-stage { grid-area: stage; justify-self: start; margin-top: 8px; }
  .hero-art { grid-area: art; align-self: end; }
  .swoosh { left: 30%; width: 60%; }
  .tagline { font-size: 16px; margin-top: 8px; letter-spacing: 1px; }
  .hero-date { font-size: 13px; margin-top: 12px; }
  .hero-stage { font-size: 13px; padding: 0 10px; }
  .badge { font-size: 13px; padding: 2px 10px; border-width: 2px; top: -6px; right: -4px; }
  .hero-paw { display: none; }
  .mascot { width: 100%; margin-top: 10px; }
  .metrics { grid-template-columns: 1fr; padding: 14px 10px; gap: 8px; }
  .metrics-icon { display: none; }
  .metric { padding: 0 4px; }
  .metric dt { font-size: 14px; }
  .metric dd { font-size: clamp(26px, 8vw, 34px); }
  .metrics-basis { font-size: 13px; }
  .metric-notes { font-size: 14px; padding: 0 4px; }
  .panel { padding: 18px 16px; }
  .feeding-care { grid-template-columns: 1fr; gap: 16px; }
  .tag-heading { font-size: 20px; padding-right: 16px; }
  .section-heading { font-size: 23px; margin-bottom: 14px; }
  .section-heading .icon { width: 38px; height: 38px; }
  .meal { grid-template-columns: 26px minmax(3.6em, 1fr) 3.2em auto; column-gap: 10px; padding-left: 2px; }
  .meal::before { left: 14px; }
  .mark { width: 24px; height: 24px; }
  .meal-time { font-size: 17px; }
  .meal-g { font-size: 19px; }
  .pill { padding: 1px 10px; font-size: 14px; }
  .care-list li { font-size: 17px; gap: 12px; }
  .care-icon { width: 48px; height: 48px; }
  .day-note { font-size: 14px; text-align: left; }
  .calendar-grid { grid-template-columns: 1fr; gap: 16px; }
  .month-desktop { display: none; }
  .phone-cal { display: block; }
  .week-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .week-strip li { display: flex; flex-direction: column; align-items: center; border: 2px solid rgba(41, 39, 35, .3); border-radius: 12px; padding: 6px 0; line-height: 1.2; background: var(--surface); }
  .week-strip .strip-day { font-weight: 800; font-size: 17px; }
  .week-strip .strip-wd { font-size: 13px; }
  .week-strip .is-record { background: var(--butter); border-color: var(--ink); }
  .month-details { margin-top: 10px; border: 2px solid var(--ink); border-radius: 16px; background: var(--surface); }
  .month-details > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; min-height: 48px; font-weight: 800; cursor: pointer; border-radius: 14px; }
  .month-details > summary::-webkit-details-marker { display: none; }
  .month-details .month { padding: 0 6px 8px; }
  .month td { height: 40px; font-size: 16px; }
  .month .day { width: 36px; height: 36px; }
  .day-card { padding: 16px; }
  .weights { grid-template-columns: 1fr; gap: 10px; }
  .weight { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; text-align: left; padding: 12px 14px; }
  .weight-icon { width: 40px; height: 40px; }
  .weight-num { font-size: 32px; display: inline-block; margin-right: 10px; }
  .weight-body .pill { vertical-align: 6px; }
  .weight-detail { margin-top: 4px; }
  .note-bar { font-size: 14px; text-align: left; justify-content: flex-start; }
  .obs { padding: 14px 16px; }
  .routine-list { grid-template-columns: 1fr; gap: 10px; }
  .manual > summary { padding: 10px 14px; gap: 12px; }
  .manual-icon { width: 40px; height: 40px; }
  .manual-name { font-size: 18px; }
  .manual-body { margin: 0 8px 8px; padding: 14px 14px; }
  .stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table tr { border: 1px solid rgba(41, 39, 35, .28); border-radius: 12px; margin-top: 8px; overflow: hidden; }
  .stack-table td { border: 0; border-top: 1px solid rgba(41, 39, 35, .12); padding: 6px 10px; }
  .stack-table td:first-child { border-top: 0; background: var(--lilac-soft); font-weight: 700; }
  .stack-table td::before { content: attr(data-label) "："; font-weight: 700; color: #4a463f; }
  .stack-table td:first-child::before { content: ""; }
  .footer-inner { font-size: 14px; }

  .bottom-nav { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; max-width: 520px; }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; border-radius: var(--r-ctl); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; line-height: 1.2; border: 2px solid transparent; }
  .bottom-nav .icon { width: 26px; height: 26px; }
  .bottom-nav a[aria-current="true"] { background: var(--butter); border-color: var(--ink); }
}
@media (max-width: 380px) {
  .meal { grid-template-columns: 24px 1fr auto auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- V2 shared feeding ledger ---------- */
.btn-link { background: none; border: 0; padding: 6px 4px; margin: 0 2px; font: inherit; font-weight: 700; color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; min-height: 36px; }
.btn-link:disabled { color: #7a7468; cursor: progress; }
.btn-primary { font: inherit; font-weight: 800; color: var(--ink); background: var(--butter); border: var(--border); border-radius: 999px; padding: 12px 22px; cursor: pointer; box-shadow: var(--shadow); min-height: 52px; }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.ledger-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.ledger-head h2:focus { outline: none; }
.ledger-head h2:focus-visible { outline: 3px solid var(--ink); }
.ledger-date { font-size: 14px; color: #4a463f; font-weight: 600; }
.ledger-daynav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 12px; font-size: 15px; }
.ledger-daynav label { font-weight: 700; }
.ledger-daynav input, .sheet input[type="date"], .sheet input[type="time"], .sheet select { font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--ink); border-radius: var(--r-ctl); padding: 6px 10px; min-height: 44px; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 14px; border: 2px solid var(--ink); border-radius: 20px; padding: 12px 14px 10px; background: var(--surface); }
.total { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 0 8px; }
.total + .total { border-left: 2px solid var(--ink); }
.total-icon { grid-row: span 2; width: 52px; height: 52px; }
.total-label { font-weight: 700; font-size: 16px; }
.total-num { font-size: 36px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.totals-basis { grid-column: 1 / -1; text-align: center; font-size: 13px; color: #4a463f; border-top: var(--hair); padding-top: 6px; margin-top: 6px; }
.add-meal { display: block; width: 100%; margin-top: 14px; font: inherit; font-size: 22px; font-weight: 800; color: var(--ink); background: var(--butter); border: var(--border); border-radius: 999px; min-height: 58px; cursor: pointer; box-shadow: var(--shadow); }
.add-meal:hover { background: #F3D35E; }
.sync { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; margin-top: 10px; font-size: 13px; color: #4a463f; }
.sync-status.is-error { color: var(--critical); font-weight: 700; }
.sync-status.is-error .btn-link { color: var(--critical); padding-left: 0; }
.flash { margin-top: 10px; background: var(--mint); border: 2px solid #9FBE8A; border-radius: var(--r-ctl); padding: 8px 12px; font-weight: 700; }
.ledger .meals { margin-top: 10px; }
.ledger .meal { grid-template-columns: 30px minmax(4.6em, auto) 3em 4em auto 1fr; }
.meal-kind { font-weight: 700; color: #3b3832; }
.meal-actions { grid-column: 2 / -1; display: flex; gap: 4px; margin-left: -6px; }
.meal.is-new { background: var(--mint-soft); border-radius: 12px; }
.meal.is-undone { opacity: .85; }
.meal.is-undone .meal-g { text-decoration: line-through; }
.mark-blank { width: 28px; height: 28px; }
.empty { margin-top: 12px; padding: 14px; text-align: center; border: 2px dashed rgba(41, 39, 35, .35); border-radius: 16px; font-weight: 700; }
.undone { margin-top: 10px; border: 2px solid rgba(41, 39, 35, .3); border-radius: 14px; padding: 0 12px; }
.undone > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-weight: 700; cursor: pointer; }
.undone > summary::-webkit-details-marker { display: none; }
.plans { margin-top: 16px; border-top: var(--hair); padding-top: 12px; }
.plans-title { font-size: 17px; }
.family { margin-top: 12px; border-top: var(--hair); padding-top: 8px; font-size: 14px; }
.family p { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.family-in span { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.family-in .mark { width: 18px; height: 18px; }
.metric-source { font-weight: 600; }
.month .day-btn { font: inherit; color: var(--ink); cursor: pointer; background: var(--mint); border: 2px solid var(--ink); }
.month .has-record .day-btn { background: var(--butter); }
.month td .day-btn[aria-label*="有喂食记录"] { font-weight: 800; }

/* Sheet: native <dialog>, bottom sheet on phones, centered dialog on larger screens. */
html.sheet-open { overflow: hidden; }
.sheet { width: min(520px, calc(100vw - 32px)); max-height: min(90vh, 760px); padding: 0; border: var(--border); border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 4px 6px 0 rgba(41, 39, 35, .2); overflow: hidden; }
.sheet[open] { display: flex; }
.sheet::backdrop { background: rgba(41, 39, 35, .45); }
.sheet-form { display: flex; flex-direction: column; width: 100%; max-height: inherit; min-height: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 8px; }
.sheet-head h2 { font-size: 24px; }
.icon-btn { font: inherit; font-size: 28px; line-height: 1; width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; background: none; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--lilac-soft); }
.sheet-body { overflow-y: auto; padding: 4px 18px 12px; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
.sheet-foot { padding: 10px 18px 16px; border-top: var(--hair); background: var(--surface); }
.save { width: 100%; background: var(--lilac); font-size: 19px; }
.unlock { background: var(--butter-soft); border: 2px solid var(--ink); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.unlock label { font-weight: 800; }
.unlock-row { display: flex; gap: 8px; }
.unlock-row input { flex: 1; min-width: 0; font: inherit; font-size: 17px; border: 2px solid var(--ink); border-radius: var(--r-ctl); padding: 8px 10px; min-height: 48px; background: var(--surface); }
.small-btn { padding: 8px 14px; min-height: 48px; font-size: 16px; white-space: nowrap; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
.fields[disabled] { opacity: .7; }
.plan-wet-note { margin-top: 8px; color: var(--critical); font-weight: 700; font-size: 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border: 0; margin: 0; padding: 0; }
.seg-opt { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; border: 2px solid rgba(41, 39, 35, .4); border-radius: 16px; font-weight: 800; font-size: 19px; cursor: pointer; background: var(--surface); }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt:has(input:checked) { background: var(--butter); border: var(--border); }
.seg-opt:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 7px var(--lilac); }
.seg-icon { width: 36px; height: 36px; }
.field-row { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; gap: 10px; }
.field-row label { font-weight: 700; }
.field-row select, .field-row input { width: 100%; min-width: 0; }
.grams-box { display: flex; align-items: center; border: var(--border); border-radius: 16px; background: var(--surface); padding: 0 14px; min-height: 64px; }
.grams-box input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 34px; font-weight: 800; text-align: center; color: var(--ink); padding: 4px 0; }
.grams-box input:focus { outline: none; }
.grams-box:focus-within { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 7px var(--lilac); }
.grams-box span { font-weight: 700; border-left: 2px solid rgba(41, 39, 35, .3); padding-left: 10px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick button { font: inherit; font-weight: 800; font-size: 18px; min-height: 48px; border: 2px solid rgba(41, 39, 35, .4); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.quick button:hover { background: var(--butter-soft); }
.hint { text-align: center; font-size: 14px; color: #4a463f; }
.field-error { color: var(--critical); font-weight: 700; font-size: 14px; min-height: 0; }
.field-error:empty { display: none; }
[aria-invalid="true"] { border-color: var(--critical) !important; }
.when { border: 2px solid rgba(41, 39, 35, .35); border-radius: 16px; padding: 8px 12px; display: grid; gap: 8px; }
.when-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; font-weight: 800; font-size: 18px; }
.when-summary .btn-link { margin-left: auto; }
.when-fields { display: grid; gap: 8px; }
.form-status { margin-top: 10px; font-weight: 700; }
.form-status.is-error { color: var(--critical); }
.form-status:empty { display: none; }

@media (max-width: 699px) {
  .ledger .meal { grid-template-columns: 26px minmax(3.8em, auto) 2.6em 3.4em auto; column-gap: 8px; }
  .ledger .meal .pill { justify-self: end; }
  .total-num { font-size: 30px; }
  .total-icon { width: 40px; height: 40px; }
  .total { padding: 0 4px; column-gap: 6px; }
  .add-meal { font-size: 20px; }
  .sheet { width: 100vw; max-width: 100vw; max-height: calc(var(--vvh, 100dvh) - 24px); margin: auto 0 var(--kb, 0px); border-radius: 24px 24px 0 0; border-bottom: 0; }
  .sheet-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .field-row { grid-template-columns: 6em 1fr; }
  .sheet-head h2 { font-size: 21px; }
}
@media (max-width: 420px) {
  .field-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (max-width: 380px) {
  .ledger .meal { grid-template-columns: 24px minmax(3.4em, auto) 2.4em 3.2em auto; column-gap: 6px; }
  .meal-time, .meal-g { font-size: 16px; }
  .seg-opt { font-size: 17px; }
}
/* Native date/time inputs move focus into internal sub-fields/picker buttons where :focus-visible
   no longer matches; keep a visible ring on any focus for form controls. */
input:focus, input:focus-within, select:focus { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 7px var(--lilac); }
.grams-box input:focus, .seg-opt input:focus { outline: none; box-shadow: none; }

.remember-note { font-weight: 400 !important; color: #4a463f; flex-basis: 100%; order: 3; }
