/* Стили экранов */

.page-date { margin: 0; color: var(--muted); font-weight: 600; }

/* Коробочки */
.box {
  padding: 14px 16px 8px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--box-later);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.box-today { border-left-color: var(--box-today); }
.box-week { border-left-color: var(--box-week); }
.box-nextWeek { border-left-color: var(--box-next); }
.box-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.box-head h2 { margin: 0; font-size: var(--fs-lg); }
.count { color: var(--muted); font-size: var(--fs-md); font-weight: 600; white-space: nowrap; }
.count.is-over { color: var(--danger); }
.box-hint { margin: 4px 0 6px; font-size: var(--fs-sm); color: var(--muted); }
.done-today summary { min-height: 40px; display: flex; align-items: center; color: var(--muted); cursor: pointer; }

/* «Сейчас» */
.now-card { border: 2px solid var(--accent); }
.now-card.is-empty { border: 2px dashed var(--border); }
.now-label { margin: 0 0 4px; color: var(--accent); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.now-title { display: block; color: var(--text); font-size: var(--fs-xl); font-weight: 700; line-height: 1.3; text-decoration: none; }
.now-why { margin: 6px 0 0; font-size: var(--fs-md); }

/* Разбор входящих */
.kind-result { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--fs-md); }

/* Проекты */
.project-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.project-row { display: flex; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none; }
.project-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; }
.project-step { font-size: var(--fs-md); }
.archive summary { min-height: 40px; display: flex; align-items: center; color: var(--muted); cursor: pointer; }
.checkpoint.is-due { border: 2px solid var(--box-week); }
.checkpoint summary { min-height: 28px; cursor: pointer; }
.plan-list, .journal { margin: 8px 0 0; padding: 0; list-style: none; }
.plan-item { display: flex; align-items: center; gap: 6px; min-height: 48px; border-top: 1px solid var(--border); }
.plan-item:first-child { border-top: 0; }
.plan-item > span, .plan-item > label { flex: 1; min-width: 0; margin: 0; }
.journal li { padding: 8px 0; border-top: 1px solid var(--border); font-size: var(--fs-md); }
.journal li:first-child { border-top: 0; }
.journal-meta { display: block; color: var(--muted); font-size: var(--fs-xs); }

/* Подключения */
.connector-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.connector-head h2 { margin: 0; font-size: var(--fs-lg); }
.connector-message { margin: 12px 0 0; color: var(--muted); font-size: var(--fs-md); }
.connector-message.is-error { color: var(--danger); }
.profile-list { margin: 12px 0 0; padding: 0; list-style: none; }
.profile-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.profile-row:first-child { border-top: 0; }
.profile-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.profile-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 12px; }
.preset { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); text-align: left; cursor: pointer; }
.preset:hover { border-color: var(--accent); }
.preset-name { font-weight: 600; }

/* Мастер первого запуска */
.wizard { max-width: 560px; margin: 0 auto; }
.wizard > * + * { margin-top: 14px; }
.wizard-dots { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.wizard-dots li { width: 28px; height: 4px; border-radius: 2px; background: var(--border); }
.wizard-dots .is-done { background: var(--accent-soft); }
.wizard-dots .is-current { background: var(--accent); }
.wizard-title { margin: 0; font-size: var(--fs-2xl); }
.lead { font-size: var(--fs-lg); }
.wizard-points { margin: 0; padding-left: 20px; }
.wizard-points li + li { margin-top: 6px; }

/* Демо-режим и экраны без навигации */
.demo-banner { padding: calc(var(--safe-top) + 6px) 16px 6px; background: var(--warn-soft); font-size: var(--fs-sm); text-align: center; }
.demo-banner + .topbar { padding-top: 8px; }
.shell.is-bare { display: block; }
.shell.is-bare .sidebar,
.shell.is-bare .tabbar,
.shell.is-bare .fab,
.shell.is-bare .topbar { display: none; }
.shell.is-bare .view { padding-top: calc(var(--safe-top) + 20px); padding-bottom: calc(var(--safe-bottom) + 32px); }

@media (min-width: 900px) {
  .toast { bottom: 32px; }
  .sheet { margin: auto; border-radius: var(--radius); }
}

/* Ассистент: Claude по подписке */
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.instructions-text { width: 100%; margin-top: 8px; font-size: var(--fs-sm); line-height: 1.4; resize: none; }

/* Чат ассистента */
.chat-head { display: grid; gap: 8px; }
.chat-row { display: flex; gap: 8px; align-items: center; }
.chat-row .input { flex: 1; min-width: 0; }
.chat-card { display: grid; gap: 12px; }
.chat-log { display: grid; gap: 8px; }
.bubble { max-width: 92%; padding: 10px 12px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); white-space: pre-line; overflow-wrap: anywhere; }
.bubble.is-user { justify-self: end; border-radius: 14px 14px 4px 14px; background: var(--accent-soft); }
.chat-tools { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.chat-tools.is-busy { animation: ai-pulse 1s ease-in-out infinite; }
.chat-error { margin: 0; color: var(--danger); font-size: var(--fs-md); }
.chat-empty { display: grid; gap: 10px; }
.chat-empty .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; }
.chat-input { flex: 1; min-height: 44px; resize: none; }
.proposal { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--accent); border-radius: var(--radius-sm); }
.proposal.is-applied { border-color: var(--border, var(--surface-2)); opacity: 0.85; }
.proposal.is-rejected { border-style: dashed; border-color: var(--muted); opacity: 0.6; }
.proposal-kicker { margin: 0; color: var(--accent); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.proposal-title { margin: 0; font-weight: 700; }
.proposal-lines { margin: 0; padding-left: 18px; }
.claude-card summary { cursor: pointer; }
.sort-row { display: flex; align-items: center; gap: 10px; }
.sort-select { width: auto; min-width: 180px; }

/* Поиск */
.search-bar { display: grid; gap: 8px; }
.search-input { font-size: var(--fs-lg); }
.search-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 8px; }
.search-results { display: grid; gap: 12px; }
.search-list { list-style: none; margin: 0; padding: 0; display: grid; }
.search-hit { display: grid; gap: 2px; padding: 10px 4px; border-bottom: 1px solid var(--surface-2); color: var(--text); text-decoration: none; }
.search-hit:hover, .search-hit:focus-visible { background: var(--surface-2); }
.search-title { font-weight: 600; }
.search-snippet { color: var(--muted); font-size: var(--fs-sm); }
.search-results mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

/* «По времени»: дела на день и встречи */
.box-schedule { border-left-color: var(--accent); }
.schedule-list { list-style: none; margin: 0; padding: 0; display: grid; }
.schedule-row, .missed-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--surface-2); }
.schedule-row.is-past { opacity: 0.55; }
.schedule-time { min-width: 92px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); font-size: var(--fs-base); }
.schedule-main { flex: 1; display: grid; gap: 2px; color: var(--text); text-decoration: none; min-width: 0; }
.missed { border: 1px solid var(--danger); }
.missed-row { flex-wrap: wrap; }
.when-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.when-row .input { width: auto; flex: 1 1 120px; }
/* Дата — строкой, время «с — до» — второй строкой: в узком окне ничего не вылезает */
.when-row > .input[type="date"] { flex: 1 1 100%; min-width: 0; }
.when-row > .input[type="time"] { flex: 1 1 0; min-width: 0; }
.missed-row .schedule-main { flex: 1 1 100%; }

/* Календарь */
.cal-head { display: grid; gap: 10px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-period { flex: 1; text-align: center; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-weekday { text-align: center; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; padding-bottom: 4px; }
.cal-cell { display: grid; gap: 4px; justify-items: center; align-content: start; min-height: 52px; padding: 6px 2px; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.cal-cell.is-other { opacity: 0.4; }
.cal-cell.is-today .cal-num { color: var(--accent); font-weight: 800; }
.cal-cell.is-selected { border-color: var(--accent); }
.cal-num { font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.dot.is-day { background: var(--accent); }
.dot.is-meeting { background: var(--box-next); }
.dot.is-deadline { background: var(--box-week); }
.cal-items, .cal-free { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cal-item { display: flex; gap: 10px; padding: 8px 4px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.cal-item:hover { background: var(--surface-2); }
.cal-item.is-meeting .cal-time { color: var(--box-next); }
.cal-item.is-deadline .cal-time { color: var(--box-week); }
.cal-time { min-width: 92px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.cal-free li { display: flex; gap: 10px; padding: 6px 4px; }
.cal-day.is-today { border: 1px solid var(--accent); }

/* План дня и недели */
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; }
.plan-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--surface-2); }
.plan-row a { color: var(--text); flex: 1; min-width: 140px; text-decoration: none; }
.plan-row a:hover { color: var(--accent); }
.plan-row.is-fixed { color: var(--muted); }
.plan-row.is-unplaced a { color: var(--muted); }
.notice-plan { background: var(--warn-soft); color: var(--warn); }

/* Занятость из календарей-подписок */
.schedule-row.is-busy .schedule-time, .cal-item.is-busy .cal-time { color: var(--muted); }
.schedule-row.is-busy .task-title { color: var(--muted); }
.cal-item.is-busy { color: var(--muted); }
.dot.is-busy { background: var(--muted); }
.cal-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

/* Экран фокуса */
.focus { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-top, 0px)) 16px calc(24px + var(--safe-bottom, 0px)); background: var(--bg); }
.focus-body { width: min(620px, 100%); display: grid; gap: 16px; text-align: center; justify-items: center; }
.focus-title { margin: 0; font-size: clamp(1.5rem, 5vw, 2.25rem); line-height: 1.2; }
.focus-time { margin: 8px 0; font-size: clamp(3.5rem, 16vw, 6rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); letter-spacing: -0.02em; }
.focus-time.is-done { color: var(--warn); }
.focus-checklist { list-style: none; padding: 0; margin: 0; text-align: left; width: 100%; display: grid; gap: 6px; }
.focus-body .input { width: 100%; }
.focus-actions { justify-content: center; }
.focus-rest { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; gap: 16px; padding: 24px; text-align: center; background: var(--bg); }
.focus-rest-title { margin: 0; font-size: var(--fs-2xl); font-weight: 700; }
.focus-rest-time { margin: 0; font-size: 4rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.still-working { border: 1px solid var(--warn); }

/* Итоги: графики и таблица */
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); }
.bar-track { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 0 5px 5px 0; background: var(--accent); }
.bar-value { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.spark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.spark-figure { margin: 0; display: grid; gap: 4px; }
.sparkline { width: 100%; height: 56px; display: block; }
.spark-base { stroke: var(--surface-2); stroke-width: 1; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.day-bar { fill: var(--accent); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 4px 6px; border-bottom: 1px solid var(--surface-2); text-align: left; }
.checkin { border: 1px solid var(--accent); }

/* Карточка задачи как в TickTick (7.5 Б) */
.task-head { display: grid; gap: 8px; }
.task-kind { color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.task-head-row { display: flex; align-items: flex-start; gap: 8px; }
.task-head-row > .check { margin-top: 6px; flex: none; }
.title-input {
  flex: 1; min-width: 0; resize: none; overflow: hidden; padding: 4px 0; border: 0; background: none; color: var(--text);
  font: inherit; font-size: var(--fs-xl); font-weight: 700; line-height: 1.3;
}
.title-input:focus { outline: none; box-shadow: inset 0 -2px 0 var(--accent); }
.status-btn {
  flex: none; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.status-btn .icon svg { width: 14px; height: 14px; }
.status-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.status-btn.is-paused { border-color: var(--warn); color: var(--warn); }
.status-btn.is-done { color: var(--muted); }
.meta-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 32px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.meta-chip .icon svg { width: 16px; height: 16px; }
.meta-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-chip.is-empty { padding: 4px 8px; color: var(--muted); border-style: dashed; }
.meta-chip.is-accent { border-color: var(--accent); color: var(--accent); }
.meta-chip.is-danger { border-color: var(--danger); color: var(--danger); }
.meta-chip.is-warn { border-color: var(--warn); color: var(--warn); }
.meta-chip:hover { background: var(--surface-2); }
.task-body { display: grid; gap: 12px; }
.notes-input { min-height: 72px; }
.attachments-inline { display: grid; gap: 6px; }
.attachments-actions { display: flex; gap: 4px; }
.chip.is-tag { color: var(--accent); }
.action-bar {
  /* Статично под заголовком (ROADMAP 17): не перекрывает поля, когда пишешь */
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.action-bar .btn { display: inline-flex; align-items: center; gap: 6px; }
.action-bar-gap { flex: 1; }
.shell[data-route="task"] .fab { display: none; }
.status-btn { margin-top: 0; min-height: 32px; }
.task-head-row .ai-btn { flex: none; }

/* Канбан (7.5 В) */
.kanban-wrap { display: grid; gap: 8px; }
.kanban-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(78vw, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
}
@media (min-width: 600px) { .kanban { grid-auto-columns: minmax(240px, 280px); } }
.kanban-col {
  display: flex; flex-direction: column; gap: 8px; min-height: 120px; padding: 10px; border-radius: var(--radius);
  background: var(--surface-2); scroll-snap-align: start; transition: box-shadow 0.15s;
}
.kanban-col.is-over { box-shadow: inset 0 0 0 2px var(--accent); }
.kanban-col-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: var(--fs-md); }
.kanban-card {
  display: flex; align-items: flex-start; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); user-select: none; -webkit-user-select: none;
}
.kanban-card.is-dragging { opacity: 0.35; }
.kanban-ghost { position: fixed; z-index: 100; pointer-events: none; box-shadow: var(--shadow); transform: rotate(2deg); }
.kanban-handle { flex: none; width: 24px; padding: 6px 0; color: var(--muted); text-align: center; cursor: grab; touch-action: none; }
.kanban-card-body { flex: 1; min-width: 0; }
.kanban-open { display: grid; gap: 2px; width: 100%; padding: 4px 2px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.kanban-open.is-done .kanban-title { color: var(--muted); text-decoration: line-through; }
.kanban-title { font-weight: 600; overflow-wrap: anywhere; }
.kanban-meta { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.kanban-move { flex: none; width: 32px; height: 32px; }
.kanban-empty { margin: 8px 4px; }
.kanban-columns-edit { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kanban-columns-edit li { display: flex; gap: 4px; align-items: center; }
.kanban-columns-edit .input { flex: 1; min-width: 0; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.segment { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.segment .icon svg { width: 16px; height: 16px; }
.segment[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.meta-chip.is-static { cursor: default; }
.meta-chip.is-static:hover { background: none; }
a.meta-chip { text-decoration: none; }
.shell[data-route="project"] .fab { display: none; }
/* Канбан на широком экране — во всю ширину (остальное на экране — по центру, как было) */
@media (min-width: 900px) {
  .view:has(.kanban) { max-width: none; }
  .view:has(.kanban) > :not(.kanban-wrap):not(.card:has(.kanban)) { max-width: var(--content-w); margin-left: auto; margin-right: auto; }
  .kanban { grid-auto-columns: minmax(220px, 1fr); }
}
.task-meta .is-tag { color: var(--accent); }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-row > .chips { display: contents; }

/* Заметки Anytype (этап 8): цвета типов и тегов как в самом Anytype */
.any-grey { --any-bg: #f1f0ee; --any-fg: #78756e; }
.any-yellow { --any-bg: #fefce8; --any-fg: #a16207; }
.any-orange { --any-bg: #fff7ed; --any-fg: #c2410c; }
.any-red { --any-bg: #fef2f2; --any-fg: #dc2626; }
.any-pink { --any-bg: #fdf2f8; --any-fg: #db2777; }
.any-purple { --any-bg: #faf5ff; --any-fg: #9333ea; }
.any-blue { --any-bg: #eff6ff; --any-fg: #2563eb; }
.any-ice { --any-bg: #f0f9ff; --any-fg: #0284c7; }
.any-teal { --any-bg: #f0fdfa; --any-fg: #0d9488; }
.any-lime { --any-bg: #f7fee7; --any-fg: #4d7c0f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .any-grey { --any-bg: #2c2b30; --any-fg: #a6a39d; }
  :root:not([data-theme="light"]) .any-yellow { --any-bg: #3a3212; --any-fg: #fde047; }
  :root:not([data-theme="light"]) .any-orange { --any-bg: #432a12; --any-fg: #fdba74; }
  :root:not([data-theme="light"]) .any-red { --any-bg: #421e1e; --any-fg: #fca5a5; }
  :root:not([data-theme="light"]) .any-pink { --any-bg: #4a1d34; --any-fg: #f9a8d4; }
  :root:not([data-theme="light"]) .any-purple { --any-bg: #301848; --any-fg: #d8b4fe; }
  :root:not([data-theme="light"]) .any-blue { --any-bg: #182a4a; --any-fg: #93c5fd; }
  :root:not([data-theme="light"]) .any-ice { --any-bg: #132b3d; --any-fg: #7dd3fc; }
  :root:not([data-theme="light"]) .any-teal { --any-bg: #0f3d38; --any-fg: #5eead4; }
  :root:not([data-theme="light"]) .any-lime { --any-bg: #283a12; --any-fg: #bef264; }
}
:root[data-theme="dark"] .any-grey { --any-bg: #2c2b30; --any-fg: #a6a39d; }
:root[data-theme="dark"] .any-yellow { --any-bg: #3a3212; --any-fg: #fde047; }
:root[data-theme="dark"] .any-orange { --any-bg: #432a12; --any-fg: #fdba74; }
:root[data-theme="dark"] .any-red { --any-bg: #421e1e; --any-fg: #fca5a5; }
:root[data-theme="dark"] .any-pink { --any-bg: #4a1d34; --any-fg: #f9a8d4; }
:root[data-theme="dark"] .any-purple { --any-bg: #301848; --any-fg: #d8b4fe; }
:root[data-theme="dark"] .any-blue { --any-bg: #182a4a; --any-fg: #93c5fd; }
:root[data-theme="dark"] .any-ice { --any-bg: #132b3d; --any-fg: #7dd3fc; }
:root[data-theme="dark"] .any-teal { --any-bg: #0f3d38; --any-fg: #5eead4; }
:root[data-theme="dark"] .any-lime { --any-bg: #283a12; --any-fg: #bef264; }
.note-glyph { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--any-bg, var(--surface-2)); color: var(--any-fg, var(--text)); font-weight: 700; font-size: var(--fs-lg); }
.note-glyph.is-sm { width: 26px; height: 26px; border-radius: 8px; font-size: var(--fs-md); }
.note-glyph.is-lg { width: 48px; height: 48px; border-radius: 12px; font-size: var(--fs-2xl); }
.note-list { display: grid; gap: 8px; }
.note-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.note-row:hover { background: var(--surface-2); }
.note-row-main { display: grid; gap: 3px; min-width: 0; }
.note-row-title { font-weight: 600; overflow-wrap: anywhere; }
.note-row-meta { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.note-row-props { display: flex; flex-wrap: wrap; gap: 4px; }
.note-prop-mini { padding: 1px 8px; border-radius: 999px; background: var(--any-bg, var(--surface-2)); color: var(--any-fg, var(--muted)); font-size: var(--fs-xs); }
.meta-chip[class*=" any-"], .chip[class*=" any-"] { background: var(--any-bg); color: var(--any-fg); border-color: transparent; }
.chip[class*=" any-"][aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--any-fg); }
.note-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.note-links li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-links a { color: var(--accent); overflow-wrap: anywhere; }
.note-picker { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 45vh; overflow-y: auto; }
.note-pick { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 4px 6px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.note-pick:hover { background: var(--surface-2); }
.note-pick > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-hint.is-warn { color: var(--warn); }
.copy-banner { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-md); }
/* Текст заметки (Markdown) */
.md { line-height: 1.55; overflow-wrap: anywhere; }
.md > * + * { margin-top: 0.6em; }
.md h2, .md h3, .md h4 { margin: 1em 0 0.3em; line-height: 1.3; }
.md ul, .md ol { padding-left: 1.3em; margin: 0.4em 0; }
.md li.md-task { list-style: none; margin-left: -1.3em; }
.md li.md-task.is-done { color: var(--muted); text-decoration: line-through; }
.md blockquote { margin: 0; padding: 4px 12px; border-left: 3px solid var(--border); color: var(--muted); }
.md pre { padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); overflow-x: auto; }
.md code { padding: 1px 4px; border-radius: 4px; background: var(--surface-2); font-size: 0.9em; }
.md a { color: var(--accent); }
.md hr { border: 0; border-top: 1px solid var(--border); }
.note-empty-text { color: var(--muted); font-style: italic; }
.shell[data-route="note"] .fab { display: none; }
/* Типы заметок — одной строкой с прокруткой, чтобы список был виден сразу */
.type-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.type-chips .chip { flex: none; }
.note-editor { min-height: 240px; font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-base); line-height: 1.5; }
.note-pick > .muted { flex: none; max-width: 35%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Панель действий на узком экране: кнопки переносятся, главная — во всю ширину */
.action-bar { flex-wrap: wrap; }
.action-bar > .btn { min-width: 0; }
@media (max-width: 360px) { .action-bar > .btn-primary { flex: 1 1 100%; justify-content: center; } }

/* Ассистент-мессенджер (9.4): одинаково на телефоне и компьютере — лента на всю высоту, поле ввода снизу */
.shell[data-route="assistant"] .main { height: 100vh; height: 100dvh; }
.shell[data-route="assistant"] .view { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); }
.shell[data-route="assistant"] .fab { display: none; }
@media (min-width: 900px) { .shell[data-route="assistant"] .view { padding-bottom: 16px; } }
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.chat-bar { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--border); }
.chat-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.chat-title:hover { background: var(--surface-2); }
.chat-title .icon svg { width: 20px; height: 20px; color: var(--accent); }
.chat-title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat .chat-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; max-height: none; }
.msg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 88%; }
.msg.is-user { align-self: flex-end; align-items: flex-end; }
.msg .bubble { max-width: 100%; padding: 10px 12px; border-radius: 16px 16px 16px 4px; background: var(--surface-2); color: var(--text); overflow-wrap: anywhere; white-space: normal; }
.msg.is-user .bubble { border-radius: 16px 16px 4px 16px; background: var(--accent); color: var(--on-accent); white-space: pre-wrap; }
.msg .bubble.md > :first-child { margin-top: 0; }
.msg-time { color: var(--muted); font-size: var(--fs-2xs); padding: 0 6px; }
.bubble.is-typing { display: flex; gap: 4px; padding: 14px; }
.bubble.is-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1s infinite ease-in-out; }
.bubble.is-typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.is-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-empty { margin: auto; display: grid; justify-items: center; gap: 10px; max-width: 420px; text-align: center; color: var(--muted); }
.chat-empty-icon svg { width: 40px; height: 40px; color: var(--accent); }
.chat-empty .chips { justify-content: center; }
.chat-compose { display: grid; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-model { justify-self: start; max-width: 100%; display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.chat-model .icon svg { width: 14px; height: 14px; color: var(--accent); }
.chat-model-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-field { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--border); border-radius: 22px; background: var(--bg); }
.chat-field:focus-within { border-color: var(--accent); }
.chat-input { flex: 1; min-width: 0; max-height: 160px; padding: 8px 0; border: 0; background: none; color: var(--text); font: inherit; line-height: 1.4; resize: none; }
.chat-input:focus { outline: none; }
.chat-send { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.chat-send svg { width: 20px; height: 20px; }
.chat-send:disabled { opacity: 0.5; }
.thread-list { overflow-y: auto; margin-top: 10px; }
.thread-link { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.thread-link.is-current { background: var(--accent-soft); color: var(--accent); }
.chat-threads > .btn { margin-top: 4px; }
/* Входящие: длинная запись — до 4 строк, полностью — при разборе */
.inbox-list .task-title { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
/* Фильтры одной строкой с прокруткой (9.2): меньше места над списком */
.filter-row.is-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filter-row.is-scroll::-webkit-scrollbar { display: none; }
.filter-row.is-scroll .chip { flex: none; }
.sort-chip { margin-left: auto; }

/* Виджеты на рабочем столе Windows (9.5): окно прозрачное, внутри — карточка во всю высоту */
html.is-widget, html.is-widget body { background: transparent; overflow: hidden; }
html.is-widget .shell.is-bare .view { padding: 0; max-width: none; height: 100vh; }
html.is-widget .demo-slot, html.is-widget .activity-bar, html.is-widget .fab { display: none; }
.widget { display: flex; flex-direction: column; height: 100vh; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); overflow: hidden; }
.w-head { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--border); -webkit-app-region: drag; user-select: none; }
.w-head .icon-btn { width: 32px; height: 32px; -webkit-app-region: no-drag; }
.w-head .icon-btn svg { width: 18px; height: 18px; }
.w-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-date { margin-left: 8px; color: var(--muted); font-weight: 400; font-size: var(--fs-sm); }
.w-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 12px; display: grid; align-content: start; gap: 8px; }
.w-label { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.w-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.w-row { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.w-row .check { width: 20px; height: 20px; flex: none; }
.w-row.is-busy { color: var(--muted); }
.w-time { flex: none; color: var(--accent); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.w-title { flex: 1; min-width: 0; padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.w-title:hover { color: var(--accent); }
.w-late { flex: none; color: var(--danger); font-size: var(--fs-xs); }
.w-empty { margin: 0; color: var(--muted); font-size: var(--fs-md); }
.w-now { display: grid; gap: 4px; padding: 10px; border-radius: 10px; background: var(--accent-soft); }
.w-now .w-title { font-weight: 700; }
.w-actions { display: flex; gap: 6px; }
.w-timer { font-size: var(--fs-3xl); font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.w-focus-title { font-weight: 700; font-size: var(--fs-lg); }
.w-month { display: flex; align-items: center; justify-content: space-between; }
.w-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.w-dow { color: var(--muted); font-size: var(--fs-2xs); }
.w-day { position: relative; aspect-ratio: 1; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.w-day:hover { background: var(--surface-2); }
.w-day.is-other { color: var(--muted); opacity: 0.6; }
.w-day.is-today { color: var(--accent); font-weight: 700; }
.w-day.is-selected { background: var(--accent); color: var(--on-accent); }
.w-dot { position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.widget .quick-add .btn { padding: 0 14px; }
.w-row .check { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 2px solid var(--muted); border-radius: 50%; background: none; color: var(--on-accent); cursor: pointer; }
.w-row .check:hover { border-color: var(--accent); background: var(--accent-soft); }
.w-row .check::before { display: none; }

/* ---------- Свои заметки (ROADMAP 12) ---------- */
a.chip { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
a.chip[aria-selected="true"], .chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.view-bar { gap: var(--sp-2); align-items: center; }
@media (max-width: 480px) { .segment-label { display: none; } .view-bar .segment { padding: 0 10px; } }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-2); margin-bottom: var(--sp-3); }
.preset { display: grid; justify-items: start; gap: 6px; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.preset:hover { border-color: var(--accent); }
.preset-name { font-weight: 700; }

.own-note-row { display: flex; align-items: center; gap: var(--sp-3); flex: 1; min-width: 0; padding: 10px 0; color: var(--text); text-decoration: none; }
.own-note-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.own-note-title { font-weight: 600; overflow-wrap: anywhere; }
.own-note-snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.own-note-date { flex: none; }
.note-props-line { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: var(--fs-sm); color: var(--muted); }
.opt-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--any-bg, var(--surface-2)); color: var(--any-fg, var(--text)); font-size: var(--fs-sm); font-weight: 600; line-height: 1.5; white-space: nowrap; }
.meta-chip .opt-chip + .opt-chip { margin-left: 4px; }
.meta-chip.is-placeholder { color: var(--muted); border-style: dashed; }
.meta-chip.is-accent { border-color: var(--accent); color: var(--accent); }
.opt-list { display: grid; gap: 2px; margin-bottom: var(--sp-2); }
.opt-row { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.opt-row.is-selected { background: var(--accent-soft); }

.table-card { padding: 0; overflow: hidden; }
.notes-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.notes-table th, .notes-table td { padding: 8px 10px; white-space: nowrap; }
.notes-table td:first-child a { color: var(--text); font-weight: 600; text-decoration: none; white-space: normal; }
.notes-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.notes-table tr.is-link { cursor: pointer; }
.notes-table tr.is-link:hover td { background: var(--surface-2); }
.th-sort { border: 0; background: none; padding: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }

.note-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--sp-3); }
.gallery-card { display: grid; align-content: start; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.gallery-cover { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--any-bg, var(--surface-2)); font-size: 2rem; }
.gallery-body { display: grid; gap: 4px; padding: var(--sp-2) var(--sp-3) var(--sp-3); }

/* Страница заметки */
.page { display: grid; gap: var(--sp-3); }
.page-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.page-head .icon-btn { margin-left: auto; }
.page-type { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px 0 4px; }
.page-title { width: 100%; resize: none; overflow: hidden; border: 0; background: none; color: var(--text); font: inherit; font-size: var(--fs-2xl); font-weight: 800; line-height: 1.25; padding: 0; }
.page-title:focus { outline: none; }
.backlink-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.backlink-list a { display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; color: var(--text); text-decoration: none; }
.backlink-list .icon svg { width: 18px; height: 18px; color: var(--muted); }

/* Блочный редактор */
.blocks { position: relative; display: grid; gap: 2px; padding-bottom: var(--sp-2); }
.blk { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: start; border-radius: 6px; }
.blk-handle { width: 24px; min-height: 28px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 12px; letter-spacing: -2px; cursor: grab; opacity: 0; touch-action: none; transition: opacity 0.15s; }
.blk:hover .blk-handle, .blk:focus-within .blk-handle { opacity: 0.7; }
@media (pointer: coarse) { .blk-handle { opacity: 0.35; } }
.blk-body { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.blk-text { flex: 1; min-width: 0; min-height: 28px; padding: 2px 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; cursor: text; }
.blk-text.is-editing:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.blocks > .blk:only-of-type .blk-text:empty::before { content: attr(data-placeholder); color: var(--muted); }
.blk-h1 .blk-text { font-size: var(--fs-xl); font-weight: 800; padding-top: 10px; }
.blk-h2 .blk-text { font-size: var(--fs-lg); font-weight: 700; padding-top: 8px; }
.blk-h3 .blk-text { font-size: var(--fs-body); font-weight: 700; padding-top: 6px; }
.blk-h1 .blk-handle, .blk-h2 .blk-handle { margin-top: 8px; }
.blk-dot, .blk-num { flex: none; min-width: 18px; padding-top: 2px; color: var(--muted); line-height: 1.55; text-align: right; font-variant-numeric: tabular-nums; }
.blk-check { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 5px; padding: 0; border: 2px solid var(--muted); border-radius: 6px; background: none; color: var(--on-accent); cursor: pointer; }
.blk-check.is-done { background: var(--accent); border-color: var(--accent); }
.blk-check svg { width: 14px; height: 14px; }
.blk-todo.is-done .blk-text { color: var(--muted); text-decoration: line-through; }
.blk-quote .blk-body { padding-left: 12px; border-left: 3px solid var(--border); color: var(--muted); }
.blk-callout .blk-body { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.blk-callout.is-warning .blk-body, .blk-callout.is-danger .blk-body { background: var(--warn-soft); }
.blk-callout-icon { padding-top: 2px; }
.blk-hr { width: 100%; margin: 12px 0; border: 0; border-top: 1px solid var(--border); }
.blk-code-wrap { position: relative; flex: 1; min-width: 0; }
.blk-code { width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: var(--fs-md)/1.5 ui-monospace, Consolas, monospace; resize: none; overflow: hidden; }
.blk-lang { position: absolute; top: 4px; right: 6px; width: 80px; border: 0; background: none; color: var(--muted); font-size: var(--fs-xs); text-align: right; }
.blk-toggle { display: flex; gap: 4px; flex: 1; min-width: 0; }
.blk-toggle-arrow { flex: none; width: 24px; min-height: 28px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.blk-toggle-main { display: grid; gap: 4px; flex: 1; min-width: 0; }
.blk-toggle-title, .blk-caption { width: 100%; min-height: 28px; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; }
.blk-toggle-body { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; resize: none; overflow: hidden; }
.blk-caption { font-weight: 400; font-size: var(--fs-sm); color: var(--muted); text-align: center; }
.blk-figure { display: grid; gap: 4px; flex: 1; min-width: 0; margin: 4px 0; }
.blk-img { max-width: 100%; max-height: 480px; border-radius: var(--radius-sm); justify-self: center; object-fit: contain; }
.blk-file { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 8px 12px; text-align: left; white-space: normal; overflow-wrap: anywhere; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; }
.blk-file .icon svg { width: 16px; height: 16px; }
.blk-table-wrap { flex: 1; min-width: 0; overflow-x: auto; }
.blk-table { border-collapse: collapse; min-width: 100%; }
.blk-table th, .blk-table td { border: 1px solid var(--border); padding: 0; }
.blk-table th { background: var(--surface-2); }
.blk-cell { width: 100%; min-width: 90px; min-height: 34px; padding: 4px 8px; border: 0; background: none; color: var(--text); font: inherit; }
.blk-table th .blk-cell { font-weight: 700; }
.blk-table-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.blk-menu { position: absolute; left: 24px; z-index: 5; display: grid; width: min(280px, calc(100% - 24px)); max-height: 280px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / 18%); }
.blk-menu[hidden] { display: none; }
.blk-menu-item { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); min-height: 38px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.blk-menu-item.is-active, .blk-menu-item:hover { background: var(--accent-soft); }
.blk-tail { min-height: 48px; cursor: text; }
.blk.is-dragging { opacity: 0.4; }
.blk.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.blk.drop-after { box-shadow: 0 2px 0 var(--accent); }
.wikilink { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); cursor: pointer; }
.wikilink.is-missing { color: var(--muted); border-bottom-style: dashed; }

/* Редактор типа */
.popover.is-wide { width: min(560px, calc(100vw - 16px)); }
.type-head { display: flex; gap: var(--sp-2); }
.type-emoji { flex: none; width: 56px; text-align: center; font-size: var(--fs-xl); }
.color-dot { width: 28px; height: 28px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--any-fg); cursor: pointer; }
.color-dot[aria-checked="true"] { border-color: var(--text); box-shadow: inset 0 0 0 3px var(--surface); }
.type-props { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.type-prop { display: grid; gap: 6px; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.type-prop-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 120px) auto auto auto; gap: 4px; align-items: center; }
.type-prop-row .icon-btn { width: 36px; height: 36px; }
.type-options { display: flex; flex-wrap: wrap; gap: 6px; }
.type-option { display: inline-flex; align-items: center; gap: 2px; }
.opt-input { width: 120px; min-height: 34px; background: var(--any-bg); color: var(--any-fg); font-weight: 600; }
.opt-color { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: var(--any-fg); cursor: pointer; }
.type-option .icon-btn { width: 30px; height: 30px; }
.type-options > .input { width: 150px; min-height: 34px; }
@media (max-width: 480px) { .type-prop-row { grid-template-columns: minmax(0, 1fr) auto auto auto; } .type-prop-row select { grid-column: 1 / -1; grid-row: 2; } }
.filter-new { display: grid; gap: var(--sp-2); }

/* Дашборды */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: var(--sp-3); }
.dash-card { display: grid; gap: var(--sp-2); align-content: start; }
.dash-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.dash-card-title { margin: 0; font-size: var(--fs-base); font-weight: 700; }
.dash-card-head .icon-btn { width: 36px; height: 36px; margin: -6px -8px 0 0; }
.dash-figures { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; }
.dash-value { font-size: var(--fs-3xl); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-badge { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.dash-badge.is-streak { background: var(--warn-soft); }
.dash-badge.is-up { background: var(--accent-soft); color: var(--accent); }
.dash-badge.is-down { color: var(--muted); }
.period-chart { width: 100%; height: auto; overflow: visible; }
.period-hit { fill: transparent; }
.period-bar:hover .day-bar { opacity: 0.8; }
.chart-value { fill: var(--text); font-size: 12px; font-weight: 700; }
.chart-label { fill: var(--muted); font-size: 10px; }
.dash-ai { display: grid; gap: var(--sp-2); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.dash-ai-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); }
.dash-ai-head .section-title { margin: 0; }
.dash-ai-head p { margin: 0; }
.dash-ai-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.dash-ai-icon svg { width: 22px; height: 22px; }
.dash-ai-text h3 { margin: 10px 0 4px; font-size: var(--fs-base); }
@media (max-width: 420px) { .dash-ai-head { grid-template-columns: auto minmax(0, 1fr); } .dash-ai-head .btn { grid-column: 1 / -1; } }
.notes-table td, .notes-table th { overflow-wrap: normal; }
.notes-table td:first-child { min-width: 130px; }
.view-bar .chip { min-height: 36px; padding: 0 10px; font-size: var(--fs-sm); }
@media (max-width: 480px) { .view-bar .segment { padding: 0 8px; } }
.blk-file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.blk-figure .blk-file-actions { justify-content: center; }

/* Обзор недели (#/plan/review) */
.review-progress { width: 100%; height: 8px; accent-color: var(--accent); }
.review-head { display: flex; align-items: center; gap: 8px; }
.review-head .check-field { flex: 1; min-width: 0; }
.review-head .check-field strong { overflow-wrap: anywhere; }
.review-step.is-done { opacity: .7; }
.review-step.is-done strong { text-decoration: line-through; text-decoration-color: var(--muted); }

/* Привычки на «Сегодня» */
.habit-week { display: inline-flex; gap: 3px; flex-shrink: 0; }
.habit-week i { width: 7px; height: 14px; border-radius: 2px; background: var(--surface-2); }
.habit-week i.is-on { background: var(--accent); }
.habit-row.is-done .task-title { color: var(--muted); }
.review-head .check-field input { flex-shrink: 0; }

/* СДВГ-помощники на «Сегодня»: победы, «Что делать сейчас?», «Застряло» */
.wins { display: flex; flex-wrap: wrap; gap: 6px; }
.win { padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 600; }
.what-now { width: 100%; justify-content: center; }
.stuck-card { border-left: 3px solid var(--warn); }
.notice-project { display: flex; align-items: center; gap: 8px; }
.notice-project svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Единый ввод и «Записать с ИИ» */
.capture-kinds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.capture-kinds .btn-ai { margin-left: auto; min-height: 36px; padding: 0 12px; }
.capture-kinds .chip { padding-inline: 12px; }
.btn-ai { color: var(--accent); }
.capture-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.capture-item { display: grid; gap: 8px; }
.capture-item > .chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.capture-item > .chips .icon-btn { margin-left: auto; }
.capture-notes { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.capture-ai { max-height: 90vh; overflow-y: auto; }
.list-row { display: flex; align-items: center; gap: 8px; }
.list-row > a { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.blk-img { cursor: zoom-in; }

/* Встроенный просмотр файлов */
.viewer { width: min(960px, 100vw); max-width: 100vw; height: min(92vh, 100dvh); max-height: 100dvh; padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); display: flex; flex-direction: column; }
.viewer:not([open]) { display: none; }
.viewer::backdrop { background: rgba(0, 0, 0, .7); }
.viewer-head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 8px 16px; border-bottom: 1px solid var(--border); }
.viewer-title { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.viewer-body { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; background: var(--surface-2); }
.viewer-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-media { max-width: 100%; max-height: 100%; }
.viewer-frame { width: 100%; height: 100%; min-height: 60vh; border: 0; background: #fff; }
.viewer-text { align-self: start; justify-self: stretch; margin: 0; padding: 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; }
.viewer-empty { text-align: center; padding: 24px; display: grid; gap: 8px; justify-items: center; }
.viewer-icon svg { width: 40px; height: 40px; }
.viewer-actions { padding: 10px 12px; border-top: 1px solid var(--border); margin: 0; }
.stakes-chip.is-must { color: var(--danger); border-color: var(--danger); }
.stakes-chip.is-own { color: var(--accent); border-color: var(--accent); }
.task-meta .is-must { color: var(--danger); }

/* Радар обязательного, «для себя», наставник */
.radar { border-left: 3px solid var(--danger); }
.radar-row.is-overdue .task-meta, .radar-row.is-today .task-meta { color: var(--danger); }
.radar-row.is-start .task-meta { color: var(--warn); }
.own-step { border-left: 3px solid var(--accent); }
.own-step-title { display: block; font-weight: 600; font-size: 1.05rem; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.mentor-links { display: flex; flex-wrap: wrap; gap: 8px; }
.notice-soft { background: var(--surface-2); color: var(--text); font-weight: 500; }

/* «Как пользоваться» */
.guide-steps, .guide-list { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.guide-steps p { margin: 2px 0 0; }
.guide-list li { overflow-wrap: anywhere; }

/* Блок «Файл» в заметке: значок, полное имя, тип и размер */
.blk-file { gap: 10px; padding: 8px 12px 8px 8px; }
.blk-file-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.blk-file-icon svg { width: 18px; height: 18px; }
.blk-file-text { display: grid; gap: 2px; min-width: 0; }
.blk-file-name { font-weight: 600; overflow-wrap: anywhere; }
.blk-file-meta { font-size: .8rem; color: var(--muted); }

/* Окно добавления (как в TickTick): поле, значки, выбранное — чипами */
.composer { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.composer-kinds { display: flex; gap: 4px; flex-wrap: wrap; }
.composer-kind { border: 0; background: none; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.composer-kind[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); }
.composer-title { width: 100%; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 1.1rem; line-height: 1.4; padding: 4px 2px; min-height: 36px; }
.composer-title::placeholder { color: var(--muted); }
.composer-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.composer-summary:empty, .composer-extra:empty { display: none; }
.composer-chip { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-size: .8rem; color: var(--text); }
.composer-chip.is-danger { color: var(--danger); }
.composer-chip.is-warn { color: var(--warn); }
.composer-chip.is-accent, .composer-chip.is-tag, .composer-chip.is-when { color: var(--accent); }
.composer-bar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 8px; }
.composer-gap { flex: 1; }
.composer-add { min-width: 96px; }
.composer-dialog { width: min(640px, 100vw); }
.composer-dialog .composer { border: 0; padding: 0; }
.add-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
.add-row:hover { color: var(--text); }
.add-row .icon svg { width: 18px; height: 18px; }

/* «Сегодня»: шапка с настройкой блоков */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.page-head .page-date { margin: 0; }
.now-actions { display: grid; gap: 8px; }
.layout-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.layout-list li { display: flex; align-items: center; gap: 4px; }
.layout-list .check-field { flex: 1; min-width: 0; }

/* Календарь «Неделя» сеткой часов (ROADMAP 17) */
.wk { padding: 0; overflow: hidden; }
.wk-head, .wk-allday { display: grid; border-bottom: 1px solid var(--border); }
.wk-corner, .wk-label { font-size: var(--fs-2xs); color: var(--muted); padding: 6px 4px; text-align: right; }
.wk-day { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; }
.wk-dow { font-size: var(--fs-xs); color: var(--muted); }
.wk-num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 700; }
.wk-day.is-today .wk-num { background: var(--accent); color: var(--on-accent); }
.wk-allday-cell { display: grid; align-content: start; gap: 3px; padding: 4px 3px; min-height: 30px; border-left: 1px solid var(--border); }
.wk-chip { display: block; width: 100%; padding: 2px 6px; border: 0; border-radius: 4px; font: inherit; font-size: var(--fs-xs); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--text); background: var(--surface-2); }
.wk-scroll { max-height: calc(100dvh - 300px); min-height: 360px; overflow-y: auto; }
.wk-body { display: grid; position: relative; }
.wk-hours { position: relative; }
.wk-hour { position: absolute; right: 6px; transform: translateY(-50%); font-size: var(--fs-2xs); color: var(--muted); }
.wk-col { position: relative; border-left: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px 48px); cursor: copy; }
.wk-col.is-today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.wk-block { position: absolute; display: grid; align-content: start; gap: 1px; padding: 3px 6px; border: 0; border-radius: 6px; font: inherit; font-size: var(--fs-xs); text-align: left; overflow: hidden; cursor: pointer; color: #fff; background: var(--accent); }
.wk-block-title { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.25; }
.wk-block-time { opacity: .85; font-size: var(--fs-2xs); }
.wk-block.is-task, .wk-chip.is-task { background: color-mix(in srgb, var(--accent) 80%, #000); color: #fff; }
.wk-block.is-must, .wk-chip.is-must { background: #b3413b; color: #fff; }
.wk-block.is-habit, .wk-chip.is-habit { background: #a33a3a; color: #fff; }
.wk-block.is-meeting, .wk-chip.is-meeting { background: #2f6fb5; color: #fff; }
.wk-block.is-day, .wk-chip.is-day { background: #b7791f; color: #fff; }
.wk-block.is-busy, .wk-chip.is-busy { background: #8a8d91; color: #fff; cursor: default; }
.wk-block.is-done, .wk-chip.is-done { opacity: .45; text-decoration: line-through; }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.wk-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.wk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.wk-side { display: grid; gap: 12px; position: sticky; top: 72px; }
@media (min-width: 900px) { .shell[data-route="calendar"] .view { max-width: 1440px; } }
.checkin-prompt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.checkin-prompt-icon { font-size: 22px; }
.checkin-prompt-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.checkin-dialog { width: min(560px, 100vw); max-height: 92dvh; overflow-y: auto; }
.checkin-dialog .card { border: 0; padding: 0; background: none; }
.settings-toc { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.settings-toc .chip { flex: none; }
.shell[data-route="settings"] .view > .card { scroll-margin-top: 72px; }
.wk-block.is-note, .wk-chip.is-note { background: #7a4fbf; color: #fff; }

/* Канбан: колонки перетаскиваются за заголовок, двойной клик — переименовать (ROADMAP 19) */
.kanban-col-head { cursor: grab; touch-action: none; user-select: none; }
.kanban-col-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-col-input { height: 30px; padding: 2px 8px; font-weight: 600; }
.kanban-col.is-dragging { opacity: 0.4; }
.kanban-col.drop-before { box-shadow: inset 3px 0 0 var(--accent); }
.kanban-col.drop-after { box-shadow: inset -3px 0 0 var(--accent); }
.kanban-col-ghost { position: fixed; z-index: 1000; pointer-events: none; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); opacity: 0.95; cursor: grabbing; }

/* Неделя: перетаскивание блоков, растягивание, выделение промежутка (ROADMAP 19) */
.wk-block { -webkit-touch-callout: none; user-select: none; }
.wk-block.is-movable { cursor: grab; }
.wk-block.is-movable::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; }
.wk-block.is-dragging { opacity: 0.35; }
.wk-ghost { z-index: 5; box-shadow: var(--shadow); opacity: 0.95; pointer-events: none; cursor: grabbing; }
.wk-select { position: absolute; left: 2px; right: 2px; z-index: 4; border-radius: 6px; background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent); font-size: var(--fs-xs); padding: 2px 6px; pointer-events: none; }
.wk-col { touch-action: pan-y; }
.wk-body { user-select: none; -webkit-user-select: none; } /* протяжка мышью не выделяет подписи часов */
.notice-must { border-color: var(--danger); color: var(--danger); }

/* «Свой сервер» (ROADMAP 20) */
.cloud-code { max-width: 180px; font-size: 1.4rem; letter-spacing: 0.3em; text-align: center; }
.cloud-devices { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cloud-devices li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.cloud-devices li > span:first-child { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cloud-devices .btn { margin-left: auto; }

/* Экран входа (ROADMAP 20) */
.login-page { display: grid; justify-items: center; align-content: center; gap: 16px; min-height: 100dvh; padding: calc(var(--safe-top) + 24px) 16px calc(var(--safe-bottom) + 24px); }
.login-card { width: min(420px, 100%); padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: var(--fs-lg); }
.login-title { margin: 8px 0 0; font-size: var(--fs-2xl); }
.cloud-login .actions .btn-primary { min-width: 140px; }

/* «По времени» на узком экране (320 px, крупный шрифт): длинные названия переносятся, строка не шире экрана */
.schedule-row { min-width: 0; flex-wrap: wrap; row-gap: 4px; }
.schedule-row .schedule-time { flex: none; }
.schedule-row .schedule-main { flex: 1 1 140px; }
.schedule-row .task-title, .schedule-row .task-meta { overflow-wrap: anywhere; }
.schedule-row > .check, .schedule-row > .badge, .schedule-row > .soon { flex: none; }

/* Фраза ключей (ROADMAP 21) */
.phrase-words { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: word; }
.phrase-words li { counter-increment: word; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font: 600 var(--fs-base)/1.2 ui-monospace, Consolas, monospace; }
.phrase-words li::before { content: counter(word) '. '; color: var(--muted); font-weight: 400; }
.phrase-input { font-family: ui-monospace, Consolas, monospace; }
.keys-card[hidden] { display: none; }
@media (max-width: 360px) { .phrase-words { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Импорт (ROADMAP 21) */
.import-summary { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.import-summary li { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); overflow-wrap: anywhere; }
.import-kinds { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.import-target { border: 0; margin: 0; padding: 0; }
.import-target .check-field { flex-wrap: wrap; }
.input-inline { width: auto; min-width: 0; max-width: 100%; height: 36px; padding: 4px 10px; }

/* «Подключения»: группы с объяснением (ROADMAP 21) */
.connect-group { margin: 12px 4px 0; }
.connect-group-title { margin: 0 0 4px; font-size: var(--fs-lg); }
.connect-legacy > summary { cursor: pointer; }

/* «Где хранить» (ROADMAP 21): заготовки плашками */
.storage-presets { display: grid; gap: 8px; }
.storage-preset { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; }
.storage-preset.is-on { border-color: var(--accent); background: var(--accent-soft); }
.storage-preset input { margin-top: 3px; flex: none; }
.storage-preset > span { display: grid; gap: 2px; min-width: 0; }
.storage-preset strong { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.storage-groups { border: 0; margin: 0; padding: 0; }
