/* ==========================================================================
   Teddy — interface styles
   Modelled on iOS / iPadOS 26: system type, grouped lists, Liquid Glass bars.
   No framework, no build step.
   ========================================================================== */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", "Helvetica Neue", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --bg-secondary: #f2f2f7;
  --label: #000000;
  --label-2: rgba(60, 60, 67, .6);
  --label-3: rgba(60, 60, 67, .3);
  --label-4: rgba(60, 60, 67, .14);
  --separator: rgba(60, 60, 67, .29);
  --fill: rgba(120, 120, 128, .2);
  --fill-2: rgba(120, 120, 128, .16);
  --fill-3: rgba(118, 118, 128, .12);
  --fill-4: rgba(116, 116, 128, .08);
  --gray: #8e8e93;

  --tint: #007aff;
  --tint-rgb: 0, 122, 255;
  --orange: #ff9500;
  --orange-rgb: 255, 149, 0;
  --orange-ink: #c45500;
  --chart: #e87000; /* a deeper orange so thin chart marks clear 3:1 on white */
  --green: #34c759;
  --green-rgb: 52, 199, 89;
  --green-ink: #1f8a3b;
  --red: #ff3b30;
  --red-rgb: 255, 59, 48;
  --indigo: #5856d6;
  --indigo-rgb: 88, 86, 214;
  --pink: #ff2d55;
  --teal: #30b0c7;

  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .8);
  --glass-rim: rgba(255, 255, 255, .85);
  --glass-edge: rgba(0, 0, 0, .06);
  --glass-shadow: 0 14px 34px -14px rgba(0, 0, 0, .22), 0 3px 10px -2px rgba(0, 0, 0, .06);
  --glass-blur: blur(22px) saturate(190%);

  --thumb: #ffffff;
  --field: #ffffff;
  --field-inset: rgba(118, 118, 128, .12);
  --switch-off: rgba(120, 120, 128, .16);

  --hairline: 1px;
  --radius-card: 24px;
  --radius-list: 22px;
  --gutter: 16px;
  --dock-h: 62px;
  --shell-max: 1120px;

  /* Motion. --ease is the iOS sheet curve; --spring is a lightly-damped spring (≈4% overshoot);
     --press is the quick squeeze when a finger lands. */
  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: linear(0, .044 5%, .149 10%, .284 15%, .428 20%, .565 25%, .687 30%, .789 35%, .871 40%, .933 45%, .977 50%, 1.007 55%, 1.026 60%, 1.035 65%, 1.038 70%, 1.036 75%, 1.03 80%, 1.02 87%, 1.008 94%, 1);
  --press: cubic-bezier(.2, 0, 0, 1);
}

@media (min-resolution: 2dppx) {
  :root { --hairline: .5px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .3);
    --label-4: rgba(235, 235, 245, .12);
    --separator: rgba(84, 84, 88, .6);
    --fill: rgba(120, 120, 128, .36);
    --fill-2: rgba(120, 120, 128, .32);
    --fill-3: rgba(118, 118, 128, .24);
    --fill-4: rgba(118, 118, 128, .18);

    --tint: #0a84ff;
    --tint-rgb: 10, 132, 255;
    --orange: #ff9f0a;
    --orange-rgb: 255, 159, 10;
    --orange-ink: #ff9f0a;
    --chart: #ff9f0a;
    --green: #30d158;
    --green-rgb: 48, 209, 88;
    --green-ink: #30d158;
    --red: #ff453a;
    --red-rgb: 255, 69, 58;
    --indigo: #5e5ce6;
    --indigo-rgb: 94, 92, 230;
    --pink: #ff375f;
    --teal: #40c8e0;

    --glass: rgba(38, 38, 41, .6);
    --glass-strong: rgba(44, 44, 47, .82);
    --glass-rim: rgba(255, 255, 255, .13);
    --glass-edge: rgba(0, 0, 0, .55);
    --glass-shadow: 0 16px 38px -14px rgba(0, 0, 0, .75);

    --thumb: #636366;
    --field: #1c1c1e;
    --field-inset: rgba(118, 118, 128, .24);
    --switch-off: rgba(120, 120, 128, .32);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.29;
  letter-spacing: -.01em;
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* A warm, barely-there glow behind everything — it gives the glass something to refract. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(56rem 28rem at -8% -12%, rgba(var(--orange-rgb), .13), transparent 70%),
    radial-gradient(44rem 24rem at 108% -6%, rgba(255, 45, 85, .07), transparent 70%);
}

a { color: var(--tint); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.icon { display: inline-block; flex-shrink: 0; vertical-align: middle; }

.num {
  font-family: var(--font-rounded);
  letter-spacing: 0;
}

/* Columns of numbers line up; standalone figures keep proportional digits. */
.entry-weight .num, .chart-stats .num { font-variant-numeric: tabular-nums; }

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

:focus-visible {
  outline: 3px solid rgba(var(--tint-rgb), .55);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--tint);
  color: #fff;
  font-weight: 600;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Glass material ---------- */

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow:
    inset 0 1px 0 var(--glass-rim),
    0 0 0 var(--hairline) var(--glass-edge),
    var(--glass-shadow);
}

/* ---------- App shell ---------- */

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

.content {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--gutter) calc(var(--dock-h) + max(12px, env(safe-area-inset-bottom)) + 40px);
  container-type: inline-size;
}

/* Navigation bar: transparent at rest, a soft progressive blur once content scrolls beneath it. */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
}

.navbar::before {
  content: "";
  position: absolute;
  inset: 0 0 -20px;
  pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 78%, transparent), color-mix(in srgb, var(--bg) 0%, transparent));
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent);
  mask-image: linear-gradient(to bottom, #000 50%, transparent);
  opacity: 0;
  transition: opacity .25s ease;
}

.is-scrolled .navbar::before { opacity: 1; }

.navbar-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
  align-items: center;
  gap: 8px;
  height: 56px;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.navbar-leading { justify-self: start; display: flex; gap: 8px; }
.navbar-trailing { justify-self: end; display: flex; gap: 8px; }

.navbar-title {
  max-width: 52vw;
  overflow: hidden;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .25s ease, transform .35s var(--ease);
}

.is-scrolled .navbar-title { opacity: 1; transform: none; }

.glass-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  color: var(--label);
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform .55s var(--spring), background-color .2s ease;
}

.glass-button:hover { background: var(--glass-strong); }
.glass-button:active { transform: scale(.92); }
.add-button { display: none; }

@media (min-width: 768px) {
  .add-button { display: inline-flex; }
}
.glass-button.is-tinted { color: var(--tint); }
.glass-button .label { display: none; }
.glass-button .icon { width: 24px; height: 24px; }

/* Sidebar (iPad and up) — a floating glass panel. */
.sidebar { display: none; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 10px 20px;
  color: var(--label);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
}

.sidebar-brand img {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 3px 6px rgba(40, 120, 255, .28));
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-link {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 12px;
  border-radius: 16px;
  color: var(--label);
  transition: background-color .15s ease;
}

.sidebar-link .icon { width: 24px; height: 24px; color: var(--tint); }
.sidebar-link:hover { background: var(--fill-4); }
.sidebar-link.is-active { color: var(--tint); font-weight: 600; }
.sidebar-link.is-active:hover { background: none; }

/* The selection is its own element so it can glide between links on navigation. */
.sidebar-indicator {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: 16px;
  background: rgba(var(--tint-rgb), .13);
  view-transition-name: sidebar-indicator;
}

.sidebar-footer { margin-top: auto; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 18px;
  color: var(--label);
}

.user-chip-text { display: flex; flex-direction: column; min-width: 0; }
.user-chip-text strong { font-size: 15px; font-weight: 600; }
.user-chip-text small {
  overflow: hidden;
  font-size: 13px;
  color: var(--label-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.initials {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(180deg, #a7adba, #858a96);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
}

/* Floating dock (phone) — tab bar capsule plus a separate add button, like iOS 26. */
.dock {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) - 4px));
  display: flex;
  gap: 10px;
  width: calc(100% - 2 * var(--gutter));
  max-width: 520px;
  margin: 0 auto;
}

.tabbar {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: var(--dock-h);
  padding: 4px;
  border-radius: 999px;
  transition: height .55s var(--spring);
}

.tab {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  border-radius: 999px;
  color: var(--label);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .25s ease;
}

.tab-label {
  max-width: 100%;
  max-height: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: opacity .2s ease, max-height .45s var(--ease);
}

.tab .icon { width: 26px; height: 26px; }
.tab.is-active { color: var(--tint); }

.tab-indicator {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: 999px;
  background: var(--fill-3);
  view-transition-name: tab-indicator;
}

/* iOS 26: the tab bar slims down while you scroll through content, and returns when you scroll back. */
.is-dock-minimized .tabbar { height: 50px; }
.is-dock-minimized .tab-label { max-height: 0; opacity: 0; }
.is-dock-minimized .dock-action { width: 50px; height: 50px; }

.dock-action {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--dock-h);
  height: var(--dock-h);
  border: 0;
  border-radius: 50%;
  color: var(--tint);
  transition: transform .55s var(--spring), width .55s var(--spring), height .55s var(--spring);
}

.dock-action:active { transform: scale(.9); }
.dock-action .icon { width: 28px; height: 28px; stroke-width: 2; }

@media (min-width: 768px) {
  :root { --gutter: 28px; --sidebar-w: 248px; }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 10px;
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    padding: 20px 12px 12px;
    border-radius: 30px;
  }

  .shell { padding-left: calc(var(--sidebar-w) + 10px); }
  .dock { display: none; }
  .content { padding-bottom: 56px; }
  .glass-button .label { display: inline; }
  .glass-button.has-label { padding: 0 18px 0 14px; }
  .glass-button.has-label .icon { width: 20px; height: 20px; }
}

@media (min-width: 1200px) {
  :root { --gutter: 40px; --sidebar-w: 268px; }
}

/* ---------- Typography ---------- */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 18px;
}

.large-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: .005em;
}

.overline {
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--label-2);
}

.secondary { color: var(--label-2); }

/* ---------- Cards ---------- */

.card {
  padding: 18px;
  border-radius: var(--radius-card);
  background: var(--bg-elevated);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.card-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
}

.card-kicker .icon { width: 20px; height: 20px; stroke-width: 2; }
.card-meta { font-size: 15px; color: var(--label-2); }
.card-detail { margin: -4px 0 8px; font-size: 15px; color: var(--label-2); min-height: 1.3em; }

/* Category colour on the glyph, a darker ink of it on the words so they stay legible. */
.tint-orange { color: var(--orange-ink); }
.tint-orange .icon { color: var(--orange); }
.tint-indigo { color: var(--indigo); }
.tint-green { color: var(--green-ink); }
.tint-green .icon { color: var(--green); }
.tint-blue { color: var(--tint); }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.section-header h2 { font-size: 20px; font-weight: 700; letter-spacing: 0; }
.section-header a { font-size: 15px; font-weight: 500; }

/* ---------- Summary (dashboard) ---------- */

.dashboard {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "hero" "chart" "highlight" "monthly" "recent";
}

.area-hero { grid-area: hero; }
.area-chart { grid-area: chart; }
.area-highlight { grid-area: highlight; }
.area-monthly { grid-area: monthly; }
.area-recent { grid-area: recent; }

@container (min-width: 640px) {
  .dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "hero hero" "chart chart" "highlight monthly" "recent recent";
  }
}

@container (min-width: 940px) {
  .dashboard {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    grid-template-areas: "chart hero" "chart highlight" "monthly recent";
  }

  /* Beside the big chart the summary card is tall: give the sparkline the room. */
  .hero .hero-body { flex-direction: column; align-items: stretch; }
  .hero .sparkline { width: 100%; height: 84px; }
}

.page-header-avatar { display: block; border-radius: 50%; }

@media (min-width: 768px) {
  .page-header-avatar { display: none; }
}

.hero { display: flex; flex-direction: column; }

.hero-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-value { display: flex; align-items: baseline; gap: 5px; }

.hero-value .num {
  font-size: 54px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
}

.hero-unit { font-size: 22px; font-weight: 600; color: var(--label-2); }

.hero-delta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  margin-top: 10px;
  font-size: 15px;
  color: var(--label-2);
}

.sparkline { flex-shrink: 0; width: 132px; height: 58px; }

.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
  color: var(--label);
  white-space: nowrap;
}

.delta .icon { width: 15px; height: 15px; stroke-width: 2.4; }
.delta.is-flat { color: var(--label-2); }

.range-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 500;
}

.hero .range-status { margin-top: auto; }
.range-status .icon { width: 20px; height: 20px; }
.range-status.is-within { background: rgba(var(--green-rgb), .13); color: var(--green-ink); }
.range-status.is-above { background: rgba(var(--orange-rgb), .14); color: var(--orange-ink); }
.range-status.is-below { background: rgba(var(--tint-rgb), .11); color: var(--tint); }
.range-status.is-unset { background: var(--fill-4); color: var(--tint); }
.range-status .chevron { margin-left: auto; width: 16px; height: 16px; opacity: .7; }

/* Segmented control */
.segmented {
  --count: 2;
  --index: 0;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(var(--count), minmax(0, 1fr));
  padding: 3px;
  border-radius: 999px;
  background: var(--fill-3);
}

.segmented-thumb {
  position: absolute;
  z-index: -1;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--count));
  border-radius: 999px;
  background: var(--thumb);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);
  transform: translateX(calc(var(--index) * 100%));
  transition: transform .6s var(--spring);
}

.segmented > button,
.segmented > label > span {
  display: grid;
  place-items: center;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.segmented > label { display: grid; position: relative; }
.segmented > label > input { position: absolute; opacity: 0; pointer-events: none; }
.segmented > label > input:focus-visible + span { outline: 3px solid rgba(var(--tint-rgb), .55); }
.segmented-sm { min-width: 128px; }
.segmented-sm > label > span { height: 28px; font-size: 15px; }

/* Charts */
.chart-card { display: flex; flex-direction: column; gap: 16px; }
.chart-head { min-height: 82px; }

.chart-kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--label-2);
}

.chart-value { display: flex; align-items: baseline; gap: 5px; margin-top: 2px; }
.chart-value .num { font-size: 34px; font-weight: 700; line-height: 1.12; }
.chart-unit { font-size: 17px; font-weight: 600; color: var(--label-2); }
.chart-sub { margin-top: 2px; min-height: 1.3em; font-size: 15px; color: var(--label-2); }

.chart-canvas { position: relative; height: 240px; }
.bars-canvas { position: relative; height: 190px; }

@container (min-width: 640px) {
  .chart-canvas { height: 300px; }
}

.chart-empty {
  position: absolute;
  inset: 0 46px 28px 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  color: var(--label-2);
  pointer-events: none;
}

.chart-svg {
  display: block;
  overflow: visible;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

.chart-svg:focus-visible { outline: 3px solid rgba(var(--tint-rgb), .45); outline-offset: 4px; border-radius: 8px; }

.chart-svg text {
  font-family: var(--font);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  fill: var(--label-2);
}

.chart-grid line { stroke: var(--label-4); stroke-width: 1; shape-rendering: crispEdges; }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area-stop-top { stop-color: var(--chart); stop-opacity: .16; }
.chart-area-stop-bottom { stop-color: var(--chart); stop-opacity: 0; }
.chart-dot { fill: var(--chart); stroke: var(--bg-elevated); stroke-width: 2; }
.chart-dot.is-last { stroke-width: 2.5; }
.chart-band { fill: rgba(var(--green-rgb), .1); }
.chart-band-line { stroke: rgba(var(--green-rgb), .55); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-svg text.chart-band-label { fill: var(--label-2); font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.chart-rule { stroke: var(--label-3); stroke-width: 1; }
.chart-focus { fill: var(--chart); stroke: var(--bg-elevated); stroke-width: 3; }
.chart-cursor { opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.chart-cursor.is-active { opacity: 1; }
.chart-cursor > * { transition: transform 90ms ease-out; }
.chart-dot, .chart-bar rect, .chart-bar circle { transform-box: fill-box; transform-origin: center; }
.chart-bar { fill: var(--chart); transition: opacity .2s ease; }
.chart-bar-avg { fill: var(--bg-elevated); }
.bars-svg.is-focused .chart-bar:not(.is-focused) { opacity: .3; }
.bars-svg.is-waiting .chart-bar { opacity: 0; }
.sparkline .chart-line { stroke-width: 2.2; }

.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding-top: 14px;
  border-top: var(--hairline) solid var(--separator);
}

.chart-stats > div { min-width: 0; }
.chart-stats > div + div { padding-left: 14px; border-left: var(--hairline) solid var(--separator); }
.chart-stats dt { font-size: 13px; font-weight: 500; color: var(--label-2); }
.chart-stats dd { margin: 3px 0 0; font-size: 20px; font-weight: 600; white-space: nowrap; }
.chart-stats small { font-size: 13px; font-weight: 500; color: var(--label-2); }

/* Highlights */
.highlight-text { font-size: 17px; line-height: 1.42; }
.highlight-text strong { font-weight: 700; }

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

.compare-item { padding: 12px 14px; border-radius: 16px; background: var(--bg-secondary); }
.compare-label { display: block; font-size: 13px; font-weight: 500; color: var(--label-2); }
.compare-value { display: block; margin-top: 2px; font-size: 22px; font-weight: 700; }
.compare-value small { font-size: 14px; font-weight: 600; color: var(--label-2); }
.compare-label::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--label-3);
  vertical-align: 1px;
}

.compare-item.is-current .compare-label::before { background: var(--chart); }

.recent { padding: 18px 0 6px; }
.recent .section-header { padding: 0 18px; }
.recent .list { border-radius: 0; background: none; }

/* ---------- Lists (inset grouped) ---------- */

.list-section { margin-top: 30px; }
.list-section:first-of-type { margin-top: 0; }
.page-header + .list-section, .account + .list-section, .tiles + .list-section { margin-top: 24px; }

.list-section-title {
  margin-bottom: 7px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--label-2);
}

.list-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.list-section-header h2 { font-size: 20px; font-weight: 700; letter-spacing: 0; }
.list-section-header span { font-size: 15px; color: var(--label-2); }

.list-section-footer {
  margin-top: 8px;
  padding: 0 18px;
  font-size: 13px;
  line-height: 1.38;
  color: var(--label-2);
}

.list {
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border-radius: var(--radius-list);
  background: var(--bg-elevated);
}

.list > * { position: relative; }

/* A hairline above every row that follows a visible row (hidden CSRF inputs don't count). */
.list > :not(input) ~ *::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  left: 18px;
  right: 0;
  height: var(--hairline);
  background: var(--separator);
  pointer-events: none;
}

.list > .has-badge::before { left: 60px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 8px 18px;
  border: 0;
  background: none;
  color: var(--label);
  font-size: 17px;
  text-align: left;
}

/* Rows highlight the instant they're touched and fade back afterwards, like table cells. */
a.list-row, button.list-row, summary.list-row { cursor: pointer; transition: background-color .4s ease; }
a.list-row:active, button.list-row:active, summary.list-row:active { background: var(--fill-2); transition-duration: 0s; }

@media (hover: hover) {
  a.list-row:hover, button.list-row:hover, summary.list-row:hover { background: var(--fill-4); }
}

.row-label { flex: 1; min-width: 0; }
.row-text { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 0; }
.row-sub { font-size: 15px; color: var(--label-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-value { color: var(--label-2); white-space: nowrap; }
.row-value.is-on { color: var(--green-ink); font-weight: 500; }

.chevron { width: 18px; height: 18px; margin-right: -4px; color: var(--label-3); stroke-width: 2.4; }

.badge {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #fff;
}

.badge .icon { width: 19px; height: 19px; stroke-width: 2; }
.bg-orange { background: var(--orange); }
.bg-green { background: var(--green); }
.bg-indigo { background: var(--indigo); }
.bg-blue { background: var(--tint); }
.bg-red { background: var(--red); }
.bg-gray { background: var(--gray); }
.bg-pink { background: var(--pink); }
.bg-teal { background: var(--teal); }

.list-button { color: var(--tint); }
.list-button .icon { width: 22px; height: 22px; }
.list-button.is-destructive { color: var(--red); }
.list-button.is-center { justify-content: center; }

/* Form rows: label on the left, value on the right — like Settings. */
.field-row { cursor: text; }
.field-row .row-label { flex: 0 0 auto; min-width: 92px; }

.field-row input,
.field-row select {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--label);
  text-align: right;
  outline: none;
}

.field-row input::placeholder { color: var(--label-3); }
.field-row input[type="date"], .field-row input[type="time"] { -webkit-appearance: none; appearance: none; }
.field-row input::-webkit-date-and-time-value { text-align: right; }
.field-row input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }

@media (prefers-color-scheme: dark) {
  .field-row input::-webkit-calendar-picker-indicator { filter: invert(1); }
}

.field-row:focus-within { background: rgba(var(--tint-rgb), .045); }

.select-wrap { position: relative; display: flex; flex: 1; align-items: center; justify-content: flex-end; min-width: 0; }
.select-wrap select { -webkit-appearance: none; appearance: none; padding-right: 22px; cursor: pointer; color: var(--label-2); }
.select-wrap .icon { position: absolute; right: -2px; width: 16px; height: 16px; color: var(--label-3); pointer-events: none; stroke-width: 2.2; }
.select-wrap option { color: initial; }

.input-with-unit { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; }
.input-with-unit span { color: var(--label-2); }

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 18px 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--red);
}

.field-error .icon { width: 16px; height: 16px; margin-top: 0; }
.list + .field-error, .field-error + .field-error { margin-top: 8px; }

/* Entry rows (history & recent) */
.entry-row { gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.entry-main { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.entry-date { font-weight: 500; }
.entry-meta { overflow: hidden; font-size: 15px; color: var(--label-2); white-space: nowrap; text-overflow: ellipsis; }
.entry-weight { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.entry-weight .num { font-size: 17px; font-weight: 600; }
.entry-weight small { font-size: 15px; font-weight: 500; color: var(--label-2); }
.entry-weight .delta { font-size: 13px; color: var(--label-2); }
.entry-weight .delta .icon { width: 13px; height: 13px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .55s var(--spring), opacity .2s ease, background-color .2s ease;
}

.btn:active { transform: scale(.96); }
.btn .icon { width: 22px; height: 22px; stroke-width: 2; }
.btn-primary { background: var(--tint); color: #fff; }
.btn-secondary { background: var(--bg-elevated); color: var(--label); box-shadow: 0 0 0 var(--hairline) var(--separator); }
.btn-tinted { background: rgba(var(--tint-rgb), .13); color: var(--tint); }
.btn-plain { height: 44px; padding: 0 12px; background: none; color: var(--tint); font-weight: 500; }
.btn-destructive { background: rgba(var(--red-rgb), .12); color: var(--red); }
.btn-block { display: flex; width: 100%; }
.is-busy { opacity: .55; pointer-events: none; }

.form-actions { margin-top: 26px; }

/* iOS switch */
.switch {
  position: relative;
  flex-shrink: 0;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 999px;
  background: var(--switch-off);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .3s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06);
  transition: transform .5s var(--spring), width .25s var(--ease);
}

.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* The knob stretches under your finger, as on iOS. */
.switch:active::after { width: 33px; }
.switch:checked:active::after { transform: translateX(14px); }

/* ---------- Empty states ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 24px 40px;
  text-align: center;
}

.empty-state h2 { margin-top: 14px; font-size: 22px; font-weight: 700; }
.empty-state p { max-width: 340px; color: var(--label-2); }
.empty-state .btn { margin-top: 16px; }

/* ---------- Cat avatar & profile ---------- */

.cat-avatar {
  display: block;
  flex-shrink: 0;
  width: var(--size);
  height: var(--size);
  overflow: hidden;
  border-radius: 50%;
  background: var(--fill-3);
}

.cat-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 22px;
  text-align: center;
}

.profile-photo { position: relative; display: block; border-radius: 50%; cursor: pointer; }
.profile-photo .cat-avatar { box-shadow: 0 10px 30px -10px rgba(40, 120, 255, .45); }

.profile-photo-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tint);
  color: #fff;
  box-shadow: 0 0 0 4px var(--bg);
}

.profile-photo-badge .icon { width: 19px; height: 19px; stroke-width: 2; }
.profile-photo:focus-within { outline: 3px solid rgba(var(--tint-rgb), .55); outline-offset: 4px; }
.profile-hero .large-title { margin-top: 16px; }
.profile-sub { margin-top: 4px; color: var(--label-2); }

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

.tile { min-width: 0; padding: 14px 14px 13px; border-radius: 20px; background: var(--bg-elevated); }
.tile-label { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.tile-label .icon { width: 16px; height: 16px; stroke-width: 2; }
.tile-value { display: block; margin-top: 6px; overflow: hidden; font-size: 22px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.tile-value small { font-size: 14px; font-weight: 600; color: var(--label-2); }

/* ---------- Settings ---------- */

.account { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.account .initials { width: 62px; height: 62px; font-size: 24px; }
.account-name { font-size: 20px; font-weight: 600; }
.account-email { margin-top: 2px; font-size: 15px; color: var(--label-2); word-break: break-all; }

.app-footer { margin-top: 32px; font-size: 13px; text-align: center; color: var(--label-3); }

.two-factor-setup { padding: 20px 18px; }
.steps { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.5; color: var(--label-2); }
.qr { width: 212px; margin: 18px auto 14px; padding: 14px; border-radius: 22px; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.setup-key { font-size: 13px; text-align: center; color: var(--label-2); }

.setup-key code {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: .06em;
  color: var(--label);
  word-break: break-all;
  user-select: all;
}

.code-form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }

.code-input {
  width: 100%;
  height: 62px;
  padding: 0 12px;
  border: 0;
  border-radius: 18px;
  background: var(--field-inset);
  font-family: var(--font-rounded);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .32em;
  text-align: center;
  outline: none;
}

.code-input:focus { box-shadow: 0 0 0 3px rgba(var(--tint-rgb), .4); }
.code-input::placeholder { color: var(--label-3); }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] .chevron { transform: rotate(90deg); }
.chevron { transition: transform .25s var(--ease); }

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  padding: 4px 18px 18px;
}

.recovery-codes code {
  padding: 9px 8px;
  border-radius: 11px;
  background: var(--fill-4);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
  user-select: all;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-right: -8px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--label-2);
}

.icon-button:hover { background: var(--fill-4); }
.icon-button.is-destructive { color: var(--red); }
.icon-button .icon { width: 21px; height: 21px; }

/* ---------- Sheet (add / edit weigh-in) ---------- */

dialog { color: var(--label); }

.sheet {
  position: fixed;
  inset: auto 8px calc(max(8px, env(safe-area-inset-bottom, 0px)) + var(--keyboard, 0px)) 8px;
  width: auto;
  max-width: none;
  max-height: calc(100dvh - var(--keyboard, 0px) - 20px - env(safe-area-inset-top, 0px));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 36px;
  background: var(--bg);
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, .35);
}

.sheet[open] { display: flex; animation: sheet-in .55s var(--ease); }
.sheet.is-closing { animation: sheet-out .32s cubic-bezier(.4, 0, 1, 1) forwards; }
.sheet::backdrop { background: rgba(0, 0, 0, .3); animation: fade-in .35s ease; }
.sheet.is-closing::backdrop { animation: fade-out .32s ease forwards; }

.sheet-inner { display: flex; flex: 1; flex-direction: column; min-height: 0; width: 100%; }

.sheet-grabber {
  flex-shrink: 0;
  width: 38px;
  height: 5px;
  margin: 7px auto 0;
  border-radius: 3px;
  background: var(--label-3);
}

.sheet-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
}

.sheet-title { font-size: 17px; font-weight: 600; text-align: center; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 16px 22px; overscroll-behavior: contain; }

.circle-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--fill-3);
  color: var(--label);
  transition: transform .55s var(--spring);
}

.circle-button:active { transform: scale(.9); }
.circle-button.is-prominent { background: var(--tint); color: #fff; }
.circle-button .icon { width: 22px; height: 22px; stroke-width: 2.2; }

.weight-input {
  display: block;
  margin-bottom: 16px;
  padding: 16px 18px 20px;
  border-radius: var(--radius-list);
  background: var(--bg-elevated);
  text-align: center;
  cursor: text;
}

.weight-input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--orange-ink);
}

.weight-input-label .icon { width: 20px; height: 20px; stroke-width: 2; color: var(--orange); }
.weight-input-field { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin-top: 6px; }

.weight-input input {
  width: 4.2ch;
  min-width: 2ch;
  field-sizing: content;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-rounded);
  font-size: 60px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.01em;
  text-align: center;
  caret-color: var(--orange);
  outline: none;
}

.weight-input input::placeholder { color: var(--label-3); }
.weight-input-unit { font-size: 24px; font-weight: 600; color: var(--label-2); }
.sheet-body .list-button-standalone { margin-top: 16px; }

.list-button-standalone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: var(--radius-list);
  background: var(--bg-elevated);
  font-size: 17px;
}

.list-button-standalone.is-destructive { color: var(--red); }

@keyframes sheet-in { from { transform: translateY(calc(100% + 40px)); } }
@keyframes sheet-out { to { transform: translateY(calc(100% + 40px)); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(12px) scale(.97); } }

@media (min-width: 640px) {
  .sheet {
    inset: 0;
    width: min(520px, calc(100% - 48px));
    height: fit-content;
    max-height: min(740px, calc(100dvh - 64px));
    margin: auto;
    border-radius: 32px;
  }

  .sheet[open] { animation: pop-in .45s var(--ease); }
  .sheet.is-closing { animation: pop-out .22s ease forwards; }
  .sheet-grabber { display: none; }
  .sheet-header { padding-top: 16px; }
}

/* ---------- Alert ---------- */

.alert {
  width: min(310px, calc(100% - 48px));
  padding: 24px 18px 18px;
  border: 0;
  border-radius: 34px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  backdrop-filter: blur(30px) saturate(190%);
  box-shadow: inset 0 1px 0 var(--glass-rim), 0 24px 60px -12px rgba(0, 0, 0, .35);
  text-align: center;
}

.alert[open] { animation: alert-in .5s var(--spring); }
.alert.is-closing { animation: fade-out .2s ease forwards; }
.alert::backdrop { background: rgba(0, 0, 0, .22); animation: fade-in .25s ease; }
.alert.is-closing::backdrop { animation: fade-out .2s ease forwards; }
.alert-title { font-size: 17px; font-weight: 600; }
.alert-message { margin-top: 6px; font-size: 15px; line-height: 1.35; color: var(--label-2); }
.alert-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

.alert-actions button {
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-3);
  font-size: 17px;
  font-weight: 500;
  transition: transform .5s var(--spring);
}

.alert-actions button:active { transform: scale(.95); }
.alert-confirm.is-destructive { color: var(--red); font-weight: 600; }

@keyframes alert-in { from { opacity: 0; transform: scale(1.1); } }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  z-index: 100;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 12px 20px 12px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -160%) scale(.9);
  transition: transform .6s var(--spring), opacity .3s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast .icon { width: 22px; height: 22px; }
.toast-success { color: var(--green); }
.toast-error { color: var(--red); }
.toast[data-type="error"] .toast-success, .toast:not([data-type="error"]) .toast-error { display: none; }

/* ---------- Authentication ---------- */

.auth {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth::before {
  background:
    radial-gradient(38rem 30rem at 15% -10%, rgba(var(--orange-rgb), .26), transparent 70%),
    radial-gradient(34rem 26rem at 100% 10%, rgba(255, 45, 85, .14), transparent 70%),
    radial-gradient(40rem 30rem at 50% 115%, rgba(var(--tint-rgb), .1), transparent 70%);
}

.auth-main {
  width: 100%;
  max-width: 440px;
  margin: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 44px) 20px calc(env(safe-area-inset-bottom, 0px) + 36px);
}

.auth-head { text-align: center; }

.auth-icon {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 20px;
  filter: drop-shadow(0 10px 22px rgba(40, 120, 255, .32));
}

.auth-title { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: .005em; }
.auth-subtitle { max-width: 330px; margin: 8px auto 0; color: var(--label-2); }

.auth-status {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(var(--green-rgb), .13);
  color: var(--green-ink);
  font-size: 15px;
  text-align: center;
}

.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.auth-form .field-error { margin: -2px 6px 0; }

.field input {
  width: 100%;
  height: 54px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  background: var(--field);
  box-shadow: 0 0 0 var(--hairline) var(--glass-edge);
  outline: none;
  transition: box-shadow .2s ease;
}

.field input::placeholder { color: var(--label-3); }
.field input:focus { box-shadow: 0 0 0 3px rgba(var(--tint-rgb), .38); }
.field.has-error input { box-shadow: 0 0 0 2px rgba(var(--red-rgb), .55); }

.switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px;
  font-size: 15px;
  cursor: pointer;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 13px;
  color: var(--label-2);
}

.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: var(--hairline);
  background: var(--separator);
}

.auth-links { display: flex; justify-content: center; margin-top: 14px; font-size: 15px; }
.auth-footer { margin-top: 30px; font-size: 15px; text-align: center; color: var(--label-2); }
.auth-footer a { font-weight: 600; }

/* ---------- Motion ---------- */

/* Pressing: a quick squeeze, then each control's spring carries it back with a little bounce. */
.btn:active, .glass-button:active, .circle-button:active, .dock-action:active, .icon-button:active, .alert-actions button:active {
  transition-duration: .12s;
  transition-timing-function: var(--press);
}

.icon-button { transition: transform .5s var(--spring), background-color .2s ease; }
.icon-button:active { transform: scale(.88); }

.tab .icon, .sidebar-link .icon, .profile-photo-badge { transition: transform .5s var(--spring); }
.tab:active .icon, .sidebar-link:active .icon { transform: scale(.84); transition-duration: .12s; transition-timing-function: var(--press); }
.profile-photo:active .profile-photo-badge { transform: scale(.85); }

@keyframes rise-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes symbol-bounce { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.06); } }
@keyframes dot-pop { from { transform: scale(0); } }
@keyframes bar-grow { from { opacity: 0; transform: scale(1, .2); } }
@keyframes draw { from { stroke-dashoffset: var(--length); } }

/* Motion is part of the design, so it plays regardless of the system's reduce-motion setting. */

/* Opening a screen: its cards settle into place one after another. */
.content > :not(.dashboard, script),
.dashboard > *,
.tiles > * {
  animation: rise-in .65s var(--ease) both;
  animation-delay: calc(var(--rise, 0) * 55ms);
}

.content > :nth-child(2), .dashboard > :nth-child(1), .tiles > :nth-child(1) { --rise: 1; }
.content > :nth-child(3), .dashboard > :nth-child(2), .tiles > :nth-child(2) { --rise: 2; }
.content > :nth-child(4), .dashboard > :nth-child(3), .tiles > :nth-child(3) { --rise: 3; }
.content > :nth-child(5), .dashboard > :nth-child(4) { --rise: 4; }
.content > :nth-child(n+6), .dashboard > :nth-child(n+5) { --rise: 5; }

/* Symbol effects: Teddy bounces in on empty screens; the toast's checkmark draws itself. */
.empty-state .cat-avatar { animation: symbol-bounce .8s var(--spring) .2s both; }
.toast.is-visible .toast-success path { --length: 11; stroke-dasharray: 11; animation: draw .45s var(--ease) .2s both; }

/* Navigating: screens crossfade, and the tab bar / sidebar selection glides to its new place. */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) { animation-duration: .25s; }

::view-transition-group(tab-indicator),
::view-transition-group(sidebar-indicator) {
  animation-duration: .6s;
  animation-timing-function: var(--spring);
}
