/* =========================================================
   Hydration (Water) — 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 and
   components unique to this app are declared here.
   ========================================================= */

/* =========================================================
   App shell — same shape as every other app in the suite, so the
   chrome (topbar, view scrolling, tab bar, sheet, settings page)
   reads identically across the whole product.
   ========================================================= */
html,
body {
  overflow: hidden;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

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

.topbar__subtitle {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--text-dim);
}

.topbar__subtitle-accent {
  color: var(--accent);
  font-weight: 650;
}

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

.gear-btn {
  flex: none;
  width: 44px;
  height: 44px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  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);
}

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

.gear-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);
}

.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);
  }
}

.view-head {
  padding: 6px 0 14px;
}

.view-head h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* =========================================================
   Ring hero — today's total against the daily goal. The one thing
   this screen exists to show, so it gets the room and the glow.
   ========================================================= */
.ring-hero {
  position: relative;
  width: min(58vw, 224px);
  aspect-ratio: 1 / 1;
  margin: 8px auto 16px;
}

.ring-hero__svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.ring-hero__track {
  fill: none;
  stroke: color-mix(in srgb, var(--text) 10%, transparent);
  stroke-width: 13;
}

.ring-hero__progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 13;
  stroke-linecap: round;
  stroke-dasharray: 603.19;
  stroke-dashoffset: 603.19;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 60%, transparent));
  transition: stroke-dashoffset 0.9s var(--ease);
}

.ring-hero__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.ring-hero__drop {
  width: 27px;
  height: 27px;
  color: var(--accent);
  filter: drop-shadow(0 3px 8px color-mix(in srgb, var(--accent) 55%, transparent));
  margin-bottom: 3px;
}

.ring-hero__value-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.ring-hero__value {
  font-family: var(--font-mono);
  font-size: clamp(30px, 10vw, 38px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ring-hero__unit {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dim);
}

.ring-hero__goal {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.ring-hero__goal-accent {
  color: var(--accent);
  font-weight: 650;
}

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

.ring-hero__pct {
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

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

/* =========================================================
   Panel tier — the quieter card treatment worn by non-hero surfaces:
   a top-edge sheen, a slight vertical gradient and one faint accent
   corner. Lit, but recessive, so it doesn't compete with the ring.
   ========================================================= */
.summary-card,
.stat,
.card {
  background:
    radial-gradient(80% 62px 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"] .summary-card,
:root[data-theme="light"] .stat,
:root[data-theme="light"] .card {
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.9),
    0 10px 24px -22px rgba(15, 23, 32, 0.5);
}

.card {
  padding: var(--card-pad);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* =========================================================
   Add Drink — the primary CTA. One tap logs the default serving
   size (set in Settings), no confirm step, no navigation.
   ========================================================= */
.add-drink {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px;
  margin: 0 0 18px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow:
    0 16px 34px -16px color-mix(in srgb, var(--accent) 85%, transparent),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.12s var(--ease);
}

.add-drink:active {
  transform: scale(0.98);
}

.add-drink__icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: var(--accent-strong);
}

/* ---- Quick preset circles ---- */
.preset-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 18px;
}

.preset {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s var(--ease);
}

.preset:active {
  transform: scale(0.92);
}

.preset__circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.preset:hover .preset__circle {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

/* The odd one out of the row — opens the custom-amount sheet rather than
   logging directly, so it reads as a different kind of action: a dashed
   ring instead of a filled glass glyph. */
.preset__circle--ghost {
  background: none;
  border-style: dashed;
  border-color: var(--border-strong);
}

.preset:hover .preset__circle--ghost {
  background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.preset__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

/* =========================================================
   Today's Summary
   ========================================================= */
.summary-card {
  border-radius: var(--radius-md);
  padding: 16px var(--card-pad);
  margin-bottom: 0;
}

.summary-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
}

.summary-card__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.summary-card__link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--accent);
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  min-width: 0;
}

.summary-stat svg {
  color: var(--accent);
}

.summary-stat__value {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

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

/* Today's drinks — lets a mis-tapped preset be corrected any time, not just
   in the few seconds before the log toast's Undo disappears. */
.entry-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 6px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.14s var(--ease);
}

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

.entry__time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.entry__amount {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.entry__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--text-faint);
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.entry__remove:hover {
  background: var(--surface-3);
  color: var(--bad);
}

/* =========================================================
   Stats view — quick numbers + a 7-day trend
   ========================================================= */
.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  padding: 13px var(--card-pad);
  border-radius: var(--radius-md);
}

.stat__value {
  display: block;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  display: block;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 3px;
}

.week-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 128px;
  padding-top: 18px;
}

.week-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  gap: 6px;
}

.week-col__bar {
  width: 100%;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--accent) 40%, var(--surface-3));
  position: relative;
  transition: height 0.45s var(--ease);
}

.week-col--current .week-col__bar {
  background: var(--accent);
}

.week-col__value {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  white-space: nowrap;
}

.week-col--current .week-col__value {
  color: var(--text-dim);
}

.week-col__label {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.week-col--current .week-col__label {
  color: var(--text);
  font-weight: 600;
}

.chart-empty {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 18px 0;
}

/* =========================================================
   Tab bar — floating pill, same construction across the suite.
   ========================================================= */
.tabbar {
  position: relative;
  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);
}

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

/* =========================================================
   Sheet (custom amount)
   ========================================================= */
.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));
  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;
}

/* ---- Custom-amount hero: a stepper either side of a big editable number,
   the same "hero" treatment as the ring gets on the main screen, so this
   sheet doesn't feel like an afterthought next to it. ---- */
.amount-hero {
  position: relative;
  padding: 22px 20px;
  margin-bottom: 14px;
  border-radius: 26px;
  background:
    radial-gradient(70% 130px at 50% 0%, color-mix(in srgb, var(--accent) 28%, 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) 26%, var(--border-strong));
  box-shadow:
    inset 0 1px 0 0 color-mix(in srgb, #fff 10%, transparent),
    0 14px 30px -22px color-mix(in srgb, var(--accent) 70%, transparent);
}

.amount-hero__stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.amount-hero__step {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-3);
  transition: transform 0.12s var(--ease);
}

.amount-hero__step:active {
  transform: scale(0.9);
}

.amount-hero__field {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 130px;
}

input.amount-hero__input {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  width: 110px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

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

input.amount-hero__input:focus,
input.amount-hero__input:focus-visible {
  outline: none;
}

.amount-hero__unit {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dim);
}

.sheet-clear {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 16px;
  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);
}

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

/* =========================================================
   Settings — full page. Identical construction to every other app's
   Settings so the product reads as one system.
   ========================================================= */
.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: 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;
}

.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;
  min-width: 0;
}

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

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

.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--stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.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: 64px;
}

/* base.css only styles input[type=...] — a bare <select> needs its own
   rule or it renders as an unstyled system dropdown. */
select.field-input {
  font-family: var(--font-ui);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  text-align: left;
  width: auto;
  cursor: pointer;
}

/* ---- Widget sync: endpoint/token fields, stacked full-width since a URL
   has no chance of fitting beside a label. Sits inside a settings group, so
   no border of its own — the group already provides the card. ---- */
.settings-stack {
  padding: 2px 16px 14px;
}

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

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

/* 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;
}

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

/* Full-width, centred action — same weight as the settings-action buttons. */
.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);
}

.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(--bad);
}

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

.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;
}

.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(--bad);
  transition: background 0.2s var(--ease);
}

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

.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(--bad);
  color: #1a0e0d;
}

/* =========================================================
   Toast — with an optional inline action (e.g. "Undo")
   ========================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 14px 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);
}

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

.toast__text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast__action {
  flex: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 6px;
}

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

/* =========================================================
   Short viewports
   ========================================================= */
@media (max-height: 640px) {
  .topbar {
    padding-top: calc(env(safe-area-inset-top) + 8px);
    padding-bottom: 6px;
  }

  .ring-hero {
    width: min(40vw, 150px);
    margin: 2px auto 8px;
  }
}
