/*
  RYTAVO base styles (Rytavo.UI). Mobile-first, light/dark, shared with a future MAUI Blazor Hybrid host.
  Colors come from the approved identity v3_Original: the host must load brand/rytavo/rytavo.tokens.css first.
  Theme = system preference, overridable by <html data-theme="light|dark"> (single mechanism).
*/

:root {
  color-scheme: light dark;

  /* UI text font stays the system stack; the Lato recommendation in the tokens is a separate change. */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-s: 10px;
  --radius-m: var(--rytavo-radius-control);
  --radius-l: var(--rytavo-radius-card);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --tap: 48px;
  --nav-height: 68px;
  --rail-width: 232px;
  --content-width: 560px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --bg: var(--rytavo-bg);
  --surface: var(--rytavo-surface);
  --surface-2: color-mix(in srgb, var(--rytavo-border) 40%, var(--rytavo-surface));
  --text: var(--rytavo-text);
  --text-muted: var(--rytavo-muted);
  --line: var(--rytavo-border);
  --accent: var(--rytavo-action);
  --accent-contrast: var(--rytavo-on-action);
  --accent-soft: color-mix(in srgb, var(--rytavo-action) 14%, var(--rytavo-surface));
  --focus: var(--rytavo-focus);
  --brand-gradient: var(--rytavo-decorative-gradient);
  /* Not part of the brand tokens; kept for error states. */
  --danger: #c0352b;
  --warning: #8a5300;
  --ok: #1e7a46;
  --shadow: 0 1px 2px rgb(16 30 50 / .04), 0 8px 24px rgb(16 30 50 / .06);
}

/*
  rytavo.tokens.css defines dark values only for [data-theme="dark"]. The same values are mirrored here for the
  system dark preference. Keep in sync with the tokens file (guarded by BrandTokensTests).
*/
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --rytavo-bg: #0B1424;
    --rytavo-surface: #142138;
    --rytavo-text: #F5F7FC;
    --rytavo-muted: #B5C3D7;
    --rytavo-border: #344762;
    --rytavo-action: #8CAEFF;
    --rytavo-on-action: #101E32;
    --rytavo-focus: #8CAEFF;
    --danger: #ff8a80;
    --warning: #ffcc80;
    --ok: #86d9a3;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  --danger: #ff8a80;
  --warning: #ffcc80;
  --ok: #86d9a3;
  --shadow: none;
}

/* Habit colors are chosen for light surfaces; on dark ones they are lifted towards the text color to stay visible. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [style*="--habit-color"] { --habit-accent: color-mix(in srgb, var(--habit-color) 62%, var(--text)); }
}
:root[data-theme="dark"] [style*="--habit-color"] { --habit-accent: color-mix(in srgb, var(--habit-color) 62%, var(--text)); }

/* Logo: show the Primary artwork on light, the Negative artwork on dark backgrounds. */
.brand-logo { display: inline-block; width: var(--brand-logo-width, 160px); max-width: 100%; line-height: 0; }
.brand-logo__img { display: block; width: 100%; height: auto; object-fit: contain; }
.brand-logo__img--dark { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo__img--light { display: none; }
  :root:not([data-theme="light"]) .brand-logo__img--dark { display: block; }
}

:root[data-theme="dark"] .brand-logo__img--light { display: none; }
:root[data-theme="dark"] .brand-logo__img--dark { display: block; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Headings receive programmatic focus after navigation (FocusOnNavigate); they are not interactive. */
h1:focus { outline: none; }

.icon { flex: none; display: block; }

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-s);
}
.skip-link:focus { top: var(--space-3); }

/* ---------- App shell ---------- */

.app__main {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4)
           calc(var(--nav-height) + var(--space-6) + env(safe-area-inset-bottom));
  outline: none;
}

/* Mobile top bar with the NoTagline wordmark (min. 160 px wide). */
.app-bar {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-3) 0;
}
.app-bar__home, .bottom-nav__brand, .brand-bar__home { display: inline-block; border-radius: var(--radius-s); line-height: 0; }

/* Signed-out pages: the same wordmark in every language, claim as localized text; the artwork includes its protective zone. */
.brand-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  max-width: var(--content-width);
  margin: 0 auto;
  padding: calc(var(--space-5) + env(safe-area-inset-top)) var(--space-3) var(--space-2);
  text-align: center;
}
.brand-bar__claim, .brand-lockup__claim { margin: 0; color: var(--text-muted); font-size: .95rem; line-height: 1.35; }
.brand-lockup { display: inline-flex; flex-direction: column; align-items: center; gap: var(--space-1); max-width: 100%; text-align: center; }

.bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(2, 1fr) auto repeat(2, 1fr);
  align-items: center;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 0 var(--space-2) env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
}
.bottom-nav__brand { display: none; }

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-s);
}
.bottom-nav__item.active { color: var(--accent); }
.bottom-nav__item--rail { display: none; }

.bottom-nav__add {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 var(--space-3);
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  cursor: pointer;
  transition: transform .15s var(--ease);
}
.bottom-nav__add:active { transform: scale(.94); }
.bottom-nav__add-label { display: none; }

@media (min-width: 960px) {
  .app-bar { display: none; }
  .bottom-nav {
    inset: 0 auto 0 0;
    width: var(--rail-width);
    height: auto;
    padding: var(--space-5) var(--space-4);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-1);
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .bottom-nav__brand { display: inline-block; order: -2; align-self: flex-start; margin: 0 0 var(--space-5); }
  .bottom-nav__item {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    min-height: var(--tap);
    padding: 0 var(--space-3);
    font-size: .95rem;
  }
  .bottom-nav__item:hover { background: var(--surface-2); }
  .bottom-nav__item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
  .bottom-nav__item--rail { display: flex; }
  .bottom-nav__add {
    order: -1;
    display: flex;
    justify-content: flex-start;
    gap: var(--space-3);
    width: auto;
    height: var(--tap);
    margin: 0 0 var(--space-4);
    padding: 0 var(--space-4);
    border-radius: 999px;
    font-weight: 650;
  }
  .bottom-nav__add-label { display: inline; }
  .app__main {
    padding-top: var(--space-6);
    padding-bottom: var(--space-7);
    padding-left: calc(var(--rail-width) + var(--space-5));
    max-width: calc(var(--content-width) + var(--rail-width) + var(--space-5));
  }
  /* Signed out there is no rail: the content sits centred under the logo (0.9.21). */
  .brand-bar ~ .app__main { padding-left: var(--space-4); max-width: var(--content-width); }
}

/* ---------- Page elements ---------- */

.page { display: flex; flex-direction: column; gap: var(--space-5); }
.page--loading { min-height: 50vh; }

.page-header { display: flex; flex-direction: column; gap: var(--space-1); }
.page-title { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.page-subtitle { color: var(--text-muted); }

.eyebrow {
  color: var(--text-muted);
  font-size: .95rem;
  font-weight: 500;
}
/* Czech capitalizes only the first word ("Středa 23. září"), so no text-transform: capitalize. */
.eyebrow::first-letter { text-transform: uppercase; }

.hint, .app-version { color: var(--text-muted); font-size: .85rem; text-align: center; }

.notice {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-m);
  background: var(--surface-2);
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.badge {
  padding: 2px var(--space-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-2); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.button:focus-visible { outline-offset: 3px; }
.button--ghost { background: transparent; color: var(--danger); border: 1px solid var(--line); }

/* ---------- Today ---------- */

.day-hero { display: flex; flex-direction: column; gap: var(--space-2); }

.day-switcher {
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap);
  align-items: center;
  margin: 0 calc(-1 * var(--space-3));
}
.day-switcher__label {
  justify-self: center;
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
}
.day-switcher__label.is-today { background: var(--text); color: var(--bg); }

.big-number {
  font-size: clamp(3rem, 15.5vw, 4.25rem);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.big-number__total { color: var(--text-muted); font-weight: 500; font-size: .5em; letter-spacing: -.01em; }
.day-hero__score { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-3); }
.day-hero__meta { color: var(--text-muted); }
.day-hero__meta strong { color: var(--text); }
.day-hero .progress { margin-top: var(--space-1); }

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: var(--brand-gradient);
  transition: width .4s var(--ease);
}

.habit-list, .day-list, .sheet__list, .occurrence-list { list-style: none; margin: 0; padding: 0; }
.habit-list { display: flex; flex-direction: column; gap: var(--space-2); }

.habit-section { display: flex; flex-direction: column; gap: var(--space-2); }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.section-title { font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.section-hint { color: var(--text-muted); font-size: .85rem; }

/* Quotas and measurements: same data, quieter than the scored daily habits. */
.habit-section--secondary { gap: var(--space-1); margin-top: calc(-1 * var(--space-2)); }
.section-header--inline { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; gap: 0 var(--space-2); padding: 0 var(--space-1); }
.habit-section--secondary .section-title { font-size: .72rem; letter-spacing: .08em; }
.habit-section--secondary .section-hint { font-size: .78rem; }
.habit-section--secondary .section-hint::before { content: "· "; }
.habit-section--secondary .habit-row { background: color-mix(in srgb, var(--surface) 65%, var(--bg)); }
.habit-section--secondary .habit-row__line { min-height: 56px; padding-block: var(--space-1); }
.habit-section--secondary .habit-row__icon { width: 34px; height: 34px; border-radius: 10px; }
.habit-section--secondary .habit-row__name { font-size: .95rem; }

.habit-row {
  --habit-accent: var(--habit-color, var(--accent));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.habit-row__line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 60px;
  padding: 6px var(--space-3) 6px var(--space-2);
}
.habit-row__main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: var(--space-1) var(--space-2);
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
div.habit-row__main { cursor: default; }
button.habit-row__main:hover, a.habit-row__main:hover { background: var(--surface-2); }
.habit-row__chevron { color: var(--text-muted); margin-left: auto; }
.habit-row.is-paused .habit-row__icon { filter: grayscale(1); opacity: .7; }
.habit-row.is-saving { border-color: color-mix(in srgb, var(--habit-accent) 50%, var(--line)); }
.habit-row__problem {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) var(--space-4) var(--space-3);
  border-top: 1px solid var(--line);
  color: var(--danger);
  font-size: .85rem;
}
.habit-row__problem.is-conflict { color: var(--text-muted); }
.habit-row__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--habit-accent) 14%, transparent);
  color: var(--habit-accent);
}
.habit-row__body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.habit-row__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habit-row__meta { color: var(--text-muted); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* Day note (0.8.1): a small secondary icon beside the quick action; the row keeps its height. */
.note-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: var(--tap);
  margin: 0 -2px 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
button.note-toggle:hover { background: var(--surface-2); color: var(--text); }
.note-toggle.has-note { color: var(--habit-accent); }
.note-toggle.has-note::after {
  content: "";
  position: absolute;
  top: 11px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--habit-accent);
  box-shadow: 0 0 0 2px var(--surface);
}
.habit-section--secondary .note-toggle.has-note::after { box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 65%, var(--bg)); }
span.note-toggle { cursor: default; }

/* Sharing indicator (0.9.3): the quiet language of the note icon; a small count never grows the row. */
.share-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: var(--tap);
  margin: 0 -2px 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
}
.share-toggle:hover { background: var(--surface-2); color: var(--text); }
.share-toggle__count {
  position: absolute;
  top: 7px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: .64rem;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.share-contexts { display: flex; flex-direction: column; gap: var(--space-1); padding: 0 var(--space-1); }
.share-context {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-m);
  color: var(--text);
  text-decoration: none;
}
.share-context:hover { background: var(--surface-2); }
.share-context__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.share-context__people { font-weight: 650; overflow-wrap: anywhere; }
.share-context__meta { color: var(--text-muted); font-size: .85rem; }
.share-context__action { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 650; font-size: .9rem; white-space: nowrap; }

/* Done state uses fill + check mark, not color alone. */
.habit-row__status {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: none;
}
.habit-row.is-done .habit-row__status {
  border-color: var(--habit-accent);
  background: var(--habit-accent);
  color: var(--accent-contrast);
}
.habit-row.is-done .habit-row__name { color: var(--text-muted); }

/* Quick actions: at least 48 px targets; the done state uses fill + check mark, not color alone. */
.check-button, .step-button, .chip-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: var(--tap);
  height: var(--tap);
  border: 2px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform .12s var(--ease), background-color .15s var(--ease);
}
.check-button { width: var(--tap); border-radius: 50%; }
.check-button[aria-pressed="true"] { border-color: var(--habit-accent); background: var(--habit-accent); color: var(--accent-contrast); }
.step-button, .chip-button { padding: 0 var(--space-3); border-color: color-mix(in srgb, var(--habit-accent) 45%, var(--line)); color: var(--habit-accent); }
.chip-button { font-weight: 650; }
.check-button:hover, .step-button:hover, .chip-button:hover { background: color-mix(in srgb, var(--habit-accent) 10%, transparent); }
.check-button[aria-pressed="true"]:hover { background: var(--habit-accent); }
.check-button:active, .step-button:active, .chip-button:active { transform: scale(.94); }
.check-button:disabled, .step-button:disabled, .chip-button:disabled { cursor: progress; opacity: .7; }

.badge--ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 2 * var(--space-4));
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4);
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  animation: sheet-in .2s var(--ease);
}
/* 0.9.6: with an open bottom sheet the toast moves to the top, above the backdrop, so it covers no form and Undo stays usable. */
body:has(.sheet) .toast {
  top: calc(var(--space-3) + env(safe-area-inset-top));
  bottom: auto;
  z-index: 45;
}
.toast__action {
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
@media (min-width: 960px) {
  .toast { bottom: var(--space-5); left: calc(50% + var(--rail-width) / 2); }
}

.page-actions { display: flex; justify-content: center; }
.page-actions--quiet { margin-top: calc(-1 * var(--space-2)); }
.link {
  padding: var(--space-2);
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
/* Inside running text the side padding shows as a gap before the following full stop. */
p .link, label .link { padding-inline: 0; }
.link--quiet {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 45%, transparent);
}
.link--quiet:hover { color: var(--text); }
.back-link { display: inline-flex; align-items: center; gap: var(--space-1); align-self: flex-start; color: var(--text-muted); font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--text); }
.page-header--actions { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form__title { font-size: 1rem; font-weight: 700; }
.form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-4); }
.form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.form__actions--end { justify-content: flex-end; }
.form--add { padding-top: var(--space-4); border-top: 1px solid var(--line); }

.fieldset { display: flex; flex-direction: column; gap: var(--space-4); margin: 0; padding: var(--space-4) var(--space-5) var(--space-5); min-width: 0; }
.fieldset:disabled { opacity: .65; }
.fieldset__legend { float: left; width: 100%; padding: 0; font-size: 1rem; font-weight: 700; }
.fieldset__legend + * { clear: both; }

.field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.field__label { font-weight: 600; font-size: .95rem; }
.field__optional { color: var(--text-muted); font-weight: 400; font-size: .85rem; }
/* A plain space collapses with a source space when there is one and adds it when Razor trimmed it. */
.field__optional::before { content: " "; }
.field__help { color: var(--text-muted); font-size: .85rem; }
.field__error { color: var(--danger); font-size: .85rem; font-weight: 600; }
.field__input-row { display: flex; align-items: center; gap: var(--space-2); }
.field__unit { color: var(--text-muted); font-weight: 600; }

.input {
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  border: 1px solid color-mix(in srgb, var(--text) 35%, var(--line));
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
}
.input:focus-visible { outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.input:disabled { background: var(--surface-2); }
.input--number { max-width: 10rem; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.input--time { max-width: 9rem; font-variant-numeric: tabular-nums; }
.input--short { max-width: 7rem; }
.input--area { resize: vertical; min-height: 4.5rem; }
select.input { cursor: pointer; }

.button--quiet { background: transparent; color: var(--text); border: 1px solid var(--line); }
.button--quiet:hover { background: var(--surface-2); }
.button--danger { background: var(--danger); color: #fff; }
.button--small { min-height: 40px; padding: 0 var(--space-4); font-size: .9rem; }
.button:disabled { opacity: .6; cursor: progress; }

.status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); font-size: .9rem; }
.status--busy { color: var(--text-muted); }
.status--ok { color: var(--ok); font-weight: 600; }
.status--warning { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); }
.status--error { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); color: var(--text); }
/* Conflict: clear but calm – nothing is broken, the latest state just has to be loaded. */
.status--conflict { flex-wrap: nowrap; align-items: flex-start; background: var(--surface-2); color: var(--text); }
.status--conflict .status__icon { flex: none; margin-top: 2px; color: var(--text-muted); }
.status--conflict p { flex: 1; }
.status--conflict .link { flex: none; align-self: center; padding: var(--space-2) 0 var(--space-2) var(--space-2); white-space: nowrap; }
@media (max-width: 420px) {
  .status--conflict { flex-wrap: wrap; }
  .status--conflict p { flex-basis: calc(100% - 30px); }
  .status--conflict .link { margin-left: 26px; padding-left: 0; }
}
.status ul { margin: 0; padding-left: var(--space-5); }
.form-errors { flex-direction: column; align-items: flex-start; outline: none; }
.form-errors:focus-visible { outline: 3px solid var(--focus); }

.notice--info { display: flex; flex-direction: column; gap: var(--space-2); color: var(--text); }
.notice--compact { gap: var(--space-1); padding: var(--space-3) var(--space-4); font-size: .88rem; }
.notice__warning { color: var(--warning); font-weight: 600; }

.confirm-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.confirm-box { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-m); background: var(--surface-2); }

/* 0.9.4: archived habit detail and the danger zone of permanent delete (icon + heading, not colour alone). */
.summary-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); margin: 0; }
.summary-list dt { margin-top: var(--space-2); color: var(--text-muted); font-size: .85rem; font-weight: 600; }
.summary-list dt:first-child { margin-top: 0; }
.summary-list dd { margin: 0; overflow-wrap: anywhere; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.danger-zone .fieldset__legend { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--danger); }
.confirm-box--danger { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.danger-zone__counts, .danger-zone__links { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
.danger-zone__links .is-blocking { color: var(--danger); font-weight: 600; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.segmented__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 56px;
  border: 2px solid var(--line);
  border-radius: var(--radius-m);
  background: transparent;
  font-weight: 650;
  cursor: pointer;
}
.segmented__option[aria-pressed="true"] { border-color: var(--habit-accent, var(--accent)); background: color-mix(in srgb, var(--habit-accent, var(--accent)) 14%, transparent); }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--line);
  border-radius: var(--radius-m);
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: inherit; }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.choice.is-disabled { cursor: not-allowed; opacity: .6; }
.choice.is-disabled.is-selected { opacity: 1; }
.choice__title { font-weight: 700; }
.choice__text { color: var(--text-muted); font-size: .8rem; line-height: 1.35; }

.weekday-picker { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.weekday {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 2px solid var(--line);
  border-radius: 50%;
  font-weight: 700;
  cursor: pointer;
}
.weekday input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.weekday:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.weekday.is-selected { border-color: var(--accent); background: var(--accent); color: var(--accent-contrast); }

.icon-picker, .color-picker { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.icon-picker__option, .color-picker__option {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 2px solid var(--line);
  border-radius: var(--radius-s);
  cursor: pointer;
}
.icon-picker__option input, .color-picker__option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-picker__option:has(input:focus-visible), .color-picker__option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.icon-picker__option.is-selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.icon-picker__more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  align-self: flex-start;
  min-height: 40px;
  margin-top: var(--space-2);
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--accent);
  font-weight: 650;
  cursor: pointer;
}
.icon-picker__more:hover { background: var(--accent-soft); }
.pick-row--setting { margin-top: var(--space-2); padding-inline: 0; border-radius: var(--radius-s); }
.pick-row--setting .habit-row__name { white-space: normal; }
.color-picker__option { border-radius: 50%; background: var(--swatch, var(--accent)); border-color: transparent; }
.color-picker__option.is-default { background: var(--brand-gradient); }
.color-picker__option.is-selected { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.color-picker__custom { background: var(--swatch, var(--surface-2)); border: 2px dashed var(--line); color: var(--text-muted); }
.color-picker__custom.is-selected { border-color: transparent; }

/* Collapsible form sections (accordion). */
.habit-form { gap: var(--space-3); }
.fold { overflow: hidden; }
.fold.has-error { border-color: var(--danger); }
.fold__heading { margin: 0; font-size: 1rem; }
.fold__toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 20px;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 56px;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-5);
  border: 0;
  background: transparent;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.fold__toggle:hover { background: var(--surface-2); }
.fold__toggle:focus-visible { outline-offset: -3px; }
.fold__summary { grid-column: 2; justify-self: end; max-width: 100%; overflow: hidden; color: var(--text-muted); font-size: .88rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.fold__chevron { grid-column: 3; color: var(--text-muted); transition: transform .2s var(--ease); }
.fold.is-open .fold__chevron { transform: rotate(180deg); }
.fold__panel { display: flex; flex-direction: column; gap: var(--space-4); padding: 0 var(--space-5) var(--space-5); }
.fieldset-plain { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldset-plain:disabled { opacity: .65; }
.fieldset-plain > legend:not(.visually-hidden) { float: left; width: 100%; padding: 0; }
.fieldset-plain > legend:not(.visually-hidden) + * { clear: both; }
.type-locked { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.type-locked__value { font-weight: 700; }
.appearance-summary { --habit-accent: var(--habit-color, var(--accent)); display: inline-flex; align-items: center; gap: var(--space-2); }
.appearance-summary__icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--habit-accent) 14%, transparent); color: var(--habit-accent); }

.icon-button:disabled { opacity: .35; cursor: default; }
.icon-button:disabled:hover { background: transparent; }

/* Habit order (0.8.3): compact rows; only the grip starts a drag, so the page still scrolls everywhere else. */
.reorder-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--space-3); min-height: 24px; margin-bottom: var(--space-2); }
.reorder-bar__state { display: inline-flex; align-items: center; gap: 4px; margin: 0; color: var(--text-muted); font-size: .8rem; }
.reorder-bar__state.is-saved { color: var(--ok); font-weight: 600; }
.reorder-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; -webkit-user-select: none; user-select: none; }
.reorder-item {
  --habit-accent: var(--habit-color, var(--accent));
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 52px;
  padding: 0 2px 0 var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.reorder-item.is-shifting, .reorder-item.is-settling { transition: transform .16s var(--ease); }
.reorder-item.is-dragging {
  z-index: 5;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 10px 24px rgb(16 30 50 / .16), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
  cursor: grabbing;
}
.reorder-item.is-settling { z-index: 5; }
.reorder-item__icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: color-mix(in srgb, var(--habit-accent) 14%, transparent); color: var(--habit-accent); }
.reorder-item__name { flex: 1; min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.reorder-move, .reorder-handle { flex: none; display: grid; place-items: center; height: 48px; padding: 0; border: 0; border-radius: var(--radius-s); background: transparent; color: var(--text-muted); cursor: pointer; }
.reorder-move { width: 32px; opacity: .7; }
.reorder-move:hover:not(:disabled), .reorder-handle:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.reorder-move:disabled { opacity: .2; cursor: default; }
.reorder-handle { width: 44px; color: var(--text); touch-action: none; cursor: grab; }
.reorder-item.is-dragging .reorder-handle { cursor: grabbing; color: var(--accent); }
.reorder-move:focus-visible, .reorder-handle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.reorder-list[data-busy] .reorder-handle { cursor: progress; }

/* ---------- Entry sheet ---------- */

.sheet--form { --habit-accent: var(--habit-color, var(--accent)); max-height: 92dvh; overflow-y: auto; }
.sheet__heading { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.sheet__subtitle { color: var(--text-muted); font-size: .85rem; }
.sheet__subtitle::first-letter { text-transform: uppercase; }
.sheet__body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-1) var(--space-2) 0; }
.sheet__goal { color: var(--text-muted); font-size: .9rem; }
.sheet__status:empty { display: none; }

.occurrence-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.occurrence { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4); }
.occurrence + .occurrence { border-top: 1px solid var(--line); }
.occurrence__time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.5rem; }
.occurrence__amount { flex: 1; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.occurrence__edit { display: flex; flex-direction: column; gap: var(--space-3); width: 100%; padding: var(--space-2) 0; }

/* ---------- History ---------- */

.day-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.day-list li + li { border-top: 1px solid var(--line); }
.day-list__row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto 18px;
  align-items: center;
  gap: var(--space-3);
  min-height: 60px;
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
}
.day-list__row:hover { background: var(--surface-2); }
.day-list__date { display: flex; flex-direction: column; line-height: 1.2; }
.day-list__weekday { color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.day-list__score { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.day-list__score.is-muted { grid-column: 2 / 4; color: var(--text-muted); font-weight: 400; text-align: left; }
.day-list__chevron { color: var(--text-muted); }
.day-list__score { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--space-1); }
.day-list__score.is-muted { justify-content: flex-start; }
.day-list__check { color: var(--ok); }
.day-list__row.is-complete .day-list__weekday { color: var(--ok); }
.day-list__row.is-missed .day-list__score { color: var(--text-muted); }

.streak { color: var(--text-muted); font-weight: 600; white-space: nowrap; }

.segmented-links { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.segmented-links__item {
  display: inline-grid;
  place-items: center;
  min-width: 72px;
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
}
.segmented-links__item[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
button.segmented-links__item { border: 0; background: transparent; cursor: pointer; }
.segmented-links__item[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Statistics ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.stat-card { display: flex; flex-direction: column; gap: 2px; padding: var(--space-4); }
.stat-card__title { color: var(--text-muted); font-size: .85rem; font-weight: 600; }
.stat-card__value { font-size: 2rem; font-weight: 750; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-card__sub { color: var(--text-muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.stat-hint { margin-top: calc(-1 * var(--space-4)); padding: 0 var(--space-1); }

.chart-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.day-bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; margin: 0; padding: 0; list-style: none; }
.day-bars__item { position: relative; flex: 1; height: 100%; border-radius: 4px; background: var(--surface-2); }
.day-bars__bar { position: absolute; inset: auto 0 0; height: var(--h); border-radius: 4px; background: var(--accent); }
.day-bars__item.is-empty { background: transparent; border: 1px dashed var(--line); }
.day-bars__item.is-today .day-bars__bar { background: var(--brand-gradient); }
.day-bars__axis { display: flex; justify-content: space-between; color: var(--text-muted); font-size: .78rem; }

.stat-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; overflow: hidden; }
.stat-list__row {
  --habit-accent: var(--habit-color, var(--accent));
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 60px;
  padding: var(--space-2) var(--space-4);
}
.stat-list__row + .stat-list__row { border-top: 1px solid var(--line); }
.stat-list__row .habit-row__icon { width: 34px; height: 34px; border-radius: 10px; }
.stat-list__name { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.stat-list__bar .progress { height: 6px; }
.stat-list__value { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.stat-list__sub { color: var(--text-muted); font-size: .8rem; }

/* ---------- Challenges ---------- */

.page-header__title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.page-header__title-row .page-title { min-width: 0; overflow-wrap: anywhere; }
.page-header__title-row .button { flex: none; margin-top: 2px; }

.challenge-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: var(--space-3);
  min-height: 72px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  text-decoration: none;
}
.challenge-card:hover { background: var(--surface-2); }
.challenge-card__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.challenge-card.is-rhythm .challenge-card__icon { background: var(--brand-gradient); color: #fff; }
.challenge-card__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.challenge-card__eyebrow, .challenge-mini__eyebrow { color: var(--text-muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.challenge-card__name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.challenge-card__body .progress, .challenge-mini .progress { height: 6px; margin-top: 2px; }
.challenge-card__value { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.challenge-card__sub { color: var(--text-muted); font-size: .8rem; }
.challenge-card__chevron { color: var(--text-muted); }

/* Today: compact card under the daily habits; never larger than a habit row plus a bar. */
.challenge-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  text-decoration: none;
}
.challenge-mini:hover { background: var(--surface-2); }
.challenge-mini.is-rhythm { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.challenge-mini__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.challenge-mini__eyebrow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.challenge-mini__score { flex: none; font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.challenge-mini__name { font-size: .95rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.challenge-hero { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5) var(--space-5); }
.challenge-hero__status { color: var(--accent); font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.challenge-hero .big-number { font-size: clamp(2.5rem, 12vw, 3.5rem); }
.challenge-hero .progress { margin-top: var(--space-1); }
.challenge-facts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}
.challenge-facts div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; min-width: 0; }
.challenge-facts dt { color: var(--text-muted); font-size: .78rem; line-height: 1.3; }
.challenge-facts dd { margin: 0; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.stat-list__row--today { grid-template-columns: 34px minmax(0, 1fr) auto 26px; }
.challenge-today { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--line); border-radius: 50%; }
.challenge-today.is-done { border-color: var(--habit-accent); background: var(--habit-accent); color: var(--accent-contrast); }

/* Days of the period: fill, light fill, outline and dashed outline differ in shape, not only in color. */
.challenge-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(22px, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.challenge-days__day { display: block; aspect-ratio: 1; min-width: 14px; border-radius: 6px; background: var(--surface-2); }
.challenge-days__day.is-complete { background: var(--accent); }
.challenge-days__day.is-partial { background: color-mix(in srgb, var(--accent) 35%, var(--surface)); }
.challenge-days__day.is-missed { background: transparent; border: 2px solid color-mix(in srgb, var(--text-muted) 50%, transparent); }
.challenge-days__day.is-open { background: transparent; border: 2px solid var(--accent); }
.challenge-days__day.is-future { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--text-muted) 45%, transparent); }
.challenge-days__day.is-today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.challenge-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; padding: 0; list-style: none; color: var(--text-muted); font-size: .8rem; }
.challenge-legend li { display: inline-flex; align-items: center; gap: var(--space-2); }
.challenge-legend .challenge-days__day { width: 14px; }

.quick-lengths { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.quick-lengths .button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pick-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.pick-list li + li { border-top: 1px solid var(--line); }
.pick-row {
  --habit-accent: var(--habit-color, var(--accent));
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 60px;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
}
.pick-row:hover { background: var(--surface-2); }
.pick-row:has(input:checked) { background: var(--accent-soft); }
.pick-row input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.pick-row .habit-row__icon { width: 34px; height: 34px; border-radius: 10px; }

/* ---------- Sharing ---------- */

.share-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); padding: var(--space-4) var(--space-5); }
.share-name .form { flex: 1; }
.share-name__label { color: var(--text-muted); font-size: .9rem; }
.share-name__value { font-weight: 700; }
.share-name .link { margin-left: auto; }

.share-group { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-4); }
.share-group__name { font-size: 1.2rem; font-weight: 700; }
.share-members, .share-pending { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.share-members li { display: flex; align-items: center; gap: var(--space-2); min-height: 40px; }
.share-members__name { font-weight: 600; }
.avatar.avatar--small { width: 32px; height: 32px; font-size: .9rem; }
.share-pending li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-3); color: var(--text-muted); font-size: .88rem; }
.share-invite { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-m); background: var(--accent-soft); }
.share-invite__title { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ok); font-weight: 700; }
.share-invite__link { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.share-invite__actions .button { flex: 1 1 auto; }
.button--whatsapp { background: #1a7f4b; border-color: #1a7f4b; color: #fff; }
.button--whatsapp:hover { background: #156b3f; }
/* The native share sheet button exists only where navigator.share does (set by js/share.js). */
.web-share-only { display: none; }
.can-web-share .web-share-only { display: inline-flex; }
.share-group__danger { justify-content: flex-end; margin-top: calc(-1 * var(--space-2)); }

/* 0.9.3: sections of the Sharing page, items offered in a group, owner's member actions. */
.share-section { display: flex; flex-direction: column; gap: var(--space-3); }
.share-section > .section-title { padding: 0 var(--space-1); }
.share-list-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-5); }
.share-list-card > .link { align-self: flex-start; padding-left: 0; }
.share-group__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.share-group__head .icon-button { margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-3)) calc(-1 * var(--space-2)) 0; color: var(--text-muted); }
.share-members__action { margin-left: auto; min-height: 40px; }
.share-items { display: flex; flex-direction: column; margin: 0 calc(-1 * var(--space-2)); padding: 0; list-style: none; }
.share-item { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: var(--space-1) var(--space-2); border-radius: var(--radius-s); color: var(--text); text-decoration: none; }
a.share-item:hover { background: var(--surface-2); }
a.share-item > .icon:last-child { color: var(--text-muted); flex: none; }
.share-item__icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.share-item__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.share-item__name { font-weight: 600; overflow-wrap: anywhere; }
.share-item__meta { color: var(--text-muted); font-size: .85rem; }

.invitation-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); }
.invitation-card__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.invitation-card__text { font-size: 1.15rem; font-weight: 650; }

.shared-row__days { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: 0 var(--space-3) var(--space-3); }
.shared-row__days-label { color: var(--text-muted); font-size: .75rem; white-space: nowrap; }
.shared-days { display: grid; flex: 1 1 220px; max-width: 280px; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.shared-days__day { display: grid; place-items: center; height: 28px; border-radius: 6px; background: var(--surface-2); color: var(--text-muted); font-size: .62rem; font-weight: 700; text-transform: lowercase; }
.shared-days__day.is-complete { background: var(--habit-accent); color: var(--accent-contrast); }
.shared-days__day.is-missed { background: transparent; border: 2px solid color-mix(in srgb, var(--text-muted) 50%, transparent); }
.shared-days__day.is-open { background: transparent; border: 2px solid var(--habit-accent); }
.shared-days__day.is-empty { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--text-muted) 35%, transparent); }
.shared-days__day.is-today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.shared-row__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2) var(--space-3); padding: 0 var(--space-3) var(--space-3); }
.shared-row__added { display: inline-flex; align-items: center; gap: var(--space-1); margin-right: auto; color: var(--ok); font-size: .85rem; font-weight: 600; }

/* Today: a new share waits for the user's decision; nothing is added automatically. */
.offer-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.offer-card__icon { display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); color: var(--accent); }
.offer-card__body { flex: 1; min-width: 0; }
.offer-card__title { font-weight: 650; line-height: 1.35; }
.offer-card__meta { color: var(--text-muted); font-size: .85rem; }
.offer-card .button { flex: none; }

/* Shared rhythm/habit: each person's own results side by side; no ranking. */
.together { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-5); }
.together-people { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.together-person { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-m); }
.together-person.is-me { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.together-person__name { font-weight: 700; }
.together-person__status { color: var(--text-muted); font-size: .85rem; }
.together-facts { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); }
.together-subtitle { margin-top: var(--space-2); color: var(--text-muted); font-size: .85rem; font-weight: 650; }
.together-table-wrap { overflow-x: auto; }
.together-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.together-table th, .together-table td { padding: var(--space-1); text-align: center; }
.together-table th[scope="row"] { max-width: 10ch; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.together-table thead th { color: var(--text-muted); font-weight: 600; }
.together-table__dow, .together-table__date { display: block; line-height: 1.2; }
.together-table__dow { text-transform: lowercase; }
.together-table td .challenge-days__day { width: 24px; margin: 0 auto; }

/* Rhythm grid (0.8.2): a compact heatmap. Every day is the same square; neutral states differ in shape, not only color.
   A week fits a 390 px phone without scrolling; longer ranges scroll under a sticky name column. */
.rhythm-grid {
  --cell: 26px;
  --cell-pitch: 30px;
  --row-pitch: 30px;
  --cell-radius: 7px;
  --cell-line: color-mix(in srgb, var(--text-muted) 38%, transparent);
  --cell-faint: color-mix(in srgb, var(--text-muted) 9%, transparent);
  --cell-level-1: color-mix(in srgb, var(--accent) 20%, var(--surface));
  --cell-level-2: color-mix(in srgb, var(--accent) 38%, var(--surface));
  --cell-level-3: color-mix(in srgb, var(--accent) 56%, var(--surface));
  --cell-level-4: color-mix(in srgb, var(--accent) 76%, var(--surface));
  --cell-level-5: var(--accent);
  --name-width: 120px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3) var(--space-3);
}
.rhythm-grid--long { --cell: 24px; --cell-pitch: 28px; --row-pitch: 28px; --cell-radius: 6px; }
/* Dark: the light accent would glare at full strength, so the steps end a little below it. */
:root[data-theme="dark"] .rhythm-grid {
  --cell-line: color-mix(in srgb, var(--text-muted) 32%, transparent);
  --cell-level-1: color-mix(in srgb, var(--accent) 17%, var(--surface));
  --cell-level-2: color-mix(in srgb, var(--accent) 31%, var(--surface));
  --cell-level-3: color-mix(in srgb, var(--accent) 46%, var(--surface));
  --cell-level-4: color-mix(in srgb, var(--accent) 62%, var(--surface));
  --cell-level-5: color-mix(in srgb, var(--accent) 82%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rhythm-grid {
    --cell-line: color-mix(in srgb, var(--text-muted) 32%, transparent);
    --cell-level-1: color-mix(in srgb, var(--accent) 17%, var(--surface));
    --cell-level-2: color-mix(in srgb, var(--accent) 31%, var(--surface));
    --cell-level-3: color-mix(in srgb, var(--accent) 46%, var(--surface));
    --cell-level-4: color-mix(in srgb, var(--accent) 62%, var(--surface));
    --cell-level-5: color-mix(in srgb, var(--accent) 82%, var(--surface));
  }
}
@media (min-width: 480px) {
  .rhythm-grid { padding: var(--space-4); --name-width: 180px; }
  .rhythm-grid--week { --cell: 30px; --cell-pitch: 35px; --row-pitch: 35px; }
}
@media (min-width: 720px) {
  /* Desktop: names stay next to their days instead of drifting apart. */
  .rhythm-grid.rhythm-grid--week .rhythm-grid__table { width: auto; }
  .rhythm-grid--week .rhythm-grid__corner, .rhythm-grid--week .rhythm-grid__habit { width: 220px; min-width: 220px; max-width: 220px; }
}
.rhythm-grid__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--space-2); min-height: 36px; }
.rhythm-grid__header .section-title { padding: var(--space-1) 0; }

/* Range switch: light text tabs; the pill is drawn inside a taller tap target. */
.grid-range { display: inline-flex; flex: none; margin: 0 -6px 0 auto; }
.grid-range__item {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: .8rem;
  font-weight: 650;
  cursor: pointer;
}
.grid-range__item > span { padding: 5px 7px; border-radius: 999px; line-height: 1.2; white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease); }
.grid-range__item:hover > span { color: var(--text); }
.grid-range__item[aria-pressed="true"] > span { background: var(--surface-2); color: var(--text); }
.grid-range__item:focus-visible { outline: none; }
.grid-range__item:focus-visible > span { outline: 2px solid var(--focus); outline-offset: 1px; }

.rhythm-grid__scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.rhythm-grid__scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-s); }
.rhythm-grid__table { border-collapse: separate; border-spacing: 0; font-size: .75rem; table-layout: fixed; }
.rhythm-grid--week .rhythm-grid__table { width: 100%; }
.rhythm-grid__table td { width: var(--cell-pitch); min-width: var(--cell-pitch); height: var(--row-pitch); padding: 0; text-align: center; }

.rhythm-grid__date { width: var(--cell-pitch); min-width: var(--cell-pitch); padding: 0 0 6px; color: var(--text-muted); font-weight: 600; line-height: 1.2; text-align: center; vertical-align: bottom; white-space: nowrap; }
.rhythm-grid__date span { display: block; }
.rhythm-grid__dow { font-size: .68rem; font-weight: 500; text-transform: lowercase; }
.rhythm-grid__day { font-size: .72rem; font-variant-numeric: tabular-nums; }
.rhythm-grid--long .rhythm-grid__day { font-size: .66rem; }
.rhythm-grid__date.is-today { position: relative; color: var(--accent); }
.rhythm-grid__date.is-today .rhythm-grid__dow { font-weight: 700; }
.rhythm-grid__date.is-today .rhythm-grid__day { font-weight: 800; }
.rhythm-grid__date.is-today::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 12px; height: 2px; border-radius: 2px; background: var(--accent); transform: translateX(-50%); }

.rhythm-grid__corner, .rhythm-grid__habit { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: -2px 0 0 var(--surface); }
.rhythm-grid--long .rhythm-grid__corner, .rhythm-grid--long .rhythm-grid__habit { width: var(--name-width); min-width: var(--name-width); max-width: var(--name-width); }
.rhythm-grid--long .rhythm-grid__habit { box-shadow: -2px 0 0 var(--surface), 8px 0 8px -8px color-mix(in srgb, var(--text) 22%, transparent); }
.rhythm-grid__habit { padding: 0 6px 0 0; font-size: .78rem; font-weight: 600; text-align: left; }
.rhythm-grid__label { display: flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; }
.rhythm-grid__icon { flex: none; display: grid; place-items: center; color: color-mix(in srgb, var(--accent) 85%, var(--text-muted)); }
.rhythm-grid__icon .icon { width: 14px; height: 14px; }
.rhythm-grid__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rhythm-grid__total > * { padding-top: 6px; border-top: 1px solid var(--line); }
.rhythm-grid__total td { height: calc(var(--row-pitch) + 6px); }
.rhythm-grid__total .rhythm-grid__habit { color: var(--text-muted); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* The link fills the table cell (tap target); the drawn square stays small. */
.rhythm-hit { display: grid; place-items: center; width: 100%; height: 100%; min-height: var(--row-pitch); color: inherit; text-decoration: none; border-radius: var(--cell-radius); }
.rhythm-hit:focus-visible { outline: none; }
.rhythm-hit:focus-visible .rhythm-cell { outline: 2px solid var(--focus); outline-offset: 2px; }
a.rhythm-hit:hover .rhythm-cell { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--text) 45%, transparent); }

.rhythm-cell {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: var(--cell, 28px);
  height: var(--cell, 28px);
  border: 1.5px solid transparent;
  border-radius: var(--cell-radius, 7px);
  background: var(--cell-faint);
  color: var(--text);
  font-size: .64rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.rhythm-cell.level-0 { background: transparent; border-color: var(--cell-line); }
.rhythm-cell.level-1 { background: var(--cell-level-1); }
.rhythm-cell.level-2 { background: var(--cell-level-2); }
.rhythm-cell.level-3 { background: var(--cell-level-3); }
.rhythm-cell.level-4 { background: var(--cell-level-4); }
.rhythm-cell.level-5 { background: var(--cell-level-5); color: var(--accent-contrast); }
.rhythm-cell.is-free { background: var(--cell-faint); }
.rhythm-cell.is-free::after { content: ""; width: 3px; height: 3px; border-radius: 50%; background: color-mix(in srgb, var(--text-muted) 50%, transparent); }
.rhythm-cell.is-paused { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--text-muted) 24%, transparent) 0 1.5px, transparent 1.5px 5px), var(--cell-faint); }
.rhythm-cell.is-future { background: transparent; border: 1px dashed color-mix(in srgb, var(--text-muted) 30%, transparent); }
.rhythm-cell.is-recorded { background: color-mix(in srgb, var(--text-muted) 20%, transparent); }
.rhythm-cell.is-recorded::after { content: ""; width: 9px; height: 2px; border-radius: 2px; background: var(--text-muted); }
.rhythm-cell.is-unrecorded { background: transparent; border: 1.5px dotted var(--cell-line); }
.rhythm-cell.is-quota { background: var(--cell-faint); }
.rhythm-cell.is-quota::after { content: ""; box-sizing: border-box; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line)); }
.rhythm-cell.is-quota-done::after { background: var(--accent); border-color: var(--accent); }

/* Today: a normal square with a thin ring and an accented header, never a bigger shape. */
.rhythm-grid__table td.is-today .rhythm-cell { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 75%, transparent); }
.rhythm-grid__table td.is-today .rhythm-cell.level-0,
.rhythm-grid__table td.is-today .rhythm-cell.is-future { border-color: color-mix(in srgb, var(--accent) 75%, transparent); box-shadow: none; }
.rhythm-grid__table td.is-today .rhythm-cell.level-5 { box-shadow: none; }

/* Total row: same squares; softer steps keep the number readable in both themes. */
.rhythm-cell--total.level-1 { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.rhythm-cell--total.level-2 { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.rhythm-cell--total.level-3 { background: color-mix(in srgb, var(--accent) 34%, var(--surface)); }
.rhythm-cell--total.level-4 { background: color-mix(in srgb, var(--accent) 48%, var(--surface)); }
.rhythm-cell--total.level-0 { color: var(--text-muted); }
.rhythm-cell--total.is-free::after { content: none; }

/* Legend: the four main states in one line, the rest folded. */
.grid-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); color: var(--text-muted); font-size: .72rem; }
.grid-legend__list { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: 0; padding: 0; list-style: none; }
.grid-legend__list li { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.grid-legend .rhythm-cell { --cell: 11px; --cell-radius: 3px; border-width: 1px; }
.grid-legend .rhythm-cell::after { transform: scale(.55); }
.grid-legend .rhythm-cell.is-free::after { transform: none; width: 2px; height: 2px; }
.grid-legend__more[open] { flex-basis: 100%; }
.grid-legend__more > summary { display: inline-flex; align-items: center; min-height: 28px; color: var(--text-muted); font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--text-muted) 45%, transparent); text-underline-offset: 3px; cursor: pointer; list-style: none; }
.grid-legend__more > summary::-webkit-details-marker { display: none; }
.grid-legend__more[open] > summary { color: var(--text); }
.grid-legend__more > .grid-legend__list { margin-top: 2px; }

/* ---------- Profile ---------- */

.profile-card { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5); }
.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 700;
}
.profile-card__name { font-size: 1.2rem; font-weight: 700; }
.profile-card__sub { color: var(--text-muted); font-size: .9rem; word-break: break-all; }

.definition-list { margin: 0; padding: var(--space-2) var(--space-5); }
.definition-list div { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; }
.definition-list div + div { border-top: 1px solid var(--line); }
.definition-list dt { color: var(--text-muted); }
.definition-list dd { margin: 0; font-weight: 600; text-align: right; }

.link-list { display: flex; flex-direction: column; overflow: hidden; }
.link-list a {
  display: grid;
  grid-template-columns: 24px 1fr 18px;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 0 var(--space-5);
  text-decoration: none;
}
.link-list a + a { border-top: 1px solid var(--line); }
.link-list a:hover { background: var(--surface-2); }

.logout-form { display: flex; justify-content: center; }

/* ---------- Empty state ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-l);
}
.empty-state__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); }
.empty-state__title { font-weight: 650; }
.empty-state__text { color: var(--text-muted); max-width: 32ch; }

/* ---------- Bottom sheet ---------- */

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .35); }
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 41;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  animation: sheet-in .22s var(--ease);
}
.sheet__header { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-2) var(--space-2); }
.sheet__title { font-size: 1.1rem; font-weight: 700; }
.sheet-action {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-m);
  text-decoration: none;
}
.sheet-action:hover { background: var(--surface-2); }
.sheet-action.is-disabled { color: var(--text-muted); cursor: default; }
.sheet-action.is-disabled:hover { background: transparent; }
.sheet-action__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--surface-2); }
.sheet-action:hover .sheet-action__icon, .sheet-action:focus-visible .sheet-action__icon { background: var(--surface); }
.sheet-action__label { font-weight: 600; }

@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
  display: none;
  position: fixed;
  inset: auto var(--space-3) calc(var(--nav-height) + var(--space-3)) var(--space-3);
  z-index: 60;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-m);
  background: var(--text);
  color: var(--bg);
}
#blazor-error-ui .reload { margin-left: var(--space-2); font-weight: 700; }
#blazor-error-ui .dismiss { float: right; border: 0; background: none; color: inherit; font-size: 1.2rem; cursor: pointer; }

/* ---------- 0.8.0: theme, language, settings ---------- */

/* An explicit theme also switches native controls (date pickers, scrollbars). */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

.brand-bar { position: relative; }
.brand-bar__tools { align-self: flex-end; margin-bottom: var(--space-2); }

.language-menu { position: relative; display: inline-block; text-align: left; }
.language-menu__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.language-menu__toggle::-webkit-details-marker { display: none; }
.language-menu[open] .language-menu__toggle { border-color: var(--accent); }
.language-menu .choice-list--menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-1));
  z-index: 30;
  min-width: 200px;
  padding: var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(16 30 50 / .16);
}

.choice-list { display: flex; flex-direction: column; }
.choice-list__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-4);
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  color: var(--text);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.choice-list__option:hover { background: var(--surface-2); }
.choice-list__option.is-selected { background: var(--accent-soft); color: var(--text); }
.choice-list__option.is-selected .icon { color: var(--accent); }
.choice-list__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-list__help { color: var(--text-muted); font-size: .82rem; font-weight: 500; }
.settings-card { padding: var(--space-2); }

.link-list a:has(.link-list__value, .badge) { grid-template-columns: 24px 1fr auto 18px; }
.link-list__value { color: var(--text-muted); font-size: .9rem; text-align: right; }
.badge--new { background: var(--accent); color: var(--accent-contrast); }

/* What's new */
.release-list { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.release { padding: var(--space-4) var(--space-5); }
.release__header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-2); }
.release__version { font-size: 1.05rem; }
.release__date { margin-left: auto; color: var(--text-muted); font-size: .85rem; }
.release__items { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding-left: 1.2em; }

/* History views */
.history-views { align-self: flex-start; }
.history-views .segmented-links__item { display: inline-flex; align-items: center; gap: var(--space-1); }

/* Value habits: presets and quick entry */
.choice-grid--compact .choice { min-height: 0; }
.value-slider { width: 100%; height: var(--tap); margin: 0; accent-color: var(--habit-accent, var(--accent)); cursor: pointer; }
.quick-values { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.quick-values__option {
  min-height: 44px;
  min-width: 64px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.quick-values__option[aria-pressed="true"] {
  border-color: var(--habit-accent, var(--accent));
  background: color-mix(in srgb, var(--habit-accent, var(--accent)) 14%, transparent);
}
.rating-scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); }
.rating-scale__option {
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.rating-scale__option[aria-pressed="true"] {
  border-color: var(--habit-accent, var(--accent));
  background: var(--habit-accent, var(--accent));
  color: var(--accent-contrast);
}
@media (min-width: 480px) {
  .rating-scale { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}

.notice--warning { color: var(--text); border-left: 4px solid var(--warning); }

/* ---------- 0.9.0: challenges, rhythms, result ---------- */

.page-description { color: var(--text-muted); font-size: .92rem; max-width: 60ch; }
.section-subtitle { color: var(--text-muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.badge--brand { background: var(--accent-soft); color: var(--accent); }
.scope-notice__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* Lists: a challenge carries the flag on an accent tile, a rhythm the droplet on the brand gradient. */
.challenge-card.is-challenge .challenge-card__icon { background: var(--accent-soft); color: var(--accent); }
.challenge-card.is-draft { border-style: dashed; }
.challenge-card.is-draft .challenge-card__icon { background: var(--surface-2); color: var(--text-muted); }
.challenge-card.is-finished .challenge-card__value strong { color: var(--accent); }

/* Today: running challenges as a compact strip; one card fills the width, more cards scroll sideways. */
.challenge-teaser {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  align-self: flex-start;
  max-width: 100%;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: .85rem;
  text-decoration: none;
}
.challenge-teaser span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.challenge-teaser .icon { flex: none; color: var(--accent); }
.challenge-strip__list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 86%;
  gap: var(--space-3);
  margin: 0 calc(-1 * var(--space-4));
  padding: 2px var(--space-4) var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--space-4);
  list-style: none;
  scrollbar-width: none;
}
.challenge-strip__list::-webkit-scrollbar { display: none; }
.challenge-strip.is-single .challenge-strip__list { grid-auto-columns: 100%; overflow: visible; }
.challenge-strip__list > li { scroll-snap-align: start; min-width: 0; }
.challenge-slide {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: var(--space-3) var(--space-4) var(--space-4);
  overflow: hidden;
  border-radius: var(--radius-l);
  background: var(--brand-gradient);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.challenge-slide::after {
  content: "";
  position: absolute;
  inset: -40% -30% auto auto;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 255 255 / .22), transparent 70%);
  pointer-events: none;
}
.challenge-slide:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.challenge-slide__head { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.challenge-slide__icon { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgb(255 255 255 / .2); }
.challenge-slide__eyebrow { flex: 1; min-width: 0; overflow: hidden; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.challenge-slide__today { flex: none; padding: 2px var(--space-2); border-radius: 999px; background: rgb(255 255 255 / .2); font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.challenge-slide__name { font-size: 1.1rem; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.challenge-slide .progress { height: 6px; background: rgb(255 255 255 / .25); }
.challenge-slide .progress__bar { background: #fff; }
.challenge-slide__meta { font-size: .8rem; opacity: .92; font-variant-numeric: tabular-nums; }

/* Detail: time (day X of Y) apart from performance (success) and today. */
.challenge-hero__eyebrow { color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.challenge-hero__day { font-size: clamp(1.6rem, 7vw, 2.1rem); font-weight: 750; letter-spacing: -.01em; line-height: 1.15; }
.challenge-hero__meta { color: var(--text-muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.challenge-hero__time { display: flex; flex-direction: column; gap: var(--space-1); }
.challenge-hero__split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}
.challenge-hero__split div { display: flex; flex-direction: column-reverse; gap: 2px; }
.challenge-hero__split dt { color: var(--text-muted); font-size: .8rem; }
.challenge-hero__split dd { margin: 0; font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.challenge-hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.challenge-hero.is-challenge { border-top: 4px solid var(--accent); }
.challenge-hero.is-draft { border-top-style: dashed; }
.challenge-stats { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-5); }
.challenge-facts--grid { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-4); border-top: 0; padding-top: 0; }
@media (min-width: 560px) {
  .challenge-facts--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.challenge-today-section { display: flex; flex-direction: column; gap: var(--space-2); }
.challenge-today-section .habit-section { margin: 0; }
.decide-card { border-left: 4px solid var(--accent); }

/* Result: a calm celebration dialog; motion is dropped with prefers-reduced-motion (global rule above). */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  overflow-y: auto;
  background: rgb(11 20 36 / .62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
:root[data-theme="dark"] .result-overlay { background: rgb(3 7 16 / .78); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .result-overlay { background: rgb(3 7 16 / .78); }
}
.result-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: min(100%, 420px);
  padding: var(--space-6) var(--space-5) var(--space-5);
  overflow: hidden;
  border-radius: var(--radius-l);
  background: var(--surface);
  color: var(--text);
  text-align: center;
  box-shadow: 0 24px 64px rgb(16 30 50 / .28);
  animation: result-in .35s var(--ease);
}
.result-card:focus, .result-card:focus-visible { outline: none; }
.result-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 220px;
  background: var(--brand-gradient);
  opacity: .16;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
  mask-image: linear-gradient(to bottom, #000, transparent);
  pointer-events: none;
}
.result-badge {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 8px 24px rgb(39 0 188 / .25);
}
.result-eyebrow { position: relative; max-width: 100%; margin-top: var(--space-2); overflow-wrap: anywhere; color: var(--text-muted); font-size: .85rem; font-weight: 650; }
.result-title { position: relative; font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; }
.result-meta { color: var(--text-muted); font-size: .85rem; }
.result-rate { margin-top: var(--space-2); }
.result-rate .big-number { color: var(--accent); font-size: clamp(3rem, 16vw, 4rem); }
.result-rate__label { color: var(--text-muted); font-size: .85rem; font-weight: 650; }
.result-facts { align-self: stretch; text-align: left; }
.result-message { max-width: 34ch; margin-top: var(--space-1); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); }
.result-actions > .button:first-child:not(.button--quiet) { flex: 0 0 100%; }
.result-confetti { position: absolute; inset: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .result-confetti { display: none; } }
.result-confetti span {
  position: absolute;
  top: -12px;
  left: calc(4% + var(--i) * 6.8%);
  width: 8px;
  height: 14px;
  border-radius: 2px;
  background: var(--brand-gradient);
  opacity: 0;
  animation: result-fall 2.4s calc(var(--i) * 70ms) var(--ease) 1 forwards;
}
.result-confetti span:nth-child(3n) { width: 10px; height: 10px; border-radius: 50%; }
.result-confetti span:nth-child(2n) { background: #35BBF4; }
@keyframes result-in { from { transform: translateY(16px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes result-fall {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  15% { opacity: .9; }
  100% { transform: translateY(260px) rotate(300deg); opacity: 0; }
}

.share-panel { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); align-self: stretch; margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.share-panel__formats { display: flex; gap: var(--space-2); }
.share-panel__formats .button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.share-panel__preview { display: block; width: auto; max-width: 100%; height: 220px; border-radius: 12px; background: var(--surface-2); box-shadow: var(--shadow); object-fit: contain; }
.share-panel__preview:not([src]) { width: 124px; }
.share-panel__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.share-panel__status { min-height: 1.3em; color: var(--text-muted); font-size: .85rem; }
.share-panel__option { display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); font-size: .9rem; cursor: pointer; }
.group-share__section { display: flex; flex-direction: column; gap: var(--space-2); }
.pick-row.is-shared { cursor: default; }
.pick-row.is-shared .habit-row__name { color: var(--text-muted); }
/* 0.9.7 leave sharing */
.share-items li:has(.share-item__leave) { display: flex; align-items: center; gap: var(--space-2); }
.share-items li:has(.share-item__leave) .share-item { flex: 1; min-width: 0; }
.share-item__leave { flex: none; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-2); }
.leave-options { display: flex; flex-direction: column; gap: var(--space-2); }
.leave-options__delete .habit-row__name { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--danger); }
.share-panel__option input { width: 20px; height: 20px; accent-color: var(--accent); }

/* 0.9.5 Measurements: neutral values (no good/bad colours), compact on Today. */
.measure-value { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.measure-hero { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-4); }
.measure-hero > div { flex: 1; min-width: 0; }
.measure-hero__value { font-size: clamp(2rem, 9vw, 2.75rem); white-space: nowrap; }
.measure-hero__action { flex: none; }
@media (max-width: 520px) {
  .measure-hero__action { flex: 1 1 100%; justify-content: center; }
}
.measure-facts dd { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.measure-facts__date { color: var(--text-muted); font-size: .8rem; font-weight: 500; }
.measure-chart-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
.measure-history { display: flex; flex-direction: column; gap: var(--space-2); }
.measure-entries .habit-row__line { min-height: 52px; }
.measure-entries__note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.m-chart { margin: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.m-chart__area { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2); }
.m-chart__y { position: relative; min-width: 3.5em; height: 180px; color: var(--text-muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.m-chart__y span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.m-chart__plot { position: relative; height: 180px; margin: 0 10px; }
.m-chart__plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.m-chart__grid { stroke: var(--line); stroke-width: 1; }
.m-chart__line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.m-chart__dot {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.m-chart__dot::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--accent);
}
.m-chart__dot.is-selected::after { inset: 7px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.m-chart__dot:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.m-chart__x { display: flex; justify-content: space-between; padding-left: calc(3.5em + var(--space-2)); color: var(--text-muted); font-size: .72rem; }
.m-chart__readout { display: flex; justify-content: center; gap: var(--space-2); min-height: 1.4em; color: var(--text-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.m-chart__readout strong { color: var(--text); }

.input-with-unit { display: flex; align-items: center; gap: var(--space-2); }
.input-with-unit .input { flex: 1; font-variant-numeric: tabular-nums; }
.input-with-unit__unit { color: var(--text-muted); font-weight: 600; }

.measure-today__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-m); background: color-mix(in srgb, var(--surface) 65%, var(--bg)); }
.measure-today__header { padding: 0 var(--space-1); }
.measure-today__all { display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); padding: 0 var(--space-1); font-size: .85rem; font-weight: 600; }
.measure-today__hint { padding: 0 var(--space-1); margin-top: calc(-1 * var(--space-2)); }
.measure-today__list li + li { border-top: 1px solid var(--line); }
.measure-today__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 48px;
  padding: var(--space-1) var(--space-3);
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.measure-today__list li:first-child .measure-today__row { border-radius: var(--radius-m) var(--radius-m) 0 0; }
.measure-today__list li:last-child .measure-today__row { border-radius: 0 0 var(--radius-m) var(--radius-m); }
.measure-today__list li:only-child .measure-today__row { border-radius: var(--radius-m); }
.measure-today__row:hover { background: var(--surface-2); }
.measure-today__row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.measure-today__icon { display: inline-grid; place-items: center; color: var(--text-muted); }
.measure-today__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.measure-today__value { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.measure-today__value.is-past { color: var(--text-muted); font-weight: 500; }
.measure-today__action { min-width: 4.5em; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--accent); font-size: .8rem; font-weight: 600; text-align: center; }

.measure-progress { display: flex; flex-direction: column; gap: var(--space-2); }
.card.measure-progress { padding: var(--space-4); }
.measure-progress--compact { align-self: stretch; padding-top: var(--space-3); border-top: 1px solid var(--line); text-align: left; }
.measure-progress__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.measure-progress__row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-3); }
.measure-progress__name { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.measure-progress__name svg { color: var(--text-muted); }
.measure-progress__values { display: inline-flex; gap: var(--space-2); font-variant-numeric: tabular-nums; }
.measure-progress__values span { color: var(--text-muted); }
.measure-progress__values.is-empty { color: var(--text-muted); font-size: .9rem; }

/* ---------- Sign-in methods (0.9.9) ---------- */
.provider-logo { display: block; flex: none; }
.sign-in-state { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: .9rem; }
.sign-in-state--on { color: var(--ok); font-weight: 600; }
.profile-section { display: flex; flex-direction: column; gap: var(--space-2); }
.profile-section .section-title { padding: 0 var(--space-1); }
.profile-section .section-hint { padding: 0 var(--space-1); margin: 0; }
.link-list a.link-list__danger { color: var(--danger); font-weight: 600; }

/* ---------- Onboarding guide (0.9.12) ---------- */
.app--guide .app__main {
  max-width: none;
  min-height: 100dvh;
  padding: calc(var(--space-4) + env(safe-area-inset-top)) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
}
.guide { display: flex; justify-content: center; min-height: calc(100dvh - 2 * var(--space-4)); }
.guide__card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: 100%;
  max-width: 720px;
}
.guide__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.guide__logo { display: inline-block; line-height: 0; border-radius: var(--radius-s); }
.guide__progress { display: flex; align-items: center; gap: var(--space-3); color: var(--text-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.guide__steps { display: flex; gap: 6px; }
.guide__step { width: 22px; height: 6px; border-radius: 999px; background: var(--line); }
.guide__step.is-done { background: var(--accent); }
.guide__title { margin: 0; font-size: clamp(1.7rem, 6vw, 2.2rem); line-height: 1.15; letter-spacing: -.02em; }
.guide__claim { margin: calc(-1 * var(--space-2)) 0 0; color: var(--accent); font-size: 1.1rem; font-weight: 700; }
.guide__lead { margin: 0; color: var(--text); font-size: 1.05rem; line-height: 1.55; }
.guide__done, .guide__item-text.guide__done { display: flex; gap: var(--space-1); align-items: center; }
.guide__done .icon { color: var(--ok); }
.guide__item--created { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.guide__list { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.guide__item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.guide__item strong { display: block; font-size: 1.02rem; }
.guide__item-text { display: block; color: var(--text-muted); line-height: 1.45; }
.guide__icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.guide__privacy { display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-l); background: var(--accent-soft); line-height: 1.5; }
.guide__privacy .icon { color: var(--accent); margin-top: 2px; }
.guide__actions { display: flex; flex-direction: column; gap: var(--space-3); margin-top: auto; padding-top: var(--space-5); }
.guide__cta { width: 100%; }
.guide__footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--tap); }
.guide__back { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--tap); text-decoration: none; }
.guide__skip { min-height: var(--tap); color: var(--text-muted); font-weight: 600; }

@media (min-width: 720px) {
  .app--guide .app__main { padding: var(--space-7) var(--space-5); }
  .guide { align-items: center; min-height: calc(100dvh - 2 * var(--space-7)); }
  .guide__card { padding: var(--space-7) var(--space-7) var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow); }
  .guide__item { background: var(--bg); }
  .guide__actions { flex-direction: row; align-items: center; margin-top: var(--space-2); }
  .guide__cta { width: auto; min-width: 220px; }
}
