
@font-face {
  font-family: Inter;
  src: url("/inter-latin.woff2") format("woff2");
  font-display: swap;
  font-weight: 100 900;
}

:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  --bg: #0c1321;
  --rail: #101929;
  --panel: #121e30;
  --raised: #192740;
  --hover: #1f3050;
  --line: #273853;
  --ink: #eef4ff;
  --muted: #a5b5ce;
  --accent: #8ebdff;
  --on-accent: #0c2349;
  --blue-bg: #21395c;
  --negative: #ffc3bd;
  --warn: #f9d29b;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body { margin: 0; min-width: 300px; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.2rem, 4.5vw, 3.25rem); line-height: 1.08; font-weight: 755; letter-spacing: -.059em; overflow-wrap: anywhere; }
h2 { font-size: 1.125rem; line-height: 1.35; font-weight: 690; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
small { color: var(--muted); font-size: .875rem; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.boot { margin: 3rem auto; width: max-content; max-width: 90vw; color: var(--muted); }
.btn, .icon-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--raised);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .48rem;
  font-size: .91rem;
  font-weight: 630;
  padding: .57rem .93rem;
  white-space: nowrap;
}
.btn:hover:not(:disabled), .icon-btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary, .icon-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled), .icon-btn.primary:hover:not(:disabled) { background: #b1d3ff; }
.btn.quiet, .icon-btn.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--negative); }
.icon-btn { width: 44px; padding: 0; flex: none; font-size: 1.25rem; }
.plus { font-size: 1.18em; line-height: 1; }
.add-habit { width: 48px; min-height: 48px; font-size: 1.55rem; border-radius: 12px; }

.app-header { background: var(--rail); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 74px; }
.header-inner, .workspace { width: min(100% - 3rem, 50rem); margin-inline: auto; }
.account-link { background: var(--panel); color: var(--accent); }
.account-link span { font-size: 1.35rem; line-height: 1; font-variant-emoji: text; }
.brand { display: inline-flex; width: fit-content; align-items: center; gap: 10px; font-weight: 790; font-size: 1.65rem; letter-spacing: -.064em; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--on-accent); background: var(--accent);
  box-shadow: inset 0 0 0 1px #d5e8ff5c;
}
.brand-mark::before {
  content: "✓"; width: 21px; height: 21px;
  border: 1.6px solid currentColor; border-radius: 5px;
  display: grid; place-items: center;
  font-size: 16px; line-height: 1; font-weight: 800;
}
.workspace { padding: clamp(2rem, 5vw, 3.4rem) 0 3rem; min-width: 0; }
.page-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .85rem; margin-bottom: 1.45rem; }
.list-navigation { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1.18rem; min-height: 49px; }
.view-tabs { align-self: stretch; display: flex; align-items: stretch; gap: clamp(.75rem, 4vw, 1.65rem); border-bottom: 1px solid var(--line); min-width: 0; }
.view-tab { display: flex; align-items: center; padding: .35rem .1rem; color: var(--muted); font-size: clamp(1rem, 3.8vw, 1.32rem); font-weight: 665; letter-spacing: -.03em; box-shadow: inset 0 -2px transparent; }
.view-tab:hover { color: var(--accent); }
.view-tab[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px var(--accent); }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.panel-pad { padding: clamp(16px, 2vw, 26px); }
.panel-heading { padding: 1.13rem 1.22rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.panel-title { margin-bottom: 1rem; }
.vertical { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.empty { padding: 2rem 1.25rem; text-align: center; color: var(--muted); }
.empty p + .btn { margin-top: .8rem; }
.list-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem 1rem; padding: 1.15rem 1.25rem; }
.day-title p { margin-top: .15rem; font-size: .9rem; }
.day-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.day-controls .icon-btn { width: 37px; background: var(--panel); }
.day-controls input[type="date"] { width: 9.75rem; padding-inline: .45rem; }
.jump-today { padding-inline: .6rem; }
.day-progress { display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem 1rem; }
.day-progress small { flex: none; font-variant-numeric: tabular-nums; }
.habit-list { list-style: none; padding: 0; margin: 0; }
.habit-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: .6rem; padding: .80rem 1.10rem; min-height: 80px; border-top: 1px solid var(--line);
}
.habit-row[data-due="false"] { background: #0f1929; }
.habit-row[data-due="true"] + .habit-row[data-due="false"] { border-top: 2px solid #31435e; }
.habit-row[data-due="false"]:last-child { border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.habit-row[data-due="false"] .habit-link { color: var(--muted); }
.habit-row[data-due="false"] .habit-icon { background: #1a2537; color: var(--muted); }
.habit-title { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.habit-label { display: grid; gap: .3rem; }
.habit-label strong { font-weight: 670; overflow-wrap: anywhere; }
.habit-label small { overflow-wrap: anywhere; }
.habit-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .55rem; }
.streak { display: inline-flex; align-items: baseline; gap: .26rem; color: #bfdaff; font-size: .83rem; font-weight: 610; font-variant-numeric: tabular-nums; }
.streak-symbol { font-size: .94rem; line-height: 1; }
.streak[data-streak="0"], .habit-row[data-due="false"] .streak { color: var(--muted); }
.habit-link { width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 0; border-radius: 6px; }
.habit-link:hover strong { color: var(--accent); }
.habit-icon {
  width: 42px; height: 42px; flex: none; border-radius: 10px;
  display: grid; place-items: center; background: #1c3151; color: #b4d3ff;
  font-size: 1.22rem; font-weight: 650;
}
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: .3rem; }
.row-edit { font-size: 1.15rem; }
.day-off-mark { display: grid; place-items: center; min-width: 44px; color: var(--muted); }
.day-off-mark span { display: grid; place-items: center; min-width: 28px; min-height: 28px; padding-inline: .3rem; border: 1px dashed #667997; border-radius: 8px; font-size: .81rem; font-variant-numeric: tabular-nums; }
.check-button { border-radius: 100%; padding: 0; width: 44px; height: 44px; border: 0; color: var(--ink); background: transparent; display: grid; place-items: center; }
.check-button:hover { background: var(--raised); }
.check-button span { border: 2px solid #6b84aa; border-radius: 100%; width: 28px; height: 28px; display: grid; place-items: center; font-size: .95rem; font-weight: 760; pointer-events: none; }
.check-button[data-status="done"] span { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.check-button[data-status="skipped"] span, .status.skipped { color: var(--warn); }
.check-button[data-status="missed"] span, .status.missed { color: var(--negative); }
.stepper { display: flex; align-items: center; border-radius: 9px; border: 1px solid var(--line); overflow: hidden; }
.stepper button { background: var(--raised); color: var(--ink); border: 0; font-size: 1.24rem; min-width: 44px; min-height: 44px; touch-action: manipulation; }
.stepper button:hover { background: var(--hover); }
.stepper button:focus-visible { outline-offset: -3px; }
.stepper span { padding-inline: .56rem; font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stepper .step-unit { padding-inline: 0; }
.status { font-size: .85rem; font-weight: 610; color: var(--muted); }
.status.done { color: #b6d6ff; }
.task-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; padding: 1rem 1.1rem; }
.task-form .form-error { grid-column: 1 / -1; }
.task-row { min-height: 62px; padding-block: .48rem; }
.task-row:last-child { border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.task-name { font-weight: 625; overflow-wrap: anywhere; }
.task-row[data-done="true"] { background: #0f1929; }
.task-row[data-done="true"] .task-name { color: var(--muted); text-decoration: line-through; text-decoration-color: #7489a8; }
progress { appearance: none; width: 100%; height: 8px; border: 0; background: var(--raised); border-radius: 20px; overflow: hidden; display: block; }
progress::-webkit-progress-bar { background: var(--raised); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 20px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 20px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.label, label.field { display: grid; min-width: 0; gap: .42rem; color: var(--muted); font-size: .9rem; font-weight: 570; }
input:not([type="checkbox"]), select, textarea {
  width: 100%; min-height: 44px; padding: .58rem .68rem; background: var(--bg); color: var(--ink);
  border: 1px solid #344865; border-radius: 8px; font-size: 1rem;
}
select { width: auto; max-width: 100%; }
.field select { width: 100%; }
textarea { resize: vertical; min-height: 86px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0 0 .5rem; }
.check-group { display: flex; flex-wrap: wrap; gap: .45rem; }
.check-label { display: flex; align-items: center; gap: .4rem; min-height: 40px; border: 1px solid var(--line); padding: .4rem .55rem; border-radius: 8px; }
.form { display: grid; gap: 1rem; }
.form-footer { display: flex; gap: .6rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.form-error { color: var(--negative); font-size: .9rem; }
.settings { max-width: 765px; }
.category-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .6rem; border-top: 1px solid var(--line); padding: .62rem 1.15rem; overflow-wrap: anywhere; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .76rem 1.17rem; border-top: 1px solid var(--line); line-height: 1.45; }
th { color: var(--muted); font-size: .86rem; font-weight: 620; white-space: nowrap; }
td { font-size: .93rem; }
td:first-child { white-space: nowrap; }
td:last-child { text-align: right; }
td .btn { min-height: 39px; }
dialog { color: var(--ink); width: min(570px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border: 1px solid #395173; border-radius: 16px; padding: 1.25rem; background: var(--panel); box-shadow: 0 23px 80px #030813a6; }
dialog::backdrop { background: #020812ba; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.dialog-heading h2 { font-size: 1.35rem; }
.toast { position: fixed; z-index: 5; bottom: 16px; right: 16px; max-width: min(420px, calc(100% - 32px)); padding: .83rem 1rem; border-radius: 9px; background: var(--raised); border: 1px solid #4b6b98; color: var(--ink); box-shadow: 0 8px 32px #050b17a8; }
.toast[data-error] { border-color: #955d62; color: var(--negative); }
.reward-hit { animation: reward-row .8s ease-out; }
.reward-hit .check-button span, .reward-hit .stepper { animation: reward-pop .48s cubic-bezier(.24,.85,.28,1.35); }
.step-hit .stepper { animation: counter-pop .34s ease-out; }
.increment-mark {
  position: fixed; z-index: 7; left: var(--x); top: var(--y); pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -100%); border: 1px solid #5988cb; border-radius: 30px;
  padding: .18rem .5rem; background: #183863; color: #d6ebff; font-size: .82rem; font-weight: 750;
  font-variant-numeric: tabular-nums; animation: counter-lift .52s ease-out both;
}
.increment-mark.goal-mark { background: #c2ddff; border-color: #dcecff; color: #112c51; box-shadow: 0 0 18px #83b9ff6b; animation-duration: 1.1s; }
.reward-field { position: fixed; inset: 0; z-index: 7; overflow: hidden; pointer-events: none; }
.reward-field i {
  position: absolute; left: var(--x); top: var(--y);
  width: 6px; height: 10px; border-radius: 2px; background: var(--colour);
  animation: reward-spark var(--length) cubic-bezier(.12,.7,.19,1) both;
}
.reward-field i:nth-child(3n) { width: 6px; height: 6px; border-radius: 50%; }
.reward-field i:nth-child(5n) { width: 4px; height: 13px; }
.reward-banner {
  position: fixed; z-index: 8; top: 31%; left: 50%; pointer-events: none;
  transform: translateX(-50%); width: min(23.5rem, calc(100% - 1.75rem));
  display: grid; justify-items: center; gap: .38rem; padding: 1.38rem 1rem 1.5rem;
  text-align: center; border: 1px solid #81baff; border-radius: 20px;
  background: #132b50; box-shadow: 0 1rem 4rem #060e22bd, 0 0 3.2rem #5299ff55;
  animation: reward-banner 3.4s cubic-bezier(.2,.78,.24,1) both;
}
.reward-medal {
  width: 55px; height: 55px; display: grid; place-items: center; margin-bottom: .18rem;
  background: #add4ff; color: #0c254f; border-radius: 50%;
  font-size: 2rem; font-weight: 780; box-shadow: 0 0 0 5px #89bcff29, 0 0 23px #81b9ff65;
}
.reward-banner strong { font-size: clamp(1.6rem, 6vw, 2.2rem); letter-spacing: -.045em; }
.reward-banner span:last-child { color: #c1d8f7; }
@keyframes reward-row {
  0%, 28% { background: #244775; box-shadow: inset 4px 0 #9fcbff; }
  100% { box-shadow: inset 0 0 transparent; }
}
@keyframes reward-pop {
  0% { transform: scale(.82); }
  51% { transform: scale(1.15); box-shadow: 0 0 16px #89bcff8c; }
  100% { transform: scale(1); }
}
@keyframes counter-pop {
  0% { box-shadow: 0 0 0 1px #82b5ff; }
  35% { transform: scale(1.04); box-shadow: 0 0 13px #70a4f68c; }
  100% { transform: scale(1); }
}
@keyframes counter-lift {
  from { opacity: 0; transform: translate(-50%, -58%); }
  20%, 68% { opacity: 1; }
  to { opacity: 0; transform: translate(-50%, -150%); }
}
@keyframes reward-spark {
  from { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(.5); }
  25% { opacity: 1; }
  to { opacity: 0; transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--spin)) scale(.64); }
}
@keyframes reward-banner {
  0% { opacity: 0; transform: translate(-50%, 16px) scale(.82); }
  12%, 90% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -8px) scale(.99); }
}
@media (prefers-reduced-motion: reduce) {
  .reward-hit { background: #244775; }
  .step-hit .stepper { border-color: var(--accent); }
  .reward-hit, .reward-hit .check-button span, .reward-hit .stepper, .reward-banner, .step-hit .stepper, .increment-mark { animation: none; }
}
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1.15rem; }
.auth-box { width: min(100%, 410px); padding: 1.7rem; }
.auth-box .brand { margin-bottom: 1.7rem; }
.auth-box h1 { font-size: 2.1rem; margin-bottom: 1.2rem; }
.auth-box .btn { width: 100%; margin-top: .3rem; }

.habit-label small:empty, .compact-unit { display: none; }
@media (max-width: 600px) {
  .header-inner, .workspace { width: calc(100% - 1.75rem); }
  .header-inner { min-height: 63px; }
  .workspace { padding: 1.35rem 0 2rem; }
  .brand { font-size: 1.46rem; }
  .brand-mark { width: 33px; height: 33px; }
  .page-title { gap: .6rem; margin-bottom: 1rem; }
  .page-title h1 { font-size: clamp(1.75rem, 6vw, 2.28rem); }
  .page-title .btn.primary { padding-inline: .7rem; }
  .list-header { padding: .9rem .75rem; gap: .6rem; }
  .day-controls { gap: .22rem; }
  .day-controls .icon-btn { width: 33px; }
  .day-controls input[type="date"] { width: 8.5rem; font-size: .88rem; }
  .day-progress { padding: 0 .75rem .85rem; }
  .habit-row { padding: .58rem .7rem; min-height: 68px; gap: .38rem; }
  .habit-icon { width: 32px; height: 32px; }
  .habit-title { gap: .55rem; }
  .habit-label strong { font-size: .95rem; }
  .panel-heading, th, td { padding-inline: .78rem; }
  .row-actions { gap: .12rem; }
  .icon-btn.quiet.row-edit { width: 38px; }
  .stepper button { min-width: 38px; }
  .stepper span { padding-inline: .36rem; }
  .stepper .step-unit { display: none; }
  .compact-unit { display: inline; }
  .task-form { padding: .75rem .7rem; }
  .field-row.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 370px) {
  .habit-row .habit-icon { display: none; }
  .field-row { grid-template-columns: 1fr; }
}
