/* DefAct — кабинеты подрядчика (/account) и клиента (/client).
   Одна система на оба кабинета. Стратегия — docs/design/cabinet-redesign.md.

   Токены по ролям: компоненты ссылаются только на них. Контраст пар текст/фон
   замерен (WCAG): основной ≥ 14:1, вторичный ≥ 7:1, третичный ≥ 4.5:1 в обеих
   темах. Старые имена (--line, --card, --muted …) оставлены алиасами — на них
   держатся разделы, которые ещё не переделаны. */

/* Фирменный шрифт Onest (SIL OFL 1.1, app/static/fonts/Onest-OFL.txt) —
   переменный, 100–900, со своего сервера: без Google Fonts и чужих адресов.
   Три набора: браузер грузит только тот, чьи символы есть на странице
   (знак ₽ — в latin-ext). */
@font-face { font-family:"Onest"; font-style:normal; font-weight:100 900; font-display:swap;
  src:url("/static/fonts/onest-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family:"Onest"; font-style:normal; font-weight:100 900; font-display:swap;
  src:url("/static/fonts/onest-latin-wght-normal.woff2") format("woff2");
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:"Onest"; font-style:normal; font-weight:100 900; font-display:swap;
  src:url("/static/fonts/onest-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  color-scheme: light;
  /* поверхности */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-hover: #eef2f8;
  --surface-sunken: #eceff5;
  --border: #e1e6ef;
  --border-strong: #c9d1df;
  /* текст */
  --text: #0f1b2d;
  --text-2: #4a5870;
  --text-3: #5f6c83;
  --text-on-solid: #ffffff;
  /* акцент — синий галочки из знака */
  --accent-text: #1d56d6;
  --accent-solid: #1f5fe0;
  --accent-solid-hover: #1a51c2;
  --accent-soft: #e8f0ff;
  --accent-ring: rgba(31, 95, 224, 0.35);
  /* статусы: цвет текста / фон пилюли */
  --ok: #13703f;      --ok-soft: #e3f4ea;
  --warn: #8a5200;    --warn-soft: #fff1d6;
  --bad: #b42323;     --bad-soft: #fce9e9;
  --info: #1d56d6;    --info-soft: #e8f0ff;
  --neutral: #4a5870; --neutral-soft: #edf0f5;
  /* боковая панель — «приборная», тёмная в обеих темах */
  --nav-bg: #0e1e3a;
  --nav-bg-2: #13284b;
  --nav-text: #aebbd2;
  --nav-text-strong: #ffffff;
  --nav-dim: #7f8ea9;
  --nav-active: rgba(255, 255, 255, 0.09);
  --nav-hover: rgba(255, 255, 255, 0.05);
  --nav-mark: #4c8dff;
  --nav-border: rgba(255, 255, 255, 0.08);
  /* глубина */
  --shadow-1: 0 1px 2px rgba(15, 27, 45, 0.06), 0 0 0 1px rgba(15, 27, 45, 0.04);
  --shadow-2: 0 4px 14px -4px rgba(15, 27, 45, 0.12), 0 0 0 1px rgba(15, 27, 45, 0.05);
  --shadow-pop: 0 18px 44px -12px rgba(15, 27, 45, 0.28), 0 0 0 1px rgba(15, 27, 45, 0.06);
  --img-outline: rgba(0, 0, 0, 0.1);
  /* шрифты */
  --font-ui: "Onest", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-data: "Cascadia Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Roboto Mono", monospace;
  /* шкала */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 26px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --side-w: 256px;

  /* алиасы старых имён */
  --card: var(--surface); --input: var(--surface); --fg: var(--text); --muted: var(--text-2);
  --line: var(--border); --hover-bg: var(--surface-hover); --zebra: var(--surface-2);
  --accent: var(--accent-text); --accent-hover: var(--accent-solid-hover);
  --ok-bg: var(--ok-soft); --warn-bg: var(--warn-soft); --bad-bg: var(--bad-soft);
  --ok-border: rgba(19, 112, 63, 0.3); --warn-border: rgba(138, 82, 0, 0.3); --bad-border: rgba(180, 35, 35, 0.3);
  --neutral-bg: var(--neutral-soft); --shadow: var(--shadow-1); --shadow-lg: var(--shadow-pop);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1220; --surface: #111a2b; --surface-2: #152036; --surface-hover: #1a2740; --surface-sunken: #0e1626;
    --border: #22314b; --border-strong: #2e4060;
    --text: #e6ecf5; --text-2: #a3b1c8; --text-3: #8594ad;
    --accent-text: #7aa2ff; --accent-solid: #2f66e8; --accent-solid-hover: #3d74f5;
    --accent-soft: rgba(91, 140, 255, 0.15); --accent-ring: rgba(122, 162, 255, 0.45);
    --ok: #5bd08b; --ok-soft: #12291f; --warn: #f2b441; --warn-soft: #2c2312;
    --bad: #f48080; --bad-soft: #301a1f; --info: #7aa2ff; --info-soft: rgba(91, 140, 255, 0.15);
    --neutral: #a3b1c8; --neutral-soft: #1a2740;
    --nav-bg: #070e1c; --nav-bg-2: #0d1830; --nav-border: rgba(255, 255, 255, 0.06);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-2: 0 6px 18px -6px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-pop: 0 20px 48px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.07);
    --img-outline: rgba(255, 255, 255, 0.1);
    --ok-border: rgba(91, 208, 139, 0.35); --warn-border: rgba(242, 180, 65, 0.35); --bad-border: rgba(244, 128, 128, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220; --surface: #111a2b; --surface-2: #152036; --surface-hover: #1a2740; --surface-sunken: #0e1626;
  --border: #22314b; --border-strong: #2e4060;
  --text: #e6ecf5; --text-2: #a3b1c8; --text-3: #8594ad;
  --accent-text: #7aa2ff; --accent-solid: #2f66e8; --accent-solid-hover: #3d74f5;
  --accent-soft: rgba(91, 140, 255, 0.15); --accent-ring: rgba(122, 162, 255, 0.45);
  --ok: #5bd08b; --ok-soft: #12291f; --warn: #f2b441; --warn-soft: #2c2312;
  --bad: #f48080; --bad-soft: #301a1f; --info: #7aa2ff; --info-soft: rgba(91, 140, 255, 0.15);
  --neutral: #a3b1c8; --neutral-soft: #1a2740;
  --nav-bg: #070e1c; --nav-bg-2: #0d1830; --nav-border: rgba(255, 255, 255, 0.06);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-2: 0 6px 18px -6px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-pop: 0 20px 48px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.07);
  --img-outline: rgba(255, 255, 255, 0.1);
  --ok-border: rgba(91, 208, 139, 0.35); --warn-border: rgba(242, 180, 65, 0.35); --bad-border: rgba(244, 128, 128, 0.35);
}

/* ---------- основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font: 400 var(--fs-md)/1.5 var(--font-ui);
}
a { color: var(--accent-text); text-underline-offset: 2px; text-decoration-thickness: from-font; }
img { max-width: 100%; }
input, select, button, textarea { font: inherit; color: inherit; }
button, a, [role="button"], summary { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: 12px; top: 12px; z-index: 100; padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; transform: translateY(-200%); }
.skip:focus { transform: none; box-shadow: var(--shadow-pop); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }
.ic.lg { width: 22px; height: 22px; }
.ic.sm { width: 15px; height: 15px; }
.data { font-family: var(--font-data); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; font-size: 0.93em; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }

/* ---------- заголовки ---------- */
h1, h2, h3 { text-wrap: balance; }
h1.h, .page-title { margin: 0; font-size: var(--fs-2xl); font-weight: 650; line-height: 1.15; letter-spacing: -0.02em; }
h2.h { margin: 0; font-size: var(--fs-lg); font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
h3.h { margin: 0 0 14px; font-size: var(--fs-md); font-weight: 650; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { margin-top: 6px; color: var(--text-2); font-size: var(--fs-md); display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.section-title h2 { margin: 0; font-size: var(--fs-lg); font-weight: 650; }
.section-title a { font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }

/* ---------- каркас подрядчика: меню-островок ---------- */
/* Островок отстоит от краёв окна на --side-gap, скруглён и не касается
   рабочей области. Свёрнутый режим (data-side="collapsed" на <html>) — только
   иконки с подсказками; выбор запоминается в localStorage. */
:root { --side-w: 264px; --side-w-mini: 76px; --side-gap: 12px; }
.shell { display: grid; grid-template-columns: calc(var(--side-w) + var(--side-gap)) minmax(0, 1fr); min-height: 100dvh;
  transition: grid-template-columns 220ms var(--ease-out); }
:root[data-side="collapsed"] .shell { grid-template-columns: calc(var(--side-w-mini) + var(--side-gap)) minmax(0, 1fr); }
.side {
  position: sticky; top: var(--side-gap); height: calc(100dvh - 2 * var(--side-gap)); margin: var(--side-gap) 0 var(--side-gap) var(--side-gap);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  background: linear-gradient(180deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%); color: var(--nav-text);
  padding: 14px 10px 10px; border-radius: 20px;
  box-shadow: 0 10px 30px -12px rgba(7, 14, 28, 0.55), inset 0 0 0 1px var(--nav-border);
}
.side-head { display: flex; align-items: center; gap: 6px; padding: 0 2px 6px; }
.side-brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px;
  color: var(--nav-text-strong); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.side-brand img { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.side-collapse, .side-close { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--nav-dim); cursor: pointer; }
.side-close { display: none; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
.side-group { margin-top: 14px; }
.side-group:first-child { margin-top: 4px; }
.side-label { padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--nav-dim);
  white-space: nowrap; overflow: hidden; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 8px 10px;
  border-radius: 11px; color: var(--nav-text); text-decoration: none; font-size: var(--fs-md); font-weight: 500;
  transition: background-color 120ms ease, color 120ms ease; white-space: nowrap;
}
.side-nav a .ic { opacity: 0.85; }
.side-nav a .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-nav a[aria-current="page"] { background: var(--nav-active); color: var(--nav-text-strong); box-shadow: inset 0 0 0 1px var(--nav-border); }
.side-nav a[aria-current="page"] .ic { opacity: 1; color: var(--nav-mark); }
.side-nav .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--nav-mark);
  color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.side-foot { padding-top: 10px; border-top: 1px solid var(--nav-border); display: flex; flex-direction: column; gap: 6px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px; min-width: 0; border-radius: 11px; text-decoration: none; color: inherit; }
.side-user .avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--nav-mark); color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.side-user .who { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.side-user .who .nm, .side-user .who .em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who .nm { font-size: var(--fs-sm); font-weight: 600; color: var(--nav-text-strong); }
.side-user .who .em { font-size: 11.5px; color: var(--nav-dim); }
.side-tools { display: flex; gap: 6px; }
.side-tools form { flex: 1; }
/* тема и обучение — иконками, «Выйти» — с надписью на остальную ширину */
.side-btn.side-btn-ic { flex: none; width: 36px; padding: 6px; }
.side-tools form .side-btn { min-width: 0; }
.side-btn { flex: 1; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px;
  padding: 6px 10px; border-radius: 10px; border: 1px solid var(--nav-border); background: transparent; color: var(--nav-text);
  font-size: var(--fs-sm); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }

/* подсказка у иконок в свёрнутом меню (создаёт cabinet.js) */
.side-tip { position: fixed; z-index: 90; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: #0b1630; color: #fff;
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  transform: translateY(-50%); opacity: 0; transition: opacity 120ms ease; }
.side-tip.on { opacity: 1; }

@media (min-width: 961px) {
  :root[data-side="collapsed"] .side { padding-inline: 8px; }
  :root[data-side="collapsed"] .side .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :root[data-side="collapsed"] .side-head { flex-direction: column; gap: 8px; padding-bottom: 8px; }
  :root[data-side="collapsed"] .side-brand { flex: none; padding: 4px; }
  :root[data-side="collapsed"] .side-collapse .ic { transform: scaleX(-1); }
  :root[data-side="collapsed"] .side-label { height: 1px; padding: 0; margin: 4px 14px 8px; background: var(--nav-border); color: transparent; }
  :root[data-side="collapsed"] .side-group { margin-top: 8px; }
  :root[data-side="collapsed"] .side-nav a { justify-content: center; padding: 10px; }
  :root[data-side="collapsed"] .side-nav .count { position: absolute; top: 3px; right: 5px; min-width: 18px; padding: 0 5px; font-size: 10.5px; line-height: 16px; }
  :root[data-side="collapsed"] .switcher { margin: 0; }
  :root[data-side="collapsed"] .switcher > summary, :root[data-side="collapsed"] .switcher > .sw-one { justify-content: center; padding: 8px; }
  :root[data-side="collapsed"] .switcher .sw-chev { display: none; }
  :root[data-side="collapsed"] .sw-menu { right: auto; width: 280px; }
  :root[data-side="collapsed"] .side-user { justify-content: center; }
  :root[data-side="collapsed"] .side-tools { flex-direction: column; }
  :root[data-side="collapsed"] .side-btn { padding: 6px; }
}

/* переключатель компании */
.switcher { position: relative; margin: 0 0 4px; }
.switcher > summary, .switcher > .sw-one { list-style: none; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 13px;
  background: var(--nav-hover); border: 1px solid var(--nav-border); cursor: pointer; color: var(--nav-text-strong); }
.switcher > summary::-webkit-details-marker { display: none; }
.switcher > .sw-one { cursor: default; }
.switcher .sw-text { min-width: 0; flex: 1; }
.switcher .sw-name { display: block; font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher .sw-role { display: block; font-size: 11.5px; color: var(--nav-dim); }
.sw-logo { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; background: #fff; flex-shrink: 0; }
.sw-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-solid); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sw-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; padding: 6px; border-radius: var(--r-md);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); transform-origin: top center; }
.sw-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); text-decoration: none; color: var(--text); }
.sw-item .nm { flex: 1; min-width: 0; }
.sw-item .nm b { display: block; font-size: var(--fs-sm); font-weight: 600; }
.sw-item .nm span { display: block; font-size: var(--fs-xs); color: var(--text-2); }

.work { min-width: 0; display: flex; flex-direction: column; }
.side-scrim { display: none; }
.topbar { display: none; }
.main { flex: 1; padding: 32px 40px 72px; }
.inner { max-width: 1120px; margin: 0 auto; }
.inner.narrow { max-width: 760px; }

/* ---------- поверхности ---------- */
.card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 20px 22px; }
.flash { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 20px; padding: 12px 14px; border-radius: var(--r-md);
  font-size: var(--fs-md); background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok-border); }
.flash.err { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-border); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px;
  margin: 0 0 20px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--text); font-size: var(--fs-md); }
.banner-warn, .dl-note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn-border); margin-bottom: 20px; font-size: var(--fs-md); line-height: 1.5; max-width: 760px; }

/* ---------- пилюли статуса: форма + слово + цвет ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent, .pill.info { background: var(--info-soft); color: var(--info); }
.pill.ok::before { width: 8px; height: 5px; border-radius: 0; background: none; border: solid currentColor; border-width: 0 0 2px 2px;
  transform: rotate(-45deg) translate(1px, -1px); }
.pill.bad::before { border-radius: 1px; transform: rotate(45deg); }
.pill.warn::before { background: none; box-shadow: inset 0 0 0 2px currentColor; }
.pill.plain::before { display: none; }
.type-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: 1px; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px;
  border-radius: var(--r-sm); border: 0; font-size: var(--fs-md); font-weight: 600; line-height: 1.2; cursor: pointer;
  text-decoration: none; white-space: nowrap; user-select: none; -webkit-user-select: none;
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms var(--ease-out); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent-solid); color: var(--text-on-solid); box-shadow: 0 1px 2px rgba(15, 27, 45, 0.18); }
.btn-ghost, .btn-secondary { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn.danger, .btn-danger { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-border); }
.btn.lg { min-height: 46px; padding: 11px 20px; font-size: var(--fs-lg); border-radius: 10px; }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: var(--fs-sm); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.link-act { background: none; border: 0; padding: 0; color: var(--accent-text); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.link-danger { background: none; border: 0; padding: 0; color: var(--bad); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: inherit; cursor: pointer; }
form.inline { display: inline; margin: 0; }

/* ---------- поля ---------- */
label { display: block; font-size: var(--fs-sm); font-weight: 600; margin: 16px 0 6px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=number],
input[type=date], input[type=time], input[type=url], select, textarea {
  display: block; width: 100%; min-height: 40px; padding: 9px 12px; font-size: var(--fs-md);
  border-radius: var(--r-sm); border: 0; background: var(--surface); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong); outline: none; transition: box-shadow 120ms ease; }
textarea { line-height: 1.5; resize: vertical; }
input[type=date], input[type=time] { height: 40px; line-height: 1.2; }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: inset 0 0 0 1px var(--accent-solid), 0 0 0 3px var(--accent-ring); outline: none; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-md); font-weight: 400; margin: 14px 0 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent-solid); }
.hint { font-size: var(--fs-xs); color: var(--text-2); margin-top: 6px; }
.search { position: relative; flex: 1; min-width: 200px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input { padding-left: 38px; }
.toolbar, .cl-search { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 18px; }
.toolbar select { width: auto; }
.cl-search input[type=search] { flex: 1; min-width: 220px; }

/* ---------- таблицы и списки ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
th { text-align: start; padding: 10px 16px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.link-row { cursor: pointer; }
.list { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-1); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--border); }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 14px 18px;
  color: inherit; text-decoration: none; transition: background-color 120ms ease; }
.list-row .t { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .m { grid-column: 1; font-size: var(--fs-sm); color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.list-row .end { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.empty { padding: 44px 24px; text-align: center; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.empty .ic { width: 28px; height: 28px; color: var(--text-3); margin-bottom: 10px; }
.empty .t { font-size: var(--fs-lg); font-weight: 650; margin-bottom: 4px; }
.empty .d { color: var(--text-2); max-width: 380px; margin: 0 auto 16px; text-wrap: pretty; }

/* ---------- обзор подрядчика ---------- */
.attention { display: grid; gap: 0; overflow: hidden; }
.att-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 18px;
  color: inherit; text-decoration: none; transition: background-color 120ms ease; }
.att-row + .att-row { border-top: 1px solid var(--border); }
.att-ic { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.att-ic.warn { background: var(--warn-soft); color: var(--warn); }
.att-ic.bad { background: var(--bad-soft); color: var(--bad); }
.att-ic.info { background: var(--info-soft); color: var(--info); }
.att-ic.ok { background: var(--ok-soft); color: var(--ok); }
.att-text b { display: block; font-weight: 650; }
.att-text span { display: block; font-size: var(--fs-sm); color: var(--text-2); }
.att-count { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: end; }
.att-go { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--accent-text); }
.att-calm { display: flex; align-items: center; gap: 14px; padding: 18px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: block; padding: 16px 18px; color: inherit; text-decoration: none; background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); transition: box-shadow 150ms ease; }
.kpi .l { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.kpi .n { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .h { font-size: var(--fs-xs); color: var(--text-3); margin-top: 6px; }

.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-item .row { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); margin-bottom: 6px; }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent-solid); }
.bar-fill.ok { background: var(--ok); } .bar-fill.warn { background: var(--warn); } .bar-fill.bad { background: var(--bad); }

/* старые плитки и блоки (разделы, ещё не переделанные) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: var(--fs-sm); color: var(--text-2); }
.dash-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 0 0 28px; }
.dash-box { padding: 16px 18px; }
.dash-title { font-size: var(--fs-md); margin: 0 0 10px; }
.dash-list { display: flex; flex-direction: column; gap: 8px; }
.dash-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); }

/* клиенты (раздел подрядчика) */
.cl-list { display: flex; flex-direction: column; gap: 10px; }
.cl-card { padding: 0; }
.cl-card > summary { list-style: none; cursor: pointer; }
.cl-card > summary::-webkit-details-marker { display: none; }
.cl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 15px 18px; }
.cl-head::before { content: ""; width: 7px; height: 7px; border: solid var(--text-3); border-width: 0 2px 2px 0; transform: rotate(-45deg);
  transition: transform 150ms var(--ease-out); margin-right: 2px; }
.cl-card[open] > .cl-head::before { transform: rotate(45deg); }
.cl-name { font-weight: 650; font-size: var(--fs-lg); }
.cl-inn { font-size: var(--fs-sm); font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.cl-meta { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.cl-table { margin: 0 14px 14px; box-shadow: inset 0 0 0 1px var(--border); }
.cl-sub { border-top: 1px solid var(--border); }
.cl-sub > summary { cursor: pointer; padding: 11px 18px; font-size: var(--fs-sm); font-weight: 600; color: var(--accent-text); }
.cl-select { width: auto; min-height: 32px; padding: 4px 8px; font-size: var(--fs-sm); }
.cl-connect { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 0 18px 14px;
  padding: 10px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1.5; background: var(--surface-2); }
.cl-connect-available, .cl-connect-disconnected_by_you { background: var(--accent-soft); }
.cl-connect-declined_by_customer { background: var(--warn-soft); }
.cl-shared { margin-top: 5px; font-size: var(--fs-xs); color: var(--warn); max-width: 420px; }
.cl-subdivisions { border-top: 1px solid var(--border); padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.cl-subdivisions-title { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; color: var(--text-3); padding: 2px 4px; text-transform: uppercase; }
.cl-card-nested { box-shadow: inset 0 0 0 1px var(--border); }
.cl-manager, .cl-own { padding: 0 18px 12px; font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.cl-own-label { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; margin: 0; font-weight: 400; }

/* данные компании, загрузка */
.data-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: end; padding: 18px; max-width: 900px; }
.data-form label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-weight: 500; color: var(--text-2); }
.data-examples { display: flex; flex-direction: column; gap: 10px; margin: 0 0 26px; max-width: 1100px; }
.data-example > summary { cursor: pointer; padding: 12px 18px; }
.data-hints { margin: 0; padding: 0 18px 10px 36px; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.6; }
.data-preview { padding: 20px 22px; margin-bottom: 22px; max-width: 900px; box-shadow: inset 0 0 0 1px var(--accent-solid), var(--shadow-1); }
.data-counts { display: flex; flex-wrap: wrap; gap: 10px; }
.data-counts > div { display: flex; flex-direction: column; min-width: 110px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface-2); }
.data-counts .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.data-counts .l { font-size: var(--fs-xs); color: var(--text-2); }
.data-counts .bad .n { color: var(--bad); }
.data-issues { margin-top: 12px; font-size: var(--fs-sm); }
.data-issues summary { cursor: pointer; font-weight: 600; color: var(--bad); }
.data-issues.warn summary { color: var(--warn); }
.data-issues ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; max-height: 280px; overflow: auto; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.dl-card { padding: 20px 22px; }
.dl-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.dl-how { margin-top: 14px; font-size: var(--fs-sm); }
.dl-how summary { cursor: pointer; color: var(--accent-text); font-weight: 600; }
.dl-how ol { margin: 10px 0 0; padding-left: 20px; line-height: 1.6; color: var(--text-2); }
.dl-sum { margin: 10px 0 0; font-size: 11.5px; color: var(--text-3); word-break: break-all; }
.dl-sum code, code { font-family: var(--font-data); }
.client-door { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin: 0 0 20px; }
.req-form .input { margin-top: 4px; }
/* компания: реквизиты | логотип и согласование */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.logo-box { display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 14px; border-radius: var(--r-md);
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; box-shadow: inset 0 0 0 1px var(--border); }
.logo-box img { max-height: 72px; max-width: 100%; object-fit: contain; }
.file-input { font-size: var(--fs-sm); color: var(--text-2); }
.file-input::file-selector-button { margin-right: 10px; padding: 7px 12px; border: 0; border-radius: var(--r-sm); background: var(--surface-sunken);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.danger-zone { box-shadow: var(--shadow-1), inset 0 0 0 1px var(--bad-border); }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }

/* таблица «название — значение», списки и шаги */
table.kv { font-size: var(--fs-md); }
table.kv td { padding: 9px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
table.kv td:first-child { width: 42%; padding-right: 14px; color: var(--text-2); }
table.kv tr:last-child td { border-bottom: 0; }
.ticks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: var(--fs-md); line-height: 1.55; }
.ticks li { position: relative; padding-left: 22px; text-wrap: pretty; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-solid); opacity: 0.7; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.steps { font-size: var(--fs-md); line-height: 1.6; }
.steps ol { margin: 10px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.dl-note .ic { flex-shrink: 0; margin-top: 2px; }

/* внутренняя проверка: документ слева, решение справа */
.review-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 1.2fr); gap: 14px 24px; align-items: center; padding: 16px 18px; }
.review-doc { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.review-act { display: flex; flex-direction: column; gap: 8px; margin: 0; }
@media (max-width: 860px) { .review-row { grid-template-columns: minmax(0, 1fr); } }

/* заявки клиента: выбор подрядчиков, ответы карточками */
.choice-list { display: flex; flex-direction: column; gap: 6px; }
.choice-list .choice { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); font-weight: 500; cursor: pointer; }
.choice input { width: 18px; height: 18px; accent-color: var(--accent-solid); margin: 0; flex-shrink: 0; }
.choice:has(input:checked) { background: var(--accent-soft); }
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.offer { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.offer .t { font-size: var(--fs-lg); }
.offer .price { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.offer.won { box-shadow: var(--shadow-1), inset 0 0 0 2px var(--ok); }
.offer.muted-offer { opacity: 0.7; }

/* аналитика клиента */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 16px 18px; }
.filter-bar input[type=date] { width: auto; }
.chart-box { position: relative; height: 240px; }

/* команда */
.person-av { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: var(--fs-sm); }
.join-row { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 14px 18px; }
.join-row > div:first-child { flex: 1; min-width: 200px; }
.join-act { display: flex; align-items: center; gap: 8px; margin: 0; }
.three-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }

/* подписка */
.plan-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px 28px; align-items: start; padding: 24px; }
.plan-name { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.plan-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-stat { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); }
.plan-stat .l { font-size: var(--fs-sm); color: var(--text-2); }
.plan-stat .n { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.plan-stat .n .faint { font-size: var(--fs-lg); font-weight: 600; }
.plan-stat .h { font-size: var(--fs-xs); color: var(--text-3); margin-top: 8px; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.plan-option { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 18px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.plan-option.current { box-shadow: var(--shadow-1), inset 0 0 0 2px var(--accent-solid); }
.plan-option .t { font-size: var(--fs-lg); }
.plan-option .price { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 4px 0 6px; }
@media (max-width: 900px) { .plan-card { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .plan-stats { grid-template-columns: minmax(0, 1fr); } }

/* формы в кабинете подрядчика: подписи над полями, ровный ритм */
.main .decision { top: 24px; }
.field-stack { display: flex; flex-direction: column; gap: 14px; }
.field-stack h2, .task-form .decision h2 { margin: 0; }
.task-form label, .field-label { display: block; margin: 0 0 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
input.lg { min-height: 46px; font-size: var(--fs-lg); font-weight: 550; }
/* форма ответа на заявку (панель справа) */
.answer-form { display: flex; flex-direction: column; gap: 14px; }
.answer-form label { margin: 0 0 6px; }
.answer-form h2 { margin: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.answer-edit > summary { list-style: none; }
.answer-edit > summary::-webkit-details-marker { display: none; }
.answer-edit[open] > summary { display: none; }
.seg-field legend { padding: 0; margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface-sunken); }
.seg label { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 32px; padding: 4px 10px; border-radius: 7px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); transition: background-color 120ms ease, color 120ms ease; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg input:focus-visible + span { outline: 2px solid var(--accent-solid); outline-offset: 1px; }

/* ---------- ЛК клиента: каркас ---------- */
.ctop { position: sticky; top: 0; z-index: 40; background: var(--surface); box-shadow: 0 1px 0 var(--border); }
.ctop .bar { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 24px; padding: 0 24px; min-height: 60px; }
.cbrand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.cbrand img { width: 28px; height: 28px; border-radius: 7px; }
.cbrand .sub { color: var(--text-3); font-weight: 500; }
.ctabs { display: flex; align-self: stretch; gap: 4px; }
.ctabs a { position: relative; display: inline-flex; white-space: nowrap; align-items: center; gap: 8px; padding: 0 12px; color: var(--text-2); text-decoration: none;
  font-weight: 550; font-size: var(--fs-md); }
.ctabs a[aria-current="page"] { color: var(--text); }
.ctabs a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent-solid); }
.ctabs .count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 11.5px; font-weight: 700; text-align: center; }
.cright { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.cbrand { white-space: nowrap; flex-shrink: 0; }
.umenu { position: relative; }
.umenu > summary { list-style: none; display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; border-radius: 999px; cursor: pointer; color: var(--text-2); }
.umenu > summary::-webkit-details-marker { display: none; }
.umenu .avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: var(--fs-sm); }
.umenu-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 240px; padding: 6px; border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-pop); }
.umenu-who { padding: 8px 10px 10px; font-size: var(--fs-sm); color: var(--text-2); border-bottom: 1px solid var(--border); margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.umenu-pop a, .umenu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0;
  border-radius: var(--r-sm); background: none; color: var(--text); font-size: var(--fs-md); text-decoration: none; cursor: pointer; text-align: start; }
.org-bar { background: var(--surface-2); box-shadow: 0 1px 0 var(--border); }
.org-inner { max-width: 1120px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; }
.org-name { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.org-meta { font-size: var(--fs-sm); margin-top: 1px; }
.org-filters { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.org-switch { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); margin: 0; }
.org-switch label { margin: 0; font-weight: 500; color: var(--text-2); }
.org-switch select { width: auto; max-width: 300px; min-height: 34px; padding: 5px 10px; font-size: var(--fs-sm); }
.cmain { max-width: 1120px; width: 100%; margin: 0 auto; padding: 28px 24px 80px; }
.link { background: none; border: 0; padding: 0; color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.back { margin-bottom: 18px; }
.ctabbar { display: none; }

/* карточки «ждут решения» */
.decide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.decide { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--shadow-1), inset 3px 0 0 var(--warn); color: inherit; text-decoration: none; }
.decide .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.decide .doc { font-size: var(--fs-lg); font-weight: 700; }
.decide .what { color: var(--text-2); font-size: var(--fs-sm); }
.decide .sum { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.decide .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px; border-radius: 999px; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.chip[aria-current="true"] { background: var(--text); color: var(--surface); box-shadow: none; }
.chip .n { font-variant-numeric: tabular-nums; opacity: 0.75; }

/* документ клиента */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.doc-layout > .decision { grid-column: 2; grid-row: 1; }
.doc-layout > .doc-main { grid-column: 1; grid-row: 1; min-width: 0; }
.doc-head { margin-bottom: 22px; }
.doc-kind { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.doc-head h1 { margin: 6px 0 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 24px; padding: 18px 20px; }
.facts dt { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 3px; }
.facts dd { margin: 0; font-weight: 550; }
.block { margin-top: 26px; }
.block > h2 { margin: 0 0 12px; font-size: var(--fs-lg); font-weight: 650; }
.prose { margin: 0; font-size: 15px; line-height: 1.65; max-width: 68ch; text-wrap: pretty; }
.defects { display: flex; flex-direction: column; }
.defect { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 4px 14px; padding: 14px 18px; align-items: start; }
.defect + .defect { border-top: 1px solid var(--border); }
.defect .n { font-family: var(--font-data); color: var(--text-3); padding-top: 1px; }
.defect .d { font-weight: 550; }
.defect .r { grid-column: 2; font-size: var(--fs-sm); color: var(--text-2); }
.defect .g { grid-column: 2; font-size: var(--fs-xs); color: var(--text-3); }
.estimate td.r, .estimate th.r { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.estimate tfoot td { font-weight: 700; background: var(--surface-2); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media { overflow: hidden; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.media .pic { aspect-ratio: 4 / 3; background: var(--surface-sunken); display: flex; align-items: center; justify-content: center; position: relative; }
.media img { width: 100%; height: 100%; object-fit: cover; outline: 1px solid var(--img-outline); outline-offset: -1px; }
.media .cap { padding: 8px 11px; font-size: var(--fs-xs); color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.decision { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.decision.pending { box-shadow: var(--shadow-2), inset 0 3px 0 var(--warn); }
.decision.approved { box-shadow: var(--shadow-2), inset 0 3px 0 var(--ok); }
.decision.rejected { box-shadow: var(--shadow-2), inset 0 3px 0 var(--bad); }
.decision .total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.decision .total b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.decision textarea { min-height: 76px; }
.decision .actions { display: flex; flex-direction: column; gap: 8px; }
.decision .quote { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--fs-sm); line-height: 1.5; }
.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding: 10px 0; }
.tl .dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.tl .dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.tl .t { font-weight: 600; }
.tl .m { font-size: var(--fs-xs); color: var(--text-2); }
.tl .c { margin-top: 6px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); font-size: var(--fs-sm); }

/* ---------- наведение — только где оно есть ---------- */
@media (hover: hover) and (pointer: fine) {
  .side-nav a:hover { background: var(--nav-hover); color: var(--nav-text-strong); }
  .side-btn:hover, .side-user:hover, .side-brand:hover, .side-collapse:hover, .side-close:hover { background: var(--nav-hover); color: var(--nav-text-strong); }
  .switcher > summary:hover { background: var(--nav-active); }
  .sw-item:hover { background: var(--surface-hover); }
  .btn-primary:hover { background: var(--accent-solid-hover); }
  .btn-ghost:hover, .btn-secondary:hover, .btn-quiet:hover { background: var(--surface-hover); }
  .icon-btn:hover { background: var(--surface-hover); }
  .list-row:hover, .att-row:hover, tr.link-row:hover td { background: var(--surface-hover); }
  .kpi:hover, .decide:hover { box-shadow: var(--shadow-2); }
  .decide:hover { box-shadow: var(--shadow-2), inset 3px 0 0 var(--warn); }
  .ctabs a:hover { color: var(--text); }
  .umenu > summary:hover { background: var(--surface-hover); }
  .umenu-pop a:hover, .umenu-pop button:hover { background: var(--surface-hover); }
  .chip:hover { color: var(--text); }
  .link:hover { color: var(--text); }
}

/* ---------- узкие экраны ---------- */
.ctabs { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ctabs::-webkit-scrollbar { display: none; }
@media (max-width: 1240px) { .ctabs a .ic { display: none; } .ctabs a { padding: 0 10px; } }
@media (max-width: 1020px) { .cbrand .sub { display: none; } }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .decision { position: static; }
  .doc-layout > .decision, .doc-layout > .doc-main { grid-column: auto; grid-row: auto; }
}
@media (max-width: 960px) {
  .shell, :root[data-side="collapsed"] .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: 10px; bottom: 10px; left: 10px; z-index: 70; height: auto; margin: 0; width: min(84vw, 300px);
    transform: translateX(calc(-100% - 20px)); transition: transform 240ms var(--ease-out);
    padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  body.side-open .side { transform: none; box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--nav-border); }
  .side-collapse { display: none; }
  .side-close { display: inline-flex; }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(7, 14, 28, 0.5); opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
  body.side-open .side-scrim { opacity: 1; pointer-events: auto; }
  body.side-open { overflow: hidden; }
  .topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 8px; min-height: 56px;
    padding: env(safe-area-inset-top) 12px 0; background: var(--surface); box-shadow: 0 1px 0 var(--border); }
  .topbar .t { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding: 20px 16px 56px; }
  .page-title, h1.h { font-size: 22px; }
}
/* ЛК клиента: нижняя панель вместо вкладок — пока вкладки не помещаются целиком. */
@media (max-width: 960px) {
  .ctop .bar { padding: 0 14px; gap: 12px; min-height: 54px; }
  .ctabs, .umenu { display: none; }
  .org-inner { padding: 10px 14px; }
  .cmain { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
  .ctabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--surface); box-shadow: 0 -1px 0 var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .ctabbar a, .ctabbar summary { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 9px;
    color: var(--text-2); text-decoration: none; font-size: 11px; font-weight: 600; list-style: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
  .ctabbar summary::-webkit-details-marker { display: none; }
  .ctabbar a[aria-current="page"] { color: var(--accent-text); }
  .ctabbar details { position: relative; }
  .ctabbar .more { position: absolute; bottom: calc(100% + 8px); right: 8px; min-width: 220px; padding: 6px; border-radius: var(--r-md);
    background: var(--surface); box-shadow: var(--shadow-pop); }
  .ctabbar .more a, .ctabbar .more button { flex-direction: row; justify-content: flex-start; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px;
    border-radius: var(--r-sm); border: 0; background: none; font-size: var(--fs-md); font-weight: 500; color: var(--text); }
}
@media (max-width: 760px) {
  input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=number],
  input[type=date], input[type=time], input[type=url], select, textarea { font-size: 16px; }
  .list-row { padding: 13px 14px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .n { font-size: 24px; }
  /* Смета на телефоне: наименование, под ним «кол-во × цена» и сумма справа. */
  table.estimate thead { display: none; }
  table.estimate tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.estimate td { padding: 0; border: 0; }
  table.estimate tbody td:first-child { flex-basis: 100%; }
  table.estimate td.q, table.estimate td.p { color: var(--text-2); font-size: var(--fs-sm); }
  table.estimate td.p::before { content: "× "; color: var(--text-3); }
  table.estimate td.s { margin-left: auto; font-weight: 700; }
  table.estimate tfoot tr { border-bottom: 0; background: var(--surface-2); }
  table.estimate tfoot td { background: none; }
  /* Таблица на телефоне — карточками: первая ячейка во всю ширину,
     остальные под ней строкой с переносом. Без прокрутки вбок. */
  table.stack thead { display: none; }
  table.stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 13px 14px; border-bottom: 1px solid var(--border); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { padding: 0; border: 0; text-align: start !important; }
  table.stack td:first-child { flex-basis: 100%; }
  table.stack td:empty { display: none; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; }
}

/* обучение (создаёт cabinet.js): затемнение с «окном» вокруг кнопки и подсказка */
.tour { position: fixed; inset: 0; z-index: 200; }
.tour-hole { position: fixed; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--accent-solid), 0 0 0 100vmax rgba(5, 10, 22, 0.7);
  transition: left 260ms var(--ease-out), top 260ms var(--ease-out), width 260ms var(--ease-out), height 260ms var(--ease-out); }
.tour-hole::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; border: 3px solid var(--accent-solid);
  animation: tour-pulse 1.6s var(--ease-out) infinite; }
.tour.no-target .tour-hole { box-shadow: 0 0 0 100vmax rgba(5, 10, 22, 0.7); }
.tour.no-target .tour-hole::after { display: none; }
@keyframes tour-pulse { from { opacity: 0.8; transform: scale(1); } to { opacity: 0; transform: scale(1.12); } }
.tour-card { position: fixed; width: min(360px, calc(100vw - 24px)); padding: 18px 18px 14px; border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
  transition: left 260ms var(--ease-out), top 260ms var(--ease-out); }
.tour-count { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tour-title { margin: 4px 0 6px; font-size: 17px; font-weight: 650; line-height: 1.25; text-wrap: balance; }
.tour-body { margin: 0; font-size: var(--fs-sm); line-height: 1.5; color: var(--text-2); text-wrap: pretty; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }
.tour-nav { display: flex; gap: 8px; margin-left: auto; }
.tour [hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .tour-hole::after { animation: none; display: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .btn:active { transform: none; }
}
@media print {
  .side, .topbar, .ctop, .ctabbar, .decision .actions { display: none !important; }
  .shell { display: block; }
}
