@font-face {
  font-family: Manrope;
  src: url("/static/fonts/manrope-cyrillic.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Manrope;
  src: url("/static/fonts/manrope-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122;
}

:root {
  --bg: #121316;
  --card: #1c1d22;
  --card-2: #26272e;
  --text: #f3f1ea;
  --muted: #a3a199;
  --line: rgba(243, 241, 234, 0.1);
  --accent: #e2b15a;
  --accent-ink: #241a08;
  --danger: #ff7b72;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --nav: 74px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Manrope, "Segoe UI", sans-serif;
  background: #0b0c0e;
  color: var(--text);
}
#app {
  width: min(440px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { min-height: 100dvh; }

main {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(var(--nav) + 28px + env(safe-area-inset-bottom));
}
h1 { font-size: 28px; line-height: 1.15; margin: 0 0 6px; text-align: center; }
.login {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-form { display: flex; flex-direction: column; }
.login input[type="password"] { margin: 8px 0 12px; }
.login-user {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.login-error { color: var(--danger); min-height: 1.3em; margin: 10px 0 0; text-align: center; }
.logout { display: block; margin: 16px auto 0; }
.lead { color: var(--muted); margin: 0 0 16px; line-height: 1.45; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.datebar { margin: 8px 0 14px; }
.icon-btn, .text-btn, .primary, .ghost, .danger {
  border: 0;
  border-radius: 12px;
}
.icon-btn, .text-btn, .ghost, .danger {
  background: var(--card-2);
}
.icon-btn {
  width: 40px;
  height: 40px;
  font-size: 20px;
}
.text-btn, .ghost, .danger, .primary {
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
  flex: none;
}
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.danger { color: var(--danger); }
.date-label { font-weight: 700; text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}
.wheel-card { margin: 0 -12px 14px; padding: 4px 0 6px; }
.wheel-card svg { width: 100%; height: auto; display: block; overflow: visible; }
.primary.wide { width: 100%; }
.day-add { margin: 0 0 14px; }
.wheel-card svg [data-wedge] { pointer-events: none; }
.sector { cursor: pointer; }
.sector:hover, .sector.is-on { fill: rgba(255, 255, 255, 0.05); }
.wheel-label {
  font-family: Manrope, "Segoe UI", sans-serif;
  font-weight: 600;
  fill: rgba(243, 241, 234, 0.88);
  cursor: pointer;
}
.wheel-label.is-on { fill: #f3f1ea; }

.sphere {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 8px 10px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.sphere:first-child { border-top: 0; }
.swatch { width: 14px; height: 14px; border-radius: 50%; }
.sphere-name { font-weight: 700; }
.score-num { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 800; }
.sphere input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }

.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.section-title {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.composer, .field { display: flex; gap: 8px; align-items: center; }
.composer input, .field input { flex: 1; min-width: 0; }
.composer input, .field input, .sheet input, .sheet select, .login input, textarea,
.goal-head input[type="text"], .habit-head input[type="text"], .note > input[type="text"], .task input[type="text"], .subtask input[type="text"] {
  width: 100%;
  min-width: 0;
  background: var(--card-2);
  color: var(--text);
  caret-color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
}
.goal-head input[type="text"], .task input[type="text"], .subtask input[type="text"] {
  padding: 8px 10px;
}
input::placeholder, textarea::placeholder { color: rgba(243, 241, 234, 0.45); }
textarea { min-height: 220px; resize: vertical; line-height: 1.45; }
.kicker {
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.plan-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.plan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
button.plan-row { cursor: pointer; }
.plan-main, .plan-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.plan-open { background: transparent; border: 0; padding: 0; cursor: pointer; }
.plan-title { font-weight: 700; line-height: 1.3; }
.plan-row.is-done .plan-title,
.goal-name.is-done,
.goal-head input.is-done {
  text-decoration: line-through;
  color: var(--muted);
}
.plan-row > .plan-title { flex: 1; min-width: 0; }
.sub-remove {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 22px;
  line-height: 1;
  flex: none;
  padding: 0;
}
.goal-check {
  width: 22px;
  flex: none;
  color: #3ecf8e;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.tree-goal .goal-check { display: block; margin-bottom: 4px; }
.plan-meta { color: var(--muted); font-size: 13px; line-height: 1.3; }
.plan-chevron { color: var(--muted); font-size: 22px; line-height: 1; flex: none; }
.plan-mark { width: 22px; color: var(--muted); text-align: center; flex: none; }
.plan-row .check, .goal-head .check { margin-top: 0; flex: none; }
.plan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 16px; }
.ghost.wide { width: 100%; margin: 0 0 14px; }
.tree-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  overflow: auto;
}
.tree-inner {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom));
}
.tree-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tree-screen h2 { margin: 0 0 4px; font-size: 26px; }
.tree-wrap { overflow-x: auto; }
.tree-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tree-table th, .tree-table td {
  border: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
  text-align: left;
  background: var(--card);
}
.tree-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #17181c;
}
.tree-goal { font-weight: 700; background: rgba(226, 177, 90, 0.08); }
.tree-done { text-decoration: line-through; color: var(--muted); }
.tree-empty { color: var(--muted); }
.goal { margin-bottom: 14px; }
.goal-head, .task, .subtask, .day-item, .note, .habit-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.goal-head { align-items: center; }
.goal-head input[type="text"], .task input[type="text"], .subtask input[type="text"] { flex: 1; min-width: 0; }
.task, .subtask, .day-item {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.subtask { margin-left: 28px; }
.task-main, .day-main { flex: 1; min-width: 0; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chip {
  border: 0;
  background: var(--card-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}
.sub-when { flex: none; white-space: nowrap; }
.struck .name, .struck .title-text { text-decoration: line-through; color: var(--muted); }
.check {
  width: 22px;
  height: 22px;
  margin-top: 10px;
  accent-color: var(--accent);
}
.check-wait { opacity: 0.35; }
.tiny {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
}
.danger.tiny { color: var(--danger); background: var(--card-2); }

.day-item { align-items: center; cursor: default; }
.day-tools {
  display: flex;
  align-items: center;
  flex: none;
  align-self: stretch;
}
.day-stop,
.day-remove {
  align-self: stretch;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
  flex: none;
}
.day-remove { color: var(--danger); }
.day-stop { color: var(--text); }
.day-stop span,
.day-remove span {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
}
.day-stop svg { width: 16px; height: 16px; display: block; }
.dot-color { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.day-item .dot-color { margin-top: 0; }
.dot-color.is-empty { background: transparent; }
.time {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 5ch;
  line-height: 1.15;
  white-space: nowrap;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  flex: none;
}
.time.has-end span:last-child { opacity: 0.72; }
.time.empty { color: transparent; }

.habit-days { display: flex; flex-wrap: wrap; gap: 6px; }
.habit-score { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-top: 4px; }
.habit-score span:last-child { color: var(--muted); font-size: 13px; text-align: right; }
.habit-block { margin-top: 10px; }
.habit-week-name { color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.habit-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.habit-cell {
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.habit-cell small { font-size: 10px; color: var(--muted); font-weight: 700; line-height: 1; }
.habit-cell b { font-size: 14px; line-height: 1.1; }
.habit-cell.is-done { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.habit-cell.is-done small { color: var(--accent-ink); }
.habit-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.habit-cell.is-missed { border-color: var(--danger); }
.habit-cell.is-off, .habit-cell.is-future { opacity: 0.35; }
.habit-cell:disabled { cursor: default; }
.habit-head { align-items: center; }
.habit-head input[type="text"], .note > input[type="text"] { flex: 1; min-width: 0; }
.habit-screen { position: relative; display: block; margin-top: 8px; }
.habit-screen h1.habit-name { font-size: 28px; padding: 0 76px; }
.habit-screen .note-tools { position: absolute; top: 0; right: 0; }
.habit-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  cursor: default;
  pointer-events: none;
}
.day-toggle, .dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.day-toggle.on, .dot.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 800; }
.dot { width: 28px; height: 28px; font-size: 0; }
.streak { color: var(--accent); font-weight: 700; font-size: 14px; }

.calendar { padding: 10px 8px 12px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 0 8px;
}
.cal-day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
}
.cal-day.is-empty { visibility: hidden; }
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-day.is-picked { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.cal-link {
  display: block;
  width: 100%;
  margin: 6px 0 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.cal-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 10px 0 14px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.cal-switch button {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  font-weight: 700;
}
.cal-switch button.active { background: var(--accent); color: var(--accent-ink); }
main.is-week {
  height: auto;
  max-height: none;
  overflow: visible;
  display: block;
}
main.is-week h1 { font-size: 22px; margin-bottom: 0; }
main.is-week .cal-switch { margin: 6px 0 8px; }
main.is-week .cal-switch button { min-height: 34px; }
main.is-week .datebar { margin: 0 0 6px; }
.week-sticky {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--bg);
  padding-bottom: 6px;
}
.week-board { margin-top: 2px; }
.week-headrow, .week-untimed, .week-canvas {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
}
.week-gutter { min-width: 0; }
.week-heads, .week-untimed-cols, .week-cols {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  min-width: 0;
}
.week-col-head {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 0 4px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}
.week-col-head strong { display: block; color: var(--text); font-size: 15px; }
.week-col-head.is-today, .week-col-head.is-today strong { color: var(--accent); }
.week-untimed { margin-bottom: 4px; }
.week-untimed-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.week-chip {
  border: 0;
  border-radius: 4px;
  padding: 2px 3px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  hyphens: manual;
  -webkit-hyphens: manual;
  overflow-wrap: normal;
}
.week-chip.is-done { text-decoration: line-through; }
.week-canvas { align-items: start; }
.week-scale { position: relative; }
.week-scale span {
  position: absolute;
  right: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.week-plot { position: relative; min-width: 0; }
.week-cols { position: relative; }
.week-gridlines { position: absolute; inset: 0; pointer-events: none; }
.week-gridlines span {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(243, 241, 234, 0.08);
}
.week-col {
  position: relative;
  min-width: 0;
  height: 100%;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
}
.week-col.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.week-col-hit {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
}
.week-block {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  padding: 3px;
  text-align: left;
}
.week-block span {
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
  hyphens: manual;
  -webkit-hyphens: manual;
  overflow-wrap: normal;
}
.week-block.is-done { opacity: 0.72; }
.week-block.is-done span { text-decoration: line-through; }

.note { width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 8px 10px 14px; margin-bottom: 10px; align-items: flex-start; overflow: hidden; }
.note-open { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; text-align: left; padding: 4px 0; }
.note strong { display: block; font-weight: 700; margin-bottom: 6px; overflow-wrap: anywhere; }
.note-title { margin: 12px 0; }
.note span { color: var(--muted); font-size: 13px; }
.note-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-top: 12px;
}
.note-top { position: relative; }
.note-top h1 { margin: 0; padding: 0 76px 0 0; text-align: left; overflow-wrap: anywhere; }
.note-tools { position: absolute; top: 0; right: 0; display: flex; gap: 2px; }
.note-tool {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.note-tool svg { width: 18px; height: 18px; display: block; }
.note-tool.is-danger { color: var(--danger); font-size: 22px; line-height: 1; }
.note-tool:hover { background: rgba(255, 255, 255, 0.06); }
.note-body {
  margin: 12px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.note-body.is-empty { color: var(--muted); }
.note-when { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.note-plus {
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  flex: none;
}
.note-actions { display: flex; gap: 8px; margin-top: 12px; }
.note-actions button { flex: 1; }

.nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(18, 19, 22, 0.96);
  border-top: 1px solid var(--line);
  z-index: 6;
}
.nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  min-height: 48px;
  padding: 6px 2px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}
.nav button.active { color: var(--accent); background: rgba(226, 177, 90, 0.12); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav) + 12px);
  transform: translateX(-50%) translateY(12px);
  background: #2c2d33;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 20;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sheet-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: min(440px, 100%);
  background: #1a1b20;
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}
.sheet h2 { margin: 0 0 12px; font-size: 20px; }
.sheet label { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 6px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet .actions .primary, .sheet .actions .ghost, .sheet .actions .danger { flex: 1; }

.empty { color: var(--muted); padding: 12px 0 4px; }
.link-box {
  width: 100%;
  word-break: break-all;
  font-size: 13px;
  color: var(--muted);
  background: var(--card-2);
  border-radius: 12px;
  padding: 10px;
  margin: 8px 0;
}

