/* ======================= редизайн 11.11: «лестница акцента» =======================
   tasteskill accent-ladder, seed 1243687598. Смелость 7 · анимация 7 · плотность 5.
   Подключается после app.css и перекрывает его; старый вид возвращается удалением одной строки в index.html.

   Лицо: лестница из оранжевого лиса Booster. Полный цвет только на мелких метках (кнопка, ряд данных,
   значок активного раздела), светлые ступени на площадях (активная строка меню, главный блок, дорожки).
   Рамка: линейная «Т» — меню и полоса 64px на одном фоне, делятся линиями 1px, листа-вкладыша больше нет.
   Шрифт Onest: у DM Sans из раздачи нет кириллицы и казахских букв.
   Движение по правилам emil-design-eng: ease-out, до 300 мс, нажатие scale(.97), появление не из нуля,
   частые действия (фильтры, поиск, клик по ячейке) не анимируются.

   Сетка при 1440: меню 232 + поле 1208; поля 28 → 1152. Сводка: 744 + 24 + 384 = 1152. */
:root {
  --ground: #fbfafc; --surface: #ffffff; --raised: #f5f3f7; --active: #efedf2;
  --border: #e7e4ec; --rule: #f0eef3; --control: #d2ced9;
  --text: #17121f; --muted: #5d5866; --faint: #6b6673;
  --accent: #ea580c; --accent-strong: #c2410c; --accent-hover: #9a3412;
  --accent-soft: #fff1e6; --accent-track: #ffd8bd; --accent-ink: #8a2f0a;
  --primary: var(--accent-strong); --primary-hover: var(--accent-hover); --primary-ink: #ffffff;
  --stage-open: #b7b2c0; --stage-closed: #dfdbe5;
  --sidebar-width: 232px; --pad: 28px; --nav-row: 36px; --row-height: 48px;
  --font: "Onest", "Golos Text", system-ui, sans-serif;
  --fs-title: 32px; --fs-section: 18px; --fs-lead: 40px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ---------- рамка ---------- */
.app { grid-template-rows: 64px minmax(0, 1fr); }
.sidebar { padding: 14px 12px 16px; border-right: 1px solid var(--border); background: var(--ground); }
.topbar { position: sticky; top: 0; z-index: 10; padding: 0 var(--pad); background: var(--ground); border-bottom: 1px solid var(--border); }
.search { height: 36px; margin: 0; width: min(520px, 100%); border-color: var(--border); border-radius: 8px; transition: border-color 150ms ease; }
.search:focus-within { border-color: var(--text); }
.proto-note { margin-left: auto; }
.sheet { margin: 0; border: 0; border-radius: 0; background: transparent; }
.brand { height: 36px; gap: 10px; margin-bottom: 14px; }
.brand svg { width: 26px; height: 26px; }
.brand b { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.scope { border-color: var(--border); border-radius: 8px; }

/* меню: строка 36 на шаге 40; активная — светлая ступень акцента, плашка переезжает между разделами */
.nav-wrap { position: relative; }
.nav-ind { position: absolute; left: 0; right: 0; top: 0; height: var(--nav-row); border-radius: 8px; background: var(--accent-soft); opacity: 0; pointer-events: none; }
.nav-ind.ready { transition: transform 240ms var(--ease-in-out), opacity 150ms ease; }
.nav-item { position: relative; margin-bottom: 4px; padding: 0 10px; transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.nav-item:active { transform: scale(0.98); }
.nav-item[aria-current="page"] { background: transparent; color: var(--accent-ink); font-weight: 500; }
.nav-item[aria-current="page"] svg { color: var(--accent); }
.nav-item[aria-current="page"] .count { color: var(--accent-ink); }
.group-label { margin: 22px 10px 8px; }
.avatar.me, .feed-item .avatar, .resp .avatar { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- заголовок экрана ---------- */
.title-row { align-items: flex-end; margin-bottom: 28px; }
.title-row h1 { font-size: var(--fs-title); line-height: 38px; font-weight: 700; letter-spacing: -0.025em; }
.title-row .sub { margin-top: 8px; font-size: 16px; line-height: 24px; }
.title-row .sub b { font-weight: 600; }
.panel h2, .rail h2.out, .feed-head h2 { font-size: var(--fs-section); line-height: 24px; font-weight: 600; letter-spacing: -0.01em; }
.rail h2.out { margin-bottom: 10px; }

/* ---------- кнопки: нажатие сжимает ---------- */
.btn { border-color: var(--border); border-radius: 8px; transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.btn:active { transform: scale(0.97); }
.btn.primary { height: 40px; padding: 0 18px; font-weight: 600; }
.btn:disabled:active, .btn[aria-disabled="true"]:active { transform: none; }
.chip, .select, .input, .toolbar .search-in { border-radius: 8px; transition: border-color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out); }
.chip:active, .segmented button:active, .toggle button:active, .tabs button:active { transform: scale(0.97); }
.chip[aria-pressed="true"], .chip.on { border-color: var(--accent-track); background: var(--accent-soft); color: var(--accent-ink); }
.chip[aria-pressed="true"] b { color: var(--accent-ink); }
.input:focus, .select:focus { outline-color: var(--accent); }
.segmented button { transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.card-link::after { transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .btn:not(.primary):hover { border-color: var(--control); }
  .card-link:hover::after { transform: translateX(3px); }
  .row.link { transition: background-color 150ms ease; }
  .rail .row.link, .pick .row.link { margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 8px; }
  .rail .row.link:hover, .pick .row.link:hover { background: var(--raised); }
  table.list tbody tr td { transition: background-color 120ms ease; }
  table.list tbody tr:hover td { background: var(--raised); }
}
table.list th:first-child, table.list td:first-child { padding-left: 10px; }
table.list th:last-child, table.list td:last-child { padding-right: 10px; }
table.list td:first-child { border-radius: 8px 0 0 8px; }
table.list td:last-child { border-radius: 0 8px 8px 0; }

/* ---------- главная цифра: светлая ступень акцента ---------- */
.lead { align-items: stretch; gap: 8px 24px; }
.lead > div:first-child { padding: 16px 20px; border-radius: 8px; background: var(--accent-soft); }
.lead-label { color: var(--accent-ink); font-weight: 500; }
.lead-value { font-size: var(--fs-lead); line-height: 44px; font-weight: 700; letter-spacing: -0.03em; color: var(--accent-ink); }
.lead-value small { color: var(--accent-ink); }
.facts { border-left: 0; align-items: center; }
.fact { padding-left: 24px; }
.fact .v { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; }
.path { height: 12px; gap: 3px; margin-top: 24px; }
.path i { border-radius: 2px; }
.path i:first-child { border-radius: 6px 2px 2px 6px; }
.path i:last-child { border-radius: 2px 6px 6px 2px; }
.fill-line .bar { height: 8px; background: var(--accent-track); }
.fill-line .bar i { background: var(--accent); }
.fill-line .num { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }

/* шахматка мест */
.seats td button { border-radius: 6px; transition: outline-color 150ms ease, transform 160ms var(--ease-out); }
.seats td button:active { transform: scale(0.96); }
.seats td button b { font-weight: 600; font-size: 15px; }
.seats td button[aria-pressed="true"] { outline: 2px solid var(--accent-strong); outline-offset: 1px; }

/* этапы над списком */
.tabs { gap: 28px; }
.tabs button b { font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.02em; }
.tabs button[aria-selected="true"]::after { height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tabs button.flat[aria-selected="true"] { font-weight: 500; }
.pill { height: 24px; padding: 0 10px; }

/* задачи, карточка */
.col { padding: 12px; }
.col header h2 { font-size: 15px; font-weight: 600; }
.col.today { background: var(--accent-soft); }
.col.today header h2, .col.today .count { color: var(--accent-ink); }
.journey { border: 0; }
.composer-tabs button { border: 1px solid transparent; transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.composer-tabs button:active { transform: scale(0.97); }
.composer-tabs button[aria-selected="true"] { box-shadow: none; border-color: var(--border); }
.segmented button[aria-pressed="true"] { box-shadow: none; outline: 1px solid var(--border); outline-offset: -1px; }
.report, .note-item, .feed-item { border-radius: 0; }
.steps .now .s-name { color: var(--accent-ink); }

/* ИИ: заливка той же ступени, что у главной кнопки (белый текст читается) */
.btn.ai.primary-ai { background: var(--accent-strong); height: 40px; font-weight: 600; }
.btn.ai.primary-ai:hover { background: var(--accent-hover); }
.nav-item.nav-ai[aria-current="page"] { background: transparent; }
.as-q { border-radius: 8px; }

/* вход */
.auth-card { padding: 36px; border-radius: 16px; }
.auth-card h1 { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; margin-top: 20px; }
.auth-card .btn.primary { height: 44px; }
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.wordmark svg { width: 28px; height: 28px; }

/* ---------- движение ---------- */
/* смена раздела: части экрана поднимаются по очереди (шаг 45 мс), один раз на переход */
@keyframes crm-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes crm-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
#screen.enter > *, #screen.enter .stack > *, #screen.enter .rail > *, #screen.enter .card-top > *, #screen.enter .board > * { animation: crm-rise 280ms var(--ease-out) backwards; }
#screen.enter > .split, #screen.enter > .card-top, #screen.enter > .board { animation: none; }
#screen.enter > :nth-child(2), #screen.enter .stack > :nth-child(1), #screen.enter .board > :nth-child(1), #screen.enter .card-top > :nth-child(1) { animation-delay: 45ms; }
#screen.enter > :nth-child(3), #screen.enter .stack > :nth-child(2), #screen.enter .rail > :nth-child(1), #screen.enter .board > :nth-child(2), #screen.enter .card-top > :nth-child(2) { animation-delay: 90ms; }
#screen.enter > :nth-child(4), #screen.enter .rail > :nth-child(2), #screen.enter .board > :nth-child(3) { animation-delay: 135ms; }
#screen.enter > :nth-child(n + 5), #screen.enter .stack > :nth-child(n + 3), #screen.enter .board > :nth-child(n + 4) { animation-delay: 180ms; }
#screen.enter .path, #screen.enter .fill-line .bar i, #screen.enter .plan i { animation: crm-reveal 600ms var(--ease-out) 160ms backwards; }
#screen.enter table.list tbody tr { animation: crm-rise 240ms var(--ease-out) backwards; }
#screen.enter table.list tbody tr:nth-child(2) { animation-delay: 30ms; }
#screen.enter table.list tbody tr:nth-child(3) { animation-delay: 60ms; }
#screen.enter table.list tbody tr:nth-child(4) { animation-delay: 90ms; }
#screen.enter table.list tbody tr:nth-child(5) { animation-delay: 120ms; }
#screen.enter table.list tbody tr:nth-child(n + 6) { animation-delay: 150ms; }

/* окно: из 0.96, не из нуля; фон проявляется */
dialog.sheet-dialog { border-radius: 16px; transition: opacity 200ms var(--ease-out), transform 240ms var(--ease-out); }
dialog.sheet-dialog::backdrop { transition: background-color 200ms ease; }
@starting-style {
  dialog.sheet-dialog[open] { opacity: 0; transform: translateY(12px) scale(0.96); }
  dialog.sheet-dialog[open]::backdrop { background-color: transparent; }
}
.toast { border-radius: 10px; background: var(--text); transition: opacity 200ms ease, transform 260ms var(--ease-out); }
.toast.bad { background: var(--negative); }
@starting-style { .toast { opacity: 0; transform: translate(-50%, 16px); } }
.mention-pop { transform-origin: top left; transition: opacity 140ms ease, transform 140ms var(--ease-out); }
@starting-style { .mention-pop { opacity: 0; transform: scale(0.97); } }
.bar i { transition: width 300ms var(--ease-out); }

/* ---------- фильтр учеников «как в магазине» ---------- */
.toolbar { gap: 8px 10px; }
.toolbar .search-in, .filter-btn { height: 36px; }
.filter-btn { gap: 8px; padding: 0 14px; font-weight: 600; }
.filter-btn svg { width: 16px; height: 16px; stroke-width: 1.6; }
.f-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-strong); color: #fff; font-size: 12px; font-weight: 600; }
.toolbar .applied { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.applied .chip { height: 32px; gap: 6px; padding: 0 8px 0 12px; font-weight: 500; }
.applied .chip-k { font-weight: 400; }
.applied .chip-k::after { content: ":"; }
.chip .x, .icon-btn .x { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.applied .btn.ghost { height: 32px; border-color: transparent; background: none; color: var(--muted); }
.applied .btn.ghost:hover { color: var(--text); background: var(--raised); }

dialog.filter-sheet { position: fixed; inset: 0 0 0 auto; display: none; grid-template-rows: auto minmax(0, 1fr) auto; width: min(400px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: -16px 0 48px rgb(23 18 31 / 0.12); transition: transform 320ms var(--ease-drawer); }
dialog.filter-sheet[open] { display: grid; }
dialog.filter-sheet::backdrop { background-color: rgb(23 18 31 / 0.22); transition: background-color 240ms ease; }
@starting-style {
  dialog.filter-sheet[open] { transform: translateX(100%); }
  dialog.filter-sheet[open]::backdrop { background-color: transparent; }
}
dialog.filter-sheet.closing { transform: translateX(100%); transition: transform 200ms var(--ease-out); }
dialog.filter-sheet.closing::backdrop { background-color: transparent; }
.filter-sheet > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 14px 20px; border-bottom: 1px solid var(--rule); }
.filter-sheet > header h2 { font-size: 20px; line-height: 26px; font-weight: 700; letter-spacing: -0.02em; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn .x { width: 14px; height: 14px; }
.fs-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 16px; }
.f-group { padding: 6px 0; }
.f-group + .f-group { border-top: 1px solid var(--rule); }
.f-group h3 { margin: 12px 0 0; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--faint); }
.facet summary { display: flex; align-items: center; gap: 8px; height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; list-style: none; user-select: none; }
.facet summary::-webkit-details-marker { display: none; }
.facet .chev { width: 14px; height: 14px; margin-left: auto; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms var(--ease-out); }
.facet[open] .chev { transform: rotate(180deg); }
.f-sel { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; }
.f-opts { margin: 0; padding: 0 0 8px; list-style: none; }
.f-opts.flat { padding-top: 6px; }
.f-opt { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 36px; margin: 0 -8px; padding: 0 8px; border-radius: 8px; cursor: pointer; }
.f-opt .f-l { overflow-wrap: anywhere; }
.f-opt .f-n { color: var(--muted); font-size: 13px; }
.f-opt.zero { color: var(--faint); cursor: default; }
.f-opt:has(input:checked) .f-l { font-weight: 500; }
.f-opt input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--control); border-radius: 5px; background: var(--surface) center / 12px no-repeat; cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease, transform 160ms var(--ease-out); }
.f-opt input[type="radio"] { border-radius: 50%; }
.f-opt input:checked { border-color: var(--accent-strong); background-color: var(--accent-strong); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m2.5 6.2 2.4 2.4 4.6-5.2' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.f-opt input[type="radio"]:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='2.6' fill='white'/%3E%3C/svg%3E"); }
.f-opt input:disabled { border-color: var(--border); background-color: var(--raised); cursor: default; }
.f-opt input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.f-opt:active input:not(:disabled) { transform: scale(0.9); }
.facet:not(.all):not(.finding) .f-opts li:nth-child(n + 11):not(:has(input:checked)) { display: none; }
.link-more { margin: -4px 0 8px; padding: 4px 0; border: 0; background: none; color: var(--accent-ink); font-weight: 500; cursor: pointer; }
.link-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.f-find { width: 100%; height: 34px; margin-bottom: 6px; }
.f-later { margin: 12px 0 0; }
.filter-sheet > footer { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); }
.filter-sheet > footer .btn { height: 44px; }
@media (hover: hover) and (pointer: fine) { .f-opt:not(.zero):hover { background: var(--raised); } }

/* ---------- сводка ИИ: отдельный оранжевый блок, текст ИИ на белой подложке крупнее остального ---------- */
.panel.ai-summary { border-color: var(--accent-track); background: var(--accent-soft); }
.ai-summary > header h2 { color: var(--accent-ink); }
.ai-summary > header .segmented, .ai-summary .ai-period .segmented { background: var(--accent-track); }
.ai-summary .ai-facts .k, .ai-summary .ai-facts .c, .ai-summary > header .meta, .ai-summary .ai-calls, .ai-summary .ai-grades dt, .ai-summary > .note { color: #6b4a3a; }
.ai-summary .ai-grades { border-top-color: var(--accent-track); }
.ai-summary .ai-draft { max-width: none; margin-top: 16px; padding: 18px 20px 20px; border: 0; border-radius: 8px; background: var(--surface); }
.ai-summary .ai-draft .pill.ai { height: 26px; background: var(--accent-strong); color: #fff; font-weight: 600; }
.ai-summary .ai-overview { max-width: 72ch; margin-top: 12px; font-size: 17px; line-height: 26px; font-weight: 500; color: var(--text); }
.ai-summary .ai-h { margin: 20px 0 6px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--accent-ink); }
.ai-summary .ai-points { gap: 10px; max-width: 72ch; }
.ai-summary .ai-points li { position: relative; padding-left: 18px; font-size: 15px; line-height: 23px; }
.ai-summary .ai-points li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.ai-summary .ai-wait { color: var(--accent-ink); font-weight: 500; }

/* ---------- телефон ---------- */
@media (max-width: 860px) {
  .app { grid-template-rows: 56px minmax(0, 1fr); }
  .topbar { padding: 0 16px; }
  .sidebar { border-right: 0; background: var(--surface); transition: transform 320ms var(--ease-drawer); }
  .title-row h1 { font-size: 26px; line-height: 32px; }
  .title-row .sub { font-size: 15px; line-height: 22px; }
  .title-row .actions .btn.primary { height: 48px; }
  .lead > div:first-child { padding: 14px 16px; }
  .lead-value { font-size: 36px; line-height: 40px; }
  .fact, .fact + .fact { padding-left: 0; }
  .fact .v { font-size: 22px; }
  .tabs { gap: 22px; }
  .nav-item { height: 44px; }
  .nav-ind { height: 44px; }
  .toolbar .search-in, .filter-btn { height: 44px; }
  .filter-btn { flex: 1 1 auto; }
  dialog.filter-sheet { width: 100vw; border-left: 0; }
  .f-opt { min-height: 44px; }
  .facet summary { height: 48px; }
  .filter-sheet > footer .btn { height: 48px; }
  .applied .chip { height: 36px; min-height: 36px; }
  table.list.cards td:first-child, table.list.cards td:last-child { padding: 0; border-radius: 0; }
}
@media (max-width: 520px) { .title-row .actions > .btn { flex: 1 1 auto; } }
/* меньше движения: проявление остаётся, перемещения нет */
@media (prefers-reduced-motion: reduce) {
  @keyframes crm-rise { from { opacity: 0; } }
  @keyframes crm-reveal { from { opacity: 0; } }
  .btn:active, .chip:active, .nav-item:active, .seats td button:active, .segmented button:active, .toggle button:active, .tabs button:active { transform: none; }
  .nav-ind.ready { transition: opacity 150ms ease; }
  dialog.filter-sheet, dialog.filter-sheet.closing { transform: none; transition: opacity 150ms ease; }
  dialog.filter-sheet.closing { opacity: 0; }
  .f-opt:active input:not(:disabled), .icon-btn:active { transform: none; }
}
