/* =========================================================
   Workday — app-specific tokens & components.
   The shared design language (surfaces, text, accents, radii,
   fonts, spacing, themes) lives in ../../../shared/tokens.css,
   and the reset in ../../../shared/base.css. Only tokens unique
   to Workday are declared here.
   ========================================================= */
:root {
  /* -- day-status semantics (fixed across themes & accents) -- */
  --worked: #34D8A5;
  --worked-dim: rgba(52, 216, 165, 0.2);
  --off: #F97166;
  --off-dim: rgba(249, 113, 102, 0.2);
  --today: #A78BFA;
  --today-dim: rgba(167, 139, 250, 0.2);

  /* -- calendar & card metrics (adjusted under [data-compact]) -- */
  --grid-gap: 3px;
  --insight-pad: 22px;
}

/* Light theme needs darker steps of the same three hues: the dark-theme values
   are ~1.9:1 on white, which left the day numbers barely readable against
   their own tinted cells. These clear 5.4:1 on white and ~4:1 on the tint. */
:root[data-theme="light"] {
  --worked: #047857;
  --worked-dim: rgba(4, 120, 87, 0.2);
  --off: #C81E1E;
  --off-dim: rgba(200, 30, 30, 0.2);
  --today: #6D28D9;
  --today-dim: rgba(109, 40, 217, 0.2);
}

:root[data-compact="true"] {
  --grid-gap: 3px;
  --insight-pad: 16px;
}

/* =========================================================
   App shell
   ========================================================= */
/* App-shell scrolling: the page itself never scrolls, the active view does.
   The tab bar was `position: fixed`, and iOS Safari re-positions fixed elements
   mid-scroll as the address bar collapses — which is what made it drift over
   the content. As a flex child of a non-scrolling shell it simply can't move. */
html,
body {
  overflow: hidden;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  /* vh/dvh track the browser chrome and iOS misreports them in standalone
     PWAs, leaving dead space below the tab bar. html/body are height: 100%
     (shared/base.css) against the real viewport, so inheriting that avoids
     the toolbar math entirely. */
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 18px) var(--view-pad-x) 12px;
}

.topbar__title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
}

.more-btn {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}

.more-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.more-btn:active {
  transform: scale(0.92);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: var(--text-dim);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* =========================================================
   Views
   ========================================================= */
.view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px var(--view-pad-x) 16px;
  animation: view-in 0.28s var(--ease);
}

.view--hidden {
  display: none;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   Salary card (calendar tab) — figures on the left, month-progress ring on
   the right. Deliberately short so the calendar under it stays on screen.
   ========================================================= */
.salary-card {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px 15px 20px;
  margin-bottom: 12px;
  border-radius: 26px;
  background:
    radial-gradient(70% 130px at 0% 0%, color-mix(in srgb, var(--accent) 34%, transparent) 0%, transparent 72%),
    radial-gradient(60% 110px at 100% 100%, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 74%),
    linear-gradient(165deg, color-mix(in srgb, var(--text) 6%, var(--surface)) 0%, var(--surface) 60%);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border-strong));
  box-shadow:
    inset 0 1px 0 0 color-mix(in srgb, #fff 10%, transparent),
    0 16px 34px -26px color-mix(in srgb, var(--accent) 80%, transparent),
    var(--shadow-1);
}

.salary-card__main {
  flex: 1;
  min-width: 0;
}

.salary-card__eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.salary-card__amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.salary-card__amount {
  font-family: var(--font-mono);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.salary-card__eye {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  color: var(--text-faint);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.salary-card__eye:hover {
  color: var(--text-dim);
  background: var(--surface-2);
}

/* The slash only shows when the amount is hidden. */
.salary-card__eye-slash {
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.salary-card__eye[aria-pressed="true"] .salary-card__eye-slash {
  opacity: 1;
}

.salary-card__caption {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-dim);
}

.salary-card__rate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  transition: background 0.15s var(--ease), transform 0.12s var(--ease);
}

.salary-card__rate:hover {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

.salary-card__rate:active {
  transform: scale(0.96);
}

:root[data-theme="light"] .salary-card__rate {
  color: color-mix(in srgb, var(--accent) 62%, #000);
}

/* ---- Month-progress ring ---- */
.salary-ring {
  position: relative;
  flex: none;
  width: 102px;
  height: 102px;
}

.salary-ring__svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.salary-ring__track {
  fill: none;
  stroke: color-mix(in srgb, var(--text) 10%, transparent);
  stroke-width: 12;
}

.salary-ring__progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent));
  transition: stroke-dashoffset 0.9s var(--ease);
}

.salary-ring__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.salary-ring__value {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.salary-ring__label {
  font-size: 9.5px;
  color: var(--text-faint);
}

/* =========================================================
   Glow hero — the treatment worn by the Calendar tab's primary surface.
   Accent radial lights at the corners with a dark pool painted back over
   the middle, so the light reads as a rim and the content stays on a plain
   surface. Insights' forecast card wears a lower-intensity variant of it.
   ========================================================= */
.calendar-card {
  position: relative;
  isolation: isolate;
  padding: 14px 14px 16px;
  border-radius: 30px;
  background:
    radial-gradient(74% 64% at 50% 52%, var(--surface) 0%, var(--surface) 46%, transparent 92%),
    radial-gradient(50% 60% at 0% 0%, var(--accent) 0%, color-mix(in srgb, var(--accent) 55%, transparent) 30%, transparent 72%),
    radial-gradient(44% 54% at 100% 0%, color-mix(in srgb, var(--accent) 88%, transparent) 0%, color-mix(in srgb, var(--accent) 40%, transparent) 32%, transparent 72%),
    radial-gradient(64% 40% at 50% 104%, color-mix(in srgb, var(--accent) 45%, transparent) 0%, transparent 74%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow:
    inset 0 0 30px -12px color-mix(in srgb, var(--accent) 55%, transparent),
    inset 0 1px 0 0 color-mix(in srgb, #fff 14%, transparent),
    0 22px 48px -26px color-mix(in srgb, var(--accent) 85%, transparent),
    var(--shadow-2);
}

.calendar-card::before {
  content: "";
  position: absolute;
  inset: -18px;
  z-index: -1;
  border-radius: 44px;
  background:
    radial-gradient(44% 50% at 12% 12%, color-mix(in srgb, var(--accent) 80%, transparent) 0%, transparent 70%),
    radial-gradient(42% 48% at 92% 8%, color-mix(in srgb, var(--accent) 62%, transparent) 0%, transparent 70%),
    radial-gradient(58% 42% at 55% 102%, color-mix(in srgb, var(--accent) 45%, transparent) 0%, transparent 70%);
  filter: blur(22px);
  opacity: 0.95;
  pointer-events: none;
}

:root[data-theme="light"] .calendar-card::before {
  opacity: 0.5;
}

/* The calendar card is tall (a whole month grid) and dense — 31 tinted cells,
   some of them the accent's own hue. Percentage-sized corner lights would scale
   with that height and wash the grid, so here they're pinned to fixed pixel
   heights: the corner glow stays the same physical size as Budget's, and the
   middle of the card stays plain. */
.calendar-card {
  background:
    radial-gradient(60% 150px at 0% 0%, color-mix(in srgb, var(--accent) 70%, transparent) 0%, color-mix(in srgb, var(--accent) 26%, transparent) 34%, transparent 72%),
    radial-gradient(52% 130px at 100% 0%, color-mix(in srgb, var(--accent) 55%, transparent) 0%, color-mix(in srgb, var(--accent) 18%, transparent) 36%, transparent 72%),
    radial-gradient(72% 110px at 50% 100%, color-mix(in srgb, var(--accent) 30%, transparent) 0%, transparent 74%),
    var(--surface);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow:
    inset 0 0 30px -14px color-mix(in srgb, var(--accent) 35%, transparent),
    inset 0 1px 0 0 color-mix(in srgb, #fff 10%, transparent),
    0 22px 48px -28px color-mix(in srgb, var(--accent) 60%, transparent),
    var(--shadow-2);
}

.calendar-card::before {
  background:
    radial-gradient(46% 120px at 12% 0%, color-mix(in srgb, var(--accent) 60%, transparent) 0%, transparent 70%),
    radial-gradient(44% 105px at 90% 0%, color-mix(in srgb, var(--accent) 45%, transparent) 0%, transparent 70%),
    radial-gradient(58% 95px at 55% 100%, color-mix(in srgb, var(--accent) 32%, transparent) 0%, transparent 70%);
  opacity: 0.7;
}

:root[data-theme="light"] .calendar-card::before {
  opacity: 0.34;
}

/* ---- Month nav ---- */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 0 12px;
}

.month-nav__label {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  transition: background 0.15s var(--ease), transform 0.12s var(--ease);
}

.month-nav__label:hover {
  background: var(--surface-2);
}

.month-nav__label:active {
  transform: scale(0.96);
}

.month-nav__year {
  color: var(--text-dim);
}

/* ---- Weekday row ---- */
.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}

.weekday-row span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  text-transform: uppercase;
  padding-bottom: 6px;
}

.weekday-row span.weekday--muted {
  opacity: 0.55;
}

/* ---- Calendar grid ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--grid-gap);
}

.day-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  transition: background 0.15s var(--ease), transform 0.12s var(--ease), box-shadow 0.18s var(--ease), color 0.15s var(--ease);
}

.day-cell:hover {
  background: color-mix(in srgb, var(--text) 9%, transparent);
}

.day-cell:active {
  transform: scale(0.88);
}

.day-cell--pad {
  visibility: hidden;
}

.day-cell--inactive {
  color: var(--text-faint);
  opacity: 0.5;
  cursor: default;
}

.day-cell--inactive:active {
  transform: none;
}

/* Unlogged days that haven't happened yet — visually receded so they
   read differently from unlogged past days, which stay full-contrast
   since those may still need attention. */
.day-cell--future {
  color: var(--text-faint);
}

.day-cell--worked {
  background: color-mix(in srgb, var(--worked) 22%, transparent);
  color: var(--worked);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--worked) 40%, transparent);
}

.day-cell--worked:hover {
  background: color-mix(in srgb, var(--worked) 30%, transparent);
}

.day-cell--off {
  background: color-mix(in srgb, var(--off) 20%, transparent);
  color: var(--off);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--off) 38%, transparent);
}

.day-cell--off:hover {
  background: color-mix(in srgb, var(--off) 28%, transparent);
}

/* Both rings are inset so the today indicator never grows the cell's
   footprint — every cell in the grid stays exactly the same size. */
.day-cell--today {
  box-shadow: inset 0 0 0 2px var(--today), inset 0 0 0 5px var(--today-dim);
}

.day-cell--today.day-cell--worked {
  box-shadow: inset 0 0 0 2px var(--today), inset 0 0 0 5px color-mix(in srgb, var(--worked) 24%, transparent);
}

.day-cell--today.day-cell--off {
  box-shadow: inset 0 0 0 2px var(--today), inset 0 0 0 5px color-mix(in srgb, var(--off) 24%, transparent);
}

.day-cell__dot {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--today);
}

@keyframes day-flash {
  0% {
    transform: scale(0.82);
    opacity: 0.45;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.day-cell--just-set {
  animation: day-flash 0.32s var(--ease);
}

/* Only shown when you're off the current month. `display:none` rather than
   `opacity:0`, so it doesn't reserve 49px of layout space the rest of the
   time — that alone was what pushed the calendar tab into scrolling. */
.today-jump {
  display: none;
  margin: 14px auto 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--today);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--today-dim);
  transition: transform 0.18s var(--ease);
}

.today-jump--visible {
  display: block;
  animation: today-jump-in 0.22s var(--ease);
}

@keyframes today-jump-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.today-jump:active {
  transform: scale(0.94);
}

.today-jump--visible:active {
  transform: translateY(0) scale(0.94);
}

/* ---- Legend ---- */
.legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend__dot--worked {
  background: var(--worked);
}

.legend__dot--off {
  background: var(--off);
}

.legend__dot--today {
  background: transparent;
  box-shadow: inset 0 0 0 1.6px var(--today);
}

/* ---- Quick stats strip on calendar view ---- */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

/* =========================================================
   Secondary card surface — every non-hero card wears this. A top-edge sheen,
   a slight vertical gradient and one faint accent corner, so the cards read
   as lit without a full bloom competing with the hero above them.
   ========================================================= */
.quick-stat,
.insight-card,
.legend__item {
  background:
    radial-gradient(80% 60px at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 72%),
    linear-gradient(168deg, color-mix(in srgb, var(--text) 5%, var(--surface)) 0%, var(--surface) 62%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 0 color-mix(in srgb, #fff 7%, transparent),
    0 10px 26px -22px rgba(0, 0, 0, 0.9);
}

:root[data-theme="light"] .quick-stat,
:root[data-theme="light"] .insight-card,
:root[data-theme="light"] .legend__item {
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.8),
    0 10px 24px -22px rgba(15, 23, 32, 0.5);
}

.quick-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px var(--card-pad);
  border-radius: var(--radius-md);
}

.quick-stat__value {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.quick-stat:nth-child(1) .quick-stat__value {
  color: var(--worked);
}

.quick-stat:nth-child(2) .quick-stat__value {
  color: var(--off);
}

.quick-stat__label {
  font-size: 11.5px;
  color: var(--text-faint);
}

/* =========================================================
   Insights — three glass cards on a dark field: Forecast, Work sites,
   Notes. Generous radii and spacing, one figure per card that carries
   the meaning, and no number the Calendar tab already shows.
   ========================================================= */
.insight-card {
  position: relative;
  isolation: isolate;
  border-radius: 28px;
  padding: 22px var(--insight-pad) 24px;
  margin-top: 16px;
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  animation: insight-rise 0.42s var(--ease) backwards;
}

.insight-card:first-child {
  margin-top: 6px;
}

/* Cards arrive in sequence — a short, once-per-view cascade rather than
   anything that repeats on every re-render. */
.insight-card:nth-child(1) { animation-delay: 0.02s; }
.insight-card:nth-child(2) { animation-delay: 0.08s; }
.insight-card:nth-child(3) { animation-delay: 0.14s; }

@keyframes insight-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* The forecast card is the one the tab exists for, so it gets the accent
   rim and a soft bloom underneath — the same treatment the calendar wears
   on the other tab, at a lower intensity so the cards below still read. */
.insight-card--forecast {
  border-radius: 32px;
  padding-top: 24px;
  background:
    radial-gradient(78% 66% at 50% 56%, var(--surface) 0%, var(--surface) 44%, transparent 94%),
    radial-gradient(58% 150px at 0% 0%, color-mix(in srgb, var(--accent) 62%, transparent) 0%, color-mix(in srgb, var(--accent) 22%, transparent) 34%, transparent 74%),
    radial-gradient(50% 130px at 100% 0%, color-mix(in srgb, var(--accent) 48%, transparent) 0%, color-mix(in srgb, var(--accent) 16%, transparent) 36%, transparent 74%),
    radial-gradient(70% 110px at 50% 102%, color-mix(in srgb, var(--accent) 30%, transparent) 0%, transparent 74%),
    var(--surface);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  box-shadow:
    inset 0 0 34px -16px color-mix(in srgb, var(--accent) 45%, transparent),
    inset 0 1px 0 0 color-mix(in srgb, #fff 12%, transparent),
    0 24px 50px -30px color-mix(in srgb, var(--accent) 70%, transparent),
    var(--shadow-2);
}

.insight-card--forecast::before {
  content: "";
  position: absolute;
  inset: -16px;
  z-index: -1;
  border-radius: 46px;
  background:
    radial-gradient(46% 120px at 14% 0%, color-mix(in srgb, var(--accent) 58%, transparent) 0%, transparent 70%),
    radial-gradient(44% 105px at 88% 0%, color-mix(in srgb, var(--accent) 42%, transparent) 0%, transparent 70%);
  filter: blur(24px);
  opacity: 0.75;
  pointer-events: none;
}

:root[data-theme="light"] .insight-card--forecast::before {
  opacity: 0.36;
}

/* ---- Card header ---- */
.insight-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.insight-head__title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.insight-head__meta {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Pace pill: Ahead / On track / Behind ---- */
.pace-pill {
  flex: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--good) 34%, transparent);
}

.pace-pill[data-tone="steady"] {
  color: var(--text-dim);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border-color: var(--border-strong);
}

.pace-pill[data-tone="bad"] {
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 15%, transparent);
  border-color: color-mix(in srgb, var(--bad) 34%, transparent);
}

/* ---- Forecast figures ---- */
.forecast-hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.forecast-hero__value {
  font-family: var(--font-mono);
  font-size: clamp(34px, 11vw, 44px);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forecast-hero__label {
  font-size: 12.5px;
  color: var(--text-dim);
}

.forecast-trend {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 5px;
  margin-top: 12px;
  padding: 6px 11px 6px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 14%, transparent);
}

.forecast-trend[data-dir="down"] {
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 13%, transparent);
}

.forecast-trend[data-dir="flat"] {
  color: var(--text-dim);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.forecast-trend__arrow {
  font-size: 13px;
  line-height: 1;
}

.forecast-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

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

.forecast-metric + .forecast-metric {
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.forecast-metric__value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.forecast-metric__label {
  font-size: 11.5px;
  color: var(--text-faint);
}

.forecast-basis {
  margin: 18px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-faint);
}

/* ---- Empty states, shared by both list cards ---- */
.card-empty {
  margin: 0;
  padding: 6px 0 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* =========================================================
   Work sites — one row per site, bar length = share of the busiest
   site's days, so the leader always reads as full.
   ========================================================= */
.site-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.site-row__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 9px;
}

.site-row__name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-row--unassigned .site-row__name {
  color: var(--text-dim);
  font-weight: 550;
}

.site-row__badge {
  flex: none;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
}

:root[data-theme="light"] .site-row__badge {
  color: color-mix(in srgb, var(--accent) 62%, #000);
}

.site-row__value {
  margin-left: auto;
  flex: none;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-dim);
}

.site-row--top .site-row__value {
  color: var(--text);
}

.site-row__track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text) 8%, transparent);
  overflow: hidden;
}

.site-row__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), color-mix(in srgb, var(--accent) 75%, transparent));
  transition: width 0.7s var(--ease);
}

.site-row--top .site-row__fill {
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  box-shadow: 0 0 16px -4px color-mix(in srgb, var(--accent) 70%, transparent);
}

.site-row--unassigned .site-row__fill {
  background: color-mix(in srgb, var(--text) 22%, transparent);
}

.site-row__foot {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

/* =========================================================
   Notes timeline — a rail down the left with a node per entry.
   Collapsed rows preview two lines; tapping opens the full text.
   ========================================================= */
.note-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* The rail sits behind the nodes and stops short of the last one so it
   doesn't trail off into empty space. */
.note-list::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 14px;
  bottom: 18px;
  width: 1.5px;
  background: linear-gradient(180deg, var(--border-strong), transparent);
  pointer-events: none;
}

.note-list:has(.card-empty)::before {
  display: none;
}

.note-item {
  position: relative;
  padding-left: 22px;
}

.note-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--text) 28%, transparent);
  transition: box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.note-item--open::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.note-item__button {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  text-align: left;
  padding: 10px 12px 11px;
  border-radius: 16px;
  transition: background 0.18s var(--ease), transform 0.14s var(--ease);
}

.note-item__button:hover {
  background: color-mix(in srgb, var(--text) 5%, transparent);
}

.note-item__button:active {
  transform: scale(0.985);
}

.note-item--open .note-item__button {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.note-item__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.note-item__date {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  white-space: nowrap;
}

.note-item__site {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:root[data-theme="light"] .note-item__site {
  color: color-mix(in srgb, var(--accent) 62%, #000);
}

.note-item__body {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  /* Collapsed: two lines then an ellipsis. Open: the whole thing. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-item--open .note-item__body {
  display: block;
  overflow: visible;
  white-space: pre-wrap;
}

.note-item__edit {
  margin: 2px 0 6px 12px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  animation: note-expand 0.24s var(--ease);
  transition: transform 0.12s var(--ease);
}

.note-item__edit:active {
  transform: scale(0.95);
}

:root[data-theme="light"] .note-item__edit {
  color: color-mix(in srgb, var(--accent) 62%, #000);
}

@keyframes note-expand {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.note-more {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--text) 5%, transparent);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.12s var(--ease);
}

.note-more:hover {
  background: color-mix(in srgb, var(--text) 9%, transparent);
  color: var(--text);
}

.note-more:active {
  transform: scale(0.98);
}

/* ---- "Add note" pill in the card header ---- */
.pill-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px 8px 11px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  transition: background 0.15s var(--ease), transform 0.12s var(--ease);
}

.pill-btn:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.pill-btn:active {
  transform: scale(0.95);
}

:root[data-theme="light"] .pill-btn {
  color: color-mix(in srgb, var(--accent) 62%, #000);
}
/* =========================================================
   Tab bar
   ========================================================= */
/* Floating pill bar: inset from the edges, with the active tab marked by a
   filled pill that slides between positions. */
.tabbar {
  position: relative;
  /* anchors .tabbar__pill; no longer fixed — see .app */
  flex: none;
  width: calc(100% - var(--view-pad-x) * 2);
  max-width: calc(480px - var(--view-pad-x) * 2);
  margin: 0 auto calc(env(safe-area-inset-bottom) + 10px);
  height: 62px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
  z-index: 30;
}

.tabbar__pill {
  position: absolute;
  top: 6px;
  left: 6px;
  height: calc(100% - 12px);
  width: calc((100% - 12px) / 2);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  transform: translateX(calc(var(--tab-index, 0) * 100%));
  transition: transform 0.32s var(--ease);
  pointer-events: none;
}

.tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: var(--radius-pill);
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 600;
  transition: color 0.18s var(--ease);
}

.tab svg {
  transition: transform 0.15s var(--ease);
}

.tab:hover {
  color: var(--text-dim);
}

.tab:active svg {
  transform: scale(0.88);
}

.tab--active {
  color: var(--accent);
}

/* The accent tokens are dark-theme steps; on the light pill they'd sit around
   1.9:1, so darken whatever accent is set rather than hard-coding a colour. */
:root[data-theme="light"] .tab--active {
  color: color-mix(in srgb, var(--accent) 62%, #000);
}

/* =========================================================
   Sheet (day action picker)
   ========================================================= */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
  z-index: 40;
}

.sheet-backdrop--visible {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 30px 30px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  /* The site/note block makes this taller than a short phone; let the sheet
     scroll inside itself rather than run off the top of the screen. */
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-2);
  transform: translateY(105%);
  transition: transform 0.32s var(--ease);
  z-index: 50;
}

.sheet--visible {
  transform: translateY(0);
}

.sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  margin: 0 auto 16px;
}

.sheet__date {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 18px;
}

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

/* Same construction as Budget's category tiles: a tinted glyph badge over a
   label, on a rounded card. */
.sheet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 20px 8px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: transform 0.12s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.sheet-btn:active {
  transform: scale(0.95);
}

.sheet-btn__icon {
  font-size: 20px;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.sheet-btn--worked .sheet-btn__icon {
  background: color-mix(in srgb, var(--worked) 16%, transparent);
  color: var(--worked);
}

.sheet-btn--off .sheet-btn__icon {
  background: color-mix(in srgb, var(--off) 16%, transparent);
  color: var(--off);
}

.sheet-btn__value {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--worked);
  font-variant-numeric: tabular-nums;
  min-height: 14px;
}

/* Selected state is carried by fill, border and a glow together — never by
   colour alone. */
.sheet-btn--worked.sheet-btn--selected {
  border-color: color-mix(in srgb, var(--worked) 60%, transparent);
  background: linear-gradient(165deg, color-mix(in srgb, var(--worked) 30%, var(--surface-2)), color-mix(in srgb, var(--worked) 14%, var(--surface-2)));
  box-shadow: 0 10px 26px -14px color-mix(in srgb, var(--worked) 85%, transparent);
}

.sheet-btn--worked.sheet-btn--selected .sheet-btn__icon {
  background: var(--worked);
  color: var(--bg);
}

.sheet-btn--off.sheet-btn--selected {
  border-color: color-mix(in srgb, var(--off) 60%, transparent);
  background: linear-gradient(165deg, color-mix(in srgb, var(--off) 28%, var(--surface-2)), color-mix(in srgb, var(--off) 13%, var(--surface-2)));
  box-shadow: 0 10px 26px -14px color-mix(in srgb, var(--off) 85%, transparent);
}

.sheet-btn--off.sheet-btn--selected .sheet-btn__icon {
  background: var(--off);
  color: var(--bg);
}

/* ---- Site & note, below the two status buttons ---- */
.sheet-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.sheet-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sheet-field__label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.site-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.site-chip {
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.12s var(--ease);
}

.site-chip:active {
  transform: scale(0.94);
}

.site-chip--selected {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}

.site-chip--add {
  color: var(--accent);
  background: var(--accent-dim);
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}

:root[data-theme="light"] .site-chip--add {
  color: color-mix(in srgb, var(--accent) 62%, #000);
}

/* The inline "new site" field takes the chip's exact shape, so naming a site
   never pulls the user out to another screen. */
.site-chip--input {
  min-width: 140px;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
}

.sheet-note {
  width: 100%;
  min-height: 62px;
  resize: none;
  padding: 12px 14px;
  border-radius: 16px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.15s var(--ease);
}

.sheet-note::placeholder {
  color: var(--text-faint);
}

.sheet-note:focus {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.sheet-clear {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 12px;
  padding: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  transition: color 0.15s var(--ease), background 0.15s var(--ease), opacity 0.15s var(--ease);
}

.sheet-clear:hover {
  color: var(--text-dim);
  background: var(--surface-3);
}

.sheet-clear--hidden {
  visibility: hidden;
  opacity: 0;
}

/* =========================================================
   Settings — full page
   ========================================================= */
.view--settings {
  padding: 0 0 40px;
}

#settingsView:not(.view--hidden) {
  animation: settings-in 0.3s var(--ease);
}

@keyframes settings-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.settings-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(env(safe-area-inset-top) + 14px) 12px 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  z-index: 5;
  border-bottom: 1px solid var(--border);
}

.settings-head h2 {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.settings-head__spacer {
  width: 40px;
  flex-shrink: 0;
}

/* The view is the scroller now, so this no longer needs to clear the tab bar. */
.settings-scroll {
  padding: 10px var(--view-pad-x) 24px;
}

.settings-section {
  margin-top: 26px;
}

.settings-section:first-child {
  margin-top: 18px;
}

.settings-section__title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 4px 10px;
}

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

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

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

.settings-row--info {
  padding: 12px 16px;
}

.settings-row__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: block;
  /* Lets a long label wrap instead of shoving the control out of the row. */
  min-width: 0;
}

.settings-row__sub {
  font-weight: 400;
  color: var(--text-faint);
  font-size: 12px;
  margin-left: 4px;
}

.settings-row__hint {
  font-size: 12px;
  color: var(--text-faint);
  margin: 3px 0 0;
  line-height: 1.4;
  max-width: 40ch;
}

.settings-row__note {
  font-size: 11.5px;
  color: var(--text-faint);
  margin: -2px 16px 12px;
}

.settings-row__value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.settings-row__control {
  flex-shrink: 0;
}

.settings-row__control--split {
  display: flex;
  gap: 8px;
}

.settings-row__control--stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dependent row (e.g. Reminder time while the reminder toggle is off) —
   stays visible but reads as inactive rather than disappearing. */
.settings-row--dim {
  opacity: 0.45;
  pointer-events: none;
}

.field-input {
  font-size: 14px;
  padding: 9px 10px;
  width: 96px;
  text-align: right;
  -moz-appearance: textfield;
}

.field-input::-webkit-outer-spin-button,
.field-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-input--center {
  text-align: center;
  width: 56px;
}

/* Endpoint / token — free text, so these get the room a number doesn't need. */
.field-input--wide {
  width: 170px;
  text-align: left;
  font-size: 12.5px;
}

.currency-input {
  width: 52px;
  flex-shrink: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  padding: 9px 4px;
  border-radius: var(--radius-sm);
}

/* Daily wage & Saturday wage share this: one control, not a box next to a box.
   The wrapper owns the frame and the *only* focus ring — the input inside is
   bare, otherwise the shared base's `input:focus-visible` outline would paint a
   second accent ring inside the wrapper's accent border. Fixed width so both
   wage rows line up and a 3-character symbol ("CHF") can't widen the control
   into the label. */
.currency-field {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  /* A fixed width, not a percentage: the parent is shrink-to-fit, so a % here
     resolves against the control's own content and collapses the field. */
  width: 148px;
  height: 40px;
  padding: 0 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.currency-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.currency-field__prefix {
  flex: none;
  max-width: 42%;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  /* Clicks fall through to the wrapper, which focuses the input (settings.js). */
  pointer-events: none;
}

.currency-field .field-input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  text-align: right;
}

/* The single ring lives on the wrapper — suppress the input's own. */
.currency-field .field-input:focus,
.currency-field .field-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.stepper-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 600;
  background: var(--surface-3);
  border-radius: 50%;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease);
}

.stepper-btn:active {
  transform: scale(0.9);
}

.toggle {
  flex-shrink: 0;
  width: 46px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.12s var(--ease);
}

.toggle:active {
  transform: scale(0.94);
}

.toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.2s var(--ease), background 0.18s var(--ease);
}

.toggle--on {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle--on .toggle__thumb {
  transform: translateX(18px);
  background: var(--accent);
}

.segmented {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.segmented__btn {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.12s var(--ease);
}

.segmented__btn:active {
  transform: scale(0.94);
}

.segmented__btn--active {
  background: var(--accent-dim);
  color: var(--accent);
}

.segmented--settings { margin: 0 0 14px; }
.segmented--settings .segmented__btn { flex: 1; text-align: center; }

.accent-group {
  display: flex;
  gap: 10px;
}

.accent-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  position: relative;
  transition: transform 0.12s var(--ease);
}

.accent-swatch:active {
  transform: scale(0.88);
}

.accent-swatch[data-value="teal"] {
  background: #34D8A5;
}

.accent-swatch[data-value="violet"] {
  background: #A78BFA;
}

.accent-swatch[data-value="blue"] {
  background: #5B9CF6;
}

.accent-swatch[data-value="amber"] {
  background: #F5B95B;
}

.accent-swatch[data-value="rose"] {
  background: #FB7BA8;
}

.accent-swatch.segmented__btn--active::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
}

.settings-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.15s var(--ease);
}

.settings-group>.settings-action:last-child {
  border-bottom: none;
}

.settings-action:hover {
  background: var(--surface-2);
}

.settings-action:active {
  background: var(--surface-3);
}

.settings-action__hint {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
}

.settings-action--danger {
  color: var(--off);
}

.settings-action__hint--danger {
  color: var(--off);
  opacity: 0.8;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
  transition: background 0.2s var(--ease);
}

.status-dot--online {
  background: var(--worked);
}

.settings-static {
  padding: 14px 16px;
}

.settings-static+.settings-static {
  border-top: 1px solid var(--border);
}

.settings-static__title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
}

.settings-static__body {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}

.changelog {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.changelog li {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

.changelog__version {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  margin-right: 6px;
}

/* =========================================================
   Confirm dialog
   ========================================================= */
.confirm {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(340px, calc(100vw - 48px));
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-2);
  transform: translate(-50%, -46%) scale(0.94);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s var(--ease), opacity 0.18s var(--ease);
  z-index: 60;
  text-align: center;
}

.confirm--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.confirm__title {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0 0 8px;
}

.confirm__body {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 18px;
}

.confirm__actions {
  display: flex;
  gap: 8px;
}

.confirm-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.12s var(--ease), filter 0.15s var(--ease);
}

.confirm-btn:active {
  transform: scale(0.96);
}

.confirm-btn--ghost {
  background: var(--surface-3);
  color: var(--text-dim);
}

.confirm-btn--danger {
  background: var(--off);
  color: #1a0e0d;
}

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 70;
  max-width: calc(100vw - 40px);
  text-align: center;
}

.toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================================================
   Stacked form field — for values too long to sit beside a label
   (endpoints, tokens). Label above, input full width.
   ========================================================= */
/* Stacked field — only where a value is too long to sit beside a label
   (endpoints, tokens). Sits inside a settings group, so no border of its own;
   the group already provides the card. */
.settings-stack {
  padding: 2px 16px 14px;
}

.field { margin-top: 14px; }
.field:first-of-type { margin-top: 4px; }

.field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

input.field__input {
  display: block;
  width: 100%;
  height: 42px;
  padding: 0 13px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

input.field__input::placeholder {
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 13px;
}

input.field__input:focus,
input.field__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* The reveal sits inside the field, so the token reads as one control rather
   than an input with a mystery button bolted to its side. */
.field__group {
  position: relative;
}

input.field__input--reveal {
  padding-right: 44px;
}

.field__reveal {
  position: absolute;
  top: 50%;
  right: 3px;
  transform: translateY(-50%);
  width: 38px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-faint);
  background: none;
  border: none;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.field__reveal:hover {
  color: var(--text);
  background: var(--surface-3);
}

.field__reveal-slash {
  opacity: 1;
  transition: opacity 0.15s var(--ease);
}

.field__reveal[aria-pressed="true"] {
  color: var(--accent);
}

.field__reveal[aria-pressed="true"] .field__reveal-slash {
  opacity: 0;
}

.settings-stack--foot {
  padding-top: 14px;
}

/* Full-width, centred action — the same weight as Budget's ghost buttons, so
   the two apps' Widget sync cards read identically. */
.btn-wide {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: background 0.15s var(--ease), transform 0.12s var(--ease);
}

.btn-wide:hover {
  background: var(--surface-3);
}

.btn-wide:active {
  transform: scale(0.98);
}

.btn-wide[disabled] {
  opacity: 0.55;
}

/* A quiet line closing the card, rather than a wall of text opening it. */
.settings-caption {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-faint);
}

/* Install is the one action in Settings worth leading with. */
.settings-action--install {
  color: var(--accent);
  background: var(--accent-dim);
}

:root[data-theme="light"] .settings-action--install {
  color: color-mix(in srgb, var(--accent) 62%, #000);
}

.install-help {
  margin: 8px 0 0;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.install-help b {
  color: var(--text);
  font-weight: 650;
}

/* =========================================================
   Short viewports — the calendar tab is the tallest screen in the app (salary
   card + 6-row grid + legend + stats). On a shorter phone, tighten the
   surrounding chrome rather than the calendar itself, so the primary action
   stays fully visible without scrolling.
   ========================================================= */
@media (max-height: 830px) {
  .topbar {
    padding-top: calc(env(safe-area-inset-top) + 10px);
    padding-bottom: 8px;
  }

  .topbar__title {
    font-size: 28px;
  }

  .view {
    padding-bottom: 8px;
  }

  .salary-card {
    padding: 12px 16px 12px 18px;
    margin-bottom: 10px;
  }

  .salary-card__amount {
    font-size: 22px;
  }

  .salary-card__rate {
    margin-top: 9px;
    padding: 6px 11px;
  }

  .salary-ring {
    width: 88px;
    height: 88px;
  }

  .salary-ring__value {
    font-size: 17px;
  }

  .legend {
    margin-top: 9px;
  }

  .legend__item {
    padding: 6px 11px;
  }

  .quick-stats {
    margin-top: 9px;
  }

  .quick-stat {
    padding: 10px 13px;
  }

  .quick-stat__value {
    font-size: 19px;
  }
}

/* =========================================================
   Small screens
   ========================================================= */
@media (max-width: 340px) {
  .day-cell {
    font-size: 12.5px;
  }

  .forecast-hero__value {
    font-size: 30px;
  }
}