/* ctor-v2.css — «Конструктор проектов» в облике кабинетов клиента и прораба (DESIGN.md v1.3, KSH-470).
   Цвета — только токены lk-tokens.css; блоки главной — классы .cv-* / .lw-* из client-v2.css и lk-widgets.css.
   Раздел 1 переводит токены дизайн-системы панелей (_ds: --background, --primary, --card…) на токены кабинетов,
   поэтому панели разделов (таблица работ, настройки, штат) берут тот же белый фон, графит и Inter без правки их файлов. */

/* ---------- 1. токены панелей → токены кабинетов ---------- */
:root, html[data-theme="light"], html:not([data-theme="dark"]) {
  --background: var(--bg); --card: var(--bg); --popover: var(--bg);
  --foreground: var(--text); --text-primary: var(--text);
  --secondary: var(--surface); --surface-hover: var(--surface); --sidebar-accent: var(--surface);
  --primary: var(--accent); --primary-hover: var(--accent-h); --primary-foreground: var(--bg); --primary-soft: var(--surface);
  --accent-color: var(--accent); --accent-wash: var(--surface); --ring: var(--accent);
  --glass-bg: var(--bg); --glass-bg-strong: var(--bg); --glass-border: var(--line); --glass-blur: none;
  --font-text: var(--font-ui); --font-display: var(--font-ui); --font-sans: var(--font-ui);
  --shadow-raised: none;
}
/* замер (measurements.css, field-measure.css) задаёт на :root зелёный --accent — у кабинетов (html.lk-v2) он графитовый */
html.lk-v2 { --accent-hover: var(--accent-h); --accent-foreground: var(--bg); --accent-soft: var(--surface); }
/* у дизайн-системы панелей --muted — заливка, у кабинетов — серый текст: там, где панели берут его заливкой, — серый фон */
.chip, .ms-preview-dialog-close { --muted: var(--surface); }
body { font-family: var(--font-ui); background: var(--bg); color: var(--text); }
/* жирного 600+ нет (DESIGN.md §3): Inter на странице грузится только 300/400/500, а без синтеза жирного
   любой 600–800 из CSS панелей (замер, брифы, таблицы) рисуется начертанием 500. Вес в style — тоже к 500 */
body { font-synthesis: none; }
/* кнопка превью анкеты замера (measurements.css, общий с калькулятором) — графит вместо оранжевого */
.c2 .ms-schema-preview-submit { background: var(--accent); }
.c2 .ms-schema-preview, .c2 .ms-schema-preview-label { background: var(--surface); border-color: var(--line); }
.c2 .ms-schema-preview-label { color: var(--muted); }
.c2 :is([style*="font-weight: 6"], [style*="font-weight: 7"], [style*="font-weight: 8"], [style*="font-weight: 9"], b, strong, th) { font-weight: 500 !important; }
.c2 h1, .c2 h2, .c2 h3 { font-weight: 400; }
.c2 ::selection { background: var(--surface); }

/* ---------- 2. страница и шапка ---------- */
.c2-page { max-width: 1440px; margin: 0 auto; padding: 28px 48px 64px; }
.c2-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.c2-logo { font-size: 18px; font-weight: 600 !important; letter-spacing: .12em; color: var(--text); text-decoration: none; }
.c2-nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.c2-nav > button, .c2-grp > button { font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.c2-nav > button:hover, .c2-grp > button:hover { color: var(--text); }
.c2-nav > button[aria-current="page"], .c2-grp.is-cur > button, .c2-grp > button[aria-expanded="true"] { color: var(--text); font-weight: 500; }
.c2-caret { font-size: 10px; color: var(--muted); }
.c2-grp { position: relative; }
.c2-grp ul { position: absolute; left: -12px; top: calc(100% + 10px); z-index: 70; min-width: 260px; margin: 0; padding: 6px; list-style: none; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, .08); }
.c2-grp li button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 14px; color: var(--text); text-align: left; cursor: pointer; }
.c2-grp li button:hover, .c2-grp li button:focus-visible { background: var(--surface); }
.c2-grp li button[aria-current="page"] { font-weight: 500; }
.c2-grp li .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.c2-grp li .h { font-size: 12px; color: var(--muted); }
.c2-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; display: inline-block; }
.c2-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 11px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.c2-me { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.c2-role { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.c2-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--bg); color: var(--text); text-decoration: none; }
.c2-ic:hover { border-color: var(--text-2); }

/* ---------- 3. главная ---------- */
.c2-home { margin-top: 48px; }
.c2-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px 48px; flex-wrap: wrap; }
.c2-eyebrow { margin: 0; font-size: 12px; color: var(--muted); }
.c2-display { margin: 8px 0 0; font-size: 44px; font-weight: 300 !important; letter-spacing: -.03em; line-height: 1.05; }
.c2-lead { margin: 12px 0 0; max-width: 640px; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.c2-search { width: min(380px, 100%); }
.c2-home .cv-prog { margin-top: 40px; }
.c2-home .cv-prog-facts { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
.c2-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; margin-top: 20px; align-items: stretch; }
.c2-grid > * { min-width: 0; display: flex; flex-direction: column; }
.c2-grid > * > .cv-w { flex: 1; margin: 0; }
.c2-w-12 { grid-column: span 12; } .c2-w-6 { grid-column: span 6; }
.c2-drafts .ft { justify-content: flex-end; }
.c2-home .lw-rt { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.c2-w-7 { grid-column: span 7; } .c2-w-5 { grid-column: span 5; }
/* строки главной: вся строка — кнопка раздела; «в порядке» и прошлые публикации — тише; «поправить» — счётчик охрой */
.c2-rb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; }
button.c2-rb { cursor: pointer; }
button.c2-rb:disabled { cursor: default; }
.c2-rows .r .by b { font-weight: 500; font-variant-numeric: tabular-nums; }
.c2-rows .r.is-warn .by b { color: var(--soon); }
.c2-rows .r.is-ok { opacity: .62; }
.c2-rows .r.is-ok .t { font-weight: 400; }
.c2-checks.is-wide .rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
.c2-checks.is-wide .rows .r:nth-child(2) { border-top: 0; }
/* условия новых смет: термин слева, значение справа */
.c2-dl { margin: 10px 0 0; display: flex; flex-direction: column; }
.c2-dr { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 11px 0; border-top: 1px solid var(--hair); }
.c2-dr:first-child { border-top: 0; }
.c2-dr dt { font-size: 13px; color: var(--muted); }
.c2-dr dd { margin: 0; font-size: 14px; line-height: 1.4; }
.c2-dr .c2-rb { display: inline; }
.c2-dr .c2-rb:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
/* фазы каталога: цепочка по порядку, полоса — сколько работ в фазе относительно самой большой */
.c2-phases { padding: 22px 24px; }
.c2-phases .hd { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.c2-chain { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 0; }
.c2-chain li { min-width: 0; border-left: 1px solid var(--hair); }
.c2-chain li:first-child { border-left: 0; }
.c2-chain .c2-rb { width: 100%; flex-direction: column; align-items: flex-start; gap: 6px; padding: 4px 18px 6px; border-radius: 12px; }
.c2-chain li:first-child .c2-rb { padding-left: 0; }
.c2-chain .c2-rb:hover:not(:disabled) .c2-pt { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.c2-pn { font-size: 12px; color: var(--muted); }
.c2-pt { font-size: 15px; font-weight: 500; line-height: 1.3; min-height: 2.6em; }
.c2-pbar { display: block; width: 100%; height: 4px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.c2-pbar i { display: block; height: 100%; border-radius: 4px; background: var(--muted); opacity: .45; }
.c2-ps { font-size: 12.5px; color: var(--muted); }

/* ---------- 4. раздел окном на весь экран (DESIGN.md §6): отступ 24, радиус 36 сверху, без transform ---------- */
.c2-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; }
html.c2-locked, html.c2-locked body { overflow: hidden; }
.c2-win { position: fixed; left: 24px; right: 24px; top: 24px; bottom: 0; background: var(--bg); border-radius: 36px 36px 0 0; box-shadow: 0 10px 60px rgba(0, 0, 0, .16); z-index: 61; overflow: auto; padding: 28px 40px 48px; outline: none; }
.c2-whead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px 24px; flex-wrap: wrap; }
.c2-wtitle { min-width: 0; }
.c2-h1 { margin: 6px 0 0; font-size: 40px; font-weight: 300 !important; letter-spacing: -.03em; line-height: 1.08; }
.c2-wact { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.c2-x { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 0; display: grid; place-items: center; cursor: pointer; color: var(--text); flex: 0 0 44px; }
.c2-x:hover { background: var(--line); }
.c2-tabs { display: flex; gap: 8px 22px; flex-wrap: wrap; max-width: 100%; }
.c2-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; border: 0; border-bottom: 1px solid transparent; background: none; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.c2-tabs button:hover { color: var(--text); }
.c2-tabs button[aria-current="page"] { color: var(--text); font-weight: 500; border-bottom-color: var(--text); }
.c2-wtools { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.c2-wtools .c2-search { width: min(360px, 100%); margin-left: auto; }
.c2-wbody { margin-top: 24px; }
.c2-note { padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.c2-note.is-att { background: var(--attention); }
.c2-notes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.c2-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: 12.5px; white-space: nowrap; }

/* ---------- 6. путь сделки до сметы (ctor-path.jsx, KSH-480): карточка на главной и окно по стадиям ---------- */
.cdp-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); }
.cdp-try { height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--accent); color: var(--bg); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.cdp-try:hover { background: var(--accent-h); }
.cdp-try:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cdp-sbx-scrim { position: fixed; inset: 0; z-index: 400; background: var(--scrim); }
.cdp-sbx { position: fixed; inset: 24px; z-index: 401; border-radius: 32px; overflow: hidden; background: var(--bg); box-shadow: 0 10px 60px rgba(0, 0, 0, .2); }
.cdp-sbx iframe { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 760px) { .cdp-sbx { inset: 0; border-radius: 0; } }
.cdp-seg button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.cdp-seg button[aria-pressed="true"] { background: var(--bg); color: var(--text); font-weight: 500; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.cdp-rail { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 8px; }
.cdp-rail li { min-width: 0; }
.cdp-rail button { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 0 4px; border: 0; border-top: 2px solid var(--line); background: none; font: inherit; text-align: left; color: var(--muted); cursor: pointer; }
.cdp-rail li.is-done button { border-top-color: var(--muted); }
.cdp-rail li.is-cur button { border-top-color: var(--text); color: var(--text); }
.cdp-rail .n { font-size: 12px; font-variant-numeric: tabular-nums; }
.cdp-rail li.is-dp .n::after { content: ' · с ДП'; }
.cdp-rail .t { font-size: 14px; line-height: 1.3; font-weight: 500; }
.cdp-rail .o { font-size: 12px; }
.cdp-rail button:hover .t { color: var(--text); }
.cdp-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 56px; margin-top: 36px; align-items: start; animation: cdp-in .2s ease-out; }
@keyframes cdp-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cdp-eyebrow { margin: 0; font-size: 12.5px; color: var(--muted); }
.cdp-h { margin: 6px 0 0; font-size: 32px; font-weight: 300 !important; letter-spacing: -.02em; line-height: 1.1; }
.cdp-lead { margin: 14px 0 0; max-width: 720px; font-size: 15.5px; line-height: 1.55; color: var(--text-2); }
.cdp-sec { margin-top: 32px; }
.cdp-sh { margin: 0 0 12px; font-size: 13px; font-weight: 500 !important; color: var(--text); }
.cdp-who { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cdp-who li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 4px 20px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--hair); font-size: 14px; line-height: 1.45; }
.cdp-who li:first-child { border-top: 0; padding-top: 0; }
.cdp-who b { font-weight: 500; }
.cdp-who span { color: var(--text-2); }
.cdp-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.cdp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cdp-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.cdp-list svg { flex: 0 0 auto; margin-top: 2px; color: var(--done); }
.cdp-list.is-stuck svg { color: var(--muted); }
.cdp-side > .cdp-sec:first-child { margin-top: 0; }
.cdp-screen { padding: 14px; border-radius: 24px; background: var(--surface); }
.cdp-scard { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 16px; background: var(--bg); }
.cdp-scard .lab { font-size: 12px; color: var(--muted); }
.cdp-scard .t { font-size: 20px; font-weight: 300; letter-spacing: -.01em; line-height: 1.2; }
.cdp-scard .s { font-size: 13.5px; line-height: 1.4; color: var(--text-2); }
.cdp-sbtn { align-self: flex-start; margin-top: 8px; display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--accent); color: var(--bg); font-size: 12.5px; font-weight: 500; }
.cdp-spath { list-style: none; margin: 14px 6px 2px; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.cdp-spath li { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.cdp-spath i { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--bg); }
.cdp-spath li.is-done { opacity: .6; }
.cdp-spath li.is-done i { background: var(--muted); border-color: var(--muted); }
.cdp-spath li.is-cur { color: var(--text); font-weight: 500; }
.cdp-spath li.is-cur i { background: var(--text); border-color: var(--text); }
.cdp-p { margin: 12px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.cdp-p.cdp-mute { font-size: 13px; color: var(--muted); }
.cdp-set { display: flex; flex-direction: column; }
.cdp-sr { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 12px 0; border: 0; border-top: 1px solid var(--hair); background: none; font: inherit; text-align: left; color: var(--text); }
.cdp-set > :first-child { border-top: 0; padding-top: 0; }
button.cdp-sr { cursor: pointer; }
.cdp-sr .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cdp-sr .t { font-size: 14px; font-weight: 500; }
.cdp-sr .lab { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
button.cdp-sr:hover .t, .cdp-step:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.cdp-foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--hair); }
.cdp-step { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.cdp-rail button:focus-visible, .cdp-step:focus-visible, .cdp-sr:focus-visible, .cdp-seg button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 6px; }
@media (max-width: 1100px) { .cdp-body { grid-template-columns: 1fr; gap: 8px; } .cdp-side { margin-top: 24px; } }

/* ---------- 5. телефон ---------- */
@media (max-width: 1100px) { .c2-w-6, .c2-w-7, .c2-w-5 { grid-column: span 12; } .c2-checks.is-wide .rows { grid-template-columns: 1fr; } .c2-checks.is-wide .rows .r:nth-child(2) { border-top: 1px solid var(--hair); } .c2-chain { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; row-gap: 18px; } .c2-chain li:nth-child(3n+1) { border-left: 0; } .c2-chain li:nth-child(3n+1) .c2-rb { padding-left: 0; } .c2-home .cv-prog-facts { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
@media (max-width: 760px) {
  .c2-page { padding: 16px 16px 48px; }
  .c2-head { flex-wrap: wrap; }
  .c2-nav { order: 3; width: 100%; gap: 10px 16px; }
  .c2-role { display: none; }
  .c2-home { margin-top: 28px; }
  .c2-display { font-size: 34px; }
  .c2-home .cv-prog-facts { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .c2-win { left: 0; right: 0; top: 16px; border-radius: 28px 28px 0 0; padding: 20px 16px 40px; }
  .c2-h1 { font-size: 30px; }
  .c2-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .c2-chain { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .c2-chain li { border-left: 0 !important; }
  .c2-chain li .c2-rb { padding-left: 0 !important; padding-right: 12px; }
  .c2-dr { grid-template-columns: 1fr; gap: 2px; }
  .c2-rows .r .by { font-size: 12.5px; white-space: normal; text-align: right; max-width: 38%; }
  .c2-rows .r .t { white-space: normal; }
  .cdp-mod .cv-mhead { flex-wrap: wrap; }
  .cdp-mod .lw-mact { width: 100%; justify-content: space-between; }
  .cdp-rail { display: flex !important; gap: 12px; overflow-x: auto; margin-top: 20px; padding-bottom: 6px; scroll-snap-type: x proximity; }
  .cdp-rail li { flex: 0 0 132px; scroll-snap-align: start; }
  .cdp-h { font-size: 26px; }
  .cdp-two { grid-template-columns: 1fr; }
  .cdp-who li { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .c2 * { animation: none !important; transition: none !important; } }
