/* ---------- шрифт ---------- */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/manrope-cyrillic-ext.woff2') format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/manrope-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/manrope-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- темы ---------- */
:root,
[data-theme='dark'] {
  color-scheme: dark;
  --bg: #17181b;
  --surface: #222428;
  --surface-2: #1d1f23;
  --surface-3: #26282d;
  --raised: #2b2e33;
  --border: #33363c;
  --border-soft: #2a2d32;
  --border-strong: #454951;
  --text: #ecedee;
  --muted: #a2a7af;
  --line: #50545c;
  --accent: #d9a860;
  --accent-ink: #17181b;
  --accent-line: #d9a860;
  --st-active: #74b587;
  --st-idea: #7fa6d9;
  --st-idle: #878d96;
  --danger: #e39a8f;
  --hover: rgba(255, 255, 255, 0.06);
  --avatar-bg: #363a41;
  --check-border: #6b7079;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --panel-shadow: -12px 0 32px rgba(0, 0, 0, 0.28);
  --scrim: rgba(8, 9, 10, 0.55);
}
[data-theme='light'] {
  color-scheme: light;
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #e7e9ec;
  --raised: #ffffff;
  --border: #d9dce1;
  --border-soft: #e2e4e8;
  --border-strong: #bfc4cb;
  --text: #17181b;
  --muted: #5b616a;
  --line: #aab0b9;
  --accent: #d9a860;
  --accent-ink: #17181b;
  --accent-line: #a8741d;
  --st-active: #3f9a5c;
  --st-idea: #4c7dc0;
  --st-idle: #9aa0a9;
  --danger: #b03a30;
  --hover: rgba(15, 18, 25, 0.05);
  --avatar-bg: #e7e9ec;
  --check-border: #8a909a;
  --shadow: 0 10px 30px rgba(20, 24, 32, 0.14);
  --panel-shadow: -12px 0 32px rgba(20, 24, 32, 0.1);
  --scrim: rgba(20, 22, 26, 0.35);
}

/* ---------- основа ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color 0.25s, border-color 0.25s, color 0.25s, stroke 0.25s, box-shadow 0.25s !important;
}
.ic {
  display: block;
  flex: none;
}

/* ---------- кнопки ---------- */
.btn {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  transition: background-color 0.15s, border-color 0.15s, filter 0.15s;
}
.btn:hover {
  background: var(--hover);
}
.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.btn.primary:hover {
  background: var(--accent);
  filter: brightness(1.06);
}
.btn.danger {
  border-color: transparent;
  color: var(--danger);
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
.icon-btn {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.icon-btn.sm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
.link-btn {
  padding: 4px 0;
  border: 0;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.link-btn:hover {
  color: var(--text);
}

/* ---------- каркас ---------- */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: relative;
  z-index: 7;
  flex: none;
  height: 56px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}
.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}
.save-state {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.save-state.bad {
  color: var(--danger);
}
.spacer {
  flex: 1;
}
.seg {
  flex: none;
  display: flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-3);
}
.seg button {
  height: 28px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background-color 0.18s, color 0.18s, box-shadow 0.18s;
}
.seg button.on {
  background: var(--raised);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* ---------- поле доски ---------- */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.stage.is-panning {
  cursor: grabbing;
}
.world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  transition: opacity 0.17s ease;
}
.stage.is-moving .world {
  will-change: transform;
}
.world.fading {
  opacity: 0;
}
.edges {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}
.edges path,
.edges line {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  transition: opacity 0.2s ease;
}
.edges path.is-hidden {
  opacity: 0;
}
.nodes {
  position: absolute;
  left: 0;
  top: 0;
}

/* ---------- карточка проекта ---------- */
.avatar {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: var(--avatar-bg);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}
.node {
  position: absolute;
  left: 0;
  top: 0;
  width: 240px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.18s, opacity 0.2s ease;
  animation: node-in 0.22s ease-out;
  --dot-ring: var(--surface);
}
.node.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}
@keyframes node-in {
  from {
    opacity: 0;
  }
}
.node:hover {
  border-color: var(--border-strong);
}
.node.selected {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px var(--accent-line);
}
.node.expanded {
  z-index: 2;
}
.node.dragging {
  z-index: 5;
  cursor: grabbing;
  box-shadow: var(--shadow);
}
.node.selected.dragging {
  box-shadow: 0 0 0 1px var(--accent-line), var(--shadow);
}
.node-head {
  position: relative;
  height: 54px;
  padding: 0 6px 0 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.node:not(.has-tasks) .node-head {
  padding-right: 12px;
}
.node-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}
.node-note {
  display: none;
  color: var(--muted);
}
.node.has-notes .node-note {
  display: block;
}
.node-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.node.all-done .node-count {
  color: var(--accent-line);
}
.node-toggle {
  display: none;
  flex: none;
  width: 28px;
  height: 28px;
  margin-left: -4px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.node.has-tasks .node-toggle {
  display: grid;
}
.node-toggle:hover {
  background: var(--hover);
  color: var(--text);
}
.node-toggle .ic {
  transition: transform 0.2s ease;
}
.node.expanded .node-toggle .ic {
  transform: rotate(180deg);
}
.node-tasks {
  display: none;
  padding: 6px 10px 10px;
  border-top: 1px solid var(--border-soft);
}
.node.expanded .node-tasks {
  display: block;
  animation: node-in 0.2s ease-out;
}
.ntask {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 1px;
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
}
.ntask span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ntask.done span {
  color: var(--muted);
  text-decoration: line-through;
}
.ntask-more {
  padding: 4px 1px 0 27px;
  font-size: 12px;
  color: var(--muted);
}
.node-add {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  width: 24px;
  height: 24px;
  padding: 0;
  display: none;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-line);
  transition: background-color 0.15s, color 0.15s;
}
.node-add.show {
  display: grid;
}
.node-add::before {
  content: '';
  position: absolute;
  inset: -9px;
}
.node-add:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

/* флажок */
.cb {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--check-border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.cb::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 5px;
  height: 9px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s ease;
}
.cb:checked {
  border-color: var(--accent);
  background: var(--accent);
}
.cb:checked::after {
  transform: rotate(45deg) scale(1);
}

/* ---------- обзор кружочками ---------- */
.dot {
  --dot-ring: var(--bg);
  position: absolute;
  left: 0;
  top: 0;
  cursor: pointer;
  animation: node-in 0.25s ease-out;
}
.dot .avatar {
  width: 100%;
  height: 100%;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dot.depth-0 .avatar {
  border-width: 2px;
  font-size: 20px;
}
.dot:hover .avatar {
  border-color: var(--muted);
}
.dot.selected .avatar {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 2px var(--accent-line);
}
.dot.dragging {
  cursor: grabbing;
}
.dot-label {
  position: absolute;
  left: 50%;
  top: 100%;
  max-width: 128px;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.2s;
}
.dot.depth-0 .dot-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}
.stage.zoomed-out .dot:not(.depth-0):not(.selected) .dot-label {
  opacity: 0;
}

/* ---------- элементы поверх доски ---------- */
.zoom {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 3;
  height: 38px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  cursor: default;
}
.zoom .icon-btn {
  width: 32px;
  height: 30px;
}
.zoom-value {
  width: 50px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.zoom-value:hover {
  background: var(--hover);
  color: var(--text);
}
.fab {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 3;
  width: 54px;
  height: 54px;
  padding: 0;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
}
.empty {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}
.empty.show {
  display: grid;
}
.empty-box {
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  cursor: default;
}
.empty-box h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.empty-box p {
  margin: 0 0 10px;
  color: var(--muted);
}

/* ---------- панель проекта ---------- */
.panel {
  position: absolute;
  top: 56px;
  right: 0;
  bottom: 0;
  z-index: 6;
  width: 384px;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-left: 1px solid var(--border-soft);
  box-shadow: var(--panel-shadow);
  transform: translateX(106%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.22, 0.8, 0.24, 1), visibility 0s linear 0.3s;
}
.panel.open {
  transform: none;
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.22, 0.8, 0.24, 1);
}
.panel.dragging {
  transition: none;
}
.panel-grab {
  display: none;
}
.panel-scroll {
  flex: 1;
  min-height: 0;
  padding: 12px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.panel-top {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.crumb {
  min-width: 0;
  max-width: 70%;
  padding: 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.crumb:hover {
  color: var(--text);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar-btn {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: none;
}
.avatar.big {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  font-size: 24px;
  transition: filter 0.15s;
}
.avatar-btn:hover .avatar.big {
  filter: brightness(1.08);
}
.avatar-btn.busy .avatar.big {
  opacity: 0.45;
}
.avatar-btn.busy::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2.5px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.head-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.head-main .name-input {
  flex: none;
  width: calc(100% + 8px);
}
.status-chip {
  height: 24px;
  padding: 0 8px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 7px;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.15s, opacity 0.15s;
}
.status-chip.none {
  gap: 4px;
  color: var(--muted);
  opacity: 0.8;
}
.status-chip:hover {
  color: var(--text);
  opacity: 1;
}
.name-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  margin-left: -8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  font-size: 19px;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.name-input:hover {
  background: var(--hover);
}
.name-input:focus {
  border-color: var(--border-strong);
  background: transparent;
}
.field-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.field {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}
.field:focus {
  border-color: var(--accent-line);
}
.field::placeholder,
.task-add input::placeholder,
.notes::placeholder,
.name-input::placeholder,
.task-text::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

/* секции */
.sec {
  border-top: 1px solid var(--border-soft);
  padding-top: 6px;
}
.sec-head {
  width: 100%;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
}
.sec-head .ic {
  color: var(--muted);
  transition: transform 0.22s ease;
}
.sec.closed .sec-head .ic {
  transform: rotate(-90deg);
}
.sec-meta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.sec-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.26s cubic-bezier(0.22, 0.8, 0.24, 1);
}
.sec.closed .sec-body {
  grid-template-rows: 0fr;
}
.sec-inner {
  min-height: 0;
  overflow: hidden;
}
.sec.closed .sec-inner {
  visibility: hidden;
  transition: visibility 0s linear 0.26s;
}
.progress {
  height: 4px;
  margin: 2px 0 8px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-3);
}
.progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.tasks {
  margin: 0 -8px;
  padding: 0;
  list-style: none;
}
.task {
  padding: 0 4px 0 8px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 9px;
  transition: background-color 0.12s;
}
.task:hover,
.task:focus-within {
  background: var(--hover);
}
.task .cb {
  margin-top: 11px;
}
.task-text {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 10px 0;
  display: block;
  resize: none;
  overflow: hidden;
  border: 0;
  background: transparent;
  font-size: 14px;
  line-height: 20px;
  outline: none;
}
.task.done .task-text {
  color: var(--muted);
  text-decoration: line-through;
}
.task-del {
  margin-top: 6px;
  opacity: 0;
}
.task:hover .task-del,
.task:focus-within .task-del {
  opacity: 1;
}
.task-add {
  height: 42px;
  margin-top: 6px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  transition: border-color 0.15s;
}
.task-add:focus-within {
  border-color: var(--accent-line);
}
.task-add input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}
.tasks-foot {
  min-height: 8px;
  padding-top: 6px;
  display: flex;
  justify-content: flex-end;
}
.notes {
  display: block;
  width: 100%;
  min-height: 132px;
  margin-bottom: 4px;
  padding: 12px;
  resize: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  line-height: 21px;
  outline: none;
  transition: border-color 0.15s;
}
.notes:focus {
  border-color: var(--accent-line);
}
.panel-foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border-soft);
}
.panel-foot .btn {
  height: 38px;
}
.foot-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.parent-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.parent-label select {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text);
}

/* ---------- меню, окна, сообщения ---------- */
.menu {
  position: fixed;
  z-index: 30;
  min-width: 232px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--raised);
  box-shadow: var(--shadow);
  animation: pop 0.14s ease-out;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
.menu button {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
}
.menu button:hover {
  background: var(--hover);
}
.menu button .ic {
  color: var(--muted);
}
.menu button.danger,
.menu button.danger .ic {
  color: var(--danger);
}
.menu button[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.menu-dot {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}
.menu button .tick {
  margin-left: auto;
  color: var(--text);
}
.menu hr {
  height: 1px;
  margin: 6px 4px;
  border: 0;
  background: var(--border-soft);
}
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 16px;
  display: grid;
  place-items: center;
  background: var(--scrim);
  animation: fade 0.16s ease-out;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  animation: pop 0.18s ease-out;
}
.modal.wide {
  width: min(560px, 100%);
}
.modal h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.modal p {
  margin: 0;
  color: var(--muted);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.modal-actions.start {
  justify-content: flex-start;
}
.backup-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border-soft);
}
.backup-list li {
  min-height: 54px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.backup-info {
  flex: 1;
  min-width: 0;
}
.backup-info b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}
.backup-info span {
  font-size: 12px;
  color: var(--muted);
}
.backup-empty {
  padding: 14px 0;
  color: var(--muted);
}
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  max-width: 100%;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--raised);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
  pointer-events: auto;
  animation: toast-in 0.22s cubic-bezier(0.22, 0.8, 0.24, 1);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.out {
  opacity: 0;
  transform: translateY(6px);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.toast button {
  padding: 2px 0;
  border: 0;
  background: none;
  font-weight: 700;
  color: var(--accent-line);
}

/* ---------- вход ---------- */
.login {
  min-height: 100%;
  padding: 24px;
  display: grid;
  place-items: center;
  overflow: auto;
}
.login form {
  width: min(340px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
}
.login label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.login .field {
  flex: none;
  height: 44px;
  font-size: 15px;
  color: var(--text);
}
.login .btn {
  height: 44px;
  font-size: 14px;
}
.login-error {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  color: var(--danger);
}

/* ---------- телефон ---------- */

/* ---------- статус проекта (необязательный) ---------- */
.status-dot {
  display: none;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--dot-ring, transparent);
  pointer-events: none;
}
.status-dot.st-idea {
  display: block;
  background: var(--st-idea);
}
.status-dot.st-active {
  display: block;
  background: var(--st-active);
}
.status-dot.st-paused {
  display: block;
  border: 2px solid var(--st-idle);
  background: var(--dot-ring, transparent);
}
.status-dot.st-done {
  display: block;
  background: var(--st-idle);
}
.node .status-dot {
  position: absolute;
  left: 35px;
  top: 35px;
}
.dot .status-dot {
  position: absolute;
  left: 85.4%;
  top: 85.4%;
  margin: -5px 0 0 -5px;
}
/* На паузе и завершённые отходят на второй план. */
.node[data-status='paused'] .node-name,
.node[data-status='done'] .node-name,
.dot[data-status='paused'] .dot-label,
.dot[data-status='done'] .dot-label,
.node[data-status='paused'] .avatar,
.node[data-status='done'] .avatar,
.dot[data-status='paused'] .avatar,
.dot[data-status='done'] .avatar {
  color: var(--muted);
}
.node[data-status='done'] .node-name,
.dot[data-status='done'] .dot-label {
  text-decoration: line-through;
}
.node[data-status='paused'] .avatar img,
.node[data-status='done'] .avatar img,
.dot[data-status='paused'] .avatar img,
.dot[data-status='done'] .avatar img {
  opacity: 0.5;
  filter: saturate(0.35);
}

/* ---------- сворачивание ветки ---------- */
.fold {
  position: absolute;
  z-index: 3;
  min-width: 18px;
  height: 18px;
  padding: 0;
  display: none;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.fold::before {
  content: '';
  position: absolute;
  inset: -8px -8px -8px -3px;
}
.fold:hover {
  border-color: var(--muted);
  color: var(--text);
}
.has-kids > .fold {
  display: grid;
}
.has-kids:hover > .fold,
.has-kids.selected > .fold,
.collapsed > .fold,
.fold:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.collapsed > .fold {
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  color: var(--text);
}
.node > .fold {
  left: 100%;
  top: 27px;
  transform: translate(-50%, -50%);
}
.node > .fold .ic {
  transform: rotate(90deg);
}
.node.collapsed > .fold {
  transform: translate(6px, -50%);
}
.dot > .fold {
  left: 85.4%;
  top: 14.6%;
  transform: translate(-50%, -50%);
}
.dot.collapsed > .fold {
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  font-size: 10.5px;
}

/* ---------- связи между проектами (не «родитель — дочерний») ---------- */
.edges .link {
  stroke-width: 1.25;
  stroke-dasharray: 4 6;
  transition: opacity 0.2s ease, stroke 0.15s ease;
}
/* В «Обзоре» линии пересоздаются при каждой перестройке — там без появления. */
.edges path.link {
  animation: link-in 0.25s ease-out;
}
.edges .link.on {
  stroke: var(--accent-line);
}
/* Связи скрыты в меню — остаются только у выбранного проекта. */
.stage[data-links='off'] .edges .link:not(.on) {
  opacity: 0;
}
@keyframes link-in {
  from {
    opacity: 0;
  }
}
.foot-actions {
  display: flex;
  gap: 8px;
}
.foot-actions .btn {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
}
.rel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rel-label {
  font-size: 12.5px;
  color: var(--muted);
}
.rel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rel-chip {
  max-width: 100%;
  height: 32px;
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
}
.rel-open,
.rel-del {
  height: 100%;
  border: 0;
  background: none;
  transition: background-color 0.12s, color 0.12s;
}
.rel-open {
  min-width: 0;
  padding: 0 4px 0 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.rel-open span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rel-open .avatar {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 10.5px;
}
.rel-del {
  flex: none;
  width: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.rel-open:hover,
.rel-del:hover {
  background: var(--hover);
}
.rel-del:hover {
  color: var(--text);
}

/* ---------- поиск ---------- */
.modal-back.top {
  place-items: start center;
  padding-top: min(14vh, 120px);
}
.modal.search {
  width: min(560px, 100%);
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.search-head {
  flex: none;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.search-head input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
}
.search-head input::placeholder {
  color: var(--muted);
}
.search-list {
  max-height: min(52vh, 420px);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--border-soft);
}
.sr {
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
}
.sr.on {
  background: var(--hover);
}
.sr .avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 12.5px;
}
.sr-text {
  flex: 1;
  min-width: 0;
}
.sr-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
}
.sr-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.sr-sub .ic {
  flex: none;
}
.sr-sub span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-sub.done span {
  text-decoration: line-through;
}
.sr-crumb {
  flex: none;
  max-width: 36%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}
.sr mark {
  background: none;
  color: var(--accent-line);
}
.search-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
@keyframes flash {
  from {
    background-color: rgba(217, 168, 96, 0.3);
  }
}
.task.flash,
.notes.flash {
  animation: flash 1.5s ease-out;
}

@media (max-width: 720px) {
  .hide-sm {
    display: none !important;
  }
  .topbar {
    height: 52px;
    gap: 8px;
  }
  .seg button {
    width: 40px;
    height: 32px;
    padding: 0;
    justify-content: center;
  }
  .seg button span {
    display: none;
  }
  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .save-state {
    min-height: 13px;
    font-size: 10.5px;
    line-height: 13px;
  }
  .modal-back.top {
    padding-top: 10px;
  }
  .search-head input {
    font-size: 16px;
  }
  .search-list {
    max-height: 44vh;
  }
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .icon-btn.sm {
    width: 34px;
    height: 34px;
  }
  .fab {
    display: grid;
  }
  .zoom .zoom-step {
    display: none;
  }
  .panel {
    top: auto;
    left: 0;
    width: auto;
    height: min(66dvh, 620px);
    border-left: 0;
    border-top: 1px solid var(--border-soft);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.22);
    transform: translateY(106%);
  }
  .panel-grab {
    flex: none;
    height: 22px;
    display: grid;
    place-items: center;
    touch-action: none;
    cursor: grab;
  }
  .panel-grab::before {
    content: '';
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-strong);
  }
  .panel-scroll {
    padding-top: 0;
  }
  .rel-chip {
    height: 36px;
  }
  .rel-del {
    width: 34px;
  }
  .task-del {
    opacity: 0.7;
  }
  .field,
  .task-add input,
  .task-text,
  .notes,
  .name-input {
    font-size: 16px; /* иначе iOS приближает страницу при фокусе */
  }
  .name-input {
    font-size: 19px;
  }
}
@media (hover: none) {
  .task-del {
    opacity: 0.7;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
