/* Батя — «тетрадь, которую проверяет Батя».
   Бумага в клетку, фиолетовые чернила — твоё, красная ручка — замечания Бати.
   Ночью — тёмно-синяя тетрадь. Шрифты: Golos Text (интерфейс), Caveat (почерк Бати). */
@import url("/static/fonts/fonts.css");

:root {
  --paper: #eef1f6; --sheet: #ffffff; --ink: #18203a; --muted: #5f6880; --line: #dbe1eb;
  --violet: #3f35b5; --violet-ink: #ffffff; --violet-soft: #e7e5fa;
  --red: #cf3428; --ok: #23824f; --warn: #a86b12; --chip: #e2e7f0;
  --cell: rgba(63, 53, 181, .085); --margin: rgba(207, 52, 40, .55);
  --me: #3f35b5; --me-ink: #ffffff; --bot: #ffffff;
  --tabbar: 64px;
  --hand: "Caveat", "Segoe Script", cursive;
  --ui: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10162a; --sheet: #182039; --ink: #e8ecf6; --muted: #929cb6; --line: #27314f;
    --violet: #a59dff; --violet-ink: #10162a; --violet-soft: #262a5a;
    --red: #ff7064; --ok: #62d394; --warn: #f0b555; --chip: #222b48;
    --cell: rgba(165, 157, 255, .075); --margin: rgba(255, 112, 100, .45);
    --me: #4d43c9; --me-ink: #ffffff; --bot: #182039;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink);
  font: 16px/1.45 var(--ui); -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; }
body { overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; line-height: 1.4; }

.btn { border-radius: 12px; padding: 11px 16px; font-weight: 600; background: var(--chip); transition: transform .08s; }
.btn:active, .tile:active, .scard:active, .chip:active, .kb button:active { transform: scale(.97); }
.btn.primary { background: var(--violet); color: var(--violet-ink); }
.btn.ghost { background: transparent; color: var(--violet); padding: 8px 2px; }
.btn.danger { color: var(--red); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; }

/* ---------- вход ---------- */
.login { height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background-image: linear-gradient(var(--cell) 1px, transparent 1px), linear-gradient(90deg, var(--cell) 1px, transparent 1px);
  background-size: 22px 22px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; text-align: center;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 20px; padding: 28px 20px 22px; }
.logo { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; background: var(--violet); color: var(--violet-ink);
  font: 700 54px/80px var(--hand); }
.login h1 { margin: 2px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.login input { font: 700 24px/1 var(--ui); font-variant-numeric: tabular-nums; text-align: center; letter-spacing: 8px; padding: 14px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.login input::placeholder { letter-spacing: 0; font: 400 17px/1 var(--ui); }

/* ---------- каркас ---------- */
.app { height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.bar { display: flex; align-items: center; gap: 8px; padding: 12px 18px 6px; min-height: 54px; }
.bar h1 { flex: 1; margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-btn { color: var(--violet); font-weight: 600; font-size: 16px; padding: 6px 2px; white-space: nowrap; }
.bar.sub h1 { font-size: 19px; letter-spacing: -.3px; text-align: center; }
.panes { flex: 1; min-height: 0; position: relative; }
.pane { position: absolute; inset: 0; display: none; }
.pane.on { display: flex; flex-direction: column; }
.pane.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(var(--tabbar) + 30px + env(safe-area-inset-bottom)); }
.pane.scroll.on { display: block; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: flex-end;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-top: 1px solid var(--line); z-index: 20; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--violet); }
.tabbar .center b { width: 50px; height: 50px; margin-top: -22px; border-radius: 50%; background: var(--violet); color: var(--violet-ink);
  font: 700 36px/54px var(--hand); box-shadow: 0 0 0 4px var(--paper); }
.tabbar .center.on b { box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--violet); }

/* ---------- главный экран: лист тетради ---------- */
.hero { position: relative; margin: 0 -16px 14px; padding: 14px 18px 18px 34px;
  background-image: linear-gradient(var(--cell) 1px, transparent 1px), linear-gradient(90deg, var(--cell) 1px, transparent 1px);
  background-size: 22px 22px; background-position: -1px -1px; }
.hero::before { content: ""; position: absolute; top: 0; bottom: 0; left: 22px; width: 1.5px; background: var(--margin); }
.hero .date { color: var(--muted); font-weight: 600; font-size: 14px; }
.hero h2 { margin: 2px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15; }
.hero .hand { margin: 14px 0 0; font: 600 31px/1.08 var(--hand); color: var(--violet); text-wrap: balance; }
.hero .sign { margin-top: 4px; font: 600 21px/1 var(--hand); color: var(--red); text-align: right; }
.hero .hand-k { margin-top: 16px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- блоки и списки ---------- */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 0 0 12px; }
.card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.card.accent { background: var(--violet-soft); border-color: transparent; }
.card.quiet { background: transparent; border: 0; border-left: 2px solid var(--violet); border-radius: 0; padding: 4px 0 4px 14px; }
.card.tap { cursor: pointer; }
.card .big { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.card p { margin: 0; }
.card p + p { margin-top: 4px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 8px; }
.sec h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.5px; }
.sec h2 .n { color: var(--muted); font-weight: 600; margin-left: 6px; }
.sec .btn.ghost { font-size: 15px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 14px 4px; text-align: center; font-size: 15px; }
.progress { height: 6px; background: color-mix(in srgb, var(--violet) 14%, transparent); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress > i { display: block; height: 100%; background: var(--violet); border-radius: 99px; }
ol.plan { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: p; }
ol.plan li { counter-increment: p; display: flex; gap: 10px; padding: 3px 0; }
ol.plan li::before { content: counter(p); font: 700 22px/1.05 var(--hand); color: var(--violet); width: 14px; flex: none; }

.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; margin: 0 0 14px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 22, 42, .12); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tiles.three { grid-template-columns: 1fr 1fr 1fr; }
.tile { background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-align: left; }
.tile .v { font-size: 23px; font-weight: 800; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 13px; color: var(--muted); line-height: 1.3; }

/* дела */
.list { background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 12px; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.check { width: 26px; height: 26px; flex: none; border-radius: 8px; border: 2px solid color-mix(in srgb, var(--violet) 55%, var(--muted)); position: relative; transition: background .15s; }
.check.done { background: var(--violet); border-color: var(--violet); }
.check.done::after { content: "✓"; position: absolute; inset: 0; color: var(--violet-ink); font: 700 24px/22px var(--hand); text-align: center; }
.task .t-title { font-weight: 600; word-wrap: break-word; }
.task .t-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }
.task .t-meta .late { color: var(--red); font-weight: 600; text-decoration: underline wavy color-mix(in srgb, var(--red) 60%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.task.big .t-title { font-size: 17px; }
.task.gone { opacity: .35; transition: opacity .3s; }
.task.gone .t-title { text-decoration: line-through; }
.task .grow { cursor: pointer; }
.list.ranked { counter-reset: r; }
.list.ranked .task { counter-increment: r; }
.list.ranked .task::before { content: counter(r); font: 700 30px/1 var(--hand); color: var(--violet); width: 16px; text-align: center; flex: none; margin-right: -2px; }
.list.done-list .t-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }

.chips-row { display: flex; gap: 6px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.chip { background: var(--chip); border-radius: 999px; padding: 7px 13px; font-size: 14px; white-space: nowrap; font-weight: 600; }
.chip.on { background: var(--violet); color: var(--violet-ink); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--chip); color: var(--muted); vertical-align: 1px; }
.badge.fact { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.guess { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

/* сферы */
.wheel { display: block; margin: 0 auto 2px; width: 100%; max-width: 300px; }
.wheel .grid { fill: none; stroke: var(--line); }
.wheel .shape { fill: color-mix(in srgb, var(--violet) 22%, transparent); stroke: var(--violet); stroke-width: 2; stroke-linejoin: round; }
.wheel .dot { fill: var(--violet); }
.wheel .dot.low { fill: var(--red); }
.wheel text { font-size: 15px; text-anchor: middle; dominant-baseline: middle; }
.sgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scard { position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 12px; min-height: 136px;
  display: flex; flex-direction: column; text-align: left; overflow: hidden; }
.scard .e { font-size: 24px; line-height: 1; }
.scard .sc { position: absolute; top: 9px; right: 12px; font-size: 26px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.scard .sc small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.scard .n { font-weight: 700; margin-top: 8px; line-height: 1.2; letter-spacing: -.2px; }
.scard .g { font-size: 13px; color: var(--muted); margin-top: 4px; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scard .s { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.scard .s .progress { flex: 1; margin: 0; height: 4px; }
.scard.red { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.scard.red::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red); }
.scard.red .sc { color: var(--red); }
.scard.red .progress > i { background: var(--red); }
.score-pick { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.score-pick button { aspect-ratio: 1; border-radius: 8px; background: var(--chip); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.score-pick button.on { background: var(--violet); color: var(--violet-ink); }
.hist { display: flex; align-items: flex-end; gap: 4px; height: 40px; margin-top: 12px; }
.hist i { flex: 1; background: var(--violet); border-radius: 3px 3px 0 0; opacity: .75; min-height: 3px; }
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.field .v { white-space: pre-wrap; word-wrap: break-word; margin-top: 1px; }
.field .v.none { color: var(--muted); font-style: italic; }
.edit-row { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.edit-row:last-child { border-bottom: 0; }
.edit-row .ic { font-size: 17px; padding: 6px 7px; color: var(--muted); border-radius: 8px; }
.edit-row .ic:disabled { opacity: .3; }
.edit-row.off .grow { opacity: .45; }
.mem { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mem:last-child { border-bottom: 0; }
.mem .src { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mem .acts { display: flex; gap: 18px; margin-top: 7px; font-size: 14px; font-weight: 600; }
.mem .acts button { color: var(--violet); }
.mem .acts .del { color: var(--red); }
.menu { padding: 0; }
.menu .item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); font-weight: 600; width: 100%; text-align: left; }
.menu .item:last-child { border-bottom: 0; }
.menu .item .ic { width: 32px; height: 32px; border-radius: 10px; background: var(--violet-soft); display: grid; place-items: center; font-size: 16px; flex: none; }
.menu .item .val { color: var(--muted); font-weight: 500; font-size: 15px; white-space: nowrap; }
.menu .item::after { content: "›"; color: var(--muted); font-size: 22px; margin-left: 4px; }
.menu .item.noarrow::after { content: none; }

/* библиотека */
.book { padding: 13px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.book:last-child { border-bottom: 0; }
.book .b-title { font-weight: 700; letter-spacing: -.2px; }
.book .b-title::after { content: "＋"; float: right; color: var(--violet); font-weight: 600; margin-left: 8px; }
.book.open .b-title::after { content: "−"; }
.book .b-gist { font-size: 14px; color: var(--muted); margin-top: 2px; }
.cat { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14.5px; line-height: 1.45; }
.cat:last-child { border-bottom: 0; }
.lib-text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; }
.book .b-body { margin-top: 10px; padding-left: 12px; border-left: 2px solid var(--violet); }
.book .b-body b { display: inline-block; margin-top: 6px; color: var(--violet); }

/* формы и шторка */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 30, .5); animation: fade .2s ease-out; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 90dvh; overflow-y: auto; background: var(--paper);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .24s cubic-bezier(.2, .8, .2, 1); }
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { margin: 4px 0 8px; font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
@keyframes up { from { transform: translateY(60px); opacity: .3; } }
@keyframes fade { from { opacity: 0; } }
.form label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin: 12px 2px 4px; }
.form input, .form textarea, .form select { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--sheet); font-size: 16px; }
.form input:focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 18%, transparent); }
.form textarea { min-height: 72px; resize: vertical; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form .actions { display: flex; gap: 8px; margin-top: 16px; }
.form .actions .btn { flex: 1; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.quick .btn { font-size: 14px; padding: 10px 6px; background: var(--sheet); border: 1px solid var(--line); }

.fab { position: fixed; right: 18px; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px;
  background: var(--violet); color: var(--violet-ink); font-size: 30px; line-height: 56px; text-align: center;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--violet) 35%, transparent); z-index: 15; }

/* ---------- чат ---------- */
.pane.chat { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
.banner { margin: 0 12px 4px; padding: 9px 12px; border-radius: 12px; background: var(--violet-soft); font-size: 14px; display: flex; gap: 8px; align-items: center; }
.banner .grow { font-weight: 600; }
.banner button { color: var(--violet); font-weight: 700; }
.feed { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.42; }
.msg.bot { align-self: flex-start; background: var(--bot); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.user { align-self: flex-end; background: var(--me); color: var(--me-ink); border-bottom-right-radius: 6px; }
.msg .time { display: block; font-size: 11px; opacity: .6; margin-top: 4px; text-align: right; font-variant-numeric: tabular-nums; }
.msg .ch { font-size: 11px; opacity: .7; margin-right: 6px; }
.msg a { color: inherit; text-decoration: underline; word-break: break-all; }
.msg .open { display: block; margin-top: 8px; color: var(--violet); font-weight: 700; }
.day { align-self: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 3px 10px; margin: 4px 0; border-radius: 99px; background: var(--chip); }
.kb { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.kb button { background: var(--chip); border-radius: 10px; padding: 9px 6px; font-size: 14px; font-weight: 600; }
.kb .wide { grid-column: span 2; }
.status { margin-top: 8px; font-size: 14px; color: var(--ok); }
.typing { align-self: flex-start; color: var(--violet); font: 600 20px/1 var(--hand); padding: 6px 8px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 6px 12px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { background: var(--sheet); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; }
.composer textarea { flex: 1; resize: none; max-height: 140px; min-height: 44px; padding: 11px 14px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--sheet); }
.composer textarea:focus { outline: none; border-color: var(--violet); }
.round { width: 44px; height: 44px; border-radius: 50%; flex: none; font-size: 20px; background: var(--chip); }
.round.primary { background: var(--violet); color: var(--violet-ink); font-weight: 700; }
.composer .round#attach { font-size: 18px; background: transparent; width: 36px; }
#mic { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.recbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.recbar #recTime { flex: 1; font: 700 19px/1 var(--ui); font-variant-numeric: tabular-nums; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
.rec-cancel { padding: 12px 10px; color: var(--muted); font-weight: 600; }
@keyframes pulse { 50% { opacity: .45; } }
.msg .pic { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; margin-bottom: 4px; background: var(--chip); min-width: 120px; min-height: 80px; object-fit: cover; }
.msg .pic.big { max-height: none; object-fit: contain; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 15px; border-radius: 12px; font-size: 14px; font-weight: 500; max-width: 90%; z-index: 60;
  animation: fade .2s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- ремонт: маршрут этапов, бюджет, фото ---------- */
.late { color: var(--red); }
.link { color: var(--violet); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.reno-hero .hand.red-pen { color: var(--red); font-size: 25px; margin-top: 8px; }
.money-line { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; font-size: 15px; }
.money-line b { font-size: 20px; font-weight: 800; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.bbar { position: relative; display: flex; height: 10px; border-radius: 99px; margin: 6px 0 6px;
  background: color-mix(in srgb, var(--violet) 12%, transparent); }
.bbar i { display: block; height: 100%; background: var(--violet); border-radius: 99px 0 0 99px; }
.bbar s { display: block; height: 100%;
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--violet) 45%, transparent) 0 4px, transparent 4px 8px); }
.bbar b { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--red); border-radius: 2px; }
#renoSeg { overflow-x: auto; }
#renoSeg button { min-width: 64px; font-size: 13.5px; }

/* этапы — маршрут на полях тетради: готово закрашено, «сейчас» обведено красной ручкой */
ol.route { list-style: none; margin: 0 0 12px; padding: 4px 0; background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; }
ol.route li { position: relative; display: flex; align-items: center; gap: 14px; padding: 11px 14px 11px 46px; cursor: pointer; }
ol.route li::before { content: ""; position: absolute; left: 25px; top: 0; bottom: 0; width: 2px; background: var(--line); }
ol.route li:first-child::before { top: 50%; }
ol.route li:last-child::before { bottom: 50%; }
ol.route li.st-done::before { background: var(--violet); }
ol.route .node { position: absolute; left: 18px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--violet) 55%, var(--muted)); background: var(--sheet); }
ol.route li.st-done .node { background: var(--violet); border-color: var(--violet); }
ol.route li.st-done .node::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--violet-ink); }
ol.route li.st-work .node { border-color: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 18%, transparent); }
ol.route li.st-work .t-title { font-weight: 800; }
ol.route li.st-done .t-title { color: var(--muted); }
ol.route li.late .t-meta { color: var(--red); }

.actions-row { display: flex; gap: 8px; margin-top: 12px; }
.actions-row .btn { flex: 1; font-size: 15px; padding: 10px 8px; }
.card.crew.off { opacity: .55; }
.item-bought .t-title { text-decoration: line-through; color: var(--muted); }
.wide-card { display: block; width: 100%; text-align: left; }

.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pgrid figure { margin: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; }
.pgrid img, .pgrid .ph { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--chip); max-width: none; border-radius: 0; margin: 0; }
.pgrid figcaption { padding: 7px 9px; font-size: 12.5px; line-height: 1.3; }
.pgrid figcaption b { color: var(--red); font-weight: 700; }
.pic.full { display: block; width: 100%; max-width: none; height: auto; border-radius: 12px; }
ol.route .t-title { font-weight: 600; line-height: 1.3; }
ol.route .t-meta { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.reno-hero h2 { font-size: 22px; line-height: 1.2; text-wrap: balance; }
.form select { -webkit-appearance: none; appearance: none; padding-right: 34px; background-color: var(--sheet);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }

/* ---------- цели: главная цифра почерком Бати, 12 клеток цикла, тактики-точки ---------- */
.goal-hero .ns-num { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.goal-hero .ns-num .hand { font: 700 44px/1 var(--hand); color: var(--violet); }
.spark { width: 120px; height: 32px; flex: none; }
.spark polyline { fill: none; stroke: var(--violet); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.weeks { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; margin: 8px 0 6px; max-width: 260px; }
.weeks i { aspect-ratio: 1; border: 1.5px solid color-mix(in srgb, var(--violet) 45%, var(--line)); border-radius: 3px; }
.weeks i.past { background: color-mix(in srgb, var(--violet) 55%, transparent); border-color: transparent; }
.weeks i.now { border-color: var(--red); box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 22%, transparent); }
.exec { display: flex; flex-direction: column; align-items: center; text-align: center; flex: none; min-width: 74px; }
.exec b { font: 700 34px/1 var(--hand); color: var(--violet); }
.exec span { font-size: 11.5px; color: var(--muted); line-height: 1.2; margin-top: 2px; }
.exec.low b { color: var(--red); }
.exec.ok b { color: var(--ok); }
.card.goal .big { font-size: 16.5px; }
.card.goal.won { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.tactics { margin-top: 6px; border-top: 1px solid var(--line); }
.tac { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.tac .dots { display: flex; gap: 3px; flex: none; }
.tac .dots i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--violet) 55%, var(--muted)); }
.tac .dots i.on { background: var(--violet); border-color: var(--violet); }
.tac.full .grow { color: var(--muted); text-decoration: line-through; }
ol.ladder .here { color: var(--red); font: 600 18px/1 var(--hand); }

/* ---------- привычки: кружок-галочка, 14 дней клетками ---------- */
.habs { display: grid; gap: 8px; margin-bottom: 12px; }
.hab { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; }
.hab .hc { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--violet) 55%, var(--muted)); display: grid; place-items: center; color: var(--violet-ink); font-weight: 800; transition: background .15s; }
.hab.done .hc { background: var(--violet); border-color: var(--violet); }
.hab.done .ht { color: var(--muted); }
.hab.warn .hc { border-color: var(--red); }
.hab .ht { display: block; font-weight: 600; }
.hab .hm { display: block; font-size: 13px; color: var(--muted); }
.hab.warn .hm { color: var(--red); }
.hab-card { background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; padding: 4px 4px 10px; }
.hab-card .hab { border: 0; }
.hab-card .muted.small { padding: 0 14px; }
.last14 { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; padding: 0 14px 6px; }
.last14 i { aspect-ratio: 1; border-radius: 3px; background: var(--chip); }
.last14 i.on { background: var(--violet); }
.progress.thin { height: 4px; margin: 6px 0 0; }
.progress.red > i { background: var(--red); }
/* воронка */
.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fstep { background: var(--violet-soft); border-radius: 12px; padding: 10px 4px; text-align: center; }
.fstep b { display: block; font: 700 30px/1 var(--hand); color: var(--violet); }
.fstep span { font-size: 12px; color: var(--muted); }
.fbar { display: grid; grid-template-columns: 96px 1fr 36px; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0; }
.fbar i { display: block; height: 10px; border-radius: 99px; background: var(--violet); min-width: 2px; }
.fbar b { text-align: right; font-variant-numeric: tabular-nums; }
.fconv { font-size: 12px; color: var(--muted); padding-left: 104px; }
.tile.metric { position: relative; }
.tile.metric .v small { font-size: 13px; font-weight: 600; color: var(--muted); }
.tile.metric .spark { width: 100%; height: 26px; margin-top: 4px; }

/* фокус, карточки, графики недели */
.inp { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); margin-top: 4px; }
.focus-clock { font: 600 56px/1.1 var(--ui); font-variant-numeric: tabular-nums; letter-spacing: -1px; margin: 8px 0 10px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 120px; background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px 8px; }
.dbar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.dbar i { display: block; width: 100%; max-width: 26px; min-height: 2px; background: var(--violet); border-radius: 6px 6px 2px 2px; }
.dbar span { font-size: 11px; color: var(--muted); margin-top: 4px; }
.dbar b { position: absolute; top: -2px; font-size: 10px; font-weight: 500; color: var(--muted); }
.flash-front { font-size: 22px; line-height: 1.3; margin: 10px 0 12px; }
ol.steps { padding-left: 20px; margin: 6px 0 10px; } ol.steps li { margin: 0 0 8px; font-size: 14px; }
ul.plain { margin: 0; padding-left: 18px; } ul.plain li { margin: 4px 0; }
code { font-size: 13px; background: var(--chip); padding: 1px 5px; border-radius: 5px; }

/* позиции сайтов */
.seo-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.seo-nums b { font-size: 30px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; margin-right: 5px; }
.seo-nums span:last-child { display: block; color: var(--muted); font-size: 13px; }
.seo-chart { width: 100%; height: auto; display: block; }
.seo-chart text { fill: var(--muted); font-size: 10px; font-family: var(--ui); }
.seo-legend { display: flex; gap: 14px; color: var(--muted); margin-top: 4px; }
.seo-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.seo-up { color: var(--ok); font-weight: 700; font-size: 13px; }
.seo-dn { color: var(--red); font-weight: 700; font-size: 13px; }
.seo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.seo-row:last-child { border-bottom: 0; }
.seo-row .grow { flex: 1; min-width: 0; }
.seo-q { font-weight: 600; font-size: 15px; }
.seo-spark { width: 64px; height: 22px; flex: none; }
.seo-pos { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 56px; font-variant-numeric: tabular-nums; }
.seo-b { display: inline-block; min-width: 34px; text-align: center; border-radius: 7px; padding: 2px 6px; font-weight: 800; font-size: 14px; }
.seo-b.t10 { background: var(--ok); color: var(--sheet); }
.seo-b.t50 { background: var(--warn); color: var(--sheet); }
.seo-b.t100 { background: var(--chip); color: var(--ink); }
.seo-b.out, .seo-b.na { color: var(--muted); font-weight: 600; font-size: 12px; }
.seo-hist { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); }
.seo-hist b { color: var(--ink); }
.seo-geo { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); }
.seo-geo .grow { flex: 1; min-width: 0; font-weight: 600; }
.seo-geo .small { color: var(--muted); font-variant-numeric: tabular-nums; }
.seo-geo b { color: var(--ink); }
