:root {
  color-scheme: dark;
  --bg: #07090d;
  --surface: #10141d;
  --surface-2: #171c27;
  --surface-3: #202737;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f6f7fb;
  --muted: #9ba4b5;
  --muted-2: #687083;
  --hot: #ff4f1f;
  --hot-2: #ff2d2d;
  --amber: #ffb000;
  --lime: #b9ff2f;
  --green: #2dff88;
  --cyan: #00dcff;
  --pink: #ff4fd8;
  --good: #63f58b;
  --danger: #ff5a6d;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  --small-font: 13px;
  --tiny-font: 12px;
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang TC",
    "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(255, 45, 45, 0.12), transparent 28rem),
    radial-gradient(circle at 82% 10%, rgba(45, 255, 136, 0.09), transparent 22rem),
    linear-gradient(180deg, #0a0d13 0%, #06070a 100%);
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100dvh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(9, 12, 18, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--hot), var(--amber) 48%, var(--lime));
  color: #111;
  font-weight: 950;
  box-shadow: 0 12px 26px rgba(255, 79, 31, 0.22);
}

.brand h1,
.topbar h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  font-weight: 760;
  line-height: 1.1;
}

.brand-kicker,
.eyebrow {
  color: var(--lime);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.3;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.primary,
.ghost,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  background: transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
}

.nav-item svg,
.primary svg,
.ghost svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

i[data-lucide] {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  font-style: normal;
  line-height: 1;
}

i[data-lucide]::before {
  content: "•";
  font-size: 17px;
  font-weight: 860;
}

i[data-lucide="plus"]::before {
  content: "+";
  font-size: 24px;
}

i[data-lucide="download"]::before {
  content: "↓";
}

i[data-lucide="flame"]::before {
  content: "♢";
}

i[data-lucide="list-checks"]::before,
i[data-lucide="check"]::before {
  content: "✓";
}

i[data-lucide="calendar-range"],
i[data-lucide="calendar-days"],
i[data-lucide="calendar-clock"] {
  font-size: 13px;
}

i[data-lucide="calendar-range"]::before,
i[data-lucide="calendar-days"]::before,
i[data-lucide="calendar-clock"]::before {
  content: "月";
  font-size: 13px;
}

i[data-lucide="git-branch-plus"]::before {
  content: "年";
  font-size: 13px;
}

i[data-lucide="blocks"]::before {
  content: "□";
}

i[data-lucide="sparkles"]::before {
  content: "✦";
}

i[data-lucide="sliders-horizontal"]::before {
  content: "⚙";
}

i[data-lucide="target"]::before {
  content: "◎";
}

i[data-lucide="arrow-right"]::before {
  content: "→";
}

i[data-lucide="arrow-up"]::before {
  content: "↑";
}

i[data-lucide="zap"]::before {
  content: "↯";
}

i[data-lucide="pencil"]::before {
  content: "✎";
}

i[data-lucide="list-plus"]::before {
  content: "+";
}

.nav-item.active {
  color: #111;
  background: linear-gradient(135deg, var(--green), var(--lime));
  font-weight: 760;
  box-shadow: 0 12px 28px rgba(45, 255, 136, 0.16);
}

.nav-item:not(.active):hover,
.ghost:hover,
.icon-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.reset-small {
  margin-top: auto;
  justify-content: flex-start;
}

.main {
  min-width: 0;
  padding: 28px clamp(18px, 4vw, 48px) 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 760;
  line-height: 1;
}

.top-actions,
.button-row,
.panel-head,
.section-title,
.control-row,
.score-row,
.focus-item,
.task-mainline,
.task-meta,
.substep-row,
.domain-pill,
.inline-form,
.switch-row {
  display: flex;
  align-items: center;
}

.top-actions,
.button-row {
  gap: 10px;
}

.primary,
.ghost,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 850;
}

.primary {
  color: #121212;
  background: linear-gradient(135deg, var(--green), var(--lime));
  box-shadow: 0 12px 28px rgba(45, 255, 136, 0.2);
}

.primary.alt {
  background: linear-gradient(135deg, var(--cyan), #b9ff2f);
}

.primary:hover {
  filter: brightness(1.06);
}

.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.ghost.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-button,
.icon-only {
  width: 42px;
  padding: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
  margin-bottom: 18px;
}

.mission-panel,
.focus-panel,
.section-band,
.ai-card,
.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  box-shadow: var(--shadow);
}

.mission-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(18px, 3vw, 28px);
  background:
    linear-gradient(135deg, rgba(255, 45, 45, 0.18), transparent 34%),
    linear-gradient(110deg, transparent 52%, rgba(45, 255, 136, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
}

.mission-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent, rgba(185, 255, 47, 0.09), transparent);
  pointer-events: none;
}

.focus-panel,
.section-band,
.ai-card,
.settings-card {
  padding: 18px;
}

.panel-head,
.section-title {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head h3,
.section-title h3,
.ai-card h3,
.settings-card h3 {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 760;
  line-height: 1.12;
}

.streak {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(185, 255, 47, 0.28);
  border-radius: var(--radius);
  color: var(--lime);
  background: rgba(185, 255, 47, 0.08);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.score-row {
  gap: 24px;
}

.mission-panel .score-row {
  display: grid;
  grid-template-columns: auto minmax(150px, 0.48fr) minmax(260px, 1fr);
  align-items: center;
}

.progress-ring {
  --size: clamp(132px, 24vw, 188px);
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  flex: 0 0 var(--size);
  border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--value) * 1%), rgba(255, 255, 255, 0.1) 0);
  box-shadow: inset 0 0 0 1px var(--line), 0 0 42px rgba(45, 255, 136, 0.12);
}

.progress-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  background: #0d1017;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
}

.progress-ring span {
  position: relative;
  z-index: 1;
  font-size: clamp(34px, 8vw, 54px);
  font-weight: 780;
  line-height: 1;
}

.score-copy {
  min-width: 0;
}

.score-copy p:first-child {
  max-width: 48ch;
  color: #f7f9ff;
  font-size: clamp(18px, 2.2vw, 25px);
  font-weight: 760;
  line-height: 1.35;
}

.meter {
  overflow: hidden;
  height: 10px;
  margin: 18px 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.meter span,
.mini-meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hot-2), var(--hot), var(--green), var(--lime));
  transition: width 250ms ease;
}

.meter-pop span,
.task-card.just-completed .mini-meter span {
  animation: meterGlow 680ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-ring.score-pop {
  animation: scorePop 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.micro,
.soft-copy {
  color: var(--muted);
  line-height: 1.55;
  font-size: var(--small-font);
}

.focus-list,
.habit-list,
.task-list,
.domain-editor,
.preview-steps {
  display: grid;
  gap: 10px;
}

.focus-progress {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: var(--small-font);
  font-weight: 760;
}

.preview-steps.compact {
  gap: 8px;
}

.habit-list {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.hero-habit-rings {
  --hero-ring-size: 66px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  gap: 9px;
  min-width: 0;
}

.hero-habit-rings[data-count="1"] {
  --hero-ring-size: 86px;
  grid-template-columns: minmax(84px, 1fr);
}

.hero-habit-rings[data-count="2"],
.hero-habit-rings[data-count="3"] {
  --hero-ring-size: 72px;
}

.hero-habit-rings[data-count="5"],
.hero-habit-rings[data-count="6"],
.hero-habit-rings[data-count="7"],
.hero-habit-rings[data-count="8"] {
  --hero-ring-size: 56px;
}

.hero-habit,
.hero-habit-empty {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.hero-habit {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 8px 6px;
}

.hero-habit.done {
  border-color: rgba(45, 255, 136, 0.32);
  background: rgba(45, 255, 136, 0.07);
}

.hero-habit > span {
  overflow: hidden;
  width: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 740;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-habit-empty {
  grid-column: 1 / -1;
  padding: 12px;
  color: var(--muted);
  font-size: var(--small-font);
  line-height: 1.45;
}

.month-grid,
.year-map-shell,
.year-month-detail,
.goal-form,
.week-board,
.month-recurring-list {
  display: grid;
  gap: 14px;
}

.month-grid,
.year-map-shell {
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
}

.month-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 16px;
  margin-bottom: 18px;
}

.month-hero-card,
.month-highlight-card,
.week-lane,
.year-goal-core,
.year-month-panel,
.year-metric-card,
.month-task-pill,
.week-detail-card,
.planning-task-row,
.task-ai-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.month-hero-card,
.month-highlight-card,
.year-goal-core,
.year-month-panel,
.task-ai-box {
  padding: 18px;
}

.month-hero-card {
  background:
    linear-gradient(135deg, rgba(255, 79, 31, 0.16), transparent 32%),
    linear-gradient(120deg, transparent 55%, rgba(45, 255, 136, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
}

.month-hero-card .score-row {
  align-items: center;
}

.month-highlight-card,
.year-goal-core {
  display: grid;
  gap: 12px;
}

.month-highlight-copy,
.year-goal-copy {
  display: grid;
  gap: 8px;
}

.month-highlight-copy h3,
.year-goal-copy h3,
.year-month-panel h3 {
  font-size: 24px;
  font-weight: 760;
  line-height: 1.2;
}

.month-goal-meta,
.year-goal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: var(--small-font);
}

.week-board {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.week-lane {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.week-lane-button {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.week-lane-button:hover,
.week-lane-button.active {
  border-color: rgba(185, 255, 47, 0.36);
  background:
    linear-gradient(135deg, rgba(255, 79, 31, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(185, 255, 47, 0.07), rgba(255, 255, 255, 0.025));
}

.week-lane-button.active {
  box-shadow: inset 0 0 0 1px rgba(185, 255, 47, 0.12), 0 16px 40px rgba(45, 255, 136, 0.08);
}

.week-task-preview {
  display: grid;
  gap: 6px;
}

.week-task-preview span {
  overflow: hidden;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: var(--tiny-font);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-detail-panel {
  margin-top: 14px;
}

.week-detail-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(45, 255, 136, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.week-detail-head,
.week-task-panel-head,
.planning-task-row {
  display: flex;
  align-items: center;
}

.week-detail-head,
.week-task-panel-head {
  justify-content: space-between;
  gap: 14px;
}

.week-detail-head h3 {
  margin-top: 3px;
  font-size: 24px;
  font-weight: 760;
  line-height: 1.2;
}

.week-score {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 50%;
  color: #111;
  background: linear-gradient(135deg, var(--green), var(--lime));
  font-size: 21px;
  font-weight: 850;
  box-shadow: 0 14px 30px rgba(45, 255, 136, 0.18);
}

.week-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
}

.week-goal-form,
.week-task-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.button-row.split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.week-task-panel h4 {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 760;
}

.planning-task-list {
  display: grid;
  gap: 8px;
}

.planning-task-row {
  gap: 10px;
  padding: 10px;
}

.planning-task-row.done {
  border-color: rgba(99, 245, 139, 0.22);
  background: rgba(99, 245, 139, 0.055);
}

.planning-task-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.planning-task-copy strong,
.planning-task-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-task-copy strong {
  font-size: 15px;
  font-weight: 740;
}

.planning-task-copy span {
  color: var(--muted);
  font-size: var(--tiny-font);
}

.week-lane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.week-lane h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 760;
}

.week-lane p {
  color: var(--muted);
  font-size: var(--small-font);
  line-height: 1.45;
}

.month-task-pill {
  padding: 10px 12px;
}

.month-task-pill strong {
  display: block;
  font-size: 15px;
  font-weight: 740;
  line-height: 1.35;
}

.month-task-pill span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--tiny-font);
}

.goal-form {
  gap: 12px;
}

.goal-settings {
  margin-top: 10px;
}

.goal-settings > summary {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  list-style: none;
}

.goal-settings > summary::-webkit-details-marker {
  display: none;
}

.goal-settings > summary:hover {
  border-color: rgba(185, 255, 47, 0.28);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.goal-settings[open] > summary {
  margin-bottom: 12px;
  color: #111;
  background: linear-gradient(135deg, var(--green), var(--lime));
}

.goal-settings .goal-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.year-form {
  gap: 14px;
}

.year-map-shell {
  gap: 18px;
}

.year-progress-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1.2fr);
  gap: 14px;
}

.year-summary-card {
  display: grid;
  gap: 18px;
  height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(45, 255, 136, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.year-summary-card h3 {
  margin: 3px 0 0;
  font-size: 26px;
  font-weight: 760;
  line-height: 1.2;
}

.year-summary-progress {
  display: grid;
  gap: 8px;
}

.year-summary-progress strong {
  font-size: 44px;
  line-height: 1;
}

.year-month-bars {
  display: grid;
  gap: 8px;
}

.year-month-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.year-month-row span,
.year-month-row strong {
  font-size: var(--small-font);
}

.year-month-row strong {
  text-align: right;
}

.year-map {
  position: relative;
  display: none;
  min-height: 760px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at center, rgba(45, 255, 136, 0.08), transparent 18rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  overflow: hidden;
}

.year-map.active {
  display: block;
}

.year-map svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.year-node-center,
.year-node-month {
  position: absolute;
  transform: translate(-50%, -50%);
}

.year-node-center {
  left: 50%;
  top: 50%;
  width: min(30vw, 280px);
  max-width: 280px;
}

.year-node-month {
  width: 150px;
}

.year-node-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: var(--text);
  background: rgba(10, 14, 21, 0.9);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.year-node-month.year-node-card {
  min-height: 112px;
}

.year-node-card.active {
  border-color: rgba(45, 255, 136, 0.34);
  box-shadow: 0 18px 48px rgba(45, 255, 136, 0.14);
}

.year-node-card strong {
  font-size: 16px;
  font-weight: 760;
  line-height: 1.3;
}

.year-node-card span,
.year-node-card small {
  color: var(--muted);
  font-size: var(--tiny-font);
  line-height: 1.35;
}

.year-node-percent {
  font-size: 28px;
  font-weight: 780;
  line-height: 1;
}

.year-timeline {
  display: grid;
  gap: 10px;
}

.year-timeline-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.year-timeline-item.active {
  border-color: rgba(45, 255, 136, 0.34);
  background: rgba(45, 255, 136, 0.06);
}

.year-timeline-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #111;
  background: linear-gradient(135deg, var(--hot), var(--amber));
  font-size: 13px;
  font-weight: 850;
}

.year-month-detail {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr);
}

.year-month-panel {
  display: grid;
  gap: 14px;
}

.year-month-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.year-metric-card {
  padding: 14px;
}

.year-metric-card strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.year-metric-card span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: var(--tiny-font);
}

.task-ai-box {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(0, 220, 255, 0.07), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
}

.habit-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 45, 45, 0.07), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.habit-card-head,
.habit-card-body,
.habit-inline,
.habit-summary-card,
.habit-month-head {
  display: flex;
  align-items: center;
}

.habit-card-head,
.habit-month-head {
  justify-content: space-between;
  gap: 12px;
}

.habit-card-body,
.habit-inline,
.habit-summary-card {
  gap: 14px;
}

.habit-title {
  font-size: 18px;
  font-weight: 740;
  line-height: 1.3;
}

.habit-meta,
.habit-copy p:last-child,
.habit-inline-copy p:last-child {
  color: var(--muted);
  font-size: var(--small-font);
}

.habit-copy,
.habit-inline-copy,
.habit-summary-copy {
  display: grid;
  gap: 6px;
}

.habit-rings {
  --ring-track: rgba(255, 255, 255, 0.08);
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.habit-rings.large {
  width: 122px;
  height: 122px;
}

.habit-rings.small {
  width: 82px;
  height: 82px;
}

.habit-rings.mini {
  width: 42px;
  height: 42px;
}

.habit-rings.hero {
  width: var(--hero-ring-size);
  height: var(--hero-ring-size);
}

.habit-ring,
.habit-ring > span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.habit-ring > span {
  content: "";
  display: block;
}

.habit-ring.month {
  background: conic-gradient(#ff4f82 calc(var(--month) * 1%), var(--ring-track) 0);
}

.habit-ring.month > span {
  inset: 8px;
  background: #0d1017;
}

.habit-ring.week {
  inset: 10px;
  background: conic-gradient(#9bff3f calc(var(--week) * 1%), var(--ring-track) 0);
}

.habit-ring.week > span {
  inset: 7px;
  background: #0d1017;
}

.habit-ring.day {
  inset: 19px;
  background: conic-gradient(#52dfff calc(var(--day) * 1%), var(--ring-track) 0);
}

.habit-ring.day > span {
  inset: 6px;
  background: #0d1017;
}

.habit-rings.small .habit-ring.month > span {
  inset: 6px;
}

.habit-rings.hero .habit-ring.month > span {
  inset: 5px;
}

.habit-rings.small .habit-ring.week {
  inset: 8px;
}

.habit-rings.hero .habit-ring.week {
  inset: 8px;
}

.habit-rings.small .habit-ring.week > span {
  inset: 6px;
}

.habit-rings.hero .habit-ring.week > span {
  inset: 5px;
}

.habit-rings.small .habit-ring.day {
  inset: 15px;
}

.habit-rings.hero .habit-ring.day {
  inset: 15px;
}

.habit-rings.small .habit-ring.day > span {
  inset: 5px;
}

.habit-rings.hero .habit-ring.day > span {
  inset: 4px;
}

.habit-rings.mini .habit-ring.month > span {
  inset: 3px;
}

.habit-rings.mini .habit-ring.week {
  inset: 5px;
}

.habit-rings.mini .habit-ring.week > span {
  inset: 3px;
}

.habit-rings.mini .habit-ring.day {
  inset: 10px;
}

.habit-rings.mini .habit-ring.day > span {
  inset: 2px;
}

.habit-ring-label {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 3px;
  text-align: center;
}

.habit-ring-label strong {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.habit-rings.small .habit-ring-label strong {
  font-size: 18px;
}

.habit-rings.hero .habit-ring-label strong {
  font-size: clamp(13px, calc(var(--hero-ring-size) * 0.25), 18px);
}

.habit-rings.hero .habit-ring-label small {
  display: none;
}

.habit-rings.mini .habit-ring-label strong {
  font-size: 11px;
}

.habit-rings.mini .habit-ring-label small {
  display: none;
}

.habit-ring-label small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
}

.habit-check {
  width: fit-content;
}

.habit-check.done {
  background: linear-gradient(135deg, #9bff3f, #d1ff6b);
}

.habit-inline {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.habit-summary {
  margin-bottom: 14px;
}

.habit-month-summary,
.habit-day-detail {
  display: grid;
  margin-bottom: 14px;
}

.habit-summary-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.habit-month-summary {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
}

.habit-month-score,
.habit-day-detail-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.month-score-ring {
  --month-score: 0;
  position: relative;
  width: 86px;
  height: 86px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(#ff6a45 calc(var(--month-score) * 1%), rgba(255, 255, 255, 0.09) 0);
}

.month-score-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #0d1017;
}

.month-score-ring span {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
}

.month-score-copy,
.habit-day-detail-card > div {
  display: grid;
  gap: 6px;
}

.month-score-copy p:first-child,
.habit-day-kicker {
  margin: 0;
  font-size: 17px;
  font-weight: 740;
}

.month-score-copy p:last-child,
.habit-day-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.habit-month-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric-chip {
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.metric-chip strong {
  font-size: 22px;
  line-height: 1;
}

.metric-chip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.habit-summary-copy p:first-child {
  font-size: 18px;
  font-weight: 740;
}

.habit-month-head h4 {
  margin: 0;
  font-size: 20px;
  font-weight: 740;
}

.habit-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.habit-weekday {
  color: var(--muted);
  font-size: var(--tiny-font);
  text-align: center;
}

.habit-day {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 6px 2px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.habit-day.today {
  border-color: rgba(45, 255, 136, 0.36);
  background: rgba(45, 255, 136, 0.06);
}

.habit-day.selected {
  border-color: rgba(82, 223, 255, 0.38);
  background: rgba(82, 223, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(82, 223, 255, 0.15);
}

.habit-day.done .habit-day-number {
  color: #f4f7fb;
}

.habit-day.future {
  opacity: 0.48;
}

.habit-day.empty {
  visibility: hidden;
  pointer-events: none;
}

.habit-day-number {
  font-size: 12px;
  font-weight: 760;
}

.habit-day-detail-card {
  justify-content: space-between;
}

.habit-day-detail-card.future {
  background: rgba(255, 255, 255, 0.02);
}

.habit-day-detail-card .habit-check[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.recurring-fields {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(45, 255, 136, 0.18);
  border-radius: var(--radius);
  background: rgba(45, 255, 136, 0.04);
}

.recurring-fields[hidden] {
  display: none;
}

.habit-dialog {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.focus-item {
  text-align: left;
  gap: 11px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.focus-rank {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: #111;
  background: linear-gradient(135deg, var(--hot), var(--amber));
  font-weight: 820;
}

.focus-item.done .focus-rank {
  background: var(--good);
}

.focus-item p {
  margin: 0;
  text-align: left;
  font-weight: 720;
  line-height: 1.3;
}

.focus-item > span:last-child {
  display: grid;
  justify-items: start;
  min-width: 0;
  color: var(--muted);
  font-size: var(--small-font);
  text-align: left;
}

.section-band {
  margin-top: 16px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(56px, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: var(--small-font);
  font-weight: 720;
}

.segmented button.active {
  color: #111;
  background: linear-gradient(135deg, var(--green), var(--lime));
}

.task-card {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.task-summary-list {
  display: grid;
  gap: 8px;
}

.task-summary-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.task-summary-card.done {
  border-color: rgba(99, 245, 139, 0.2);
  background: rgba(99, 245, 139, 0.055);
}

.task-summary-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.summary-check {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  color: transparent;
  background: rgba(255, 255, 255, 0.04);
}

.summary-check.checked {
  color: #111;
  border-color: transparent;
  background: linear-gradient(135deg, var(--green), var(--lime));
}

.summary-progress-chip {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid rgba(185, 255, 47, 0.2);
  border-radius: 999px;
  color: var(--lime);
  background: rgba(185, 255, 47, 0.07);
  font-size: 12px;
  font-weight: 850;
}

.task-summary-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.task-summary-main strong,
.task-summary-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-summary-main strong {
  font-size: 15px;
  font-weight: 740;
}

.task-summary-main span {
  color: var(--muted);
  font-size: var(--tiny-font);
}

.task-summary-body {
  padding: 0 10px 10px;
}

.task-summary-body .task-card {
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
}

.task-card.done {
  border-color: rgba(99, 245, 139, 0.2);
  background: rgba(99, 245, 139, 0.06);
}

.task-mainline {
  align-items: flex-start;
  gap: 11px;
}

.task-mainline.step-driven {
  display: block;
}

.check {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  color: transparent;
  background: rgba(255, 255, 255, 0.04);
}

.check.checked {
  color: #111;
  background: linear-gradient(135deg, var(--green), var(--lime));
  border-color: transparent;
}

.task-content {
  min-width: 0;
  flex: 1;
}

.task-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-title-row.compact-actions {
  justify-content: flex-end;
  margin-bottom: 4px;
}

.task-title {
  margin-top: 1px;
  color: var(--text);
  font-size: 16px;
  font-weight: 720;
  line-height: 1.35;
  word-break: break-word;
}

.task-card.done .task-title {
  color: rgba(246, 247, 251, 0.7);
  text-decoration: line-through;
}

.task-card.recurring.done .task-title {
  color: var(--text);
  text-decoration: none;
}

.task-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.task-actions.embedded-actions {
  position: absolute;
  top: 10px;
  right: 10px;
}

.task-summary-body .task-card {
  padding-top: 12px;
}

.task-summary-body .task-card .task-meta {
  padding-right: 76px;
}

.mini-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.mini-icon svg {
  width: 16px;
  height: 16px;
}

.task-meta {
  flex-wrap: wrap;
  gap: 7px;
  margin: 9px 0 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: var(--tiny-font);
  font-weight: 780;
}

.tag.hot {
  color: #ffd5c9;
  border-color: rgba(255, 79, 31, 0.28);
  background: rgba(255, 79, 31, 0.1);
}

.tag.habit {
  color: #caffeb;
  border-color: rgba(45, 255, 136, 0.24);
  background: rgba(45, 255, 136, 0.08);
}

.task-notes {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.note {
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: var(--small-font);
  line-height: 1.45;
}

.note.reward {
  color: #dfffd1;
  background: rgba(185, 255, 47, 0.06);
}

.note.cost {
  color: #ffd1d6;
  background: rgba(255, 90, 109, 0.07);
}

.mini-meter {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.substeps {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.substep-row {
  gap: 8px;
  color: var(--muted);
  font-size: var(--small-font);
  line-height: 1.35;
}

.substep-row.done {
  color: rgba(155, 164, 181, 0.7);
  text-decoration: line-through;
}

.tiny-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  color: transparent;
  background: rgba(255, 255, 255, 0.03);
}

.tiny-check.checked {
  color: #111;
  background: var(--lime);
  border-color: transparent;
}

.empty-state {
  padding: 28px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

label.field,
.control-row label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: var(--small-font);
  font-weight: 780;
}

.control-row label {
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  text-align-last: left;
}

textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(45, 255, 136, 0.58);
  box-shadow: 0 0 0 3px rgba(45, 255, 136, 0.12);
}

.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.domain-card {
  display: block;
  width: 100%;
  color: var(--text);
  text-align: left;
  overflow: hidden;
  min-height: 174px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.025));
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.domain-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--domain-color), white 22%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.072), rgba(255, 255, 255, 0.028));
}

.domain-card.active {
  border-color: rgba(185, 255, 47, 0.38);
  box-shadow: inset 0 0 0 1px rgba(185, 255, 47, 0.12);
}

.domain-detail {
  margin-top: 14px;
}

.domain-detail-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--domain-color), transparent 88%), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.domain-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.domain-detail-actions .ghost {
  white-space: nowrap;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.compact-grid .domain-card {
  min-height: 142px;
}

.domain-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.domain-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: #111;
  background: var(--domain-color);
  box-shadow: 0 12px 26px color-mix(in srgb, var(--domain-color), transparent 72%);
}

.domain-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

.domain-card h4 {
  margin: 12px 0 4px;
  font-size: 20px;
  font-weight: 760;
}

.domain-stats {
  color: var(--muted);
  font-size: var(--small-font);
}

.domain-percent {
  font-size: 28px;
  font-weight: 780;
  line-height: 1;
}

.domain-bar {
  overflow: hidden;
  height: 8px;
  margin: 14px 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.domain-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--domain-color), rgba(255, 255, 255, 0.92));
}

.domain-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: var(--small-font);
  list-style: none;
}

.domain-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--domain-color);
  font-size: var(--small-font);
  font-weight: 820;
}

.domain-card-action svg,
.domain-card-action i {
  width: 16px;
  height: 16px;
}

.ai-layout,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-card.wide {
  grid-column: 1 / -1;
}

.sync-card .panel-head {
  align-items: center;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--tiny-font);
  font-weight: 800;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
}

.sync-status.online {
  border-color: rgba(99, 245, 139, 0.45);
  color: #63f58b;
  background: rgba(99, 245, 139, 0.1);
}

.sync-status.pending {
  border-color: rgba(185, 255, 47, 0.38);
  color: var(--lime);
  background: rgba(185, 255, 47, 0.08);
}

.sync-status.offline {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--muted);
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.sync-advanced {
  margin-top: 10px;
}

.sync-advanced > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: var(--small-font);
  font-weight: 760;
  list-style: none;
}

.sync-advanced > summary::-webkit-details-marker {
  display: none;
}

.sync-advanced[open] > summary {
  margin-bottom: 10px;
  color: var(--text);
}

.utility-actions {
  margin-top: 14px;
  justify-content: flex-end;
}

.text-button {
  appearance: none;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: var(--small-font);
  font-weight: 760;
  cursor: pointer;
}

.text-button:hover {
  color: var(--lime);
}

.large-icon {
  width: 32px;
  height: 32px;
  color: var(--lime);
}

.prompt-box {
  min-height: 220px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid rgba(185, 255, 47, 0.2);
  border-radius: var(--radius);
  color: #dce3f2;
  background: rgba(185, 255, 47, 0.045);
  white-space: pre-wrap;
  line-height: 1.55;
}

.preview-step {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--small-font);
  background: rgba(255, 255, 255, 0.035);
}

.preview-step.editable-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.preview-step.editable-step input {
  min-height: 36px;
  border-radius: 6px;
  font-size: var(--small-font);
}

#taskAiResult {
  display: none;
}

.api-status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--small-font);
  line-height: 1.45;
}

.api-status.good {
  color: var(--good);
}

.api-status.bad,
.warning-copy {
  color: #ffd1d6;
}

.inline-form {
  gap: 8px;
  margin-bottom: 16px;
}

.inline-form input[type="color"] {
  width: 48px;
  padding: 4px;
}

.domain-pill {
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.domain-pill span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--domain-color);
}

.switch-row {
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-weight: 780;
}

.switch-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--lime);
}

.switch-row > span {
  flex: 1;
}

.help-tip {
  position: relative;
}

.help-tip summary {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 850;
}

.help-tip summary::-webkit-details-marker {
  display: none;
}

.help-tip p {
  position: absolute;
  right: 0;
  top: 32px;
  z-index: 4;
  width: min(260px, 74vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(17, 23, 34, 0.98);
  box-shadow: var(--shadow);
  font-size: var(--tiny-font);
  line-height: 1.45;
}

dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #111722;
  box-shadow: var(--shadow);
}

#habitDialog {
  width: min(860px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
}

.task-form {
  display: grid;
  gap: 11px;
  padding: 16px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 2px;
}

.dialog-head h3 {
  margin-top: 3px;
  font-size: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.task-primary-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 92px;
}

.task-time-grid,
.duration-grid,
.recurring-grid,
.outcome-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.outcome-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.028);
}

.outcome-card input {
  min-height: 38px;
}

.task-ai-box .button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.task-ai-box textarea {
  min-height: 120px;
}

.button-row.end {
  justify-content: flex-end;
}

.danger {
  color: #ffd5dc;
  border-color: rgba(255, 90, 109, 0.25);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  transform: translate(-50%, 120px);
  max-width: min(520px, calc(100vw - 28px));
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(20, 25, 35, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

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

.celebration {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.celebration.show {
  animation: celebrate 900ms ease forwards;
}

.celebration p {
  position: relative;
  z-index: 1;
  padding: 14px 20px;
  border-radius: var(--radius);
  color: #111;
  background: var(--lime);
  font-size: 28px;
  font-weight: 950;
  box-shadow: 0 20px 50px rgba(185, 255, 47, 0.25);
}

.burst {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: conic-gradient(var(--hot), var(--amber), var(--lime), var(--cyan), var(--hot));
  filter: blur(18px);
  opacity: 0.5;
}

.bottom-nav {
  display: none;
}

@keyframes celebrate {
  0% {
    opacity: 0;
    transform: scale(0.88);
  }
  22%,
  70% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

@keyframes meterGlow {
  0% {
    filter: brightness(1);
    box-shadow: 0 0 0 rgba(185, 255, 47, 0);
  }
  35% {
    filter: brightness(1.28);
    box-shadow: 0 0 18px rgba(185, 255, 47, 0.42);
  }
  100% {
    filter: brightness(1);
    box-shadow: 0 0 0 rgba(185, 255, 47, 0);
  }
}

@keyframes scorePop {
  0% {
    transform: scale(1);
    box-shadow: inset 0 0 0 1px var(--line), 0 0 42px rgba(45, 255, 136, 0.12);
  }
  38% {
    transform: scale(1.045);
    box-shadow: inset 0 0 0 1px rgba(185, 255, 47, 0.5), 0 0 54px rgba(45, 255, 136, 0.26);
  }
  100% {
    transform: scale(1);
    box-shadow: inset 0 0 0 1px var(--line), 0 0 42px rgba(45, 255, 136, 0.12);
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  .main {
    padding: 14px 12px calc(88px + env(safe-area-inset-bottom));
  }

  .hero-grid,
  .month-hero,
  .month-grid,
  .year-progress-shell,
  .year-map-shell,
  .year-month-detail,
  .ai-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: center;
    margin-bottom: 14px;
  }

  .top-actions .icon-button {
    display: none;
  }

  .bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    overflow: hidden;
    scrollbar-width: none;
    gap: 3px;
    padding: 7px 6px max(7px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(8, 10, 15, 0.98);
    backdrop-filter: blur(16px);
  }

  .bottom-nav::-webkit-scrollbar {
    display: none;
  }

  .bottom-nav::after {
    content: "";
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    height: calc(120px + env(safe-area-inset-bottom));
    background: rgba(8, 10, 15, 0.98);
    z-index: -1;
  }

  .bottom-nav .nav-item {
    display: grid;
    justify-items: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 4px 2px;
    font-size: 10px;
  }
}

@media (max-width: 680px) {
  .topbar {
    display: flex;
    gap: 10px;
  }

  .top-actions {
    width: auto;
    flex: 0 0 auto;
  }

  .top-actions .primary {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .top-actions .primary span {
    display: none;
  }

  .topbar h2 {
    font-size: 30px;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .hero-grid {
    gap: 10px;
    margin-bottom: 10px;
  }

  .mission-panel,
  .focus-panel,
  .section-band,
  .month-hero-card,
  .month-highlight-card,
  .year-goal-core,
  .year-month-panel,
  .task-ai-box {
    padding: 12px;
  }

  .mission-panel .panel-head,
  .focus-panel .panel-head,
  .section-title,
  .panel-head {
    margin-bottom: 10px;
  }

  .mission-panel .score-row {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 12px;
  }

  .mission-panel .progress-ring {
    --size: 118px;
    margin-inline: 0;
  }

  .mission-panel .progress-ring::after {
    inset: 9px;
  }

  .mission-panel .progress-ring span {
    font-size: 36px;
  }

  .mission-panel .score-copy {
    grid-column: 1 / -1;
  }

  .score-copy p:first-child {
    font-size: 18px;
  }

  .meter {
    margin: 10px 0 6px;
  }

  .hero-habit-rings {
    --hero-ring-size: 54px;
    align-self: stretch;
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    gap: 6px;
  }

  .hero-habit-rings[data-count="1"] {
    --hero-ring-size: 78px;
  }

  .hero-habit-rings[data-count="2"],
  .hero-habit-rings[data-count="3"] {
    --hero-ring-size: 62px;
  }

  .hero-habit-rings[data-count="5"],
  .hero-habit-rings[data-count="6"],
  .hero-habit-rings[data-count="7"],
  .hero-habit-rings[data-count="8"] {
    --hero-ring-size: 46px;
  }

  .hero-habit {
    gap: 4px;
    padding: 6px 4px;
  }

  .hero-habit > span {
    font-size: 10px;
  }

  .habit-section {
    display: none;
  }

  .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }

  .segmented {
    width: auto;
    flex: 0 0 auto;
  }

  .segmented button {
    min-width: 54px;
    padding-inline: 8px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .task-primary-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 72px;
    gap: 8px;
  }

  .task-time-grid,
  .duration-grid,
  .recurring-grid,
  .outcome-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .task-time-grid {
    grid-template-columns: 1fr;
  }

  .task-primary-grid label,
  .task-time-grid label,
  .duration-grid label,
  .recurring-grid label,
  .outcome-grid label {
    min-width: 0;
  }

  .task-primary-grid span,
  .task-time-grid span,
  .duration-grid span,
  .recurring-grid span,
  .outcome-grid span {
    font-size: 11px;
  }

  .task-form {
    gap: 9px;
    padding: 12px;
  }

  .task-ai-box .button-row {
    gap: 7px;
  }

  .task-ai-box .primary,
  .task-ai-box .ghost {
    min-height: 38px;
    padding-inline: 8px;
  }

  .control-row {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }

  .control-row label {
    grid-template-columns: 68px minmax(0, 1fr);
    align-items: center;
  }

  input,
  select {
    min-height: 38px;
  }

  .task-list,
  .focus-list,
  .month-recurring-list {
    gap: 8px;
  }

  .task-card {
    padding: 10px;
  }

  .task-mainline {
    gap: 9px;
  }

  .check {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .task-title-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }

  .task-actions {
    justify-content: flex-end;
    gap: 4px;
  }

  .mini-icon {
    width: 30px;
    height: 30px;
  }

  .task-title {
    font-size: 15px;
  }

  .task-meta {
    gap: 5px;
    margin: 7px 0 8px;
  }

  .tag {
    min-height: 22px;
    padding: 0 7px;
  }

  .task-notes {
    gap: 5px;
    margin: 8px 0;
  }

  .note {
    padding: 7px 8px;
    font-size: 12px;
  }

  .substeps {
    gap: 5px;
    margin-top: 8px;
  }

  .substep-row {
    min-height: 28px;
    padding: 2px 0;
  }

  .habit-inline {
    margin-top: 8px;
    padding: 8px;
  }

  .habit-card-body,
  .habit-summary-card,
  .habit-inline {
    align-items: flex-start;
  }

  .year-month-metrics,
  .habit-month-summary,
  .habit-day-detail-card {
    grid-template-columns: 1fr;
  }

  .month-hero {
    gap: 10px;
    margin-bottom: 10px;
  }

  .year-summary-card,
  .domain-detail-card {
    padding: 12px;
  }

  .year-summary-progress strong {
    font-size: 34px;
  }

  .year-month-row {
    grid-template-columns: 38px minmax(0, 1fr) 42px;
    gap: 8px;
    padding: 8px;
  }

  .month-hero-card .score-row {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  .month-hero-card .progress-ring {
    --size: 96px;
  }

  .month-hero-card .progress-ring span {
    font-size: 29px;
  }

  .month-grid,
  .year-map-shell,
  .year-month-detail,
  .goal-form,
  .week-board,
  .month-recurring-list {
    gap: 10px;
  }

  .week-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(238px, 82vw);
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .week-board::-webkit-scrollbar {
    display: none;
  }

  .week-lane {
    scroll-snap-align: start;
    gap: 8px;
    padding: 12px;
  }

  .week-lane h4 {
    font-size: 16px;
  }

  .month-task-pill {
    padding: 8px 10px;
  }

  .week-detail-panel {
    margin-top: 10px;
  }

  .week-detail-card {
    gap: 12px;
    padding: 12px;
  }

  .week-detail-head {
    align-items: flex-start;
  }

  .domain-detail-actions {
    display: grid;
    justify-items: end;
    gap: 8px;
  }

  .domain-detail-actions .ghost span {
    display: none;
  }

  .week-detail-head h3 {
    font-size: 20px;
  }

  .week-score {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    font-size: 17px;
  }

  .week-detail-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .button-row.split {
    display: grid;
    grid-template-columns: 1fr;
  }

  .planning-task-row {
    gap: 8px;
    padding: 8px;
  }

.planning-task-row .tag {
  display: none;
}

  .planning-task-copy strong,
  .planning-task-copy span {
    white-space: normal;
  }

  .year-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .habit-month-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .year-map {
    display: none !important;
  }

  .year-timeline-item {
    grid-template-columns: auto 1fr;
    gap: 8px;
    padding: 10px;
  }

  .year-timeline-item .tag {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .domain-grid,
  .compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .domain-card {
    min-height: 0;
    padding: 10px;
  }

  .domain-icon {
    width: 34px;
    height: 34px;
  }

  .domain-icon svg {
    width: 18px;
    height: 18px;
  }

  .domain-card h4 {
    margin: 8px 0 3px;
    font-size: 16px;
  }

  .domain-percent {
    font-size: 22px;
  }

  .domain-bar {
    margin: 9px 0 0;
  }

  .domain-detail {
    margin-top: 10px;
  }

  .compact-grid .domain-card ul {
    display: none;
  }

  .compact-grid .domain-card-action {
    margin-top: 8px;
    padding-top: 8px;
  }

  .task-summary-toggle {
    min-height: 50px;
    padding: 9px 10px;
  }

  .metric-chip {
    padding: 10px 8px;
  }

  .metric-chip strong {
    font-size: 18px;
  }

  .metric-chip span {
    font-size: 11px;
  }

  .habit-day-detail-card {
    align-items: stretch;
  }

  .habit-day-detail-card .habit-check {
    width: 100%;
    justify-content: center;
  }
}
