:root {
  --bg: #f7f1e8;
  --surface: #fffdf9;
  --ink: #2d2520;
  --muted: #8b7d73;
  --deep: #3a2924;
  --deep-2: #50352c;
  --accent: #e78157;
  --accent-soft: #f8d8c5;
  --sage-soft: #dce9e1;
  --gold: #e8b86a;
  --danger: #bd5353;
  --page-pad: 20px;
  --motion-fast: 150ms;
  --motion-sheet: 220ms;
}
* { box-sizing: border-box; }
html { background: #ddd8d0; overscroll-behavior-y: none; touch-action: manipulation; scrollbar-color: #b8a99f transparent; scrollbar-width: thin; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { border-radius: 999px; background: #b8a99f; }
*::-webkit-scrollbar-thumb:hover { background: #9d8c81; }
*::-webkit-scrollbar-thumb:active { background: #806f65; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #ddd8d0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; }
button { color: inherit; touch-action: manipulation; }
button, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(215,114,77,.34); outline-offset: 2px; }
.app-shell {
  position: relative;
  width: 100%;
  max-width: 402px;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: radial-gradient(circle at 100% 0, rgba(232,184,106,.14), transparent 28%), var(--bg);
  box-shadow: 0 0 55px rgba(61,44,35,.10);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(15px + env(safe-area-inset-top)) max(var(--page-pad), env(safe-area-inset-right)) 15px max(var(--page-pad), env(safe-area-inset-left));
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.brand-lockup h1 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  max-width: 290px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.05;
}
.secret-name-trigger {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  cursor: pointer;
}
.secret-name-trigger:active { transform: scale(.98); }
.secret-name-trigger:disabled { cursor: default; }
.brand-lockup h1 small {
  flex: none;
  padding: 4px 7px;
  border-radius: 999px;
  color: #8c4d34;
  background: var(--accent-soft);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .06em;
}
.brand-caption { margin: 4px 0 0; color: #a29388; font-size: 10px; letter-spacing: .18em; }
.icon-button, .close-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.icon-button {
  width: 44px;
  height: 44px;
  color: #68574e;
  background: rgba(255,253,249,.94);
  box-shadow: 0 7px 20px rgba(66,48,38,.07);
}
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.55; }
main { padding: 0 max(var(--page-pad), env(safe-area-inset-right)) calc(108px + env(safe-area-inset-bottom)) max(var(--page-pad), env(safe-area-inset-left)); }
.view { display: none; animation: reveal .18s cubic-bezier(.22,.72,.25,1); }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hero-card {
  position: relative;
  min-height: 236px;
  padding: 21px;
  overflow: hidden;
  color: #fff8f2;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 30px;
  background: radial-gradient(circle at 78% 10%, rgba(231,129,87,.30), transparent 35%), linear-gradient(145deg, var(--deep-2), #2d211e 68%);
  box-shadow: 0 22px 44px rgba(72,48,38,.20);
}
.hero-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, rgba(255,255,255,.05), transparent 40%); pointer-events: none; }
.hero-glow { position: absolute; width: 190px; height: 190px; right: -48px; top: -68px; border-radius: 50%; background: rgba(238,178,111,.13); }
.hero-copy { position: relative; z-index: 2; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  color: #eddcd2;
  background: rgba(255,255,255,.07);
  font-size: 10px;
  font-weight: 650;
}
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: #f2bd78; box-shadow: 0 0 0 4px rgba(242,189,120,.10); }
.hero-kicker { margin: 27px 0 5px; color: #c5afa4; font-size: 10px; letter-spacing: .08em; }
.duration-display { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.duration-display strong { font-family: "Avenir Next", "SF Pro Display", sans-serif; font-size: 43px; font-weight: 560; letter-spacing: -.06em; line-height: 1; }
.duration-display span { margin-right: 4px; color: #cdb9af; font-size: 11px; }
.hero-range { max-width: 235px; margin: 9px 0 0; color: #bca89f; font-size: 10px; line-height: 1.5; }
.moon-orbit { position: absolute; right: 20px; bottom: 18px; width: 83px; height: 83px; border: 1px solid rgba(255,255,255,.07); border-radius: 50%; }
.moon { position: absolute; width: 50px; height: 50px; right: 5px; bottom: 1px; border-radius: 50%; background: #ffe8ca; box-shadow: -7px 8px 28px rgba(255,201,137,.25); }
.moon::after { content: ""; position: absolute; width: 45px; height: 45px; left: -10px; top: -7px; border-radius: 50%; background: #32231f; }
.star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #f6ddc6; }
.star-a { left: 8px; top: 23px; }.star-b { left: 29px; top: 4px; opacity: .5; }.star-c { right: 1px; top: 29px; opacity: .7; }
.primary-action {
  position: relative;
  z-index: 3;
  width: calc(100% - 24px);
  display: grid;
  grid-template-columns: 46px 1fr 20px;
  align-items: center;
  gap: 11px;
  margin: -17px auto 26px;
  padding: 12px 14px;
  border: 1px solid rgba(87,63,51,.06);
  border-radius: 20px;
  text-align: left;
  background: #fffdf9;
  box-shadow: 0 12px 28px rgba(60,43,34,.12);
  cursor: pointer;
  transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.primary-action:active { transform: scale(.985); box-shadow: 0 7px 18px rgba(60,43,34,.11); }
.primary-action .plus { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; color: #fff8f2; background: linear-gradient(145deg, #ef9168, #d96d46); box-shadow: 0 8px 18px rgba(222,112,72,.23); font-size: 24px; font-weight: 300; }
.primary-action b { display: block; font-size: 14px; letter-spacing: -.01em; }
.primary-action small { color: #998a80; font-size: 10px; }
.primary-action svg { width: 18px; fill: none; stroke: #7a6960; stroke-width: 1.8; }
.quick-actions {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
  margin: -17px 6px 26px;
}
.quick-action {
  min-width: 0;
  min-height: 92px;
  display: grid;
  grid-template-rows: 34px auto;
  justify-items: center;
  align-content: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid rgba(87,63,51,.06);
  border-radius: 18px;
  text-align: center;
  background: rgba(255,253,249,.97);
  box-shadow: 0 13px 30px rgba(60,43,34,.11);
  cursor: pointer;
  transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.quick-action:active { transform: scale(.97); box-shadow: 0 7px 18px rgba(60,43,34,.09); }
.quick-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #fff8f2;
  background: linear-gradient(145deg,#ef9168,#d96d46);
}
.quick-icon svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.poop-mark { color: #654639; background: #ead4bf; font-family: "Songti SC",serif; font-weight: 800; }
.calcium-mark { color: #486b5a; background: #d8e9df; font-family: "Avenir Next",sans-serif; font-size: 12px; font-weight: 800; }
.quick-action > span:last-child { width: 100%; min-width: 0; }
.quick-action b, .quick-action small { display: block; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.quick-action b { font-size: 13px; line-height: 17px; }.quick-action small { margin-top: 2px; color: #9a8c82; font-size: 8px; line-height: 11px; }
.section-block { margin-top: 25px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.section-heading.compact { align-items: center; }
.section-heading h2, .sheet-header h2 { margin: 0; letter-spacing: -.04em; }
.section-heading h2 { font-size: 19px; }
.text-button { min-height: 36px; border: 0; padding: 7px 0 7px 12px; color: #c06442; background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.daily-metrics { grid-template-columns: repeat(3,1fr); gap: 8px; }
.daily-metrics .metric-card { display: grid; min-height: 128px; grid-template-rows: 31px 20px 28px 14px; justify-items: center; align-content: center; padding: 12px 8px; text-align: center; }
.daily-metrics .metric-card p { width: 100%; margin: 8px 0 0; line-height: 12px; }
.daily-metrics .metric-card strong { width: 100%; align-self: center; font-size: 17px; line-height: 24px; }
.daily-metrics .metric-card small { width: 100%; align-self: center; overflow: hidden; line-height: 12px; text-overflow: ellipsis; white-space: nowrap; }
.poop-mini { color: #6b493a; background: #eedbc8; font-family: "Songti SC",serif; font-size: 13px; font-weight: 800; }
.calcium-mini { color: #4f7562; background: #dcebe3; font-family: "Avenir Next",sans-serif; font-size: 10px; font-weight: 800; }
.metric-card { min-width: 0; padding: 15px; border: 1px solid rgba(65,49,40,.05); border-radius: 20px; background: rgba(255,253,249,.94); box-shadow: 0 9px 26px rgba(62,45,36,.05); }
.metric-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 11px; }
.metric-icon svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.metric-icon.warm { color: #a7603e; background: #f8e3d5; }.metric-icon.green { color: #527966; background: var(--sage-soft); }
.metric-card p { margin: 13px 0 3px; color: var(--muted); font-size: 10px; }
.metric-card strong { display: block; overflow: hidden; font-size: 22px; letter-spacing: -.05em; text-overflow: ellipsis; white-space: nowrap; }
.metric-card small { color: #ab9e95; font-size: 9px; }
.legend { color: var(--muted); font-size: 9px; }.legend i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 3px; background: var(--accent-soft); }
.week-chart-card { padding: 17px 13px 12px; border: 1px solid rgba(65,49,40,.05); border-radius: 20px; background: rgba(255,253,249,.94); box-shadow: 0 9px 26px rgba(62,45,36,.04); }
.chart-zone { position: relative; height: 120px; display: flex; align-items: end; }
.goal-band { position: absolute; left: 0; right: 0; bottom: 74px; height: 27px; border-radius: 7px; background: rgba(248,216,197,.30); }
.goal-band::after { content: "7–9h"; position: absolute; right: 5px; top: 5px; color: #b37a62; font-size: 8px; }
.bars { position: relative; z-index: 1; width: 100%; height: 100%; display: grid; grid-template-columns: repeat(7,1fr); align-items: end; gap: 10px; }
.bar { position: relative; min-height: 5px; border-radius: 7px 7px 4px 4px; background: #d9d1ca; transition: height .4s ease; }
.bar.on-target { background: #6fa58a; }.bar.late { background: #e18b6e; }.bar.today { box-shadow: inset 0 0 0 2px rgba(45,37,32,.38); }
.bar::before { content: attr(data-value); position: absolute; top: -16px; left: 50%; transform: translateX(-50%); color: #8d7d74; font-size: 8px; white-space: nowrap; }
.bar.empty { height: 5px !important; opacity: .42; }.bar.empty::before { content: "—"; }
.chart-labels { display: grid; grid-template-columns: repeat(7,1fr); gap: 10px; margin-top: 9px; text-align: center; color: #95867d; font-size: 9px; }
#view-trends { padding-top: 10px; }
.period-switch { display: grid; grid-template-columns: repeat(3,1fr); padding: 4px; border-radius: 15px; background: #e9e0d6; }
.period-switch button { display: grid; min-height: 37px; place-items: center; border: 0; border-radius: 12px; color: #8e8076; background: transparent; font-size: 11px; line-height: 1; cursor: pointer; }
.period-switch button.active { color: var(--ink); background: var(--surface); box-shadow: 0 5px 16px rgba(61,44,35,.08); font-weight: 750; }
.trend-summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.trend-summary-card { display: flex; min-width: 0; min-height: 108px; flex-direction: column; align-items: center; justify-content: center; padding: 9px 6px; border: 1px solid rgba(65,49,40,.04); border-radius: 17px; text-align: center; background: var(--surface); }
.summary-mark { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; margin-bottom: 5px; border-radius: 10px; font-size: 13px; line-height: 1; }
.sleep-summary-mark { color: #a7603e; background: #f8e3d5; font-size: 18px; }
.trend-summary-card small, .trend-summary-card em, .trend-summary-card strong { display: block; width: 100%; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.trend-summary-card small { color: var(--muted); font-size: 8px; line-height: 11px; }
.trend-summary-card strong { margin-top: 2px; font-size: 17px; line-height: 23px; letter-spacing: -.04em; }
.trend-summary-card em { color: var(--muted); font-size: 8px; line-height: 11px; font-style: normal; }
.calendar-card { margin: 12px 0; padding: 17px 14px 15px; border: 1px solid rgba(65,49,40,.05); border-radius: 22px; background: var(--surface); box-shadow: 0 10px 28px rgba(62,45,36,.05); }
.calendar-head { display: flex; align-items: center; justify-content: space-between; }
.calendar-head small { color: var(--muted); font-size: 8px; }.calendar-head h3 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.03em; }
.month-controls { display: flex; gap: 6px; }.month-controls button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #e6ddd6; border-radius: 11px; color: #6f5f56; background: #faf6f1; font-size: 20px; cursor: pointer; }
.calendar-metric-switch { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin: 13px 0 12px; padding: 4px; border-radius: 13px; background: #eee6df; }
.calendar-metric-switch button { display: grid; min-height: 34px; place-items: center; border: 0; border-radius: 10px; color: #8e8076; background: transparent; font-size: 10px; line-height: 1; cursor: pointer; }
.calendar-metric-switch button.active { color: #fff9f4; background: var(--deep); font-weight: 750; box-shadow: 0 5px 14px rgba(62,44,36,.15); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); column-gap: 3px; }
.calendar-grid { row-gap: 3px; }
.calendar-weekdays { margin-bottom: 4px; text-align: center; color: #9b8d84; font-size: 8px; }
.calendar-day { position: relative; display: grid; aspect-ratio: 1; place-items: center; border: 1px solid rgba(65,49,40,.03); border-radius: 10px; color: #9c8f87; text-align: center; font-variant-numeric: tabular-nums; background: #f1ece7; transition: .2s ease; }
.calendar-day b { font-size: 10px; font-weight: 650; }
.calendar-day.outside { opacity: .27; }
.calendar-day.sleep-good { color: #315b49; background: #b9dbc9; }.calendar-day.sleep-late { color: #8a422f; background: #f2b7a3; }
.calendar-day.heat-1 { color: #526b5f; background: #dbeae2; }.calendar-day.heat-2 { color: #315c4a; background: #9bcbb5; }.calendar-day.heat-3 { color: #fff; background: #4f9173; }
.calendar-day.today-cell { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px #8b6959; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 9px 12px; margin-top: 11px; color: #8e8178; font-size: 8px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }.calendar-legend i { width: 10px; height: 10px; border-radius: 4px; background: #f1ece7; }
.calendar-legend i.sleep-good { background: #b9dbc9; }.calendar-legend i.sleep-late { background: #f2b7a3; }.calendar-legend i.heat-1 { background: #dbeae2; }.calendar-legend i.heat-2 { background: #9bcbb5; }.calendar-legend i.heat-3 { background: #4f9173; }
.night-dot, .morning-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; }.night-dot { background: #4c3530; }.morning-dot { background: var(--gold); }
#view-history { padding-top: 10px; }
.history-list { display: grid; gap: 19px; }.month-title { margin: 0 0 8px 3px; color: var(--muted); font-size: 10px; font-weight: 750; }.history-group { display: grid; gap: 8px; }
.history-overview { display: flex; align-items: center; justify-content: space-between; min-height: 26px; color: var(--muted); font-size: 9px; }
.history-overview p { margin: 0; color: #6f5f56; font-weight: 750; }
.history-item { width: 100%; min-height: 73px; display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid rgba(65,49,40,.05); border-radius: 18px; text-align: left; background: var(--surface); cursor: pointer; }
.history-item:hover { border-color: rgba(134,88,65,.13); background: #fffaf5; }
.history-item:active { transform: scale(.99); background: #fffaf5; }.date-tile { display: flex; height: 47px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 13px; text-align: center; background: #f2e6dc; }
.date-tile strong { font-size: 17px; line-height: 17px; }.date-tile small { margin: 0; color: var(--muted); font-size: 8px; line-height: 10px; }
.history-main { display: grid; min-width: 0; align-content: center; }.history-main strong, .history-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.history-main strong { font-size: 13px; line-height: 17px; }.history-main small { color: var(--muted); font-size: 9px; line-height: 12px; }
.history-duration { display: grid; align-content: center; text-align: right; }.history-duration strong { display: block; font-size: 15px; line-height: 20px; }.history-duration small { color: #b07351; font-size: 10px; line-height: 13px; letter-spacing: 1px; }
.poop-tile { background: #efe0cf; }.calcium-tile { background: #dfece5; }
.event-tag { display: inline-block; margin-bottom: 3px; padding: 2px 5px; border-radius: 5px; color: #97543a; background: #f8e2d6; font-size: 7px; font-style: normal; font-weight: 750; }
.event-tag.poop-tag { color: #6f4c3d; background: #efdfcf; }.event-tag.calcium-tag { color: #4f7562; background: #deece4; }
.history-pagination { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 10px; padding-top: 2px; }
.history-pagination button { min-height: 44px; padding: 0 14px; border: 1px solid #e4d9d1; border-radius: 14px; color: #625249; background: var(--surface); font-size: 10px; font-weight: 750; cursor: pointer; transition: transform var(--motion-fast) ease, border-color var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.history-pagination button:last-child { justify-self: stretch; }
.history-pagination button:hover:not(:disabled) { border-color: #d3b8a8; background: #fff8f2; }
.history-pagination button:active:not(:disabled) { transform: scale(.97); }
.history-pagination button:disabled { color: #b7aaa2; background: #eee8e2; cursor: not-allowed; }
.history-pagination span { min-width: 62px; color: var(--muted); text-align: center; font-size: 9px; white-space: nowrap; }
.history-pagination strong { color: var(--ink); font-size: 11px; }
.empty-state { padding: 52px 24px; text-align: center; color: var(--muted); }.empty-state .empty-moon { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 50%; background: #f6d9c6; box-shadow: inset 15px -8px 0 #d99f7e; }
.empty-state h3 { margin: 0 0 8px; color: var(--ink); font-size: 16px; }.empty-state p { margin: 0; font-size: 10px; line-height: 1.7; }
.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: calc(100% - 40px);
  max-width: 362px;
  display: grid;
  grid-template-columns: repeat(3,1fr);
  padding: 6px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(70,51,41,.08);
  border-radius: 22px;
  background: rgba(255,253,249,.97);
  box-shadow: 0 11px 30px rgba(57,41,33,.13);
}
.bottom-nav button { display: grid; min-height: 51px; justify-items: center; align-content: center; gap: 2px; border: 0; padding: 4px; border-radius: 16px; color: #a0938b; background: transparent; font-size: 8px; cursor: pointer; transition: color var(--motion-fast) ease, background-color var(--motion-fast) ease, transform var(--motion-fast) ease; }
.bottom-nav button:active { transform: scale(.94); }
.bottom-nav svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }.bottom-nav button.active { color: #fff9f4; background: var(--deep); font-weight: 700; }
.sheet-backdrop { position: fixed; z-index: 30; inset: 0; display: flex; justify-content: center; align-items: flex-end; padding: 0 max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: rgba(37,27,23,.42); animation: backdropIn .16s ease-out both; }
.sheet-backdrop[hidden] { display: none; }
.bottom-sheet { width: 100%; max-width: 382px; max-height: calc(100dvh - max(18px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom))); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 10px 20px 20px; border-radius: 28px; background: #fbf7f1; box-shadow: 0 18px 52px rgba(41,29,24,.22); animation: sheetUp var(--motion-sheet) cubic-bezier(.2,.76,.24,1) both; will-change: transform; }
.sheet-backdrop.closing { opacity: 0; transition: opacity .16s ease; }
.sheet-backdrop.closing .bottom-sheet { transform: translateY(18px) scale(.985); transition: transform .16s ease; }
@keyframes backdropIn { from { background: rgba(37,27,23,0); } }
@keyframes sheetUp { from { opacity: .6; transform: translateY(34px) scale(.985); } to { opacity: 1; transform: none; } }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 15px; border-radius: 4px; background: #d5cbc3; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }.sheet-header h2 { font-family: "Songti SC", "STSong", serif; font-size: 25px; }
.close-button { width: 40px; height: 40px; color: #75655c; background: #eee6df; font-size: 23px; font-weight: 300; transition: transform var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.close-button:active { transform: scale(.9); background: #e5dad2; }
.bottom-sheet form, .form-field, .time-field, .form-two-col > * { min-width: 0; }
.form-field { display: block; margin-top: 14px; }.form-field > span, .quality-field legend { display: block; margin: 0 0 8px 2px; color: #66584f; font-size: 11px; font-weight: 700; }.form-field span small { color: #a79b93; font-weight: 400; }
.form-field input, .form-field textarea, .profile-input-row input { width: 100%; border: 1px solid #e4dad2; outline: none; border-radius: 14px; color: var(--ink); background: #fffdfb; }
.form-field input { min-width: 0; height: 50px; padding: 0 13px; font-size: 16px; }.form-field textarea { min-height: 82px; padding: 13px; resize: none; font-size: 16px; line-height: 1.5; }
.form-field input[type="date"], .form-field input[type="time"], .time-field input[type="time"], .bedtime-goal-row input[type="time"] { display: flex; width: 100%; min-width: 0; max-width: 100%; align-items: center; justify-content: center; overflow: hidden; padding-block: 0; -webkit-appearance: none; appearance: none; line-height: normal; font-variant-numeric: tabular-nums; }
.form-field input[type="date"]::-webkit-date-and-time-value, .form-field input[type="time"]::-webkit-date-and-time-value, .time-field input[type="time"]::-webkit-date-and-time-value, .bedtime-goal-row input[type="time"]::-webkit-date-and-time-value { display: flex; min-width: 0; height: 100%; align-items: center; justify-content: center; margin: 0; padding: 0; line-height: normal; text-align: center; }
.form-field input:focus, .form-field textarea:focus, .time-field input:focus, .profile-input-row input:focus { border-color: #d68a67; box-shadow: 0 0 0 3px rgba(214,138,103,.12); }
.time-grid { position: relative; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 10px; margin-top: 14px; }.time-field span { display: block; margin: 0 0 8px 2px; color: #66584f; font-size: 11px; font-weight: 700; }
.time-field input { width: 100%; min-width: 0; height: 53px; padding: 0 7px; border: 1px solid #e4dad2; outline: none; border-radius: 15px; color: var(--ink); background: #fffdfb; font-size: 18px; font-weight: 700; }.time-arrow { padding-bottom: 18px; text-align: center; color: #a0938a; }
.time-arrow { position: absolute; z-index: 2; left: 50%; bottom: 14px; display: grid; width: 24px; height: 24px; padding: 0; transform: translateX(-50%); place-items: center; border: 1px solid #e7ddd6; border-radius: 50%; color: #6f5f56; background: #fbf7f1; font-size: 14px; line-height: 1; font-weight: 700; pointer-events: none; }
.duration-preview { display: flex; justify-content: space-between; margin-top: 10px; padding: 12px 13px; border-radius: 13px; color: #87543e; background: #f8e5d9; font-size: 10px; }.duration-preview strong { font-size: 11px; }
.quality-field { margin: 16px 0 0; padding: 0; border: 0; }.quality-options { display: grid; grid-template-columns: repeat(5,1fr); gap: 5px; }.quality-options input { position: absolute; opacity: 0; pointer-events: none; }
.quality-options label { display: flex; min-width: 0; min-height: 59px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 2px; border: 1px solid #e5dcd5; border-radius: 13px; text-align: center; background: #fffdfb; cursor: pointer; transition: transform var(--motion-fast) ease, border-color var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.quality-options label:active { transform: scale(.94); }
.quality-options label span { display: block; font-size: 19px; line-height: 20px; filter: grayscale(.4); opacity: .7; }.quality-options label small { display: block; color: #91837a; font-size: 8px; line-height: 9px; }
.quality-options input:checked + label { border-color: #df9a79; background: #f9e6da; box-shadow: 0 0 0 2px rgba(223,154,121,.10); }.quality-options input:checked + label span { filter: none; opacity: 1; }
.save-button, .delete-button { width: 100%; min-height: 53px; margin-top: 19px; border: 0; border-radius: 16px; color: #fff; background: linear-gradient(145deg,#4b342d,#30221e); box-shadow: 0 10px 22px rgba(57,39,32,.13); font-weight: 750; cursor: pointer; transition: transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease; }
.save-button:active { transform: scale(.98); box-shadow: 0 5px 13px rgba(57,39,32,.11); }
.delete-button { margin-top: 7px; color: var(--danger); background: transparent; font-size: 11px; }
.form-two-col { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 9px; }
.choice-field { margin: 15px 0 0; padding: 0; border: 0; }
.choice-field legend { margin: 0 0 7px 2px; color: #66584f; font-size: 10px; font-weight: 700; }
.condition-options { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.condition-options input { position: absolute; opacity: 0; pointer-events: none; }
.condition-options label { display: grid; min-width: 0; min-height: 45px; place-items: center; border: 1px solid #e5dcd5; border-radius: 12px; color: #786a61; text-align: center; background: #fffdfb; font-size: 10px; line-height: 1; cursor: pointer; transition: transform var(--motion-fast) ease, border-color var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.condition-options label:active { transform: scale(.94); }
.condition-options input:checked + label { border-color: #d79270; color: #88482f; background: #f9e3d6; box-shadow: 0 0 0 2px rgba(215,146,112,.09); font-weight: 750; }
.dose-presets { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin-top: 8px; }
.dose-presets button { display: grid; min-width: 0; min-height: 42px; place-items: center; border: 1px solid #dedfd9; border-radius: 12px; color: #557061; text-align: center; background: #edf4f0; font-size: 10px; line-height: 1; font-weight: 700; cursor: pointer; transition: transform var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.dose-presets button:active { transform: scale(.95); background: #dcece3; }
.profile-settings { margin-bottom: 13px; padding: 15px; border: 1px solid rgba(65,49,40,.05); border-radius: 18px; background: #fffdfb; }
.icon-button { position: relative; }
.cloud-indicator { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border: 2px solid var(--bg); border-radius: 50%; background: #a69a92; transition: background-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease; }
.cloud-indicator.synced { background: #5e8c73; box-shadow: 0 0 0 3px rgba(94,140,115,.12); }
.cloud-indicator.pending, .cloud-indicator.needs-consent { background: #d58b55; }
.cloud-indicator.error { background: var(--danger); }
.cloud-card { margin-bottom: 13px; padding: 15px; border: 1px solid rgba(65,49,40,.06); border-radius: 18px; background: linear-gradient(145deg,#f3f7f3,#fffdfb 72%); }
.cloud-card-heading { display: flex; align-items: center; gap: 10px; }
.cloud-status-mark { width: 11px; height: 11px; flex: 0 0 auto; border: 3px solid #d7ddd8; border-radius: 50%; background: #fffdfb; }
.cloud-card[data-status="synced"] .cloud-status-mark { border-color: #6c947d; background: #6c947d; box-shadow: 0 0 0 4px rgba(108,148,125,.12); }
.cloud-card[data-status="syncing"] .cloud-status-mark { border-color: #9cb4a5; border-top-color: #4f7d65; animation: cloudSpin .8s linear infinite; }
.cloud-card[data-status="pending"] .cloud-status-mark, .cloud-card[data-status="needs-consent"] .cloud-status-mark { border-color: #dda273; background: #dda273; }
.cloud-card[data-status="error"] .cloud-status-mark { border-color: var(--danger); background: var(--danger); }
.cloud-card h3 { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.35; }
.cloud-card-heading p { margin: 3px 0 0; color: #557061; font-size: 9px; font-weight: 700; }
.cloud-status-copy { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.cloud-error { margin: 9px 0 0; padding: 9px 10px; border-radius: 11px; color: #873f3b; background: #f9e4e1; font-size: 9px; line-height: 1.5; }
.cloud-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.cloud-actions button { min-height: 40px; padding: 0 13px; border-radius: 12px; font-size: 10px; font-weight: 750; cursor: pointer; }
.cloud-actions button[hidden] { display: none; }
.cloud-actions button:disabled, .account-submit:disabled { cursor: wait; opacity: .68; }
.cloud-primary { border: 0; color: #fffaf5; background: var(--deep); }
.cloud-secondary { border: 1px solid #dce4de; color: #4f6d5d; background: #f8fbf8; }
.profile-settings label { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }.profile-settings label span { font-size: 12px; font-weight: 750; }.profile-settings label small { color: var(--muted); font-size: 8px; }
.profile-input-row { display: grid; grid-template-columns: 1fr 78px; gap: 8px; }.profile-input-row input { min-width: 0; height: 45px; padding: 0 12px; }.profile-input-row button { border: 0; border-radius: 13px; color: #fff9f4; background: var(--deep); font-size: 10px; font-weight: 700; cursor: pointer; }
.profile-settings .preference-label { margin-top: 15px; padding-top: 14px; border-top: 1px solid #eee5de; }
.bedtime-goal-row { display: flex; align-items: center; gap: 10px; }
.bedtime-goal-row input { width: 126px; height: 43px; padding: 0 11px; border: 1px solid #e4dad2; outline: none; border-radius: 13px; color: var(--ink); background: #fffdfb; font-size: 17px; font-weight: 700; }
.bedtime-goal-row span { color: var(--muted); font-size: 9px; }
.settings-copy { margin: 0 2px 13px; color: var(--muted); font-size: 10px; line-height: 1.6; }.settings-actions { overflow: hidden; border: 1px solid rgba(65,49,40,.05); border-radius: 18px; background: #fffdfb; }
.settings-actions button, .import-label { width: 100%; display: block; padding: 14px 15px; border: 0; border-bottom: 1px solid #eee6e0; text-align: left; background: #fffdfb; cursor: pointer; }
.settings-actions span, .settings-actions small { display: block; }.settings-actions span { font-size: 12px; font-weight: 700; }.settings-actions small { margin-top: 3px; overflow-wrap: anywhere; color: var(--muted); font-size: 9px; line-height: 1.4; }.settings-actions input { display: none; }.settings-actions .danger-row { color: var(--danger); border-bottom: 0; }
.confirm-backdrop { align-items: center; padding: max(20px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); }
.confirm-dialog { width: 100%; max-width: 330px; padding: 22px; border-radius: 24px; text-align: center; background: #fffdf9; box-shadow: 0 18px 52px rgba(41,29,24,.24); animation: sheetUp var(--motion-sheet) cubic-bezier(.2,.76,.24,1) both; }
.confirm-mark { display: grid; width: 38px; height: 38px; margin: 0 auto 12px; place-items: center; border-radius: 13px; color: #9b433f; background: #f7dddd; font-size: 19px; font-weight: 800; }
.confirm-dialog h2 { margin: 0; font-family: "Songti SC","STSong",serif; font-size: 21px; }
.confirm-dialog p { margin: 9px 8px 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.confirm-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.confirm-actions button { min-height: 46px; border: 1px solid #e5dcd5; border-radius: 14px; background: #fffaf5; font-size: 11px; font-weight: 750; cursor: pointer; }
.confirm-actions .confirm-danger { border-color: transparent; color: #fff; background: var(--danger); }
.secret-backdrop { align-items: center; padding: max(20px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); }
.secret-dialog { position: relative; width: 100%; max-width: 330px; overflow: hidden; padding: 30px 25px 24px; border: 1px solid rgba(129,83,61,.08); border-radius: 28px; text-align: center; background: radial-gradient(circle at 50% -15%, #f9d7c2 0, transparent 47%), #fffdf9; box-shadow: 0 22px 58px rgba(55,37,30,.24); animation: sheetUp var(--motion-sheet) cubic-bezier(.2,.76,.24,1) both; }
.secret-mark { display: grid; width: 48px; height: 48px; margin: 0 auto 17px; place-items: center; transform: rotate(-5deg); border-radius: 17px 17px 19px 14px; color: #fff9f4; background: linear-gradient(145deg,#ed9571,#d9684c); box-shadow: 0 10px 22px rgba(217,104,76,.22); font-size: 21px; }
.secret-dialog .eyebrow { margin-bottom: 7px; color: #a4664b; }
.secret-dialog h2 { margin: 0; font-family: "Songti SC","STSong",serif; font-size: 23px; }
.secret-dialog > p:last-of-type { margin: 13px 2px 21px; color: #6f5e54; font-family: "Songti SC","STSong",serif; font-size: 15px; font-weight: 700; line-height: 1.85; }
.secret-close { width: 100%; min-height: 48px; border: 0; border-radius: 15px; color: #fff9f4; background: var(--deep); font-size: 11px; font-weight: 750; cursor: pointer; transition: transform var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.secret-close:hover { background: var(--deep-2); }
.secret-close:active { transform: scale(.98); }
.account-backdrop { align-items: center; padding: max(20px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); }
.account-dialog { position: relative; width: 100%; max-width: 350px; padding: 25px 23px 23px; border: 1px solid rgba(65,49,40,.08); border-radius: 27px; background: #fffdf9; box-shadow: 0 22px 58px rgba(55,37,30,.24); animation: sheetUp var(--motion-sheet) cubic-bezier(.2,.76,.24,1) both; }
.account-dialog .eyebrow { margin: 0 0 6px; color: #617b6c; }
.account-dialog h2 { margin: 0; font-family: "Songti SC","STSong",serif; font-size: 23px; }
.account-dialog > p:not(.eyebrow):not(.form-error) { margin: 9px 0 18px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.dialog-close { position: absolute; top: 13px; right: 13px; display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 50%; color: #72655c; background: #f7f1eb; font-size: 20px; cursor: pointer; }
.account-mark { display: grid; width: 44px; height: 44px; margin-bottom: 16px; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(145deg,#71917f,#4f725f); box-shadow: 0 10px 22px rgba(79,114,95,.18); font-size: 20px; }
.account-field { display: block; margin-top: 12px; }
.account-field > label { display: block; margin: 0 0 7px 2px; color: #66584f; font-size: 10px; font-weight: 700; }
.account-field input { width: 100%; min-width: 0; height: 49px; padding: 0 13px; border: 1px solid #e4dad2; outline: none; border-radius: 14px; color: var(--ink); background: #fffdfb; font-size: 14px; }
.account-field input:focus { border-color: #73917f; box-shadow: 0 0 0 3px rgba(115,145,127,.13); }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 62px; }
.password-wrap button { position: absolute; top: 6px; right: 6px; min-width: 48px; height: 37px; border: 0; border-radius: 10px; color: #5c7466; background: #edf3ef; font-size: 9px; font-weight: 700; cursor: pointer; }
.form-error { margin: 10px 1px 0; color: #944540; font-size: 10px; line-height: 1.5; }
.account-submit { width: 100%; min-height: 49px; margin-top: 16px; border: 0; border-radius: 14px; color: #fffaf5; background: var(--deep); font-size: 11px; font-weight: 750; cursor: pointer; }
.migration-dialog { text-align: center; }
.migration-dialog .account-mark { margin-right: auto; margin-left: auto; }
.migration-mark { background: linear-gradient(145deg,#d99470,#bd684d); }
.migration-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.35fr); gap: 8px; margin-top: 18px; }
.migration-actions button { min-height: 48px; margin: 0; border-radius: 14px; font-size: 10px; font-weight: 750; cursor: pointer; }
.migration-actions > button:first-child { border: 1px solid #e4dad2; color: #72655c; background: #fffaf5; }
@keyframes cloudSpin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: calc(100% - 40px); padding: 11px 16px; transform: translate(-50%,20px); border-radius: 999px; color: #fff9f4; background: rgba(56,39,33,.95); box-shadow: 0 10px 28px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transition: .25s ease; font-size: 10px; white-space: nowrap; }
.toast.show { transform: translate(-50%,0); opacity: 1; }
@media (min-width: 600px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100dvh - 48px); border-radius: 38px; }
  .bottom-nav { bottom: 34px; }
  .sheet-backdrop { align-items: center; padding: 24px; }
}
@media (max-width: 430px) { html, body { background: var(--bg); }.app-shell { max-width: none; box-shadow: none; } }
@media (max-width: 430px) and (max-height: 900px) {
  body[data-view="trends"] .topbar { padding-bottom: 8px; }
  #view-trends { padding-top: 2px; }
  .trend-summary-grid { margin-top: 9px; }
  .trend-summary-card { min-height: 102px; }
  .calendar-card { margin-top: 9px; padding-top: 14px; padding-bottom: 11px; }
  .calendar-metric-switch { margin-top: 10px; margin-bottom: 8px; }
  .calendar-legend { margin-top: 8px; }
}
@media (max-height: 760px) { .hero-card { min-height: 218px; }.hero-kicker { margin-top: 20px; }.moon-orbit { transform: scale(.88); transform-origin: bottom right; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (forced-colors: active) { html { scrollbar-color: auto; } *::-webkit-scrollbar-thumb { background: CanvasText; } }
