:root {
  --bg: #ffffff;
  --text: #111214;
  --text-2: #6d6d72;
  --text-3: #a2a2a7;
  --line: #ececef;
  --fill: #f1f2f4;
  --grouped: #f2f2f7;
  --shadow: 0 1px 2px rgba(17, 24, 20, 0.05), 0 4px 18px rgba(17, 24, 20, 0.06);
  --green: #1d8a4b;
  --green-press: #17733e;
  --green-text: #1a9050;
  --green-bar: #86d9a1;
  --green-bar-in: #4cc274;
  --green-soft: #ebf7ef;
  /* Multiplied over the bar: a minty to lime tint on the track, a deeper band across the fill. */
  --zone: linear-gradient(to right, #d3efe6, #d9f3e2 45%, #e9f6c8);
  --orange: #d97a0c;
  --orange-bar: #f5a742;
  --red: #e5483d;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; }
button { padding: 0; border: 0; background: none; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

/* ---- Shell ---- */

.views { position: relative; flex: 1; min-height: 0; }

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 16px) 20px 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.tabbar {
  flex: none;
  display: flex;
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: #fff;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}
.tab svg { width: 27px; height: 27px; }
.tab.active { color: var(--green-text); }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}
.page-head h1 { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { margin: 3px 0 0; color: var(--text-2); font-size: 18px; }

/* ‹ date › under the Today title; the arrows sit just outside the date so it lines up with the title. */
.day-nav { display: flex; align-items: center; gap: 2px; margin: 3px 0 0 -7px; }
.day-nav .page-sub { margin: 0; min-width: 0; }
.day-arrow {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  color: var(--green-text);
  transition: background-color 0.15s, transform 0.2s var(--ease), opacity 0.15s;
}
.day-arrow svg { stroke-width: 2.4; }
.day-arrow:active:not(:disabled) { background: var(--fill); transform: scale(0.9); }
.day-arrow:disabled { color: var(--text-3); opacity: 0.4; cursor: default; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 -10px 0 0;
  border-radius: 22px;
}
.icon-btn:active { background: var(--fill); }

.text-btn { padding: 10px 4px; color: var(--green-text); font-size: 17px; }
.text-btn.strong { font-weight: 600; }
.text-btn:disabled { color: var(--text-3); cursor: default; }
.text-btn:active:not(:disabled) { opacity: 0.6; }

.head-add { display: flex; align-items: center; gap: 4px; margin: 2px -4px 0 0; font-size: 19px; }
.head-add svg { width: 20px; height: 20px; stroke-width: 2.4; }

.card { border-radius: 16px; background: #fff; box-shadow: var(--shadow); }

.empty-note { margin: 8px 0 24px; padding: 28px 16px; color: var(--text-2); font-size: 16px; text-align: center; }

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 62px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(29, 138, 75, 0.22);
}
.btn-primary svg { width: 28px; height: 28px; }
.btn-primary:active { background: var(--green-press); }

.btn-soft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 58px;
  margin-top: 4px;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green-text);
  font-size: 17px;
  font-weight: 600;
}
.btn-soft:active { background: #dcf0e3; }
.btn-soft:disabled { opacity: 0.7; }
.btn-soft .spinner { width: 18px; height: 18px; }

.btn-delete {
  width: 100%;
  height: 52px;
  margin-top: 24px;
  border-radius: 12px;
  background: #fff;
  color: var(--red);
  font-size: 17px;
}
.screen .btn-delete { background: none; }
.btn-delete:active { opacity: 0.6; }

/* ---- Today ---- */

.section-title { margin: 0 0 14px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }

.meter { position: relative; }

/* "Weight Loss Zone" with a bracket over the zone's stretch of the bar. */
.meter-label { position: relative; color: var(--text-2); font-size: 14px; text-align: center; white-space: nowrap; }
.meter-label::after {
  content: '';
  display: block;
  height: 7px;
  margin: 4px 0 5px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  opacity: 0.7;
}

.meter-track { position: relative; height: 16px; overflow: hidden; border-radius: 8px; background: var(--fill); }
.meter-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1; /* over the fill, tinting it rather than hiding behind it */
  mix-blend-mode: multiply;
  margin-left: -5px;
  box-sizing: content-box; /* so the padding widens it rather than eating into it */
  padding: 0 5px; /* widens it 5px each side, so the fades below centre on the zone's limits */
  background: var(--zone);
  /* Soft edges that fade in and out over 10px. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 10px), transparent);
}
/* Over the zone the fill covers it completely: a neutral tint keeps the orange from turning olive. */
.meter-track:has(.meter-fill.over) .meter-zone { background: #ebe3dc; }
/* The colour sits in background-color so it still fades between levels; the sheen on top adds depth. */
.meter-fill {
  position: relative;
  height: 100%;
  border-radius: 8px;
  background-color: var(--green-bar);
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%, rgba(0, 40, 20, 0.1));
  transition: width 0.8s var(--ease), background-color 0.8s var(--ease);
}
@media (prefers-reduced-motion: reduce) { .meter-fill { transition: none; } }
.meter-fill.in { background-color: var(--green-bar-in); }
.meter-fill.over { background-color: var(--orange-bar); }

/* Today's total on the left, the zone's limits under its edges. */
.meter-scale { position: relative; height: 20px; margin-top: 10px; color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.meter-now { color: var(--text); font-size: 15px; }
.meter-tick { position: absolute; top: 0; transform: translateX(-50%); }

.total { margin: 20px 0 14px; text-align: center; }
.total-num { font-size: 40px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.total-unit { font-size: 22px; font-weight: 500; }
.total-sub { display: block; margin-top: 2px; color: var(--text-2); font-size: 17px; }

.meal-list { display: flex; flex-direction: column; gap: 12px; }

/* Today keeps its header, meter and total in place; only the meals scroll, between them and Log meal. */
#view-today { overflow: hidden; }
#view-today .meal-list {
  flex: 1;
  min-height: 0;
  margin: 0 -20px;
  padding: 12px 20px 24px; /* room for the cards' shadows, and for the fade below */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  -webkit-mask-image: linear-gradient(transparent, #000 12px);
  mask-image: linear-gradient(transparent, #000 12px);
}
#view-today .meal-list > * { flex: none; }

.meal-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 10px 18px 10px 10px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.15s;
}
.meal-card:active { transform: scale(0.985); }

.thumb {
  display: grid;
  place-items: center;
  flex: none;
  width: 62px;
  height: 62px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-text);
  object-fit: cover;
}
.meal-info { flex: 1; min-width: 0; }
.meal-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.meal-time { display: block; margin-top: 5px; color: var(--text-2); font-size: 15px; }
.meal-kcal { font-size: 17px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }

.log-bar {
  position: relative; /* drawn over the end of the meal list, which fades out under it */
  margin: -22px -20px 0;
  padding: 22px 20px 16px;
  background: linear-gradient(rgba(255, 255, 255, 0), #fff 30%);
}

/* ---- Weight ---- */

.segmented { display: flex; margin-bottom: 18px; padding: 3px; border-radius: 11px; background: var(--fill); }
.segmented button { flex: 1; height: 36px; border-radius: 9px; color: var(--text-2); font-size: 16px; font-weight: 500; }
.segmented button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }

.chart { height: 236px; margin-bottom: 16px; }
.chart svg { overflow: visible; font-family: inherit; }
.chart text { fill: var(--text-3); font-size: 12px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--green-text); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--green-text); stroke: #fff; stroke-width: 1.5; }
.chart-empty { display: grid; place-items: center; height: 100%; padding: 20px; border-radius: 16px; background: var(--fill); color: var(--text-2); font-size: 15px; text-align: center; }

.weight-summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 16px 18px; }
.weight-latest { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.weight-latest small { font-size: 20px; font-weight: 500; }
.weight-meta { display: block; margin-top: 4px; color: var(--text-2); font-size: 14px; }
.weight-change { text-align: right; }
.weight-change b { display: inline-flex; align-items: center; gap: 2px; color: var(--green-text); font-size: 22px; font-weight: 600; }
.weight-change b svg { stroke-width: 2.6; }
.weight-change.up b { color: var(--orange); }
.weight-change.flat b { color: var(--text-2); }

.goal-meta { color: var(--green-text); font-weight: 500; }

.chart .goal-line { stroke: var(--green-text); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: 0.7; }
.chart .goal-label { fill: var(--green-text); font-weight: 600; }

.weight-list { margin-bottom: 24px; padding: 0 18px; }
.weight-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  font-size: 17px;
}
.weight-row:last-child { border-bottom: 0; }
.weight-row span:last-child { color: #4a4a4f; font-variant-numeric: tabular-nums; }

/* ---- Layers: action sheet and form sheets ---- */

.layer { position: fixed; inset: 0; z-index: 50; max-width: 480px; margin: 0 auto; }

.backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.32); opacity: 0; transition: opacity 0.3s; }
.layer.open .backdrop { opacity: 1; }

.action-sheet {
  position: absolute;
  right: 8px;
  bottom: calc(var(--safe-bottom) + 8px);
  left: 8px;
  transform: translateY(calc(100% + 20px));
  transition: transform 0.32s var(--ease);
}
.layer.open .action-sheet { transform: none; }

.action-group { overflow: hidden; border-radius: 14px; background: #fff; }

.action-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  cursor: pointer;
}
.action-item:last-child { border-bottom: 0; }
.action-item svg { color: var(--green-text); }
.action-item:active { background: var(--fill); }
.action-item.destructive { justify-content: center; color: var(--red); }

.action-title { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 14px; text-align: center; }

.action-cancel { width: 100%; height: 58px; margin-top: 8px; border-radius: 14px; background: #fff; color: var(--green-text); font-size: 18px; font-weight: 600; }
.action-cancel:active { background: var(--fill); }

/* Form sheets hang from the top so the keyboard never covers the fields. */
.sheet {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  border-radius: 14px 14px 0 0;
  background: var(--grouped);
  transform: translateY(105%);
  transition: transform 0.34s var(--ease);
}
.layer.open .sheet { transform: none; }

.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 56px; padding: 4px 12px; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-head .text-btn:first-child { justify-self: start; }
.sheet-head .text-btn:last-child { justify-self: end; }

.sheet-body { flex: 1; overflow-y: auto; padding: 8px 16px calc(var(--safe-bottom) + 24px); }

.form-title { margin: 20px 16px 8px; color: var(--text-2); font-size: 13px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; }
.form-title:first-child { margin-top: 4px; }

.form-group { overflow: hidden; border-radius: 12px; background: #fff; }

.field { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field > span { flex: none; width: 82px; }
.field input {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 17px;
  text-align: right;
}
.field input::placeholder { color: var(--text-3); }
.field input[type="date"], .field input[type="time"] { -webkit-appearance: none; appearance: none; min-height: 50px; }
.field input::-webkit-date-and-time-value { text-align: right; }
.field em { color: var(--text-2); font-style: normal; }
.field.big input { font-size: 28px; font-weight: 600; padding: 10px 0; }
.field input.invalid { color: var(--red); }
.field input.invalid::placeholder { color: var(--red); }
.field .unit-input { flex: 0 0 58px; color: var(--text-2); text-align: left; }
.field-text { padding: 0; }
.field-text textarea {
  flex: 1;
  min-height: 92px;
  padding: 14px 16px;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 17px;
  line-height: 1.35;
  resize: none;
}
.field-text textarea::placeholder { color: var(--text-3); }
.field-text textarea.invalid::placeholder { color: var(--red); }
.form-gap { margin-top: 16px; }
.field .secret { -webkit-text-security: disc; }
.field .secret:focus { -webkit-text-security: none; }

.form-note { margin: 10px 16px 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.form-error { margin: 12px 16px 0; color: var(--red); font-size: 15px; }
.sheet .btn-soft { margin-top: 16px; }

.field select {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  text-align: right;
  text-align-last: right;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

/* ---- Zone calculator ---- */
.zone-result { margin-top: 20px; padding: 16px; border-radius: 12px; background: #fff; }
.zone-empty { margin: 0; color: var(--text-2); font-size: 15px; text-align: center; }
.zone-rows { margin: 0; }
.zone-rows div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 15px; }
.zone-rows dt { color: var(--text-2); }
.zone-rows dd { margin: 0; font-variant-numeric: tabular-nums; }
.zone-answer { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; }
.zone-answer span { display: block; color: var(--text-2); font-size: 14px; }
.zone-answer b { display: block; margin-top: 4px; color: var(--green-text); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.zone-warn { margin: 12px 0 0; color: var(--orange); font-size: 14px; line-height: 1.4; }

/* ---- Meal screen ---- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  transform: translateX(100%);
  transition: transform 0.34s var(--ease);
}
.screen.open { transform: none; }

.nav-bar { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 6px) 14px 4px 8px; }
.nav-bar .icon-btn { margin: 0; }
.nav-bar .text-btn { font-size: 19px; }

.screen-body { flex: 1; overflow-y: auto; padding: 6px 20px calc(var(--safe-bottom) + 28px); }

.meal-hero { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }

.hero-photo {
  display: grid;
  place-items: center;
  flex: none;
  width: 112px;
  height: 124px;
  border-radius: 16px;
  background: var(--green-soft);
  color: var(--green-text);
  object-fit: cover;
}
.hero-photo svg { width: 36px; height: 36px; }

.hero-info { flex: 1; min-width: 0; }

.title-input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}
.title-input::placeholder { color: var(--text-3); }

.hero-meta { display: flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--text-2); font-size: 16px; white-space: nowrap; }
/* The time shows as plain text; an invisible time input on top opens the native picker. */
.time-field { position: relative; display: inline-block; text-decoration: underline dotted var(--text-3); text-underline-offset: 3px; }
.time-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  font-size: 16px;
  opacity: 0;
  cursor: pointer;
}

.hero-total { margin-top: 10px; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero-total small { font-size: 22px; font-weight: 500; }

.item-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.item-list:empty { display: none; }

.item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 12px 10px 10px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: left;
}
.item-row:active { background: #fafafa; }
.item-row > svg { color: var(--text-3); }

.item-emoji {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #f5f6f5;
  font-size: 30px;
  line-height: 1;
}
.item-info { flex: 1; min-width: 0; }
.item-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.item-qty { display: block; margin-top: 4px; color: var(--text-2); font-size: 15px; }
.item-kcal { font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.skeleton .item-info { display: flex; flex-direction: column; gap: 10px; }
.skeleton .item-emoji, .bone {
  background: linear-gradient(90deg, #eff0f2 25%, #e4e6e9 37%, #eff0f2 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.bone { display: block; height: 12px; border-radius: 6px; }

@keyframes shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

.status-line { display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; color: var(--text-2); font-size: 15px; }

.spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(29, 138, 75, 0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.banner { margin-bottom: 16px; padding: 14px 16px; border-radius: 14px; background: #fff4e5; color: #7a4300; font-size: 15px; line-height: 1.4; }
.banner p { margin: 0 0 8px; }
.banner button { color: var(--green-text); font-size: 15px; font-weight: 600; }

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

.toast {
  position: fixed;
  z-index: 200;
  bottom: calc(var(--safe-bottom) + 100px);
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border-radius: 20px;
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  font-size: 15px;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Motion: quick, subtle feedback when something is pressed ---- */
.btn-primary, .btn-soft, .btn-delete, .action-cancel, .item-row, .icon-btn {
  transition: transform 0.2s var(--ease), background-color 0.15s, opacity 0.15s;
}
.btn-primary:active, .btn-soft:active:not(:disabled), .btn-delete:active, .action-cancel:active { transform: scale(0.97); }
.item-row:active { transform: scale(0.985); }
.icon-btn:active { transform: scale(0.92); }
.text-btn, .action-item, .weight-row { transition: opacity 0.15s, background-color 0.15s; }
.segmented button { transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; }

/* Icons that hint at what they do: Back nudges back, Add turns its plus. */
.icon-btn svg, .head-add svg, .tab svg { transition: transform 0.3s var(--ease); }
[data-ed="back"]:active svg { transform: translateX(-3px); }
.head-add:active svg { transform: rotate(90deg); }

/* A tab's icon dips and springs back when it becomes the current one. */
.tab { transition: color 0.2s; }
.tab:active svg { transform: scale(0.9); }
.tab.pop svg { animation: tab-pop 0.38s var(--ease); }
@keyframes tab-pop {
  35% { transform: scale(0.84); }
  70% { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary, .btn-soft, .btn-delete, .action-cancel, .item-row, .icon-btn, .icon-btn svg, .head-add svg, .tab svg { transform: none !important; }
  .tab.pop svg { animation: none; }
}
