:root {
  --bg: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --sub: var(--tg-theme-subtitle-text-color, var(--tg-theme-hint-color, #8e8e93));
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, var(--tg-theme-button-color, #2481cc));
  --head: var(--tg-theme-section-header-text-color, var(--tg-theme-hint-color, #6d6d72));
  --danger: var(--tg-theme-destructive-text-color, #ff3b30);
  --sep: var(--tg-theme-section-separator-color, rgba(128,128,128,.18));
  --fill: color-mix(in srgb, var(--hint) 14%, transparent);
  --fill-strong: color-mix(in srgb, var(--hint) 22%, transparent);
  --green: #34c759; --orange: #ff9500; --purple: #af52de; --yellow: #ffb800; --red: #ff3b30; --teal: #30b0c7;
  --radius: 20px;
  --safe-b: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --tabs-h: 64px;
  color-scheme: light dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
a { color: var(--link); text-decoration: none; }
svg { display: block; }

.page { padding: 12px 16px calc(var(--tabs-h) + var(--safe-b) + 24px); max-width: 640px; margin: 0 auto; }
.page.sub { padding-top: 8px; }
.splash { min-height: 80vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--hint); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--fill-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Заголовки */
.top { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.top .titles { flex: 1; min-width: 0; }
.hello { color: var(--hint); font-size: 14px; }
.h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 26px 4px 10px; display: flex; align-items: baseline; gap: 8px; }
.h2 .more { margin-left: auto; font-size: 15px; font-weight: 500; color: var(--link); }
.h2 .count { color: var(--hint); font-weight: 600; font-size: 17px; }
.caption { color: var(--hint); font-size: 13px; margin: 8px 4px 0; }

/* Аватар */
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 17px; color: #fff; background: var(--accent); overflow: hidden; position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 32px; }
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.avatar .dot { position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--card); }

/* Карточки */
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.card + .card { margin-top: 12px; }
.pad { padding: 16px; }
.hero { padding: 18px 18px 16px; }
.hero .label { color: var(--hint); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.hero .big { font-size: 34px; font-weight: 700; letter-spacing: -.03em; margin: 2px 0 2px; font-variant-numeric: tabular-nums; }
.hero .meta { color: var(--hint); font-size: 14px; }
.hero .meta b { color: var(--text); font-weight: 600; }
.hero-row { display: flex; gap: 10px; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--fill); font-size: 14px; font-weight: 500; white-space: nowrap; }
.pill.accent { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.pill.warn { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }

/* Быстрые действия */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 4px; }
.quick button { display: grid; justify-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--text); position: relative; }
.quick .ico { width: 56px; height: 56px; border-radius: 18px; background: var(--card); display: grid; place-items: center; color: var(--accent); }
.quick .badge { position: absolute; top: -4px; right: calc(50% - 34px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }

/* Плитки */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border-radius: 18px; padding: 14px; min-width: 0; }
.tile .k { color: var(--hint); font-size: 13px; }
.tile .v { font-size: 20px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .s { color: var(--hint); font-size: 12px; margin-top: 2px; }

/* Списки */
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; width: 100%; text-align: left; position: relative; min-height: 60px; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 68px; border-top: .5px solid var(--sep); }
.row.plain + .row.plain::before { left: 16px; }
button.row:active, .row.tap:active { background: var(--fill); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .subtitle { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row .side { text-align: right; flex: none; max-width: 45%; }
.row .side .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .side .s { color: var(--hint); font-size: 12px; margin-top: 2px; white-space: nowrap; }
.row .chev { color: var(--hint); opacity: .6; flex: none; }
.icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; }
.icon.round { border-radius: 50%; }
.st-voting { --c: var(--purple); } .st-assign { --c: var(--yellow); } .st-work { --c: var(--accent); }
.st-revision { --c: var(--orange); } .st-ready { --c: var(--green); } .st-closed { --c: var(--hint); }
.st-cancelled { --c: var(--red); } .st-active { --c: var(--accent); } .st-done { --c: var(--green); }
.st-stage { --c: #30b0c7; } .st-stage_done { --c: var(--green); }
/* Этапы заказа */
.ring-box { position: relative; width: 56px; height: 56px; flex: none; display: grid; place-items: center; }
.ring-box svg { position: absolute; inset: 0; }
.ring-box b { font-size: 13px; font-variant-numeric: tabular-nums; }
.ring-bg { fill: none; stroke: var(--fill-strong); stroke-width: 6; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dasharray .5s cubic-bezier(.2,.8,.2,1); }
.ring-box.full .ring-fg { stroke: var(--green); }
.stages-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px 10px; }
.stages-head .title { font-weight: 600; }
.stages-head .subtitle { color: var(--hint); font-size: 14px; margin-top: 2px; }
.stage-list { background: none; box-shadow: none; margin: 0; border-radius: 0; }
.row.stage { cursor: pointer; }
.row.stage.done .title { color: var(--hint); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--hint) 60%, transparent); }
.row.stage.late .subtitle { color: var(--red); }
.stage-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--fill-strong); flex: none; display: grid; place-items: center;
  color: #fff; background: none; transition: background .15s, border-color .15s; }
.stage-check.on { background: var(--green); border-color: var(--green); }
.stage-check:not([disabled]):active { transform: scale(.9); }
.row.preset { gap: 10px; }
.inline-in { width: 100%; background: var(--fill); border: 0; border-radius: 10px; padding: 8px 10px; color: var(--text); font: inherit; }
.inline-in.w { width: 64px; text-align: center; }
.w-box { display: grid; justify-items: center; gap: 2px; flex: none; }
.w-box small { color: var(--hint); font-size: 11px; }
.row.preset .x { width: 28px; height: 28px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--hint); flex: none; }
.pbar { height: 4px; border-radius: 2px; background: var(--fill-strong); margin-top: 6px; overflow: hidden; max-width: 220px; }
.pbar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.pbar.full i { background: var(--green); }
.icon[class*="st-"] { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--c, var(--hint)) 15%, transparent); color: var(--c, var(--hint)); white-space: nowrap; }
.due-late { color: var(--red) !important; }
.due-soon { color: var(--orange) !important; }
.empty { padding: 28px 16px; text-align: center; color: var(--hint); }
.empty .e { font-size: 34px; margin-bottom: 6px; }

/* Голосование на главной */
.poll { padding: 14px 16px; }
.poll + .poll { border-top: .5px solid var(--sep); }
.poll .q { font-weight: 600; }
.poll .m { color: var(--hint); font-size: 13px; margin: 2px 0 10px; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { flex: 1 1 0; min-width: 84px; padding: 10px 8px; border-radius: 12px; background: var(--fill); font-weight: 600; font-size: 14px; text-align: center; }
.choice.on { background: var(--accent); color: var(--accent-text); }
.choice small { display: block; font-weight: 500; font-size: 12px; opacity: .75; margin-top: 2px; }

/* Сегменты и поиск */
.seg { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--hint); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.search { display: flex; align-items: center; gap: 8px; background: var(--fill); border-radius: 12px; padding: 0 12px; margin-bottom: 12px; color: var(--hint); }
.search input { flex: 1; border: 0; background: none; outline: none; padding: 10px 0; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { padding: 7px 13px; border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 500; white-space: nowrap; }
.chips button.on { background: var(--text); color: var(--bg); }
.group-label { color: var(--head); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; margin: 18px 16px 6px; }
.group-label.row-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.group-label.row-label .more { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--link); }

/* Календарь */
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.cal-head .m { font-size: 18px; font-weight: 700; }
.cal-nav { display: flex; gap: 6px; }
.round-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--accent); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); padding: 4px 8px 12px; gap: 2px; }
.cal .wd { text-align: center; color: var(--hint); font-size: 12px; font-weight: 600; padding: 6px 0; }
.cal .d { aspect-ratio: 1/1; border-radius: 50%; display: grid; place-items: center; position: relative; font-weight: 500; font-variant-numeric: tabular-nums; max-height: 46px; margin: 0 auto; width: 100%; max-width: 46px; }
.cal .d.out { color: var(--hint); opacity: .45; }
.cal .d.today { color: var(--accent); font-weight: 700; }
.cal .d.sel { background: var(--accent); color: var(--accent-text); }
.cal .dots { position: absolute; bottom: 4px; left: 0; right: 0; display: flex; justify-content: center; gap: 2px; }
.cal .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--c); }
.cal .d.sel .dots i { background: var(--accent-text); }

/* Графики */
.chart { padding: 6px 12px 12px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--hint); font-size: 11px; }
.legend { display: flex; gap: 14px; padding: 0 16px 14px; color: var(--hint); font-size: 13px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--c); }

/* Нижнее меню */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.tabs button { flex: 1; display: grid; justify-items: center; gap: 3px; padding: 4px 0; font-size: 11px; font-weight: 500; color: var(--hint); position: relative; }
.tabs button.on { color: var(--accent); }
.tabs .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

/* Шторка */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; opacity: 0; transition: opacity .25s; }
.scrim.on { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 92vh; background: var(--bg); border-radius: 24px 24px 0 0;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.sheet.on { transform: none; }
.sheet.dragging { transition: none; user-select: none; -webkit-user-select: none; cursor: grabbing; }
.sheet-handle, .sheet-top { cursor: grab; }
.sheet-handle { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: 8px auto 0; flex: none; }
.sheet-body { overflow-y: auto; padding: 8px 16px calc(20px + var(--safe-b)); overscroll-behavior: contain; }
.sheet .h1 { font-size: 24px; margin: 8px 0 4px; }
.sheet-top { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--hint); font-size: 14px; }
.sheet-top .x { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--hint); }

/* Кнопки */
.btn { width: 100%; padding: 14px 16px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.secondary { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
.btn.ghost { background: var(--card); color: var(--accent); }
.btn.danger { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }
.btn:disabled { opacity: .5; }
.btn + .btn { margin-top: 8px; }
.actions { margin-top: 16px; }
.stars { display: flex; gap: 6px; }
.stars button { flex: 1; padding: 10px 0; border-radius: 12px; background: var(--fill); font-size: 20px; color: var(--hint); }
.stars button.on { background: color-mix(in srgb, var(--yellow) 22%, transparent); color: var(--yellow); }
.field { display: flex; gap: 8px; }
.field input { flex: 1; min-width: 0; border: 0; border-radius: 12px; background: var(--fill); padding: 12px; outline: none; }

/* Таймлайн */
.timeline { padding: 6px 16px 10px; }
.tl { display: flex; gap: 12px; position: relative; padding: 8px 0; }
.tl::before { content: ""; position: absolute; left: 13px; top: 34px; bottom: -8px; width: 2px; background: var(--fill-strong); }
.tl:last-child::before { display: none; }
.tl .icon { width: 28px; height: 28px; border-radius: 50%; background: var(--fill); color: var(--hint); }
.tl .body { flex: 1; min-width: 0; padding-top: 4px; }
.tl .t { font-size: 14px; }
.tl .d { color: var(--hint); font-size: 12px; margin-top: 1px; }
.tl .a { font-weight: 600; font-size: 14px; padding-top: 4px; font-variant-numeric: tabular-nums; text-align: right; }
.tl .code, .code { color: var(--hint); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.warn-text { color: var(--red) !important; }
.chips.scroll { margin-bottom: 8px; }
.seg.mode { margin: -6px 0 14px; }
.plus { color: var(--green); }

/* Настройки-переключатель */
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--fill-strong); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.check { color: var(--accent); flex: none; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + var(--safe-b) + 14px); z-index: 50; margin: 0 auto; max-width: 420px;
  background: color-mix(in srgb, var(--text) 88%, transparent); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 500; text-align: center;
  transform: translateY(20px); opacity: 0; transition: .25s; }
.toast.on { transform: none; opacity: 1; }
.skeleton { background: linear-gradient(90deg, var(--fill) 0%, var(--fill-strong) 50%, var(--fill) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); height: 120px; margin-bottom: 12px; }
@keyframes sk { to { background-position: -200% 0; } }
.fade { animation: fade .25s ease; }
@keyframes fade { from { transform: translateY(6px); } }

/* ---------- 0.16: формы, графики, команда, переписка ---------- */
.update-bar { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--accent); color: var(--accent-text);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); white-space: nowrap; }
.form { margin: 8px 0 10px; display: grid; gap: 12px; }
.fld { display: grid; gap: 6px; }
.fld span { color: var(--hint); font-size: 13px; }
.fld small { color: var(--hint); font-size: 12px; }
.fld input, .fld textarea, .composer textarea { width: 100%; border: 0; border-radius: 12px; background: var(--fill); padding: 12px; outline: none; font: inherit; color: inherit; resize: vertical; }
.form .toggle { padding: 4px 0; min-height: 0; }
.actions .btn + .form + .btn, .actions .form + .btn { margin-top: 8px; }
.badge-inline { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; }
.row .side .badge-inline { margin-top: 4px; }

.mchart { position: relative; padding: 6px 4px 0; }
.mc-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 4px; }
.mc-range { font-weight: 600; font-size: 15px; }
.mc-plot { padding: 4px 12px 8px; touch-action: pan-y; user-select: none; cursor: grab; }
.mc-plot svg { width: 100%; height: auto; overflow: visible; display: block; }
.mc-plot .grid { stroke: var(--sep); stroke-width: 1; }
.mc-plot .axis { fill: var(--hint); font-size: 10px; }
.mc-col .hit { fill: transparent; }
.mc-col:hover .hit { fill: var(--fill); }
.mc-col.sel .hit { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.mc-tip { position: absolute; top: 44px; z-index: 5; background: var(--card); border-radius: 12px; padding: 8px 10px; font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,.16); pointer-events: none; display: grid; gap: 3px; min-width: 150px; }
.mc-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.mc-tip .muted { color: var(--hint); font-size: 12px; }
.mc-tip b.one { font-size: 15px; }
.ln-box { position: relative; touch-action: pan-y; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.ln-box svg { width: 100%; height: 100%; display: block; }
.ln-cursor { position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -.5px; background: currentColor; opacity: .35; pointer-events: none; }
.ln-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--card);
  border: 3px solid currentColor; box-shadow: 0 1px 6px rgba(0,0,0,.25); pointer-events: none; }
.ln-tip { position: absolute; top: -34px; z-index: 5; background: var(--card); color: var(--text); border-radius: 10px; padding: 4px 9px;
  box-shadow: 0 4px 16px rgba(0,0,0,.16); pointer-events: none; display: flex; gap: 6px; align-items: baseline; white-space: nowrap; font-size: 13px; }
.ln-tip small { color: var(--hint); font-size: 12px; }
[hidden].ln-cursor, [hidden].ln-dot, [hidden].ln-tip { display: none; }
.pies { display: grid; gap: 12px; }
.pie { padding: 14px 16px; }
.pie-title { font-weight: 600; margin-bottom: 8px; }
.pie-body { display: flex; gap: 16px; align-items: center; }
.pie-ring { position: relative; width: 132px; flex: none; }
.donut { width: 132px; height: 132px; display: block; }
.donut circle { transition: opacity .15s; cursor: pointer; }
.donut circle.dim { opacity: .25; }
.pie-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.pie-center b { font-size: 17px; }
.pie-center small { color: var(--hint); font-size: 11px; max-width: 80px; line-height: 1.2; }
.pie-legend { flex: 1; min-width: 0; display: grid; gap: 4px; }
.pie-legend button { display: grid; grid-template-columns: 10px 1fr auto 36px; gap: 8px; align-items: center; text-align: left; font-size: 13px; padding: 3px 0; }
.pie-legend i { width: 10px; height: 10px; border-radius: 3px; }
.pie-legend span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pie-legend b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pie-legend small { color: var(--hint); text-align: right; }
@media (max-width: 380px) { .pie-body { flex-direction: column; align-items: stretch; } .pie-ring { margin: 0 auto; } }

.team-tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.row.person { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.row.person .title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; white-space: normal; }
.row.person .stats { white-space: normal; }
.row.person .chev { align-self: center; }
.profile-head { display: grid; justify-items: center; gap: 6px; margin: 8px 0 16px; text-align: center; }
.chips.center { justify-content: center; flex-wrap: wrap; margin: 6px 0 0; padding: 0; overflow: visible; }
.quick-row { display: flex; gap: 8px; margin: 4px 0 6px; }
.quick-row .btn { flex: 1; width: auto; }
.quick-row .btn + .btn { margin-top: 0; }

.chat { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 90px; }
.bubble { max-width: 82%; align-self: flex-start; background: var(--card); padding: 9px 12px; border-radius: 16px 16px 16px 6px; white-space: pre-wrap; word-break: break-word; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-radius: 16px 16px 6px 16px; }
.bubble.nudge { background: color-mix(in srgb, var(--yellow) 18%, var(--card)); color: var(--text); }
.bubble small { display: block; opacity: .65; font-size: 11px; margin-top: 3px; text-align: right; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-b)); z-index: 15; display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 12px; background: color-mix(in srgb, var(--bg) 92%, transparent); max-width: 640px; margin: 0 auto; }
.composer textarea { flex: 1; resize: none; }
.round-btn.send { width: 44px; height: 44px; background: var(--accent); color: var(--accent-text); flex: none; }
.round-btn:disabled { opacity: .35; }

/* ---------- Широкий экран (компьютер): боковое меню и вся ширина ---------- */
@media (min-width: 900px) {
  :root { --side: 232px; }
  .tabs { top: 0; bottom: 0; right: auto; width: var(--side); flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 28px 12px; border-top: 0; border-right: .5px solid var(--sep); }
  .tabs button { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; font-size: 15px; }
  .tabs button.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .tabs button svg { width: 22px; height: 22px; }
  .tabs .badge { position: static; margin-left: auto; }
  .page { max-width: 1320px; margin: 0 0 0 var(--side); padding: 28px 40px 48px; }
  @media (min-width: 1600px) { .page { margin-left: calc(var(--side) + (100vw - var(--side) - 1320px) / 2); } }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .quick { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-width: 640px; }
  .pies { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
  .list.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
  .list.people .row + .row::before { display: none; }
  .list.people .row { border-bottom: .5px solid var(--sep); }
  .sheet { left: auto; right: 0; top: 0; bottom: 0; width: 520px; max-width: 100vw; max-height: none; border-radius: 0;
    transform: translateX(100%); margin: 0; box-shadow: -8px 0 32px rgba(0,0,0,.12); }
  .sheet .sheet-handle { display: none; }
  .toast { bottom: 24px; }
  .composer { left: var(--side); bottom: 0; max-width: none; padding: 12px 40px; }
  .chat { padding-bottom: 80px; max-width: 900px; }
  .update-bar { left: calc(50% + var(--side) / 2); }
}

/* 0.17 */
.fld select { width: 100%; border: 0; border-radius: 12px; background: var(--fill); padding: 12px; outline: none; font: inherit; color: inherit; }
.tl.tap { cursor: pointer; border-radius: 12px; }
.tl.tap:active, .tl.tap:hover { background: var(--fill); }
.top .pill.accent { flex: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.card .chips button { background: var(--fill); }
.card .chips button.on { background: var(--text); color: var(--bg); }
.more-box .btn { margin-top: 8px; }
.list.off { opacity: .5; }

/* 0.19: действия списками, ровные отступы */
.actions { display: flex; flex-direction: column; gap: 8px; }
.actions .btn + .btn, .actions .form + .btn, .actions .btn + .form + .btn { margin-top: 0; }
.actions .form { margin: 0; }
.act-list .row.act { min-height: 54px; }
.act-list .act-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.act-list .row + .row::before { left: 60px; }
.act-list .form { margin: 0 12px 12px; background: var(--bg); border-radius: 16px; }
.act-list .row.danger .title { color: var(--red); }
.chip.title-chip { --c: var(--purple); }
.dm-bad { color: var(--red); } .dm-warn { color: var(--orange); }
.chips { cursor: default; }
@media (pointer: fine) { .chips:not(.wrap):not(.center), .fbar { cursor: grab; } .chips.dragging, .fbar.dragging { cursor: grabbing; } .chips.dragging button, .fbar.dragging button { pointer-events: none; } }

/* 0.20 */
.person-hero { display: grid; justify-items: center; gap: 6px; text-align: center; margin: 4px 0 14px; padding: 22px 16px 16px; border-radius: 24px;
  background: linear-gradient(145deg, hsl(var(--h) 70% 55% / .28), hsl(calc(var(--h) + 60) 70% 55% / .14) 60%, transparent), var(--card); }
.person-hero .avatar.lg { box-shadow: 0 6px 24px hsl(var(--h) 70% 45% / .45); }
.pill.glass { background: color-mix(in srgb, var(--card) 60%, transparent); backdrop-filter: blur(6px); }
.trophies { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.trophies span { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.nudge-card { display: block; width: 100%; text-align: left; margin-top: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--purple) 18%, var(--card)), var(--card)); }
.vbar { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; margin: 7px 0 5px; background: var(--fill); }
.vbar i { display: block; height: 100%; }
.vstat { margin-top: 10px; }
.vstat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vstat .subtitle { color: var(--hint); font-size: 13px; margin-top: 2px; }
body.is-stale .page { margin-left: auto !important; margin-right: auto !important; max-width: 520px; }

/* ---------- 0.25: загрузка, навигация, фильтры, кадрирование ---------- */
.splash-screen { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: 24px; text-align: center; transition: opacity .35s ease, visibility .35s; }
.splash-screen.out { opacity: 0; visibility: hidden; }
.splash-logo { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; color: #fff; font-size: 38px; font-weight: 800;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--purple))); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
  animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
.splash-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.splash-bar { width: 200px; height: 5px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 6px; }
.splash-bar i { display: block; height: 100%; width: 12%; border-radius: 3px; background: var(--accent); transition: width .45s ease; }
.splash-step { color: var(--hint); font-size: 13px; min-height: 18px; }
.splash-fact { max-width: 300px; min-height: 40px; font-size: 14px; color: var(--sub); transition: opacity .3s; }
.splash-fact.dim { opacity: 0; }

.back-bar { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 8px -6px; padding: 6px 10px 6px 4px; border-radius: 999px; color: var(--link); font-size: 15px; font-weight: 500; }
.back-bar:active { background: var(--fill); }

/* Переходы: вперёд — справа, назад — слева, вкладки — проявление. */
.page > .go-fwd { animation: go-fwd .26s cubic-bezier(.2,.8,.2,1); }
.page > .go-back { animation: go-back .26s cubic-bezier(.2,.8,.2,1); }
@keyframes go-fwd { from { opacity: 0; transform: translateX(22px); } }
@keyframes go-back { from { opacity: 0; transform: translateX(-22px); } }
.row, .btn, .pill, .chips button, .quick button, .fpill, .tile.tap { transition: transform .12s ease, background-color .15s ease; }
.row:active, .quick button:active, .tile.tap:active { transform: scale(.985); }
.btn:active, .pill:active, .fpill:active { transform: scale(.96); }
@media (prefers-reduced-motion: reduce) { .page > .go-fwd, .page > .go-back, .fade, .splash-logo { animation: none; } .row:active, .btn:active { transform: none; } }

/* Лента фильтров с выпадашками */
.fbar { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
.fbar::-webkit-scrollbar { display: none; }
.fpill { display: inline-flex; align-items: center; gap: 4px; padding: 7px 10px 7px 13px; border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 500; white-space: nowrap; flex: none; }
.fpill svg { opacity: .55; }
.fpill:not(.reset) svg:last-child { transform: rotate(90deg); }
.fpill.on { background: color-mix(in srgb, var(--accent) 15%, var(--card)); color: var(--accent); }
.fpill.on svg { opacity: 1; }
.fpill.reset { color: var(--hint); padding-right: 13px; }
.pick-list .row { min-height: 50px; }
.pick-list .row .n { color: var(--hint); font-size: 14px; font-variant-numeric: tabular-nums; }
.pick-list .row.on .title { color: var(--accent); font-weight: 600; }
.pick-title { font-size: 20px; font-weight: 700; margin: 8px 4px 12px; }

/* Этапы: свёрнутая история */
.stages-head .tog { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 4px; color: var(--link); font-size: 14px; font-weight: 500; padding: 6px 8px; border-radius: 10px; }
.stages-head .tog svg { transition: transform .2s; transform: rotate(90deg); }
.stages-head .tog.open svg { transform: rotate(-90deg); }
.row.stage.auto .subtitle { font-style: italic; }
.row.stage.auto .stage-check { opacity: .5; }
.chips button.suggest { background: color-mix(in srgb, var(--accent) 15%, var(--card)); color: var(--accent); }

/* Ссылки внутри строк и карточек */
.lnk { color: var(--link); cursor: pointer; }
.tile.tap { cursor: pointer; }
.tile.tap .k::after { content: " ›"; opacity: .6; }
.hero .seg.mini { margin: 10px 0 0; background: color-mix(in srgb, var(--hint) 12%, transparent); }
.hero .seg.mini button { padding: 5px 4px; font-size: 13px; }

/* Кадрирование фото */
.crop { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; flex-direction: column; touch-action: none; user-select: none; -webkit-user-select: none; }
.crop-stage { position: relative; flex: 1; overflow: hidden; cursor: grab; }
.crop-stage img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; pointer-events: none; }
.crop-mask { position: absolute; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 9999px rgba(0,0,0,.6); outline: 2px solid rgba(255,255,255,.85); }
.crop-bar { display: flex; align-items: center; gap: 12px; padding: 14px 16px calc(14px + var(--safe-b)); color: #fff; background: #000; }
.crop-bar input[type=range] { flex: 1; accent-color: #fff; }
.crop-bar button { color: #fff; font-weight: 600; padding: 8px 4px; }
.crop-bar button.ok { color: #4cd964; }
.crop-hint { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.75); font-size: 13px; pointer-events: none; }

/* ---------- 0.26: аналитика ---------- */
.an-total { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 2px 4px 0; font-variant-numeric: tabular-nums; }
.an-sub { color: var(--hint); font-size: 14px; margin: 2px 4px 12px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.an-delta { font-weight: 600; font-size: 13px; padding: 2px 8px; border-radius: 999px; background: var(--fill); }
.an-delta.up { color: var(--green); background: color-mix(in srgb, var(--green) 13%, transparent); }
.an-delta.down { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.an-stage { padding: 6px 0 10px; overflow: hidden; }
.an-wrap { position: relative; }
.an-car { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; cursor: grab; }
.an-car::-webkit-scrollbar { display: none; }
.an-car.free { scroll-snap-type: none; cursor: grabbing; user-select: none; -webkit-user-select: none; }
.an-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: grid; justify-items: center; gap: 6px; padding: 8px 16px 4px; min-height: 236px; align-content: start; }
.an-slide-label { color: var(--hint); font-size: 13px; font-weight: 600; }
.an-ring-box { position: relative; width: 190px; height: 190px; }
.an-ring { width: 100%; height: 100%; }
.an-ring circle { transition: opacity .2s, stroke-dasharray .35s ease; }
.an-ring circle.dim { opacity: .18; }
.an-ring-bg { stroke: var(--fill); }
.an-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.an-center b { font-size: 26px; letter-spacing: -.02em; }
.an-center small { color: var(--hint); font-size: 12px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bars { width: 100%; display: grid; gap: 10px; padding: 6px 4px; }
.an-bar.dim { opacity: .35; }
.an-bar-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.an-bar-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bar i { display: block; height: 8px; border-radius: 4px; background: var(--fill); margin-top: 4px; overflow: hidden; }
.an-bar u { display: block; height: 100%; border-radius: 4px; transition: width .35s ease; }
.an-empty { color: var(--hint); padding: 70px 0; }
.an-nav { display: flex; align-items: center; gap: 6px; padding: 6px 10px 0; }
.an-arrow { flex: none; width: 32px; height: 32px; }
.an-months { flex: 1; display: flex; justify-content: center; gap: 4px; min-width: 0; overflow: hidden; }
.an-months button { white-space: nowrap; }
.an-scale button { white-space: nowrap; font-size: 13px; padding: 8px 2px; }
.an-months button { padding: 5px 10px; border-radius: 999px; font-size: 13px; color: var(--hint); font-weight: 500; transition: background-color .2s, color .2s; }
.an-months button.on { background: var(--text); color: var(--bg); font-weight: 600; }
.an-controls { display: flex; gap: 8px; margin: 12px 0 10px; }
.an-controls .seg { margin: 0; }
.an-scale { flex: 1; }
.an-view { flex: none; }
.an-view button { padding: 8px 10px; display: grid; place-items: center; }
.an-cuts { margin-bottom: 10px; }
.an-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.an-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 7px 12px 7px 9px; border-radius: 999px; font-size: 14px;
  background: color-mix(in srgb, var(--c) 13%, var(--card)); transition: transform .12s, background-color .2s, box-shadow .2s; }
.an-chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.an-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.an-chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.an-chip.on { box-shadow: inset 0 0 0 2px var(--c); background: color-mix(in srgb, var(--c) 24%, var(--card)); }
.an-chip:active { transform: scale(.96); }
.an-links { display: grid; gap: 4px; margin-top: 10px; }
.an-links .btn { margin: 0; }
.an-day { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 4px 8px; font-weight: 700; font-size: 17px; }
.an-day b { color: var(--hint); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.row.period-row, .tile.tap, .row.debt-row { cursor: pointer; }
/* ---------- 0.27: тестировщик, заявки ---------- */
.tester-bar { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin: 0 0 12px; padding: 9px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--orange) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent); }
.tester-bar > span:first-child { font-size: 20px; }
.tester-bar .body { flex: 1; min-width: 0; display: grid; }
.tester-bar b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tester-bar small { color: var(--hint); font-size: 12px; }
.tester-bar .tb-change { color: var(--link); font-size: 14px; font-weight: 600; flex: none; }
.apply { max-width: 520px; margin: 0 auto; }
.apply .row.on { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 14px; }/* Бывшие участники — чёрно-белые */
.row.person.ex .avatar, .ex-stack .avatar, .person-hero.ex .avatar { filter: grayscale(1); opacity: .75; }
.row.person.ex .title { color: var(--hint); }
.person-hero.ex { background: linear-gradient(145deg, color-mix(in srgb, var(--hint) 18%, transparent), transparent 70%), var(--card); }
.person-hero.ex .h1 { color: var(--hint); }
.ex-stack { display: flex; flex: none; }
.ex-stack .avatar { box-shadow: 0 0 0 2px var(--card); }
.ex-stack .avatar + .avatar { margin-left: -12px; }
.row.ex-entry .title { color: var(--hint); }.tester-bar.demo { background: color-mix(in srgb, var(--accent) 12%, var(--card)); border-color: color-mix(in srgb, var(--accent) 30%, transparent); padding: 8px 8px 8px 14px; }
.tester-bar.demo .body { display: grid; }
.tester-bar .tb-change.muted { color: var(--hint); }
.tester-bar button.tb-change { padding: 6px 8px; }