:root {
  color-scheme: light;
  --bg: #f3f5ef;
  --surface: #ffffff;
  --surface-soft: #f8f8f3;
  --ink: #1f2b27;
  --muted: #67736c;
  --faint: #909a94;
  --line: #dfe4dc;
  --green: #2f6b57;
  --green-dark: #274f43;
  --green-soft: #e5f0e9;
  --amber: #c99239;
  --amber-soft: #fbf0d8;
  --coral: #c96647;
  --coral-soft: #f8e8e1;
  --blue: #426f8b;
  --blue-soft: #e9f0f4;
  --danger: #aa433f;
  --shadow: 0 12px 32px rgba(30, 49, 40, 0.08);
  --sidebar-width: 230px;
  --radius: 8px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 107, 87, 0.24);
  outline-offset: 2px;
}

svg {
  display: block;
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: var(--muted);
}

.boot-screen .brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--green-dark);
  color: #f9f4e8;
  display: grid;
  place-items: center;
}

.family-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 18px;
  background:
    linear-gradient(145deg, rgba(229, 240, 233, 0.9), rgba(243, 245, 239, 0) 52%),
    var(--bg);
}

.family-login-card {
  width: min(100%, 420px);
  padding: 28px 24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.family-login-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 18px;
  color: #f9f4e8;
  background: var(--green-dark);
}

.family-login-mark svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.family-login-card h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.family-login-copy {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.family-login-card .form-actions {
  margin-top: 18px;
}

.family-login-card .button {
  width: 100%;
}

.brand-mark svg {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  display: none;
}

.main-column {
  min-height: 100vh;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px 12px;
}

.topbar-title {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.16;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.local-chip {
  display: none;
}

.content {
  padding: 4px 16px 28px;
}

.view {
  display: none;
  animation: view-in 180ms ease-out;
}

.view.active {
  display: block;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 2px 12px;
}

.section-heading > :first-child {
  min-width: 0;
}

.section-heading:first-child {
  margin-top: 8px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-heading .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.text-button {
  border: 0;
  padding: 6px 0;
  color: var(--green);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.icon-button svg,
.quick-action svg,
.nav-button svg,
.button svg,
.record-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.quick-action {
  min-width: 0;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.quick-action:active {
  transform: scale(0.97);
}

.quick-action:hover {
  border-color: #b9c8be;
}

.quick-action .quick-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
}

.quick-action:nth-child(2) .quick-icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.quick-action:nth-child(3) .quick-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.quick-action:nth-child(4) .quick-icon {
  color: var(--coral);
  background: var(--coral-soft);
}

.smart-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 8px 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.smart-entry svg {
  flex: 0 0 auto;
  width: 18px;
  color: var(--green);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.smart-entry input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: 0;
}

.smart-entry input::placeholder {
  color: var(--faint);
}

.smart-entry button {
  flex: 0 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.stat-label svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: clamp(24px, 7.2vw, 34px);
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.stat-note {
  min-height: 17px;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.energy-panel {
  margin-top: 10px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.energy-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.energy-head h3 {
  margin: 0;
  font-size: 15px;
}

.energy-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.energy-number {
  flex: 0 0 auto;
  text-align: right;
  font-size: 22px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.energy-number span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.energy-track {
  position: relative;
  height: 9px;
  margin: 16px 0 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf0ea;
}

.energy-fill {
  height: 100%;
  min-width: 0;
  max-width: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 320ms ease;
}

.energy-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #60502e;
  background: var(--amber-soft);
  font-size: 12px;
  line-height: 1.55;
}

.notice svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.notice.danger {
  color: #6f3230;
  background: var(--coral-soft);
}

.timeline {
  display: grid;
  gap: 8px;
}

.record-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 68px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.record-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
}

.record-row[data-kind="solid"] .record-icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.record-row[data-kind="diaper"] .record-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.record-row[data-kind="weight"] .record-icon {
  color: var(--coral);
  background: var(--coral-soft);
}

.record-copy {
  min-width: 0;
}

.record-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 14px;
  font-weight: 720;
}

.record-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-detail {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.record-time {
  align-self: start;
  padding-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.record-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.record-menu {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.record-actions button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.record-actions button:hover {
  background: var(--surface-soft);
}

.record-actions svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.empty-state {
  padding: 28px 20px;
  border: 1px dashed #c9d1c9;
  border-radius: var(--radius);
  text-align: center;
  background: rgba(255, 255, 255, 0.46);
}

.empty-state .empty-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
}

.empty-state .empty-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.empty-state p {
  max-width: 320px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.panel {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel + .panel {
  margin-top: 10px;
}

.panel h3 {
  margin: 0;
  font-size: 16px;
}

.panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.panel p:last-child {
  margin-bottom: 0;
}

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.filter-bar input,
.filter-bar select {
  min-width: 0;
  flex: 1;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
}

.date-group {
  margin-bottom: 18px;
}

.date-group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 8px;
  color: var(--muted);
  font-size: 12px;
}

.date-group-title strong {
  color: var(--ink);
  font-size: 13px;
}

.growth-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.growth-metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.growth-metric .label {
  color: var(--muted);
  font-size: 12px;
}

.growth-metric .value {
  margin-top: 7px;
  font-size: 25px;
  font-weight: 760;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.growth-metric .value small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.chart-panel {
  margin-top: 10px;
  padding: 14px 10px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 4px 8px;
  color: var(--muted);
  font-size: 11px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dash {
  width: 16px;
  height: 0;
  border-top: 2px solid var(--faint);
}

.legend-dash.p50 {
  border-color: var(--green);
}

.legend-dash.point {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: var(--coral);
}

.chart-wrap {
  position: relative;
  min-height: 260px;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-axis {
  fill: var(--muted);
  font-size: 10px;
}

.chart-grid {
  stroke: #e8ece6;
  stroke-width: 1;
}

.chart-band {
  fill: rgba(47, 107, 87, 0.09);
}

.chart-p50 {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
}

.chart-point {
  fill: var(--surface);
  stroke: var(--coral);
  stroke-width: 2.5;
}

.forecast-band {
  fill: rgba(201, 146, 57, 0.16);
}

.forecast-line {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

.forecast-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.forecast-copy strong {
  color: var(--ink);
}

.forecast-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 99px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.warn {
  color: #725621;
  background: var(--amber-soft);
}

.settings-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.settings-group + .settings-group {
  margin-top: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 58px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row:hover {
  background: var(--surface-soft);
}

.settings-row.main {
  align-items: flex-start;
}

.settings-copy {
  min-width: 0;
}

.settings-copy strong {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
}

.settings-copy strong svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-copy span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.settings-value {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.settings-row .chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
}

.danger-zone .settings-row {
  color: var(--danger);
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 14px;
  padding: 17px;
  border-radius: var(--radius);
  color: #f9fbf8;
  background: var(--green-dark);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green-dark);
  background: #f2ead5;
  font-size: 20px;
  font-weight: 780;
}

.profile-copy {
  min-width: 0;
}

.profile-copy strong {
  display: block;
  font-size: 17px;
}

.profile-copy span {
  display: block;
  margin-top: 3px;
  color: rgba(249, 251, 248, 0.7);
  font-size: 12px;
}

.profile-hero .icon-button {
  margin-left: auto;
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(207, 215, 208, 0.9);
  background: rgba(250, 251, 247, 0.96);
  backdrop-filter: blur(14px);
}

.nav-button {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.nav-button.active {
  color: var(--green);
  background: var(--green-soft);
}

.nav-button svg {
  width: 20px;
  height: 20px;
}

.modal-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  align-items: end;
  padding-top: 28px;
  background: rgba(20, 30, 26, 0.5);
  animation: fade-in 160ms ease-out;
}

.modal-backdrop.center {
  align-items: center;
  padding: 20px;
}

.modal-sheet {
  width: 100%;
  max-height: 94vh;
  overflow: auto;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: sheet-in 210ms ease-out;
}

.modal-backdrop.center .modal-sheet {
  max-width: 520px;
  border-radius: 12px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(20px);
  }
}

.modal-head {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.modal-head h2 {
  margin: 0;
  font-size: 19px;
}

.modal-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-head .icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.sheet-form {
  padding: 17px 18px calc(18px + env(safe-area-inset-bottom));
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 11px;
  color: var(--ink);
  background: var(--surface);
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

.field input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 42px;
}

.input-suffix span {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.choice-pill {
  position: relative;
  display: inline-flex;
}

.choice-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-pill span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.choice-pill input:checked + span {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.check-row input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--green);
}

.check-row + .check-row {
  margin-top: 8px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 720;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  background: var(--green-dark);
}

.button.secondary {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}

.button.ghost {
  color: var(--green);
  background: var(--green-soft);
}

.button.danger {
  color: #fff;
  background: var(--danger);
}

.button.small {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 18px -18px calc(-18px - env(safe-area-inset-bottom));
  padding: 13px 18px calc(13px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.form-actions .button {
  flex: 1;
}

.product-list {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.product-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px 12px;
}

.product-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.product-copy strong {
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.product-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.product-actions {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.product-actions .icon-button {
  width: 36px;
  height: 36px;
}

.product-actions .icon-button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}

.report-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}

.report-card {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
}

.report-copy {
  min-width: 0;
}

.report-copy h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.report-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.report-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.report-actions .icon-button {
  width: 34px;
  height: 34px;
}

.report-actions .icon-button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}

.report-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.report-image {
  display: block;
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.report-file-grid,
.report-file-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 12px;
}

.report-file-editor {
  margin-top: 8px;
}

.report-file-item {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.report-file-item img {
  display: block;
  width: 100%;
  height: 112px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
}

.report-file-item strong {
  display: block;
  margin: 7px 0 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.report-image-button span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: left;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 12px;
}

.metric-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.metric-item span,
.metric-item em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
}

.metric-item strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.metric-item strong small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.report-empty {
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 12px;
}

.report-flag-list {
  display: grid;
  gap: 7px;
  padding: 0 14px 12px;
}

.report-flag {
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--blue) 26%, transparent);
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  line-height: 1.45;
}

.report-flag.attention {
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
  color: var(--danger);
  background: var(--coral-soft);
}

.report-flag strong {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.report-flag strong svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.report-summary {
  margin: 0 14px 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.report-summary strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.report-summary p,
.report-note {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.report-note {
  padding: 0 14px 14px;
  color: var(--muted);
}

.metric-editor {
  display: grid;
  gap: 8px;
  margin-bottom: 9px;
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 68px minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: center;
}

.metric-row input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}

.metric-remove {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
}

.metric-remove svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.report-upload-preview {
  margin-top: 8px;
}

.report-upload-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.report-full {
  padding: 17px 18px calc(18px + env(safe-area-inset-bottom));
}

.report-full img {
  display: block;
  width: 100%;
  max-height: 68vh;
  border-radius: 8px;
  object-fit: contain;
}

@media (max-width: 390px) {
  .report-file-grid,
  .report-file-editor {
    grid-template-columns: 1fr;
  }
}

.ingredient-list {
  display: grid;
  gap: 8px;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 34px;
  gap: 7px;
  align-items: center;
}

.ingredient-row select,
.ingredient-row input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 9px;
  background: var(--surface);
}

.ingredient-remove {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
}

.ingredient-remove svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.calc-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  color: var(--green-dark);
  background: var(--green-soft);
}

.calc-box strong {
  display: block;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.calc-box span {
  display: block;
  margin-top: 3px;
  color: #577166;
  font-size: 11px;
}

.onboarding {
  max-width: 640px;
  margin: 0 auto;
}

.onboarding-intro {
  padding: 24px 20px 6px;
}

.onboarding-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 16px;
  color: #f9f5e8;
  background: var(--green-dark);
}

.onboarding-mark svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.onboarding h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.onboarding-intro p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.onboarding .sheet-form {
  padding-top: 15px;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.divider-label::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.toast-root {
  position: fixed;
  z-index: 120;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 16px;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 420px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: #26362f;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.45;
  animation: toast-in 180ms ease-out;
}

.toast.error {
  background: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stack-8 > * + * {
  margin-top: 8px;
}

.stack-12 > * + * {
  margin-top: 12px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.helper-text {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.draft-notice {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid #dfcfac;
  border-radius: var(--radius);
  color: #6f5320;
  background: var(--amber-soft);
}

.draft-notice strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.draft-notice svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.draft-notice span {
  font-size: 12px;
  line-height: 1.5;
}

.data-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.data-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.data-list span:last-child {
  color: var(--muted);
  text-align: right;
}

@media (min-width: 620px) {
  .content {
    max-width: 900px;
    margin: 0 auto;
    padding-right: 24px;
    padding-left: 24px;
  }

  .topbar {
    max-width: 900px;
    margin: 0 auto;
    padding-right: 24px;
    padding-left: 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .quick-action {
    min-height: 94px;
  }

  .growth-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    border-right: 1px solid var(--line);
    background: #f8f9f4;
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 8px 24px;
  }

  .sidebar-brand .brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #f9f4e8;
    background: var(--green-dark);
  }

  .sidebar-brand .brand-mark svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .sidebar-brand strong {
    display: block;
    font-size: 16px;
  }

  .sidebar-brand span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
  }

  .sidebar-nav {
    display: grid;
    gap: 5px;
  }

  .sidebar .nav-button {
    min-height: 46px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 12px;
    font-size: 13px;
  }

  .sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    background: var(--surface);
    font-size: 11px;
    line-height: 1.5;
  }

  .sidebar-footer strong {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    color: var(--green);
    font-size: 12px;
  }

  .sidebar-footer svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
  }

  .main-column {
    min-width: 0;
    padding-bottom: 0;
  }

  .topbar {
    max-width: 1120px;
    padding-top: 28px;
  }

  .topbar h1 {
    font-size: 31px;
  }

  .local-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 99px;
    color: var(--green);
    background: var(--surface);
    font-size: 11px;
    font-weight: 700;
  }

  .local-chip::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    content: "";
  }

  .content {
    max-width: 1120px;
    padding: 10px 24px 44px;
  }

  .bottom-nav {
    display: none;
  }

  .today-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
    gap: 14px;
    align-items: start;
  }

  .today-overview .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .today-overview .energy-panel {
    margin-top: 0;
  }

  .dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    gap: 18px;
    align-items: start;
  }

  .record-row {
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
  }

  .record-side {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .record-side .record-time {
    padding-top: 0;
  }

  .modal-backdrop {
    align-items: center;
    padding: 26px;
  }

  .modal-sheet {
    max-width: 620px;
    max-height: min(90vh, 760px);
    margin: 0 auto;
    border-radius: 12px;
  }

  .modal-head {
    padding-right: 20px;
    padding-left: 20px;
  }

  .sheet-form {
    padding-right: 20px;
    padding-left: 20px;
  }

  .form-actions {
    margin-right: -20px;
    margin-left: -20px;
    padding-right: 20px;
    padding-left: 20px;
  }

  .form-actions .button {
    flex: 0 0 auto;
    min-width: 100px;
  }

  .onboarding .sheet-form {
    padding: 18px 26px 24px;
  }

  .onboarding-intro {
    padding: 28px 26px 0;
  }
}

@media (max-width: 390px) {
  .content,
  .topbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .quick-grid {
    gap: 6px;
  }

  .quick-action {
    min-height: 80px;
    gap: 6px;
    font-size: 12px;
  }

  .quick-action .quick-icon {
    width: 34px;
    height: 34px;
  }

  .section-heading {
    gap: 10px;
  }

  .section-heading .button {
    min-width: max-content;
    padding-right: 10px;
    padding-left: 10px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
