/* =========================================================================
   Momentum — styles
   Tokens first (light, then dark), then layout, then components.
   ========================================================================= */

:root {
  color-scheme: light;
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --surface-3: #eaeaef;
  --border: #e6e6eb;
  --border-strong: #d4d4dc;
  --text: #17171c;
  --text-2: #4b4b55;
  --text-3: #6b6b76;
  --text-4: #a2a2ad;

  --accent: #5b5bd6;
  --accent-bg: #5b5bd6;
  --accent-bg-hover: #4d4dc6;
  --accent-soft: #eeeefc;

  --good: #18794e;
  --good-mark: #30a46c;
  --good-soft: #e7f6ee;
  --warn: #9a5200;
  --warn-mark: #f5a524;
  --warn-soft: #fff3dc;
  --bad: #c62a2f;
  --bad-mark: #e5484d;
  --bad-soft: #fdecec;

  --p1: #e5484d;
  --p2: #f76b15;
  --p3: #3e8ef7;
  --p4: #b4b4bd;
  --flame: #f76b15;

  --chart-grid: #ececf0;
  --chart-axis: #d4d4dc;

  --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.04);
  --shadow: 0 1px 2px rgba(20, 20, 40, 0.04), 0 6px 20px rgba(20, 20, 40, 0.06);
  --shadow-lg: 0 18px 50px rgba(20, 20, 40, 0.18), 0 3px 10px rgba(20, 20, 40, 0.06);
  --toast-bg: #1d1d24;

  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 252px;
  --tabbar-h: 62px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0c0c0f;
    --surface: #16161a;
    --surface-2: #1d1d22;
    --surface-3: #27272e;
    --border: #26262d;
    --border-strong: #36363f;
    --text: #ededf0;
    --text-2: #bdbdc7;
    --text-3: #92929d;
    --text-4: #5f5f6a;
    --accent: #9696f6;
    --accent-bg: #5b5bd6;
    --accent-bg-hover: #6868e0;
    --accent-soft: rgba(124, 124, 240, 0.16);
    --good: #4cc38a;
    --good-mark: #30a46c;
    --good-soft: rgba(48, 164, 108, 0.16);
    --warn: #ffb224;
    --warn-mark: #f5a524;
    --warn-soft: rgba(255, 178, 36, 0.14);
    --bad: #ff6b70;
    --bad-mark: #e5484d;
    --bad-soft: rgba(229, 72, 77, 0.16);
    --p1: #ff6369;
    --p2: #ff8b3e;
    --p3: #5eb1ef;
    --p4: #6c6c77;
    --chart-grid: #222228;
    --chart-axis: #36363f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55), 0 3px 10px rgba(0, 0, 0, 0.3);
    --toast-bg: #2b2b33;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0c0c0f;
  --surface: #16161a;
  --surface-2: #1d1d22;
  --surface-3: #27272e;
  --border: #26262d;
  --border-strong: #36363f;
  --text: #ededf0;
  --text-2: #bdbdc7;
  --text-3: #92929d;
  --text-4: #5f5f6a;
  --accent: #9696f6;
  --accent-bg: #5b5bd6;
  --accent-bg-hover: #6868e0;
  --accent-soft: rgba(124, 124, 240, 0.16);
  --good: #4cc38a;
  --good-mark: #30a46c;
  --good-soft: rgba(48, 164, 108, 0.16);
  --warn: #ffb224;
  --warn-mark: #f5a524;
  --warn-soft: rgba(255, 178, 36, 0.14);
  --bad: #ff6b70;
  --bad-mark: #e5484d;
  --bad-soft: rgba(229, 72, 77, 0.16);
  --p1: #ff6369;
  --p2: #ff8b3e;
  --p3: #5eb1ef;
  --p4: #6c6c77;
  --chart-grid: #222228;
  --chart-axis: #36363f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55), 0 3px 10px rgba(0, 0, 0, 0.3);
  --toast-bg: #2b2b33;
}

/* ---------------- Base ---------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}
html.sheet-open {
  overflow: hidden;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.muted {
  color: var(--text-3);
}
.small {
  font-size: 13px;
}
.num {
  font-variant-numeric: tabular-nums;
}

/* ---------------- Layout ---------------- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  display: none;
}
.main {
  min-width: 0;
}
.view {
  max-width: 820px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 40px);
}
.view.wide {
  max-width: 1060px;
}
.view.enter {
  animation: viewIn 0.38s var(--ease) both;
}
@media (min-width: 600px) {
  .view {
    padding-left: 28px;
    padding-right: 28px;
  }
}
@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding: 18px 12px 14px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
  .view {
    padding: 40px 48px 80px;
  }
  .tabbar,
  .only-mobile {
    display: none !important;
  }
}
@media (max-width: 899.98px) {
  .only-desktop {
    display: none !important;
  }
}

/* ---------------- Sidebar ---------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 16px;
  font-weight: 750;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.nav-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 550;
  transition: background 0.15s, color 0.15s;
}
.nav-item .ico {
  color: var(--text-3);
}
.nav-item:hover {
  background: var(--surface-2);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item.active .ico {
  color: var(--accent);
}
.nav-item .count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.nav-item .count.alert {
  color: var(--bad);
}
.side-mini {
  margin: 18px 4px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  display: block;
}
.side-mini .lbl {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
}
.side-mini .val {
  font-size: 14px;
  font-weight: 700;
  margin: 2px 0 8px;
  display: flex;
  justify-content: space-between;
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.save-state {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  padding-left: 8px;
}
.save-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good-mark);
}
.save-state.error i {
  background: var(--bad-mark);
}

/* ---------------- Bottom tab bar (phones/tablets) ---------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 4px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(18px);
  backdrop-filter: saturate(1.8) blur(18px);
  border-top: 1px solid var(--border);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s;
}
.tab .ico {
  width: 24px;
  height: 24px;
  transition: transform 0.25s var(--spring);
}
.tab.active {
  color: var(--accent);
}
.tab.active .ico {
  transform: translateY(-1px) scale(1.06);
}
.tab .badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 7px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--bad-mark);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
}

/* ---------------- Headings ---------------- */
.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.view-head > div:first-child {
  min-width: 0;
}
.eyebrow {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
}
.title {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -0.028em;
}
@media (min-width: 900px) {
  .title {
    font-size: 32px;
  }
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.section {
  margin-top: 28px;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin: 0 0 8px;
  padding: 0 2px;
}
.section-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-head h2.lg {
  font-size: 16px;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}
.section-head .count {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-3);
  background: var(--surface-3);
  padding: 0 7px;
  border-radius: 99px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
.section-head .sub {
  font-size: 13px;
  color: var(--text-3);
}
.section-head .spacer {
  flex: 1;
}
.section-head.is-bad h2 {
  color: var(--bad);
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.btn:hover {
  background: var(--surface-2);
}
.btn:active {
  transform: scale(0.97);
}
.btn .ico {
  width: 17px;
  height: 17px;
}
.btn-primary {
  background: var(--accent-bg);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 2px rgba(30, 30, 90, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-primary:hover {
  background: var(--accent-bg-hover);
}
.btn-danger {
  background: var(--bad-mark);
  border-color: transparent;
  color: #fff;
}
.btn-danger:hover {
  background: #d63c41;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-ghost.danger {
  color: var(--bad);
}
.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}
.btn-block {
  width: 100%;
}
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.icon-btn.sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.icon-btn.sm .ico {
  width: 16px;
  height: 16px;
}
.icon-btn.bordered {
  border: 1px solid var(--border);
  background: var(--surface);
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: 8px;
  text-decoration: none;
}
.link-btn:hover {
  background: var(--accent-soft);
}
.link-btn .ico {
  width: 15px;
  height: 15px;
}

/* ---------------- Segmented control ---------------- */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-3);
  border-radius: 11px;
}
.segmented > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 620;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.segmented > .on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(20, 20, 40, 0.1);
}
.segmented .n {
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.segmented.block {
  display: flex;
  width: 100%;
}
.segmented.block > * {
  flex: 1;
}
.segmented.sm > * {
  min-height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
}

/* ---------------- Year stepper ---------------- */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  height: 40px;
}
.stepper button {
  width: 36px;
  height: 38px;
  border: 0;
  background: none;
  color: var(--text-2);
  display: grid;
  place-items: center;
  border-radius: 9px;
}
.stepper button:hover {
  background: var(--surface-2);
}
.stepper span {
  min-width: 46px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* ---------------- Quick add ---------------- */
.quickadd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.2s;
}
.quickadd:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.quickadd .qa-plus {
  color: var(--accent);
  width: 22px;
  height: 22px;
}
.quickadd input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}
.quickadd input::placeholder {
  color: var(--text-4);
}
.qa-submit {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: var(--accent-bg);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.25s var(--spring);
}
.quickadd.has-value .qa-submit {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.qa-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 2px 0;
  min-height: 0;
}
.qa-preview:empty {
  display: none;
}
.qa-hint {
  margin: 8px 4px 0;
  font-size: 12.5px;
  color: var(--text-3);
}
.qa-hint code {
  font-family: inherit;
  font-weight: 650;
  color: var(--text-2);
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 5px;
}
.token {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 650;
  animation: tokenIn 0.25s var(--spring) both;
}
.token .ico {
  width: 13px;
  height: 13px;
}
.token i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* ---------------- Task list ---------------- */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.task {
  position: relative;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.task + .task {
  border-top: 1px solid var(--border);
}
.task:first-child,
.task:first-child .task-inner,
.task:first-child .task-swipe {
  border-top-left-radius: calc(var(--radius) - 1px);
  border-top-right-radius: calc(var(--radius) - 1px);
}
.task:last-child,
.task:last-child .task-inner,
.task:last-child .task-swipe {
  border-bottom-left-radius: calc(var(--radius) - 1px);
  border-bottom-right-radius: calc(var(--radius) - 1px);
}
.task-swipe {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: var(--good-mark);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
}
.task-swipe span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.task-swipe .ico {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
  transition: transform 0.25s var(--spring);
}
.task.swiping .task-swipe {
  display: flex;
}
.task .sw-snooze {
  display: none !important;
}
.task.swipe-left .task-swipe {
  background: var(--accent-bg);
  justify-content: flex-end;
}
.task.swipe-left .sw-done {
  display: none !important;
}
.task.swipe-left .sw-snooze {
  display: inline-flex !important;
}
.task:not(.armed) .task-swipe {
  filter: saturate(0.5);
  opacity: 0.85;
}
.task.armed .task-swipe .ico {
  transform: scale(1.3);
}
.task-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 2px;
  padding: 2px 4px 2px 4px;
  background: var(--surface);
  transition: transform 0.28s var(--ease), background 0.15s;
}
@media (hover: hover) {
  .task-inner:hover {
    background: color-mix(in srgb, var(--surface-2) 60%, var(--surface));
  }
  .task-inner:hover .drag-handle {
    opacity: 1;
  }
}
.task.p1 {
  --pc: var(--p1);
}
.task.p2 {
  --pc: var(--p2);
}
.task.p3 {
  --pc: var(--p3);
}
.task.p4 {
  --pc: var(--p4);
}
.check {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: none;
  border-radius: 50%;
}
.check::before {
  content: '';
  position: absolute;
  width: 21px;
  height: 21px;
  top: 50%;
  left: 50%;
  margin: -10.5px 0 0 -10.5px;
  border-radius: 50%;
  border: 2px solid var(--pc, var(--p4));
  background: color-mix(in srgb, var(--pc, var(--p4)) 9%, transparent);
  transition: background 0.2s, border-color 0.2s;
}
.check .ico {
  position: relative;
  width: 12px;
  height: 12px;
  stroke-width: 3.4;
  color: var(--pc, var(--p4));
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  transition: stroke-dashoffset 0.28s ease 0.04s, color 0.15s;
}
@media (hover: hover) {
  .check:hover .ico {
    stroke-dashoffset: 0;
  }
}
.task.is-done .check::before,
.task.completing .check::before {
  background: var(--pc, var(--p4));
}
.task.p4.is-done .check::before,
.task.p4.completing .check::before {
  background: var(--text-3);
  border-color: var(--text-3);
}
.task.is-done .check .ico,
.task.completing .check .ico {
  stroke-dashoffset: 0;
  color: #fff;
}
.task.completing .check::before {
  animation: pop 0.4s var(--spring);
}
.task-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 6px 11px 2px;
  border: 0;
  background: none;
  text-align: left;
  border-radius: 8px;
}
.task-title {
  font-size: 15.5px;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
}
.task-title > span {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 58%;
  background-size: 0% 1.5px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 0.35s var(--ease), color 0.3s;
}
.task.is-done .task-title > span,
.task.completing .task-title > span {
  background-size: 100% 1.5px;
  color: var(--text-3);
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 12px;
  font-size: 12.5px;
  color: var(--text-3);
}
.meta,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.meta .ico {
  width: 13px;
  height: 13px;
}
.meta.goal span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta.is-overdue {
  color: var(--bad);
  font-weight: 600;
}
.meta.is-today {
  color: var(--good);
  font-weight: 600;
}
.tag i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.drag-handle {
  flex: none;
  width: 34px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--text-4);
  cursor: grab;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.15s;
}
@media (hover: none) {
  .drag-handle {
    opacity: 0.7;
  }
}
.drag-handle:focus-visible {
  opacity: 1;
}
.task-list.is-sorting .task:not(.dragging) {
  transition: transform 0.2s var(--ease);
}
.task.dragging {
  z-index: 5;
  cursor: grabbing;
}
.task.dragging .task-inner {
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
}
.task.is-new {
  animation: taskIn 0.45s var(--ease) both;
}
.task.collapsing {
  overflow: hidden;
  transition: height 0.3s var(--ease), opacity 0.25s;
}
.done-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 10px 6px;
  border: 0;
  background: none;
  border-radius: 10px;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 620;
  text-align: left;
}
.done-toggle:hover {
  background: var(--surface-2);
}
.done-toggle .ico {
  transition: transform 0.2s var(--ease);
}
.done-toggle[aria-expanded='true'] .chev {
  transform: rotate(180deg);
}
.task-list.done-list .task-title {
  color: var(--text-3);
}

/* Upcoming: week strip */
.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 2px 0 6px;
}
.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 650;
  text-decoration: none;
}
.week-day b {
  font-size: 17px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.week-day.today {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.week-day.today b {
  color: var(--accent);
}
.week-day .dots {
  display: flex;
  gap: 3px;
  height: 6px;
}
.week-day .dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.date-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 22px 2px 8px;
  scroll-margin-top: 16px;
}
.date-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.date-head span {
  font-size: 13px;
  color: var(--text-3);
}

/* ---------------- Habits ---------------- */
.habit-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px 16px 8px;
  margin: 0 -16px;
  scrollbar-width: none;
  scroll-padding: 0 16px;
}
.habit-row::-webkit-scrollbar {
  display: none;
}
@media (min-width: 600px) {
  .habit-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    overflow: visible;
    margin: 0;
    padding: 0;
  }
}
.habit {
  position: relative;
  flex: 0 0 146px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 13px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s, background 0.25s, transform 0.12s;
}
.habit:active {
  transform: scale(0.97);
}
.habit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.habit-emoji {
  font-size: 21px;
  line-height: 1;
}
.habit-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: transparent;
  transition: background 0.25s, border-color 0.25s, color 0.2s;
}
.habit-check .ico {
  width: 15px;
  height: 15px;
  stroke-width: 3;
}
.habit-name {
  font-size: 14px;
  font-weight: 640;
  line-height: 1.3;
  min-height: 2.6em;
  color: var(--text);
}
.habit-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.streak {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.streak .ico {
  width: 14px;
  height: 14px;
}
.streak.hot {
  color: var(--text-2);
}
.streak.hot .ico {
  color: var(--flame);
  fill: color-mix(in srgb, var(--flame) 25%, transparent);
}
.week-dots {
  display: flex;
  gap: 3px;
}
.week-dots i {
  width: 7px;
  height: 7px;
  border-radius: 2.5px;
  background: var(--surface-3);
}
.week-dots i.on {
  background: var(--good-mark);
}
.week-dots i.rest {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.habit.done {
  border-color: color-mix(in srgb, var(--good-mark) 45%, var(--border));
  background: color-mix(in srgb, var(--good-mark) 6%, var(--surface));
}
.habit.done .habit-check {
  background: var(--good-mark);
  border-color: var(--good-mark);
  color: #fff;
}
.habit.just-done .habit-check {
  animation: pop 0.45s var(--spring);
}
.habit.just-done .streak {
  animation: bump 0.45s var(--spring);
}
.habit .rest-note {
  font-size: 12px;
  color: var(--text-3);
}

/* ---------------- Cards, stats, progress ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 680;
  color: var(--text-2);
}
.card-title .ico {
  color: var(--text-3);
  width: 17px;
  height: 17px;
}
a.card {
  color: inherit;
  text-decoration: none;
}
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 720px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.stat {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat-label {
  font-size: 12.5px;
  font-weight: 620;
  color: var(--text-3);
}
.stat-value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-3);
}
.bar {
  --bar: var(--accent);
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--bar) 15%, var(--surface-2));
}
.bar.thin {
  height: 6px;
}
.bar.thick {
  height: 12px;
}
.bar-fill {
  --p: 0;
  display: block;
  height: 100%;
  width: calc(var(--p) * 1%);
  border-radius: inherit;
  background: var(--bar);
  transition: width 1s var(--ease);
}
.bar-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--text);
  box-shadow: 0 0 0 2px var(--surface);
}
.ring-wrap {
  --ring: var(--accent);
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
}
.ring-wrap.lg {
  width: 76px;
  height: 76px;
}
.ring-wrap.md {
  width: 56px;
  height: 56px;
}
.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 3.6;
}
.ring-track {
  stroke: color-mix(in srgb, var(--ring) 15%, var(--surface-2));
}
.ring-fill {
  --p: 0;
  stroke: var(--ring);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--p));
  transition: stroke-dashoffset 1.1s var(--ease);
}
.ring-label {
  position: relative;
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.ring-wrap.lg .ring-label {
  font-size: 18px;
}
.ring-wrap.md .ring-label {
  font-size: 14px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}
.pill .ico {
  width: 13px;
  height: 13px;
  stroke-width: 2.4;
}
.pill.good {
  background: var(--good-soft);
  color: var(--good);
}
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.pill.accent {
  background: var(--accent-soft);
  color: var(--accent);
}
.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-3);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.empty-icon .ico {
  width: 22px;
  height: 22px;
}
.empty h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--text);
}
.empty p {
  margin: 0 auto;
  max-width: 340px;
  font-size: 14px;
}
.empty .btn {
  margin-top: 14px;
}

/* ---------------- Overview ---------------- */
.ov-hero {
  margin-bottom: 20px;
}
.ov-hero .title {
  font-size: 28px;
}
.ov-summary {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 15px;
  max-width: 640px;
}
.ov-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 960px) {
  .ov-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  .span-7 {
    grid-column: span 7;
  }
  .span-5 {
    grid-column: span 5;
  }
  .span-12 {
    grid-column: 1 / -1;
  }
}
.ov-today-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.ov-big {
  font-size: 22px;
  font-weight: 740;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.mini-list {
  list-style: none;
  margin: 0 -6px;
  padding: 0;
}
.mini-list .task + .task {
  border-top: 0;
}
.mini-list .task-inner {
  border-radius: 10px;
}
.mini-list .task-main {
  padding: 10px 4px 10px 0;
}
.mini-list .task-title {
  font-size: 14.5px;
}
.habit-lines {
  display: flex;
  flex-direction: column;
}
.habit-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 0;
  background: none;
  text-align: left;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 10px;
}
.habit-line:hover {
  background: var(--surface-2);
}
.habit-line .habit-emoji {
  font-size: 18px;
  width: 24px;
  text-align: center;
}
.habit-line .nm {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.habit-line .habit-check {
  width: 24px;
  height: 24px;
}
.habit-line .habit-check .ico {
  width: 13px;
  height: 13px;
}
.habit-line.done .habit-check {
  background: var(--good-mark);
  border-color: var(--good-mark);
  color: #fff;
}
.rev-mini {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.rev-mini .spark {
  width: 120px;
  height: 40px;
  flex: none;
}
.spark .spark-bar {
  fill: color-mix(in srgb, var(--accent) 35%, var(--surface-2));
}
.spark .spark-cur {
  fill: var(--accent);
}
.spark .spark-empty {
  fill: var(--surface-3);
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 8px;
}
.kv b {
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.goal-lines {
  display: grid;
  gap: 4px 28px;
}
@media (min-width: 720px) {
  .goal-lines {
    grid-template-columns: 1fr 1fr;
  }
}
.goal-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 0;
  border: 0;
  background: none;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.goal-line .nm {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}
.goal-line .nm i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex: none;
}
.goal-line .pc {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.goal-line .bar {
  grid-column: 1 / -1;
}

/* ---------------- Goals ---------------- */
.goal-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}
.goal-summary .facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}
.goal-summary .fact b {
  display: block;
  font-size: 20px;
  font-weight: 740;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.goal-summary .fact span {
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 600;
}
.goal-grid {
  display: grid;
  gap: 14px;
}
@media (min-width: 760px) {
  .goal-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.goal-card {
  --gc: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.goal-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  background: var(--gc);
  opacity: 0.85;
}
.goal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.goal-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-3);
}
.goal-cat i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--gc);
}
.goal-title {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--text);
}
.goal-title:hover {
  color: var(--accent);
}
.goal-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.goal-progress .bar {
  flex: 1;
}
.goal-pct {
  min-width: 42px;
  text-align: right;
  font-size: 15px;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
}
.goal-sub {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 13px;
  color: var(--text-3);
}
.goal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
}
.ms-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.ms {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  font-size: 14px;
}
.ms-check {
  flex: none;
  width: 36px;
  height: 36px;
  margin-left: -8px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  border-radius: 8px;
}
.ms-check span {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: transparent;
  transition: background 0.2s, border-color 0.2s;
}
.ms-check .ico {
  width: 12px;
  height: 12px;
  stroke-width: 3.4;
}
.ms.done .ms-check span {
  background: var(--gc, var(--accent));
  border-color: var(--gc, var(--accent));
  color: #fff;
  animation: pop 0.35s var(--spring);
}
.ms-text {
  flex: 1;
  min-width: 0;
  transition: color 0.2s;
}
.ms.done .ms-text {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.ms .ms-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 1px solid transparent;
  background: none;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 14px;
}
.ms .ms-input:hover {
  border-color: var(--border);
}
.ms .ms-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.ms.done .ms-input {
  color: var(--text-3);
  text-decoration: line-through;
}
.add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.add-row .input {
  flex: 1;
}

/* ---------------- Revenue ---------------- */
.rev-hero {
  padding: 22px;
}
.rev-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-3);
}
.hero-figure {
  margin: 4px 0 2px;
  font-size: 40px;
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
@media (min-width: 600px) {
  .hero-figure {
    font-size: 48px;
  }
}
.hero-sub {
  font-size: 14px;
  color: var(--text-3);
}
.hero-sub b {
  color: var(--text-2);
  font-weight: 650;
}
.target-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 6px;
  color: var(--text-2);
  font-weight: 650;
}
.target-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
}
.target-btn .ico {
  width: 14px;
  height: 14px;
  color: var(--text-3);
}
.pace {
  margin-top: 20px;
}
.pace .bar {
  height: 12px;
}
.pace-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-3);
}
.pace-legend .key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pace-legend .key i {
  width: 2px;
  height: 12px;
  border-radius: 2px;
  background: var(--text);
}
.chart-card .card-head {
  flex-wrap: wrap;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12.5px;
  color: var(--text-2);
  margin: -4px 0 8px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend .sw-col {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}
.legend .sw-line {
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.legend .sw-ref {
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--text-3);
}
.chart {
  position: relative;
  width: 100%;
  height: 250px;
  touch-action: pan-y;
}
.chart svg {
  display: block;
  overflow: visible;
}
.chart .grid line {
  stroke: var(--chart-grid);
  stroke-width: 1;
}
.chart .baseline {
  stroke: var(--chart-axis);
  stroke-width: 1;
}
.chart .axis-label {
  fill: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart .axis-label.strong {
  fill: var(--text);
  font-weight: 700;
}
.chart .col {
  fill: var(--accent);
  transition: opacity 0.15s;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.chart .col.partial {
  fill-opacity: 0.55;
}
.chart .col.grow {
  animation: grow 0.7s var(--ease) both;
  animation-delay: var(--d);
}
.chart:hover .col:not(.is-hover) {
  opacity: 0.55;
}
.chart .ref-line {
  stroke: var(--text-3);
  stroke-width: 1.5;
}
.chart .ref-label,
.chart .end-label {
  fill: var(--text-2);
  font-size: 11.5px;
  font-weight: 650;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.chart .end-label {
  fill: var(--text);
  font-size: 12.5px;
  font-weight: 750;
}
.chart .line-act {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .line-act.draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1s var(--ease) forwards;
}
.chart .area-act {
  fill: var(--accent);
  fill-opacity: 0.1;
}
.chart .line-tgt {
  fill: none;
  stroke: var(--text-3);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.7;
}
.chart .dot-act {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}
.chart .crosshair {
  stroke: var(--chart-axis);
  stroke-width: 1;
  transition: opacity 0.15s;
}
.chart-tip {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -100%);
  pointer-events: none;
  min-width: 170px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
}
.chart-tip[hidden] {
  display: none;
}
.tip-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  line-height: 1.7;
}
.tip-row b {
  margin-left: auto;
  padding-left: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tip-row .sw {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}
.tip-row .sw.act {
  background: var(--accent);
}
.tip-row .sw.tgt {
  background: var(--text-3);
  height: 2px;
}
.tip-delta {
  margin-top: 4px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
  font-weight: 650;
}
.tip-delta.up {
  color: var(--good);
}
.tip-delta.down {
  color: var(--bad);
}
.table-wrap {
  overflow-x: auto;
  margin: 0 -18px -18px;
}
.mtable {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.mtable th {
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-3);
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mtable td {
  height: 46px;
  padding: 2px 18px;
  font-size: 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mtable tr:last-child td {
  border-bottom: 0;
}
.mtable th:first-child,
.mtable td:first-child {
  text-align: left;
  font-weight: 600;
}
.mtable tr.is-current td:first-child::after {
  content: 'now';
  margin-left: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 99px;
}
.mtable tr.is-future td {
  color: var(--text-4);
}
.mtable tfoot td {
  font-weight: 750;
  border-top: 1px solid var(--border-strong);
}
.cell-input {
  width: 118px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: right;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.cell-input:hover {
  border-color: var(--border);
  background: var(--surface);
}
.cell-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.var-up {
  color: var(--good);
}
.var-down {
  color: var(--bad);
}
.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entry {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.entry:last-child {
  border-bottom: 0;
}
.entry .date {
  width: 48px;
  flex: none;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  line-height: 1.2;
}
.entry .date b {
  display: block;
  font-size: 17px;
  color: var(--text);
}
.entry .note {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry .note.adj {
  color: var(--text-3);
  font-style: italic;
}
.entry .amt {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.entry .amt.neg {
  color: var(--bad);
}
.amount-field {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 4px;
  transition: border-color 0.15s;
}
.amount-field:focus-within {
  border-color: var(--accent);
}
.amount-field span {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-3);
}
.amount-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 34px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.quick-amts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------------- Roadmap ---------------- */
.rm-hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 22px 22px 18px;
  color: #fff;
  background: radial-gradient(120% 120% at 100% 0%, rgba(150, 140, 255, 0.55) 0%, transparent 55%),
    radial-gradient(80% 90% at 0% 100%, rgba(60, 200, 170, 0.18) 0%, transparent 60%),
    linear-gradient(140deg, #17153b 0%, #2b2777 55%, #4338ca 100%);
  box-shadow: 0 10px 40px rgba(50, 40, 160, 0.25);
}
@media (min-width: 700px) {
  .rm-hero {
    padding: 28px 30px 22px;
  }
}
.rm-hero .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}
.rm-hero h2 {
  margin: 2px 0 20px;
  font-size: 26px;
  font-weight: 760;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.rm-figs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}
@media (min-width: 700px) {
  .rm-figs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.rm-fig .lbl {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}
.rm-fig strong {
  display: block;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.rm-fig .sm {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
}
.rm-hero .bar {
  --bar: #fff;
  background: rgba(255, 255, 255, 0.16);
  margin-top: 8px;
}
.journey {
  position: relative;
  margin: 30px 8px 0;
  height: 54px;
}
.journey-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
}
.journey-fill {
  --p: 0;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(var(--p) * 1%);
  border-radius: inherit;
  background: linear-gradient(90deg, #a5b4fc, #ffffff);
  transition: width 1.4s var(--ease);
}
.journey-mark {
  position: absolute;
  top: 17px;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #262262;
  border: 2px solid rgba(255, 255, 255, 0.45);
}
.journey-mark.hit {
  background: #fff;
  border-color: #fff;
}
.journey-mark.ipo {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  display: grid;
  place-items: center;
  background: #262262;
}
.journey-mark.ipo .ico {
  width: 12px;
  height: 12px;
}
.journey-label {
  position: absolute;
  top: 32px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 650;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}
.journey-label.hit {
  color: #fff;
}
.journey-you {
  position: absolute;
  top: 17px;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.22);
  animation: youPulse 2.6s ease-in-out infinite;
  transition: left 1.4s var(--ease);
}
.journey-you span {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 6px;
  background: #fff;
  color: #2b2777;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.rm-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0 14px;
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tl-item {
  position: relative;
  padding: 0 0 14px 46px;
}
.tl-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 30px;
  bottom: -14px;
  width: 2px;
  background: var(--border-strong);
}
.tl-item:last-child::before {
  display: none;
}
.tl-item.is-achieved::before {
  background: var(--good-mark);
}
.tl-node {
  position: absolute;
  left: 0;
  top: 14px;
  z-index: 1;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 750;
}
.tl-node .ico {
  width: 15px;
  height: 15px;
}
.is-achieved .tl-node {
  background: var(--good-mark);
  border-color: var(--good-mark);
  color: #fff;
}
.is-achieved .tl-node .ico {
  stroke-width: 3;
}
.is-current .tl-node {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
  animation: nodePulse 2.6s ease-in-out infinite;
}
.tl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.is-current .tl-card {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.tl-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border: 0;
  background: none;
  text-align: left;
}
.tl-head > div {
  flex: 1;
  min-width: 0;
}
.tl-title {
  display: block;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.02em;
}
.tl-sub {
  display: block;
  font-size: 13px;
  color: var(--text-3);
}
.tl-head .chev {
  color: var(--text-3);
  transition: transform 0.25s var(--ease);
}
.tl-head[aria-expanded='true'] .chev {
  transform: rotate(180deg);
}
.tl-progress {
  padding: 0 16px 14px;
}
.tl-progress .kv {
  margin-top: 6px;
}
.tl-body {
  display: grid;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 45%, var(--surface));
  animation: fadeDown 0.3s var(--ease);
}
.tl-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.tl-edit .full {
  grid-column: 1 / -1;
}
.action-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.action {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  font-size: 14px;
}
.action .ms-check {
  --gc: var(--good-mark);
}
.action .x {
  opacity: 0;
}
.action:hover .x,
.action:focus-within .x {
  opacity: 1;
}
@media (hover: none) {
  .action .x {
    opacity: 1;
  }
}
.add-milestone {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 0 46px;
}

/* ---------------- Forms ---------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > label,
.field-label {
  font-size: 12.5px;
  font-weight: 680;
  color: var(--text-3);
}
.input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 16px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover {
  border-color: var(--border-strong);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.input {
  height: auto;
  min-height: 92px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8a95' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.field-grid {
  display: grid;
  gap: 16px;
}
@media (min-width: 560px) {
  .field-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
.field.full {
  grid-column: 1 / -1;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 620;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover {
  border-color: var(--border-strong);
}
.chip.on {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.chip .ico {
  width: 14px;
  height: 14px;
}
.chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.prio-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.prio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}
.prio .ico {
  width: 15px;
  height: 15px;
}
.prio.p1 .ico {
  color: var(--p1);
}
.prio.p2 .ico {
  color: var(--p2);
}
.prio.p3 .ico {
  color: var(--p3);
}
.prio.p4 .ico {
  color: var(--text-4);
}
.prio.on {
  border-color: currentColor;
}
.prio.p1.on {
  color: var(--p1);
  background: color-mix(in srgb, var(--p1) 10%, var(--surface));
}
.prio.p2.on {
  color: var(--p2);
  background: color-mix(in srgb, var(--p2) 10%, var(--surface));
}
.prio.p3.on {
  color: var(--p3);
  background: color-mix(in srgb, var(--p3) 10%, var(--surface));
}
.prio.p4.on {
  color: var(--text-2);
  background: var(--surface-2);
}
.tag-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.tag-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.tag-editor input {
  flex: 1;
  min-width: 110px;
  height: 32px;
  border: 0;
  outline: 0;
  background: none;
  font-size: 15px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 4px 0 9px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 620;
}
.tag-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.tag-chip button {
  width: 22px;
  height: 22px;
  border: 0;
  background: none;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.tag-chip button:hover {
  background: var(--surface-3);
}
.tag-chip .ico {
  width: 13px;
  height: 13px;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: grid;
  place-items: center;
  color: #fff;
}
.swatch .ico {
  width: 15px;
  height: 15px;
  stroke-width: 3;
  opacity: 0;
}
.swatch.on {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c);
}
.swatch.on .ico {
  opacity: 1;
}
.days-row {
  display: flex;
  gap: 4px;
}
.day-tog {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
}
.day-tog.on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
input[type='range'] {
  width: 100%;
  accent-color: var(--accent-bg);
}

/* ---------------- Sheet & dialog ---------------- */
.sheet-backdrop,
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 8, 14, 0.45);
  opacity: 0;
  transition: opacity 0.28s;
}
.sheet-backdrop.open {
  opacity: 1;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-lg);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(105%);
  transition: transform 0.34s var(--ease);
  outline: none;
}
.sheet.open {
  transform: none;
}
.sheet-grab {
  flex: none;
  height: 22px;
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
}
.sheet-grab span {
  width: 38px;
  height: 5px;
  border-radius: 99px;
  background: var(--border-strong);
}
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 20px 20px;
}
@media (min-width: 700px) {
  .sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(600px, calc(100vw - 48px));
    max-height: min(780px, calc(100dvh - 64px));
    border-radius: 18px;
    padding-bottom: 0;
    opacity: 0;
    transform: translate(-50%, -47%) scale(0.97);
    transition: transform 0.24s var(--ease), opacity 0.2s;
  }
  .sheet.open {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  .sheet-grab {
    display: none;
  }
  .sheet-body {
    padding: 22px 24px 22px;
  }
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}
.sheet-head h2 {
  flex: 1;
  margin: 6px 0 0;
  font-size: 19px;
  font-weight: 740;
  letter-spacing: -0.015em;
}
.sheet-head .check {
  margin: -2px 0 0 -10px;
}
.title-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  resize: none;
  padding: 7px 0 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.35;
  overflow: hidden;
}
.title-input::placeholder {
  color: var(--text-4);
}
.notes-input {
  width: 100%;
  min-height: 64px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface-2);
  resize: none;
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
}
.notes-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.sheet-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.sheet-foot .grow {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-3);
}
.sheet-section {
  margin-top: 22px;
}
.sheet-section > h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child {
  border-bottom: 0;
}
.setting-row .lbl b {
  display: block;
  font-size: 14.5px;
  font-weight: 620;
}
.setting-row .lbl span {
  font-size: 12.5px;
  color: var(--text-3);
}
.setting-row .input {
  width: 140px;
}
.habit-edit {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.habit-edit .emoji-input {
  text-align: center;
  font-size: 20px;
  padding: 0;
}
.habit-edit .days-row {
  grid-column: 2 / -1;
}
.habit-edit .stats-line {
  grid-column: 2 / -1;
  font-size: 12.5px;
  color: var(--text-3);
}
.habit-edit .tools {
  display: flex;
  gap: 2px;
}
.dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 70;
  width: min(400px, calc(100vw - 32px));
  padding: 22px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -50%);
  animation: dialogIn 0.22s var(--ease);
}
.dialog-backdrop {
  z-index: 69;
  opacity: 1;
}
.dialog h3 {
  margin: 0 0 6px;
  font-size: 17px;
}
.dialog p {
  margin: 0;
  color: var(--text-2);
  font-size: 14.5px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ---------------- Toast ---------------- */
#toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 80;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
@media (min-width: 900px) {
  #toast-root {
    bottom: 26px;
    left: calc(50% + var(--sidebar-w) / 2);
  }
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  min-height: 46px;
  border-radius: 12px;
  background: var(--toast-bg);
  color: #f3f3f6;
  font-size: 14px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.32s var(--spring) both;
}
.toast.out {
  animation: toastOut 0.2s ease forwards;
}
.toast button {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #b9b9ff;
  font-size: 13.5px;
  font-weight: 750;
  padding: 7px 11px;
  border-radius: 8px;
}
.toast button:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ---------------- Small additions ---------------- */
.quickadd.has-value ~ .qa-hint {
  display: none;
}
.habit.rest:not(.done) {
  opacity: 0.72;
}
.tab .badge.neutral {
  background: var(--accent-bg);
}
button.week-day {
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}
button.week-day:disabled {
  cursor: default;
  opacity: 0.7;
}
.week-day:hover:not(:disabled) {
  border-color: var(--border-strong);
}
@media (max-width: 559.98px) {
  .hide-sm {
    display: none;
  }
  .view-head .btn-primary span {
    display: none;
  }
  .view-head .btn-primary {
    width: 40px;
    padding: 0;
  }
}
.setting-row .lbl b .ico {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
  color: var(--text-3);
}
.view:focus {
  outline: none;
}
.ov-hero {
  align-items: flex-start;
}
.goal-summary .facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px;
}
@media (min-width: 600px) {
  .goal-summary .facts {
    grid-template-columns: repeat(4, auto);
  }
}
.pace-legend {
  flex-wrap: wrap;
}
@media (max-width: 559.98px) {
  .mtable th,
  .mtable td {
    padding-left: 12px;
    padding-right: 12px;
  }
  .table-wrap {
    margin: 0 -12px -18px;
  }
  .cell-input {
    width: 104px;
  }
  .journey-label.minor {
    display: none;
  }
}

/* ---------------- Motion ---------------- */
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes taskIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
    background: var(--accent-soft);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes tokenIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(0.8);
  }
  70% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes bump {
  0% {
    transform: none;
  }
  40% {
    transform: translateY(-3px) scale(1.12);
  }
  100% {
    transform: none;
  }
}
@keyframes grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.96);
  }
}
@keyframes youPulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(255, 255, 255, 0.08);
  }
}
@keyframes nodePulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px var(--accent-soft);
  }
  50% {
    box-shadow: 0 0 0 8px transparent;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Revenue: table + log side by side only when there's room for all table columns */
.rev-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1280px) {
  .rev-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: start;
  }
}
/* Overview habit card is narrow beside the Today card on mid-size screens: keep names readable. */
@media (min-width: 960px) and (max-width: 1279.98px) {
  .habit-line .week-dots {
    display: none;
  }
}

/* ---------------- Sync status ---------------- */
button.save-state {
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  padding: 6px 8px;
  margin-left: 0;
  border-radius: 8px;
  cursor: pointer;
}
button.save-state:hover {
  background: var(--surface-2);
}
.save-state.busy i,
.dot.busy {
  background: var(--accent);
  animation: blink 1s ease-in-out infinite;
}
.save-state.warn i,
.dot.warn {
  background: var(--warn-mark);
}
.save-state.idle i,
.dot.idle {
  background: var(--text-4);
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: 1px;
  background: var(--good-mark);
}
.dot.error {
  background: var(--bad-mark);
}
/* Phones have no sidebar: flag sync problems with a dot on the Settings button. */
html[data-sync='warn'] .icon-btn[data-act='open-settings'] {
  position: relative;
}
html[data-sync='warn'] .icon-btn[data-act='open-settings']::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn-mark);
  box-shadow: 0 0 0 2px var(--bg);
}
@keyframes blink {
  50% {
    opacity: 0.35;
  }
}
