/* Platinum — стили. Mobile-first: базовые правила для телефона,
   @media (min-width: …) добавляют раскладку для широких экранов.

   Внешний вид — по образцу easyui.site: шрифт Geist, надписи капсом —
   JetBrains Mono, монохромная палитра zinc, кнопки-«таблетки», серые
   карточки с большим скруглением, плавающие панели «со стеклом». Цветом
   выделены только категории (и синим — «сейчас/сегодня»), всё остальное
   чёрно-белое: так цвет на экране всегда означает данные. */

/* --- Шрифты ------------------------------------------------------------------
   Файлы лежат у нас (без запросов к Google и CDN: быстрее и приватнее, и
   работает офлайн). Переменные шрифты: один файл на все начертания. Латиница
   и кириллица — разные файлы, браузер скачает только нужные (unicode-range).
   Лицензия SIL OFL 1.1 — static/fonts/*-OFL.txt. */
@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/geist-cyrillic.2a3115452ed6.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/geist-latin.a147f99cd533.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;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-cyrillic.615bf869ebeb.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.b058178d7f30.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;
}

/* --- Токены ------------------------------------------------------------------
   Тему выбирает js/theme.js: атрибут data-theme на <html> («как в системе»
   по умолчанию, можно закрепить светлую или тёмную в профиле). */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --sheet: #ffffff;            /* фон шторки */
  --well: #f1f1f2;             /* серые карточки */
  --well-line: #e4e4e7;        /* разделители внутри карточек */
  --surface: #ffffff;          /* поля ввода, кнопки, чипы */
  --raised: #ffffff;           /* активный сегмент переключателя */
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --text: #0a0a0a;
  --text-2: #52525b;
  --muted: #71717a;
  --subtle: #a1a1aa;
  --accent: #0a0a0a;
  --accent-fg: #ffffff;
  --blue: #3b82f6;             /* «сейчас» и «сегодня» */
  /* Квадранты матрицы Эйзенхауэра (приоритет заметок). */
  --q-do: #ef4444;
  --q-plan: #3b82f6;
  --q-delegate: #f59e0b;
  --q-later: #a1a1aa;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #10b981;
  --hover: rgb(10 10 10 / 5%);
  --track: rgb(10 10 10 / 7%); /* пустая часть полос */
  --ring: rgb(10 10 10 / 6%);
  --focus: rgb(10 10 10 / 45%);
  --glass: rgb(255 255 255 / 82%);
  --shadow-subtle: 0 1px 2px 0 rgb(15 15 20 / 6%), 0 0 0 1px rgb(15 15 20 / 4%);
  --shadow-elevated: 0 10px 25px -8px rgb(15 15 20 / 14%), 0 0 0 1px rgb(15 15 20 / 5%);
  --shadow-pill: 0 12px 28px -8px rgb(15 15 20 / 18%), 0 0 0 1px rgb(15 15 20 / 4%);
  --radius: 14px;
  --radius-card: 26px;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --sheet: #111113;
  --well: #18181b;
  --well-line: #27272a;
  --surface: #111113;
  --raised: #2a2a2e;
  --line: #29292c;
  --line-strong: #3a3a3f;
  --text: #f2f2f3;
  --text-2: #a1a1a6;
  --muted: #85858c;
  --subtle: #5c5c63;
  --accent: #f2f2f3;
  --accent-fg: #0a0a0a;
  --blue: #60a5fa;
  --q-do: #f87171;
  --q-plan: #60a5fa;
  --q-delegate: #fbbf24;
  --q-later: #71717a;
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #34d399;
  --hover: rgb(242 242 243 / 6%);
  --track: rgb(242 242 243 / 8%);
  --ring: rgb(242 242 243 / 8%);
  --focus: rgb(242 242 243 / 55%);
  --glass: rgb(17 17 19 / 82%);
  --shadow-subtle: 0 1px 2px 0 rgb(0 0 0 / 18%), 0 0 0 1px rgb(242 242 243 / 2%);
  --shadow-elevated: 0 10px 25px -8px rgb(0 0 0 / 40%), 0 0 0 1px rgb(242 242 243 / 4%);
  --shadow-pill: 0 12px 28px -8px rgb(0 0 0 / 55%), 0 0 0 1px rgb(242 242 243 / 4%);
}

/* --- Основа ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1 { margin: 0; font-size: 34px; font-weight: 600; line-height: 1.05; letter-spacing: -0.035em; }
h2 { margin: 0 0 10px; font-size: 18px; font-weight: 600; line-height: 1.4; letter-spacing: -0.02em; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0 0 10px; }
strong, b { font-weight: 600; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.muted { color: var(--muted); }
.center { text-align: center; }
.hint { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.error { display: block; margin-top: 4px; color: var(--danger); font-size: 12.5px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Иконки — линейные, 24×24, рисуются цветом текста (спрайт в _icons.html). */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* Надпись над заголовком: моноширинный шрифт капсом с широкой разрядкой. */
.eyebrow {
  margin: 0 0 14px;
  color: var(--muted);
  font: 500 11px/1.2 var(--font-mono);
  letter-spacing: .28em;
  text-transform: uppercase;
}
.lead { max-width: 34rem; margin: 14px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.65; }

/* «Хлебные крошки»: Шаблоны / Мой цикл */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); text-decoration: none; transition: color .15s; }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); }

/* --- Шапка и навигация ------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: calc(60px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0 20px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text); text-decoration: none;
  font: 500 15px/1 var(--font-mono); letter-spacing: -0.02em;
}
.brand-mark {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--text) 0 30%, var(--line-strong) 30% 100%);
  -webkit-mask: radial-gradient(circle, transparent 50%, #000 52%);
          mask: radial-gradient(circle, transparent 50%, #000 52%);
}
.brand-mark-lg { width: 26px; height: 26px; }
.topbar-tools { display: flex; align-items: center; gap: 2px; }

/* Переключатель темы показывает, куда переключит: луну в светлой, солнце в тёмной. */
.theme-toggle .i-sun, [data-theme="dark"] .theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }

/* На телефоне внизу «док»: плавающая панель разделов и кнопка таймера рядом
   (идущий таймер — отдельной панелью над ними). На компьютере разделы — в
   шапке, таймер — плашкой внизу по центру. */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.nav, .timer.is-running, .fab {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
          backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pill);
}
.nav { display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 999px; }
.nav a {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px;
  color: var(--muted); text-decoration: none;
  transition: color .15s, background-color .15s;
}
.nav a:hover { color: var(--text); }
.nav a.is-active { color: var(--text); background: var(--hover); }
.nav .ico { width: 20px; height: 20px; }
.nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --dock-h — измеренная высота нижней панели (app.js): она растёт, когда идёт
   таймер или играет музыка. Без JS — запасные значения. */
body:has(.dock) .main { padding-bottom: calc(var(--dock-h, calc(80px + env(safe-area-inset-bottom))) + 16px); }
body:has(.timer.is-running) .main { padding-bottom: calc(var(--dock-h, calc(144px + env(safe-area-inset-bottom))) + 16px); }

@media (min-width: 900px) {
  .topbar { min-height: 72px; padding: 0 28px 0 32px; }
  .dock { position: static; display: block; padding: 0; }
  /* Разделы — «таблетками» по центру шапки. Пока страница вверху, панель
     прозрачная, при прокрутке становится стеклянной (как в образце). */
  .nav {
    position: fixed; top: 12px; left: 50%; z-index: 30; transform: translateX(-50%);
    padding: 4px 6px;
    background: transparent; border-color: transparent; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    transition: background-color .2s, border-color .2s, box-shadow .2s;
  }
  .is-scrolled .nav {
    background: var(--glass); border-color: var(--line); box-shadow: var(--shadow-pill);
    -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
  }
  .nav a { width: auto; height: auto; padding: 6px 12px; color: var(--text-2); font-size: 13px; font-weight: 500; }
  .nav a.is-active { background: var(--hover); }
  .nav .ico { display: none; }
  .nav-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  body:has(.dock) .main, body:has(.timer.is-running) .main { padding-bottom: 104px; }
}

.main { flex: 1; min-height: 0; }
.page { max-width: 720px; margin: 0 auto; padding: 12px 16px 32px; }
.page-narrow { max-width: 560px; }
@media (min-width: 900px) { .page { padding-top: 48px; } }

/* Заголовок страницы: надпись капсом, крупный заголовок, действия справа. */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 12px 0 28px; }
.page-head > div { min-width: 0; }
@media (min-width: 900px) {
  h1 { font-size: 48px; }
  .page-head { margin-top: 0; margin-bottom: 36px; }
}

/* --- Карточки, кнопки, формы -------------------------------------------------- */
.card { margin-bottom: 12px; padding: 22px 20px; background: var(--well); border-radius: var(--radius-card); }
.card > h2 { margin-bottom: 8px; }
.muted-card { background: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, opacity .15s, transform .15s;
}
.btn:hover { border-color: var(--line-strong); background: color-mix(in srgb, var(--text) 4%, var(--surface)); }
.btn:active { transform: scale(.98); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { border-color: var(--accent); background: var(--accent); opacity: .86; }
.btn-danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-danger:hover { border-color: var(--danger); background: var(--danger); opacity: .88; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: transparent; background: var(--hover); }
.btn-danger-text { color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn .ico { width: 16px; height: 16px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-2);
  text-decoration: none; cursor: pointer; transition: color .15s, background-color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.is-active { background: var(--hover); color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field-label { color: var(--text); font-size: 13px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-width: 0; min-height: 42px; padding: 9px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  /* 16px — иначе iOS увеличивает страницу при фокусе на поле. */
  font-size: 16px; line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--subtle); box-shadow: 0 0 0 3px var(--ring); }
input:disabled { color: var(--muted); background: transparent; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 14px;
}
@media (min-width: 900px) and (pointer: fine) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea { font-size: 14px; }
}
input[type=color] {
  width: 42px; height: 42px; flex: none; padding: 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 999px; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 999px; }
input[type=checkbox] { accent-color: var(--accent); }
.has-error input, .has-error select { border-color: var(--danger); }

.alert { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 4px; font-size: 14px; }
.alert p { margin: 0; }
.alert-error { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.alert-warn { margin: 0; background: color-mix(in srgb, var(--warn) 13%, transparent); color: color-mix(in srgb, var(--warn) 62%, var(--text)); }
.badge {
  display: inline-block; vertical-align: middle; padding: 4px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 15%, transparent); color: color-mix(in srgb, var(--warn) 62%, var(--text));
  font: 500 10px/1.2 var(--font-mono); font-style: normal; letter-spacing: .06em; text-transform: uppercase;
}

/* Сегментированный переключатель (План/Факт, «Начал», тема). */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--hover); }
.seg label, .seg a, .seg button {
  position: relative; padding: 7px 14px; border: 0; border-radius: 999px; background: none;
  color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.3; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color .15s, background-color .15s, box-shadow .15s;
}
.seg label:hover, .seg a:hover, .seg button:hover { color: var(--text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg a.is-active, .seg button.is-active {
  background: var(--raised); color: var(--text); box-shadow: var(--shadow-subtle);
}
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg-kind { display: flex; }
.seg-kind label { flex: 1; text-align: center; }

/* Вкладки с подчёркиванием (Неделя / Месяц). */
.tabs { display: flex; gap: 28px; margin: 0 0 22px; }
.tabs a {
  position: relative; padding: 2px 0 10px;
  color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: color .15s;
}
.tabs a:hover, .tabs a.is-active { color: var(--text); }
.tabs a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; border-radius: 1px; background: var(--text);
}

/* --- Авторизация --- */
.auth { width: 100%; max-width: 420px; margin: 0 auto; padding: calc(48px + env(safe-area-inset-top)) 16px 40px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 32px; font: 500 17px/1 var(--font-mono); letter-spacing: -0.02em; }
.auth-card { padding: 26px 22px 22px; }
.auth-card h1 { margin-bottom: 22px; font-size: 30px; }
.auth-card .eyebrow { margin-bottom: 12px; }
.auth-card .form + p { margin: 18px 0 0; font-size: 14px; }
.auth > .center { margin-top: 18px; color: var(--text-2); font-size: 14px; }

/* --- Уведомления --- */
.toasts {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 50; display: grid; gap: 8px; width: min(92vw, 420px);
}
.toast {
  padding: 12px 16px; border-radius: 16px; background: var(--accent); color: var(--accent-fg);
  box-shadow: var(--shadow-elevated); font-size: 14px; font-weight: 500; cursor: pointer;
  animation: toast-in .25s ease-out, toast-out .3s ease 5s forwards;
}
.toast-error { background: var(--danger); color: #fff; }
.toast-warning { background: #f59e0b; color: #1a1205; animation-delay: 0s, 9s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }

/* --- День --- */
/* Отступ сверху даёт шапка (с ней и безопасная зона под вырезом экрана). */
.dayhead { padding: 12px 16px 0; }
.dayhead > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.dayhead .eyebrow { margin-bottom: 12px; }
.dayhead-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
@media (min-width: 900px) {
  .dayhead { padding-top: 48px; }
  .dayhead h1 { font-size: 48px; }
}

.week { display: grid; grid-template-columns: 30px repeat(7, 1fr) 30px; align-items: center; gap: 2px; margin-top: 22px; }
.week-arrow {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px;
  color: var(--muted); text-decoration: none; transition: color .15s, background-color .15s;
}
.week-arrow:hover { background: var(--hover); color: var(--text); }
.week-day {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 0 10px; border-radius: 16px;
  color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none;
  transition: background-color .15s;
}
.week-day:hover { background: var(--hover); }
.week-day strong { color: var(--text); font-size: 17px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
/* Сегодня — синим кольцом и синей датой: видно сразу, и когда выбран другой день. */
.week-day.is-today { box-shadow: inset 0 0 0 2px var(--blue); color: var(--blue); }
.week-day.is-today strong { color: var(--blue); }
.week-day.is-selected { background: var(--accent); color: color-mix(in srgb, var(--accent-fg) 62%, transparent); }
.week-day.is-selected strong { color: var(--accent-fg); }

.day-page { max-width: 640px; padding-top: 18px; padding-bottom: 96px; }

/* Итоги дня: план — полупрозрачно, факт — заливкой; шкала 00–24. */
/* Шкала суток: план и факт. Два вида на выбор (User.day_scale): линейка и
   циферблат; переключатель — в шапке карточки. */
.summary { margin-bottom: 12px; padding: 14px 20px 18px; background: var(--well); border-radius: var(--radius-card); }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.summary-title { margin: 0; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.scale-seg { margin: 0; }
.scale-seg button { display: grid; place-items: center; width: 34px; height: 26px; padding: 0; }
.scale-seg .ico { width: 15px; height: 15px; }

/* Линейка: полосы плана и факта во всю ширину, насечки и подписи каждые 3 часа. */
.ruler { display: grid; gap: 14px; }
.ruler-label { margin: 0 0 7px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.ruler-label b { margin-left: 7px; color: var(--text); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ruler-bar { position: relative; }
.ruler-bar .strip { height: 22px; border-radius: 8px; }
.ruler-bar::after {
  content: ""; position: absolute; inset: 0; border-radius: 8px; pointer-events: none;
  background: repeating-linear-gradient(to right, transparent 0 calc(12.5% - 1px), color-mix(in srgb, var(--well) 70%, transparent) calc(12.5% - 1px) 12.5%);
}
/* Подписи — ровно под насечками: каждая на своей восьмой части ширины. */
.ruler .ticks { position: relative; display: block; height: 11px; margin-top: -6px; font-size: 11px; }
.ruler .ticks span { position: absolute; top: 0; left: calc((var(--i) - 1) * 12.5%); transform: translateX(-50%); }
.ruler .ticks span:nth-child(1) { --i: 1; transform: none; }
.ruler .ticks span:nth-child(2) { --i: 2; }
.ruler .ticks span:nth-child(3) { --i: 3; }
.ruler .ticks span:nth-child(4) { --i: 4; }
.ruler .ticks span:nth-child(5) { --i: 5; }
.ruler .ticks span:nth-child(6) { --i: 6; }
.ruler .ticks span:nth-child(7) { --i: 7; }
.ruler .ticks span:nth-child(8) { --i: 8; }
.ruler .ticks span:nth-child(9) { --i: 9; transform: translateX(-100%); }
.ruler .strip-now { top: -4px; bottom: -4px; z-index: 1; margin-left: -1px; border-radius: 2px; }

/* Циферблат на 24 часа (разметка и геометрия — в tracker/_summary.html). */
.dial { position: relative; width: min(320px, 100%); margin: 0 auto; }
.dial svg { display: block; width: 100%; height: auto; overflow: visible; }
.dial circle { fill: none; }
.dial .dial-track { stroke: var(--track); stroke-width: 3; }
.dial .dial-plan { stroke-width: 3; opacity: .45; }
.dial .dial-inner .dial-track, .dial .dial-fact { stroke-width: 3.9; }
.dial-ticks line { stroke: var(--subtle); stroke-width: .22; opacity: .7; }
.dial-ticks line.is-major { stroke: var(--subtle); stroke-width: .34; }
.dial text { fill: var(--subtle); font: 400 1.9px/1 var(--font-mono); text-anchor: middle; dominant-baseline: central; }
.dial text.is-major { fill: var(--text-2); font-weight: 500; }
.dial-now line { stroke: var(--blue); stroke-width: .5; stroke-linecap: round; }
.dial .dial-now circle { fill: var(--blue); }
.dial-center { position: absolute; inset: 0; display: grid; place-content: center; gap: 7px; text-align: center; pointer-events: none; }
.dial-key { display: grid; color: var(--muted); font-size: 11.5px; line-height: 1.25; }
.dial-key b { color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dial-key.is-plan b { color: var(--text-2); font-size: 14px; font-weight: 500; }
.strip { position: relative; height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.strip i { position: absolute; top: 0; bottom: 0; }
.seg-plan { background: color-mix(in srgb, var(--c) 40%, transparent); }
.seg-fact { background: var(--c); }
.strip-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--blue); }
.ticks { display: flex; justify-content: space-between; color: var(--subtle); font: 400 10px/1 var(--font-mono); letter-spacing: 0; }

/* Порядок дня: по строке на дело, план и факт рядом. */
.agenda { list-style: none; margin: 0; padding: 4px 0; background: var(--well); border-radius: var(--radius-card); overflow: hidden; }
.agenda > li + li { border-top: 1px solid var(--well-line); }
.row { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; padding: 14px 18px; }
.row-time { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.row-time strong { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.row-time small { color: var(--muted); font-size: 11px; }
.row-main { position: relative; min-width: 0; padding-left: 13px; }
.row-main::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 3px; border-radius: 3px; background: var(--c); }
.row-title {
  display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  color: var(--text); font-weight: 500; letter-spacing: -0.015em; text-decoration: none;
}
.row-title span { color: var(--muted); font-weight: 400; }
.row-missed .row-title { color: var(--muted); }
.row-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; text-decoration: none;
  transition: border-color .15s, background-color .15s, color .15s;
}
.pill-plan {
  border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 8%, transparent); color: var(--text);
}
.pill-fact { background: var(--c); color: var(--fg); }
.pill-add { border: 1px dashed var(--line-strong); color: var(--muted); }
.pill-add:hover { border-color: var(--subtle); color: var(--text); }
/* Идущий таймер — факт «до сейчас» с мигающей точкой. */
.pill-running::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fg); animation: pulse 1.6s ease-in-out infinite; }
.pill-form { display: contents; }
.pill-start { border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.pill-start:hover { border-color: var(--line-strong); }
.pill-start .ico { width: 10px; height: 10px; color: var(--c); }
.row-note { color: var(--muted); font-size: 12px; }
.row-dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Свободное время — тихой строкой, по тапу можно заполнить. */
.gap a {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 18px; color: var(--muted); font-size: 13px; text-decoration: none;
  transition: color .15s, background-color .15s;
}
.gap a:hover { background: var(--hover); color: var(--text); }
.gap-plus { display: grid; place-items: center; width: 24px; height: 24px; border: 1px dashed var(--line-strong); border-radius: 50%; }
.gap-plus .ico { width: 12px; height: 12px; }
.gap-dur { font-variant-numeric: tabular-nums; }

/* Метка «сейчас» между делами. */
.agenda > li.now { position: relative; height: 0; border-top: 1.5px solid var(--blue); }
/* «Сейчас» после последнего дела: место под ярлык внутри карточки. */
.agenda > li.now:last-child { margin-bottom: 14px; }
.now span {
  position: absolute; left: 14px; top: -10px; padding: 0 8px; border-radius: 999px;
  background: var(--blue); color: #fff;
  font: 500 10px/19px var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
}
.empty { padding: 44px 20px; background: var(--well); border-radius: var(--radius-card); color: var(--text-2); text-align: center; }
.empty p { max-width: 30rem; margin-left: auto; margin-right: auto; }
.empty .btn { margin-top: 8px; }
.empty-more { margin-top: 16px; font-size: 14px; }

.fab {
  position: fixed; right: 16px; bottom: calc(var(--dock-h, calc(68px + env(safe-area-inset-bottom))) + 16px); z-index: 15;
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 999px;
  color: var(--text); text-decoration: none; transition: transform .15s;
}
.fab:active { transform: scale(.95); }
.fab .ico { width: 22px; height: 22px; stroke-width: 2; }
body:has(.timer.is-running) .fab { bottom: calc(var(--dock-h, calc(132px + env(safe-area-inset-bottom))) + 16px); }
@media (min-width: 900px) {
  .fab, body:has(.timer.is-running) .fab { right: 28px; bottom: 24px; }
}

/* --- Нижняя шторка (dialog) --- */
dialog.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; overflow: auto;
  background: var(--sheet); color: var(--text); box-shadow: var(--shadow-elevated);
}
dialog.sheet[open] { animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
/* «Ручка» сверху — привычный знак шторки на телефоне. */
dialog.sheet::before { content: ""; display: block; width: 36px; height: 4px; margin: 8px auto 0; border-radius: 999px; background: var(--line-strong); }
dialog.sheet::backdrop { background: rgb(0 0 0 / 40%); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(28px); } }
@media (min-width: 720px) {
  dialog.sheet { margin: auto; border-radius: var(--radius-card); }
  dialog.sheet::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { dialog.sheet[open], .toast { animation: none; } }
.sheet-form { display: grid; gap: 14px; padding: 14px 20px 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.025em; }
.sheet-head h2:focus { outline: none; }
.sheet-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: 13px;
}
/* Дата — отдельной строкой на узком экране, начало и конец — рядом. */
.grid-3 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 > :first-child { grid-column: 1 / -1; }
@media (min-width: 480px) {
  .grid-3 { grid-template-columns: 1.4fr 1fr 1fr; }
  .grid-3 > :first-child { grid-column: auto; }
}
.grid-3 .hint { display: none; }
.pick { display: grid; gap: 8px; padding-bottom: env(safe-area-inset-bottom); }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .15s;
}
.chip:hover { border-color: var(--line-strong); background: color-mix(in srgb, var(--text) 3%, var(--surface)); }
/* Предложенный вариант (например, категория из плана) — заливкой. */
.chip.is-suggested { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.chip-cat { font-weight: 600; }
.chip-cat::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip:active { transform: scale(.97); }

/* --- Категории --- */
.cat-row { display: flex; gap: 8px; align-items: center; }
.cat-row input[type=text] { flex: 1; min-width: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; align-items: center; }
.chip-static { min-height: 32px; margin: 0; padding: 0 3px 0 12px; font-size: 13px; cursor: default; }
.chip-static button {
  display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: none; color: var(--muted); font-size: 15px; cursor: pointer;
}
.chip-static button:hover { background: var(--hover); color: var(--text); }
.chip-static.is-archived span { color: var(--muted); text-decoration: line-through; }
.tag-add { display: flex; gap: 6px; }
.tag-add input { width: 150px; min-height: 32px; padding: 5px 14px; border-radius: 999px; font-size: 13px; }
.tag-add .btn { min-height: 32px; width: 32px; padding: 0; }
.cat-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--well-line); font-size: 13px;
}
.archived-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.archived-row span:nth-child(3) { flex: 1; }
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--c); }

/* --- Шаблоны цикла --- */
.back { display: inline-block; padding: 4px 0; color: var(--muted); font-size: 13px; text-decoration: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tpl-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 22px; color: var(--text); text-decoration: none; transition: background-color .2s;
}
.tpl-card:hover { background: color-mix(in srgb, var(--text) 4%, var(--well)); }
.tpl-card strong { display: block; margin-bottom: 2px; font-size: 18px; letter-spacing: -0.02em; }
.tpl-card .muted { font-size: 13px; }
.tpl-card-side { display: grid; gap: 4px; justify-items: end; text-align: right; font-size: 13px; }
.tpl-card-side .ico { color: var(--muted); }
.tpl-today { color: var(--text); font-weight: 500; }

/* Сводка цикла: полоса 00–24 на каждый день, часы по категориям, проверки. */
.cycle-summary { margin-top: 24px; padding: 24px 22px 20px; }
.cycle-summary .eyebrow { margin-bottom: 10px; }
.cycle-lead { margin: 0 0 20px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.cycle-strips { display: grid; gap: 12px; }
.cycle-row { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 12px; }
.cycle-label { display: grid; line-height: 1.25; }
.cycle-label b { font-size: 12.5px; font-weight: 600; }
.cycle-label small { color: var(--muted); font-size: 11px; }
.cycle-row .strip { height: 12px; }
.cycle-totals { width: 100%; margin: 22px 0 6px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.cycle-totals th, .cycle-totals td { padding: 9px 0; border-top: 1px solid var(--well-line); text-align: right; white-space: nowrap; }
.cycle-totals thead th { padding-top: 0; border-top: 0; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.cycle-totals tbody th { font-weight: 500; text-align: left; white-space: normal; }
/* Под названием — цель (норма) на категорию или «+ цель». План её не выполняет — красным. */
.cycle-goal { display: block; margin: 2px 0 0 20px; color: var(--muted); font-size: 11.5px; font-weight: 400; text-decoration: none; }
a.cycle-goal-add:hover { color: var(--text); }
.cycle-totals tr.is-missed td, .cycle-totals tr.is-missed .cycle-goal { color: var(--danger); }
.cycle-totals tbody th .dot { display: inline-block; margin-right: 10px; vertical-align: 0; }
.cycle-totals td { width: 30%; color: var(--text-2); }
.cycle-totals td:first-of-type { color: var(--text); font-weight: 600; }
.cycle-checks { margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--well-line); font-size: 13.5px; }
.cycle-checks h3 { margin: 0 0 10px; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.cycle-checks ul { display: grid; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.cycle-checks ul:last-child { margin-bottom: 0; }
.cycle-hint { margin: 0; color: var(--text-2); line-height: 1.5; }
.cycle-checks li { display: grid; grid-template-columns: 16px 1fr; align-items: start; gap: 10px; color: var(--text-2); line-height: 1.45; }
.cycle-checks .ico { width: 16px; height: 16px; margin-top: 1px; }
.cycle-checks .is-ok .ico { color: var(--ok); }
.cycle-checks .is-warn { color: var(--text); }
.cycle-checks .is-warn .ico { color: var(--danger); }

/* Состояние плана: когда применяли и не пора ли применить заново. */
.tpl-status {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 32px; padding: 14px 14px 14px 20px; background: var(--well); border-radius: 20px;
}
.tpl-status p { margin: 0; font-size: 14px; }
.tpl-status.is-warn { background: color-mix(in srgb, var(--warn) 11%, var(--well)); }

.cycle-day { margin-bottom: 26px; }
.cycle-day-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 0 4px 0 6px; }
.cycle-day-head h2 { margin: 0; font-size: 16px; }
.cycle-day-head .muted { font-size: 13px; }
.cycle-day.is-today .cycle-day-head .muted { color: var(--blue); font-weight: 500; }
.cycle-day-head .icon-btn { margin-left: auto; }
.cycle-day-empty {
  display: block; padding: 16px; border: 1px dashed var(--line-strong); border-radius: 20px;
  color: var(--muted); font-size: 14px; text-align: center; text-decoration: none; transition: color .15s, border-color .15s;
}
.cycle-day-empty:hover { border-color: var(--subtle); color: var(--text); }
.row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.tz {
  padding: 0 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font: 500 10.5px/18px var(--font-mono);
}

/* Применение шаблона: предпросмотр изменений. */
.preview { display: grid; gap: 6px; }
.preview .error { margin: 0; }
.preview-period { margin: 0; font-weight: 600; }
.preview-list { display: grid; margin: 0; }
.preview-list div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--well-line); }
.preview-list dt { font-size: 14px; }
.preview-list dt small { display: block; color: var(--muted); font-size: 12px; }
.preview-list dd { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rules { padding: 8px 4px 24px; color: var(--text-2); font-size: 14px; }
.rules h2 { color: var(--text); font-size: 15px; }
.rules ul { display: grid; gap: 6px; margin: 0; padding-left: 18px; }

/* --- Таймер --- */
/* Стоит: круглая кнопка «старт» рядом с панелью разделов. */
.timer form { margin: 0; }
.timer-idle {
  display: grid; place-items: center; padding: 0; border-radius: 999px;
  background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  color: var(--text); text-decoration: none;
}
.timer-play {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow-pill);
  transition: transform .15s;
}
.timer-idle:active .timer-play { transform: scale(.95); }
.timer-play .ico { width: 18px; height: 18px; margin-left: 2px; }
.timer-idle-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Идёт: отдельная панель на всю ширину над разделами. */
.timer.is-running {
  order: -1; flex: 1 1 100%; max-width: 480px;
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 5px 5px 5px 18px; border-radius: 999px;
}
.timer-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.timer-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text-2); font-size: 14px; }
.timer-label strong { color: var(--text); font-weight: 600; }
.timer-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); animation: pulse 1.6s ease-in-out infinite; }
.timer-clock { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.timer.is-long .timer-clock { color: color-mix(in srgb, var(--warn) 80%, var(--text)); }
.timer-stop {
  display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); cursor: pointer; transition: opacity .15s, transform .15s;
}
.timer-stop:hover { opacity: .86; }
.timer-stop:active { transform: scale(.95); }
.timer-stop .ico { width: 14px; height: 14px; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .timer-dot, .pill-running::before { animation: none; } }

@media (min-width: 900px) {
  .timer { position: fixed; left: 50%; bottom: 20px; z-index: 20; transform: translateX(-50%); }
  .timer.is-running { width: min(480px, calc(100% - 32px)); }
  /* Стоит: «таблетка» с кнопкой и подписью. */
  .timer-idle {
    display: flex; gap: 12px; padding: 5px 20px 5px 5px;
    background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow-pill);
    -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
    font-size: 14px; font-weight: 500;
  }
  .timer-play { width: 38px; height: 38px; box-shadow: none; }
  .timer-play .ico { width: 14px; height: 14px; }
  .timer-idle-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}

/* Шторка идущего таймера. */
.timer-now { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 20px; background: var(--well); }
.timer-now-text { flex: 1; min-width: 0; }
.timer-now-text small { display: block; }
.timer-now .timer-clock { font-size: 24px; letter-spacing: -0.03em; }
.sheet-section { padding: 4px 20px 16px; border-top: 1px solid var(--line); }
.sheet-section h3 { margin: 14px 0 2px; }
.sheet-section .hint { margin: 0 0 12px; }
.sheet-section > .sheet-form { padding: 0; }
details.sheet-section > summary { padding: 14px 0; font-weight: 600; cursor: pointer; }

/* --- Итоги --- */
.stats-page { padding-bottom: 32px; }
.stats-block { margin-bottom: 28px; }
.stats-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding: 0 4px; }
.stats-head h2 { margin: 0; }
.stats-head a { font-size: 13px; }
.stats-head .muted { font-size: 12.5px; }
.stats-block .summary { margin-bottom: 0; }
.panel { list-style: none; margin: 0; padding: 4px 0; background: var(--well); border-radius: var(--radius-card); }
.panel > li { padding: 16px 20px; }
.panel > li + li { border-top: 1px solid var(--well-line); }
.empty-panel { padding: 20px; color: var(--muted); font-size: 14px; }

.period-nav { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; margin: 0 0 26px; text-align: center; }
.period-nav .week-arrow { width: 36px; height: 36px; }
.period-nav div { display: grid; gap: 2px; }
.period-nav strong { font-size: 15px; letter-spacing: -0.015em; }
.period-nav div a { color: var(--muted); font-size: 12.5px; text-decoration: none; }
.period-nav div a:hover { color: var(--text); }

/* Цели: один период — полоса прогресса, несколько — точки по периодам. */
.goal-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; color: var(--text); text-decoration: none; }
.goal-title strong { font-size: 15px; }
.goal-title span { color: var(--muted); font-size: 13px; }
.goal-bar { height: 8px; margin: 12px 0 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.goal-bar i { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.goal-bar.goal-done i { background: var(--ok); }
.goal-bar.goal-missed i { background: var(--danger); }
.goal-meta { margin: 0; color: var(--muted); font-size: 13px; }
.goal-meta strong { color: var(--text); }
.goal-dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.goal-dots.with-labels { justify-content: space-between; }
.goal-dot { display: grid; justify-items: center; gap: 4px; }
.goal-dot i { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-radius: 50%; }
.goal-dots.with-labels .goal-dot i { width: 26px; height: 26px; }
.goal-dot small { color: var(--muted); font-size: 11px; }
.goal-dot.is-done i { border-color: var(--ok); background: var(--ok); }
.goal-dot.is-missed i {
  border-color: color-mix(in srgb, var(--danger) 60%, transparent);
  background: color-mix(in srgb, var(--danger) 18%, transparent);
}
.goal-dot.is-progress i { border-style: dashed; border-color: var(--c); }
.goal-dot.is-upcoming i, .goal-dot.is-partial i { opacity: .45; }

/* Плитка с крупным числом, как «$10,161» в образце. */
.tile { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 20px 22px; }
.tile .eyebrow { flex-basis: 100%; margin-bottom: 10px; }
.tile strong { font-size: 32px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .muted { font-size: 13px; }

.cat-line { display: flex; align-items: center; gap: 9px; }
.cat-line strong { font-weight: 500; }
.cat-fact { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.cat-bar { height: 6px; margin: 10px 0 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.cat-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12.5px; }
.pct { color: var(--text); }
.pct.is-good { color: var(--ok); }
.cat-tags { display: flex; flex-wrap: wrap; gap: 4px 10px; }

.goal-norm { display: grid; grid-template-columns: 96px 1fr; align-items: end; gap: 10px; }
/* Переключатель той же высоты, что поле «Часов», — подписи на одной линии. */
.goal-norm .seg { min-height: 42px; }
.goal-norm .seg label { display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.check input { width: 20px; height: 20px; }

/* --- Музыка для фокуса (js/focus.js) --- */
/* Всё управление — в шапке, «таблеткой» вместо кнопки наушников: обложка,
   название и автор трека, полоска прогресса (по ней перематывают), ⏮ ⏯ ⏭,
   громкость (ползунок — при наведении) и × — выключить. */
.focus-on .topbar [data-focus-videos] { display: none; }
.focus-pill {
  display: flex; align-items: center; gap: 2px; height: 46px; margin-right: 6px; padding: 4px 5px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--glass);
}
.focus-pill button {
  display: grid; place-items: center; flex: none; width: 28px; height: 34px; padding: 0;
  border: 0; border-radius: 999px; background: none; color: var(--text-2); cursor: pointer;
  transition: color .15s, background-color .15s, opacity .15s;
}
.focus-pill .ico { width: 16px; height: 16px; }
.focus-pill .focus-play { width: 34px; background: var(--accent); color: var(--accent-fg); }
/* Подсветка — только под мышью: на телефоне после касания она бы «залипала». */
@media (hover: hover) {
  .focus-pill button:hover { background: var(--hover); color: var(--text); }
  .focus-pill .focus-play:hover { background: var(--accent); color: var(--accent-fg); opacity: .82; }
}
.focus-pill .focus-close { color: var(--muted); }
/* Обложка трека (пока не загрузилась — наушники); играет — зелёная точка. */
.focus-cover {
  position: relative; display: grid; place-items: center; flex: none; width: 36px; height: 36px;
  border-radius: 50%; background: var(--hover); color: var(--text-2);
}
.focus-cover .ico { width: 17px; height: 17px; }
.focus-cover img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.focus-cover img[hidden] { display: none; }
.focus-pill[data-state="playing"] .focus-cover::after {
  content: ""; position: absolute; right: -1px; bottom: 0; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 2px var(--bg); animation: pulse 1.6s ease-in-out infinite;
}
.focus-pill-text { display: grid; gap: 1px; width: 150px; min-width: 0; padding: 0 8px 0 9px; }
/* Высота строк задана точно: название, автор и полоска должны уместиться в «таблетку». */
.focus-pill-text b { overflow: hidden; font-size: 13px; font-weight: 500; line-height: 15px; letter-spacing: -0.01em; white-space: nowrap; text-overflow: ellipsis; }
.focus-sub { display: flex; justify-content: space-between; gap: 8px; min-width: 0; color: var(--muted); }
.focus-sub small { font-size: 11px; line-height: 13px; white-space: nowrap; }
.focus-author { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Время трека — когда в шапке есть место; иначе — подсказкой у полоски. */
.focus-time { display: none; flex: none; font-variant-numeric: tabular-nums; }
@media (min-width: 1600px) {
  .focus-pill-text { width: 200px; }
  .focus-time:not(:empty) { display: inline; }
}
/* Полоска прогресса; поверх — прозрачный ползунок повыше, чтобы попадать мышью. */
.focus-line { position: relative; display: block; height: 2px; margin-top: 4px; border-radius: 2px; background: var(--track); transition: transform .15s; }
.focus-line:hover, .focus-line:focus-within { transform: scaleY(2); }
.focus-line i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--text); transition: width 1s linear; }
.focus-line:focus-within i { transition: none; }
.focus-seek { position: absolute; top: -6px; left: 0; width: 100%; height: 14px; margin: 0; opacity: 0; cursor: pointer; }
/* Ползунок громкости — при наведении на кнопку, под «таблеткой». */
.focus-volume { position: relative; display: flex; flex: none; }
.focus-volume-pop {
  position: absolute; top: 100%; left: 50%; z-index: 40; padding-top: 10px;
  opacity: 0; visibility: hidden; transform: translateX(-50%); transition: opacity .15s, visibility .15s;
}
.focus-volume:hover .focus-volume-pop, .focus-volume:focus-within .focus-volume-pop { opacity: 1; visibility: visible; }
.focus-volume-pop input {
  display: block; width: 112px; margin: 0; padding: 12px 14px; box-sizing: content-box;
  border: 1px solid var(--line); border-radius: 999px; background: var(--raised); box-shadow: var(--shadow-pill);
  accent-color: var(--accent); cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
  .focus-pill[data-state="playing"] .focus-cover::after { animation: none; }
}

/* Сам плеер YouTube на странице невидим: музыка играет, управление — в шапке.
   Размер — 356×200, меньше YouTube встраивать не разрешает. */
.focus-frame { position: fixed; z-index: -1; top: 0; left: 0; width: 356px; height: 200px; opacity: 0; pointer-events: none; }
.focus-frame iframe { width: 100%; height: 100%; border: 0; }

/* Шапка с «таблеткой» должна уместиться справа от меню разделов (оно по центру).
   Чем уже экран, тем меньше в ней: «Руководство» из меню переезжает книгой в
   шапку (вход в руководство остаётся всегда), прячется переключатель темы (он
   есть в профиле), потом название, ⏮ и громкость. */
@media (max-width: 1499px) {
  .focus-on .nav a.nav-wide { display: none; }
  .focus-on .topbar .guide-link { display: inline-grid; }
}
@media (max-width: 1439px) {
  .focus-on .theme-toggle { display: none; }
}
@media (max-width: 1365px) {
  .focus-pill-text { width: 100px; }
}
@media (min-width: 900px) and (max-width: 1279px) {
  .focus-pill-text { display: none; }
  .focus-cover { margin-right: 4px; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .focus-pill .focus-prev, .focus-volume { display: none; }
}
@media (min-width: 900px) and (max-width: 979px) {
  .focus-cover { display: none; }
}
/* Телефон: разделы внизу, в шапке — книга, название, ⏯ ⏭ и ×; громкость — кнопками телефона. */
@media (max-width: 899px) {
  .focus-on .brand-text { display: none; }
  .focus-pill { height: 42px; margin-right: 2px; padding-left: 5px; }
  .focus-line { margin-top: 3px; }
  .focus-pill-text { width: 104px; padding: 0 6px 0 4px; }
  .focus-cover, .focus-pill .focus-prev, .focus-volume { display: none; }
  .focus-pill button { height: 30px; width: 28px; }
  .focus-pill .focus-play { width: 30px; }
}

/* --- Профиль --- */
.theme-seg [data-theme-set] { flex: 1; }
.theme-seg { display: flex; }
[data-theme-choice="system"] [data-theme-set="system"],
[data-theme-choice="light"] [data-theme-set="light"],
[data-theme-choice="dark"] [data-theme-set="dark"] { background: var(--raised); color: var(--text); box-shadow: var(--shadow-subtle); }
.danger-zone h2 { color: var(--danger); }
.delete-list { margin: 0 0 12px; padding-left: 18px; color: var(--text-2); }

/* --- Заметки --- */
/* Поле «записать» — белое в серой карточке, растёт по тексту (field-sizing). */
.note-compose { margin-bottom: 22px; padding: 6px; background: var(--well); border-radius: 22px; }
.note-compose textarea {
  display: block; min-height: 96px; max-height: 50vh; resize: none; field-sizing: content;
  border-color: transparent; border-radius: 17px;
}
.note-compose .error { padding: 0 12px; }
.note-compose-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 6px 2px 0 12px; }
.note-compose-hint { margin-right: auto; color: var(--muted); font-size: 12px; }
@media (pointer: coarse) { .note-compose-hint { display: none; } }
textarea { resize: vertical; field-sizing: content; min-height: 96px; max-height: 60vh; }

.notes > li.note { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 12px; padding: 14px 20px 14px 16px; }
.note form { margin: 0; }
.note-check {
  display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px;
  border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--surface);
  color: transparent; cursor: pointer; transition: border-color .15s, background-color .15s, color .15s;
}
.note-check .ico { width: 13px; height: 13px; stroke-width: 2.5; }
.note-check:hover { border-color: var(--text); color: var(--muted); }
.note.is-done .note-check { border-color: var(--ok); background: var(--ok); color: #fff; }
.note-body { display: grid; gap: 4px; min-width: 0; color: var(--text); text-decoration: none; }
/* Переносы строк как написаны; длинная заметка — первые 6 строк, целиком — в шторке. */
.note-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden;
  white-space: pre-line; overflow-wrap: anywhere;
}
.note-meta { color: var(--muted); font-size: 12px; }
.note.is-done .note-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.notes-done { margin-top: 26px; }
/* Приоритет — квадрант матрицы Эйзенхауэра: у каждой заметки свой цвет. */
.prio-do { --prio: var(--q-do); }
.prio-plan { --prio: var(--q-plan); }
.prio-delegate { --prio: var(--q-delegate); }
.prio-later { --prio: var(--q-later); }
.prio-none { --prio: var(--line-strong); }

/* Выбор приоритета: 2×2, строки «важно / не важно», столбцы «срочно / не срочно». */
.prio-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.note-compose .prio-pick { margin-top: 6px; }
.prio-option {
  position: relative; display: grid; gap: 1px; padding: 8px 10px 8px 26px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.prio-option::before { content: ""; position: absolute; left: 11px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--prio); }
.prio-option input { position: absolute; opacity: 0; pointer-events: none; }
.prio-name { color: var(--text); font-size: 13px; font-weight: 500; }
.prio-option small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.prio-option:hover { border-color: var(--line-strong); }
.prio-option:has(input:checked) {
  border-color: var(--prio); background: color-mix(in srgb, var(--prio) 12%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--prio);
}
.prio-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Заметка в списке: цветная полоса слева, кружок и подпись квадранта. */
.notes > li.note { position: relative; }
.note:not(.prio-none)::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--prio);
}
.note.is-done::before { opacity: .35; }
.note:not(.prio-none) .note-check { border-color: color-mix(in srgb, var(--prio) 70%, var(--line-strong)); }
.prio-label {
  display: inline-flex; align-items: center; gap: 5px; margin-right: 8px;
  color: color-mix(in srgb, var(--prio) 70%, var(--text));
  font: 500 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
}
.prio-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--prio); }

/* Фильтр по приоритету: строка «таблеток», на телефоне листается вбок. */
.prio-filter {
  display: flex; gap: 6px; margin: 0 -16px 12px; padding: 2px 16px;
  overflow-x: auto; scrollbar-width: none;
}
.prio-filter::-webkit-scrollbar { display: none; }
.prio-filter a {
  display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: border-color .15s, color .15s, background-color .15s;
}
.prio-filter a:hover { border-color: var(--line-strong); color: var(--text); }
.prio-filter i { width: 7px; height: 7px; border-radius: 50%; background: var(--prio); }
.prio-filter span { color: var(--muted); font-variant-numeric: tabular-nums; }
.prio-filter a.is-active { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.prio-filter a.is-active span { color: color-mix(in srgb, var(--accent-fg) 60%, transparent); }

/* Шторка заметки: «Сохранить» на всю ширину, под ней две кнопки рядом. */
.note-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.note-actions .btn-primary { grid-column: 1 / -1; }
.notes-done > summary { display: flex; align-items: center; gap: 10px; padding: 6px 4px 10px; font-weight: 600; cursor: pointer; list-style: none; }
.notes-done > summary::-webkit-details-marker { display: none; }
.notes-done > summary::before {
  content: ""; width: 7px; height: 7px; margin: 0 2px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s;
}
.notes-done[open] > summary::before { transform: rotate(45deg); }

/* --- Руководство (по образцу easyui.site/docs) --- */
.guide { max-width: 1080px; margin: 0 auto; padding: 4px 16px 40px; }
.guide-side { display: none; }
.guide-main { min-width: 0; max-width: 720px; }
.guide-top { display: flex; align-items: center; gap: 14px; margin: 8px 0 34px; }
.guide-top .crumbs { margin: 0; }
@media (min-width: 900px) {
  .guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; padding-top: 40px; }
  .guide-side { display: block; position: sticky; top: 88px; align-self: start; max-height: calc(100dvh - 104px); overflow: auto; }
  .guide-menu { display: none; }
}
/* На телефоне меню — выпадающая панель по кнопке (details, без JS). */
.guide-menu { position: relative; flex: none; }
.guide-menu > summary { list-style: none; }
.guide-menu > summary::-webkit-details-marker { display: none; }
.guide-menu-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 30;
  width: min(300px, calc(100vw - 32px)); padding: 18px 12px 12px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--sheet); box-shadow: var(--shadow-elevated);
}
.guide-nav-title { margin: 0 0 18px 10px; font-size: 10.5px; }
.guide-nav-group { margin: 20px 0 8px 10px; font-size: 10.5px; }
.guide-nav-title + .guide-nav-group { margin-top: 0; }
.guide-nav { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.guide-nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px;
  color: var(--text-2); font-size: 14px; text-decoration: none; transition: color .15s, background-color .15s;
}
.guide-nav a:hover { background: var(--hover); color: var(--text); }
.guide-nav a.is-active { background: var(--hover); color: var(--text); font-weight: 500; }
.guide-nav .ico { width: 15px; height: 15px; color: var(--muted); }
.guide-main > .eyebrow { margin-bottom: 12px; }
.guide-main h1 { font-size: 30px; letter-spacing: -0.03em; line-height: 1.1; }
@media (min-width: 900px) { .guide-main h1 { font-size: 40px; } }
.guide-lead p { max-width: 42rem; margin: 16px 0 0; color: var(--text-2); font-size: 15px; line-height: 1.65; }
.guide-lead strong { color: var(--text); }
.guide-main hr { margin: 36px 0 0; border: 0; border-top: 1px solid var(--line); }

.doc-section { margin-top: 40px; }
.doc-section > .eyebrow { margin-bottom: 8px; }
.doc-section h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 16px; letter-spacing: -0.01em; }
.doc-section h2 .ico { width: 16px; height: 16px; }
.doc-section p, .doc-section li { color: var(--text-2); font-size: 14px; line-height: 1.65; }
.doc-section p { margin: 0 0 12px; }
.doc-section strong { color: var(--text); }
.doc-section ul { display: grid; gap: 8px; margin: 0 0 12px; padding-left: 18px; }
.doc-cards { display: grid; gap: 12px; margin-top: 18px; }
@media (min-width: 640px) { .doc-cards { grid-template-columns: 1fr 1fr; } }
.doc-card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.doc-card-ico {
  display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--well);
}
.doc-card-ico .ico { width: 15px; height: 15px; }
/* Карточка квадранта в руководстве: цветная точка вместо иконки. */
.doc-card-ico.prio-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--prio); }
.doc-card h3 { margin: 0 0 6px; font-size: 14px; }
.doc-card p { margin: 0; font-size: 13px; }
/* Шаги: номер в кружке и тонкая линия до следующего. */
.doc-steps { display: grid; margin: 18px 0 0; padding: 0; list-style: none; counter-reset: step; }
.doc-steps > li { position: relative; padding: 0 0 22px 44px; counter-increment: step; }
.doc-steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -3px;
  display: grid; place-items: center; width: 28px; height: 28px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--well);
  color: var(--text); font: 500 12px/1 var(--font-mono);
}
.doc-steps > li::after { content: ""; position: absolute; left: 14px; top: 30px; bottom: 2px; width: 1px; background: var(--line); }
.doc-steps > li:last-child { padding-bottom: 0; }
.doc-steps > li:last-child::after { display: none; }
.doc-steps h3 { margin: 0 0 4px; color: var(--text); font-size: 14px; }
.doc-steps p { margin: 0; }
.doc-callout {
  display: flex; align-items: flex-start; gap: 14px; margin-top: 36px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 18px; color: var(--text); text-decoration: none;
}
a.doc-callout { transition: border-color .15s, background-color .15s; }
a.doc-callout:hover { border-color: var(--line-strong); background: var(--hover); }
.doc-callout .ico { width: 16px; height: 16px; margin-top: 2px; }
.doc-callout strong { display: block; margin-bottom: 2px; color: var(--text); font-size: 14px; }
.doc-callout span { color: var(--muted); font-size: 13px; line-height: 1.55; }
kbd {
  padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--well);
  color: var(--text); font: 500 11.5px/1.6 var(--font-mono);
}
.guide-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 52px; padding-top: 24px; border-top: 1px solid var(--line); }
.guide-pager a { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; }
.guide-pager a:hover .ico { transform: translateX(var(--shift, 2px)); }
.guide-pager .ico { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.guide-pager small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.guide-prev { --shift: -2px; }
.guide-next { margin-left: auto; text-align: right; }

/* Вход в руководство: книга в шапке (на узких экранах), пункт меню — на широких. */
.nav a.nav-wide { display: none; }
@media (min-width: 1200px) {
  .nav a.nav-wide { display: grid; }
  .guide-link { display: none; }
}
