/* BAITECH CRM — единый стиль. Сине-зелёная гамма.
   Цвета заданы переменными: чтобы сменить палитру, правятся только они.
   (Это рабочая палитра, не брендбук BAITECH: официальные HEX согласовать по исходникам.) */

/* BAITECH CRM — единый стиль (дизайн из прототипа: тёмная боковая панель, плоские карточки, синий акцент).
   Все цвета заданы переменными: палитру можно сменить, правя только их.
   (Рабочая палитра, не брендбук BAITECH: официальные HEX согласовать по исходникам.) */

:root {
  --side: #0E2E5B; --side-ink: #C3D0E3; --side-act: #1A3F75; --side-mark: #038D4B;
  --accent: #0E2E5B; --accent-hover: #1A3F75; --accent-ink: #ffffff;
  --primary: #038D4B; --primary-hover: #027A41; --head: "Montserrat", "Golos Text", system-ui, sans-serif;

  /* старые имена (используются в разметке разделов) */
  --navy: #0E2E5B; --blue: #0E2E5B; --blue-dark: #0E2E5B; --teal: #0E2E5B;
  --green: #038D4B; --green-dark: #027A41;

  --bg: #F0F3F7; --card: #ffffff; --text: #12233F; --muted: #5B6A80; --line: #D7DEE8; --soft: #F6F8FB;
  --danger: #B8322A; --danger-bg: #FBE7E4; --warn-bg: #FBF0D9;

  --grad: linear-gradient(135deg, #0E2E5B 0%, #0A2347 60%, #0B3B3A 140%);   /* тёмные блоки */
  --grad-btn: #038D4B;                                           /* акцентные кнопки */

  --surface-2: #F6F8FA; --field-bg: #ffffff; --field-border: #BCC6D2; --line-strong: #9AA5B2;
  --chip-blue-bg: #E7EDF6; --chip-green-bg: #E1F4EA; --chip-gray-bg: #EEF1F5; --chip-gray-fg: #5C6878;
  --ok-bg: #E1F4EA; --ok-fg: #027A41; --warn-fg: #9A5B00; --info-bg: #E4EEF7; --info-fg: #2B5C8A;
  --bubble-in: #ffffff; --bubble-out: #EAF1FC;
  color-scheme: light;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(14,46,91,.06), 0 6px 18px rgba(14,46,91,.06);
  --shadow-lg: 0 18px 50px rgba(15, 25, 38, .25);
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Тёмная тема: явный выбор (data-theme="dark") или системная (авто, без data-theme="light"). */
:root[data-theme="dark"] {
  --side: #0B1118; --side-ink: #A5B3C3; --side-act: #1B2634; --side-mark: #5B9BFF;
  --accent: #4D8DF0; --accent-hover: #6AA0F5; --accent-ink: #0B1118; --primary: #1FA866; --primary-hover: #34BF7C;
  --navy: #E4EAF1; --blue: #6AA0F5; --blue-dark: #8DB8F8; --teal: #6AA0F5; --green: #4CC38A; --green-dark: #5FD39A;
  --bg: #0E141B; --card: #151D27; --text: #E4EAF1; --muted: #94A3B5; --line: #263241; --soft: #1A2430;
  --danger: #F0877D; --danger-bg: #3B1F1D; --warn-bg: #3A2F12;
  --grad: linear-gradient(135deg, #0B1118 0%, #1B2634 100%); --grad-btn: #4D8DF0;
  --surface-2: #1A2430; --field-bg: #101821; --field-border: #34445A; --line-strong: #4A5B72;
  --chip-blue-bg: #1B3050; --chip-green-bg: #14392E; --chip-gray-bg: #212C3A; --chip-gray-fg: #A9B7C8;
  --ok-bg: #14392E; --ok-fg: #6FE0B5; --warn-fg: #F0C660; --info-bg: #1B3050; --info-fg: #8DB8F8;
  --bubble-in: #1A2430; --bubble-out: #1B3050;
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --side: #0B1118; --side-ink: #A5B3C3; --side-act: #1B2634; --side-mark: #5B9BFF;
    --accent: #4D8DF0; --accent-hover: #6AA0F5; --accent-ink: #0B1118; --primary: #1FA866; --primary-hover: #34BF7C;
    --navy: #E4EAF1; --blue: #6AA0F5; --blue-dark: #8DB8F8; --teal: #6AA0F5; --green: #4CC38A; --green-dark: #5FD39A;
    --bg: #0E141B; --card: #151D27; --text: #E4EAF1; --muted: #94A3B5; --line: #263241; --soft: #1A2430;
    --danger: #F0877D; --danger-bg: #3B1F1D; --warn-bg: #3A2F12;
    --grad: linear-gradient(135deg, #0B1118 0%, #1B2634 100%); --grad-btn: #4D8DF0;
    --surface-2: #1A2430; --field-bg: #101821; --field-border: #34445A; --line-strong: #4A5B72;
    --chip-blue-bg: #1B3050; --chip-green-bg: #14392E; --chip-gray-bg: #212C3A; --chip-gray-fg: #A9B7C8;
    --ok-bg: #14392E; --ok-fg: #6FE0B5; --warn-fg: #F0C660; --info-bg: #1B3050; --info-fg: #8DB8F8;
    --bubble-in: #1A2430; --bubble-out: #1B3050;
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; color: var(--navy); font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 .75rem; }

/* ---------- Каркас: боковая панель + верхняя панель ---------- */
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.app { display: flex; min-height: 100vh; }
.side { width: 248px; background: var(--side); color: var(--side-ink); flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px 24px; }
.side .brand { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px 16px; color: #fff; font-weight: 750; font-size: 19px; letter-spacing: .06em; margin: 0; }
.side .brand small { font-weight: 500; letter-spacing: 0; font-size: 12px; color: var(--side-ink); }
.side .brand:hover { color: #fff; text-decoration: none; }
.side h5 { margin: 14px 10px 4px; font-size: 12px; font-weight: 500; color: #7F8EA0; }
.side a:not(.brand) { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--side-ink); min-height: 40px; font-size: 14px; }
.side a:not(.brand):hover { background: var(--side-act); color: #fff; text-decoration: none; }
.side a.on { background: var(--side-act); color: #fff; box-shadow: inset 3px 0 0 var(--side-mark); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top h1 { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.top .sp { flex: 1; }
.burger { display: none; }
.gsearch { position: relative; width: min(300px, 30vw); margin: 0; }
.gsearch input { width: 100%; padding-left: 34px; min-height: 40px; margin: 0; }
.gsearch svg { position: absolute; left: 9px; top: 10px; color: var(--muted); pointer-events: none; }
.ibtn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; border-radius: 7px; cursor: pointer; color: var(--text); text-decoration: none; }
.ibtn:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.cnt { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 650; }
.ibtn .cnt { position: absolute; top: 4px; right: 2px; }
.umenu { position: relative; }
.umenu summary { list-style: none; }
.umenu summary::-webkit-details-marker { display: none; }
.userb { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 12px 4px 4px; cursor: pointer; min-height: 40px; }
.ava { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--chip-blue-bg); color: var(--accent); font-weight: 650; font-size: 13px; flex: none; }
.uname { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.umenu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 30; display: grid; gap: 2px; }
.umenu-pop a, .umenu-pop button { display: flex; align-items: center; min-height: 40px; padding: 0 10px; border-radius: 7px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; width: 100%; text-align: left; text-decoration: none; }
.umenu-pop a:hover, .umenu-pop button:hover { background: var(--surface-2); }
.umenu-pop form { margin: 0; }
.umenu-pop .small { padding: 4px 10px; }
.scrim-nav, .bnav { display: none; }

/* ---------- Контент ---------- */
#view { padding: 20px; max-width: 1500px; width: 100%; }
body.auth #view { max-width: none; padding: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card h1, .card h2 { display: flex; align-items: center; gap: .5rem; }
.card.accent { position: relative; overflow: hidden; padding-top: 1.5rem; }
.card.accent::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--accent); }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }

.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: .5rem; }
.toolbar h1, .toolbar h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--primary, var(--accent));
  color: #fff;
  border: 1px solid var(--primary, var(--accent));
  border-radius: 7px;
  padding: 0 14px;
  min-height: 40px;
  font: inherit; font-weight: 550; font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { color: #fff; text-decoration: none; background: var(--primary-hover, var(--accent-hover)); border-color: var(--primary-hover, var(--accent-hover)); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(1.1); color: #fff; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.actions form { margin: 0; }

/* ---------- Формы ---------- */
form > div, form .field { margin-bottom: 1rem; }
label { display: block; font-size: .875rem; font-weight: 600; color: var(--navy); margin-bottom: .3rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=url], input[type=search], select, textarea {
  width: 100%;
  padding: .65rem .8rem;
  min-height: 40px;
  border: 1px solid var(--field-border);
  border-radius: 7px;
  background: var(--field-bg);
  font: inherit;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus, input[type=search]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 95, 209, .16);
  outline: none;
}
input[type=file] {
  width: 100%;
  padding: .5rem;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--soft);
  font: inherit;
  color: var(--muted);
}
input[type=file]::file-selector-button {
  margin-right: .75rem;
  padding: .45rem .9rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit; font-weight: 600;
  cursor: pointer;
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--teal); vertical-align: middle; }
/* Чекбокс слева от подписи */
form div:has(> input[type=checkbox]) { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: .5rem; }
form div:has(> input[type=checkbox]) label { margin: 0; font-weight: 500; }
.helptext, form .helptext { display: block; color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.errorlist { list-style: none; padding: .4rem .7rem; margin: .3rem 0; border-radius: 8px; background: var(--danger-bg); color: var(--danger); font-size: .875rem; }
form ul:not(.errorlist) { color: var(--muted); font-size: .8rem; padding-left: 1.1rem; margin: .25rem 0; }

.est-row { background: var(--soft); border-style: dashed; box-shadow: none; padding: 1rem 1.1rem; margin-bottom: .75rem; }
.est-row > div:last-child { margin-bottom: 0; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 0 -.25rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tbody tr:hover td { background: var(--surface-2); }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; background: none; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Бейджи (текст + точка, не только цвет) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12.5px; font-weight: 550;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.founder { background: var(--chip-blue-bg); color: var(--blue-dark); }
.badge.accountant { background: var(--chip-green-bg); color: var(--green-dark); }
.badge.employee { background: var(--chip-gray-bg); color: var(--chip-gray-fg); }
.badge.on { background: var(--chip-green-bg); color: var(--green-dark); }
.badge.off { background: var(--danger-bg); color: var(--danger); }

/* ---------- Сообщения ---------- */
.msg { padding: .75rem 1rem; border-radius: 10px; margin-bottom: .75rem; background: var(--ok-bg); color: var(--ok-fg); border-left: 4px solid var(--green); }
.msg.error { background: var(--danger-bg); color: var(--danger); border-left-color: var(--danger); }
.msg.warning { background: var(--warn-bg); color: var(--warn-fg); border-left-color: #e0a100; }

/* ---------- Главная: плитки ---------- */
.hero { background: var(--grad); color: #fff; border: 0; position: relative; overflow: hidden; }
.hero h1 { color: #fff; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.hero .badge { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255,255,255,.25); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.tile {
  display: block; padding: 1.1rem 1.25rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s;
}
a.tile:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.tile .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.25rem; background: var(--chip-blue-bg); color: var(--accent); margin-bottom: .6rem; }
.tile strong { display: block; color: var(--navy); }
.tile.soon { opacity: .65; border-style: dashed; }

/* ---------- Детали проекта ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.kv .item { background: var(--soft); border-radius: 10px; padding: .8rem 1rem; }
.kv .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.kv .value { font-size: 1.35rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.file-link { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; padding-top: .75rem; }

/* ---------- Страница входа и «узкие» страницы ---------- */
body.auth { background: var(--grad); display: flex; flex-direction: column; }
body.auth #view { margin: auto; width: 100%; max-width: 440px; padding: 2rem 1rem; }
body.auth .card { box-shadow: var(--shadow-lg); border: 0; padding: 2rem; }
.auth-brand { text-align: center; color: #fff; margin-bottom: 1.25rem; }
.auth-brand .logo { width: 56px; height: 56px; font-size: 1.5rem; margin: 0 auto .6rem; }
.auth-brand h1 { color: #fff; margin: 0; letter-spacing: .08em; }
.auth-brand p { opacity: .85; margin: .2rem 0 0; }

/* ---------- Вкладки проекта ---------- */
.tabs { display: flex; gap: 2px; margin: 0 0 16px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tabs a { padding: 10px 13px; color: var(--muted); font-weight: 550; font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; min-height: 44px; display: inline-flex; align-items: center; }
.tabs a:hover { color: var(--accent); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Проектирование ---------- */
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.stage .step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; font-size: .9rem; }
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.file-row .fname { flex: 1 1 140px; word-break: break-all; font-size: .9rem; }

/* ---------- Окно предпросмотра ---------- */
dialog.preview { width: min(1000px, 96vw); height: 92vh; padding: 0; border: 0; border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.preview[open] { display: flex; flex-direction: column; }
dialog.preview::backdrop { background: rgba(10, 46, 77, .65); }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--soft); border-bottom: 1px solid var(--line); }
.preview iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------- Товары ---------- */
.searchbar { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.searchbar input { flex: 1 1 220px; width: auto; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.product-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.product-photo { aspect-ratio: 4 / 3; background: var(--soft); display: grid; place-items: center; overflow: hidden; }
.product-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.product-body .actions { margin-top: auto; padding-top: .5rem; }
.price { font-weight: 700; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.form-photo { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); }

.thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--soft); flex: none; display: block; }
.thumb-ph { display: grid; place-items: center; font-size: 1.3rem; color: var(--muted); }
.thumb-ph.big { font-size: 3rem; width: auto; height: auto; background: none; }

/* ---------- Подборщик товаров (снабжение) ---------- */
.picker { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.picker .card { margin-bottom: 0; }
#picker-search { margin-top: .25rem; }
.picker-list { max-height: 520px; overflow-y: auto; margin-top: .75rem; }
.pick-row, .cart-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.pick-row:last-child, .cart-row:last-child { border-bottom: 0; }
.pick-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-info strong { overflow-wrap: anywhere; }
.pick-row .btn, .cart-row .btn { flex: none; min-width: 44px; }
.qty { display: flex; align-items: center; gap: .35rem; flex: none; }
.qty input { width: 90px; min-height: 40px; padding: .4rem .5rem; text-align: right; }
input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192, 57, 43, .15); }
.picker-total { margin-top: .75rem; padding-top: .75rem; border-top: 2px solid var(--soft); font-weight: 600; }
.total-line { color: var(--green-dark); }
.error-text { color: var(--danger); }
.totals { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 2px solid var(--soft); }
.total-chip { background: var(--soft); color: var(--navy); font-weight: 700; padding: .25rem .8rem; border-radius: 999px; font-variant-numeric: tabular-nums; }
td.photo-cell { width: 64px; }

/* ---------- Мобильная версия ---------- */
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .card { padding: 1rem; }
  .btn { width: auto; }
  .toolbar .btn { flex: 1 1 auto; }
  .tiles { grid-template-columns: 1fr; }
  th, td { padding: .55rem .5rem; }

  /* Широкие таблицы превращаются в карточки */
  .table-wrap { margin: 0; overflow-x: visible; }
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .85rem; margin-bottom: .75rem; background: var(--card); }
  table.responsive td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: .4rem 0; text-align: right; }
  table.responsive td::before { content: attr(data-label); flex: 0 0 38%; text-align: left; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
  table.responsive td.row-actions { justify-content: flex-start; padding-top: .6rem; border-top: 1px solid var(--line); margin-top: .3rem; }
  table.responsive td.row-actions::before { display: none; }
  table.responsive tbody tr:hover td { background: none; }
  .tabs a { padding: .6rem .7rem; font-size: .95rem; }
  .picker { grid-template-columns: 1fr; }
  .cart-row { flex-wrap: wrap; }
  .cart-row .pick-info { flex-basis: calc(100% - 70px); }
  table.responsive td.photo-cell { justify-content: flex-start; }
  table.responsive td.photo-cell::before { display: none; }
  dialog.preview { width: 100vw; height: 100vh; border-radius: 0; max-width: 100vw; max-height: 100vh; }
}

@media (max-width: 860px) {
  .picker { grid-template-columns: 1fr; }
}

/* ---- Чат проекта ---- */
.chat-link { text-decoration: none; margin-left: .25rem; }
.chatbox { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chat-top h2 { margin: 0; font-size: 1.05rem; }
.chat-top .sub { color: var(--muted); font-size: .8rem; }
.faces { display: flex; }
.faces .avatar { width: 30px; height: 30px; font-size: .8rem; margin-left: -8px; border: 2px solid var(--surface-2); }
.faces .avatar:first-child { margin-left: 0; }
.faces .more { background: var(--soft); color: var(--muted); }
.chat-log { position: relative; height: min(62vh, 560px); overflow-y: auto; display: flex; flex-direction: column; gap: .7rem; padding: 1rem;
  background: var(--bg); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 18px 18px; scroll-behavior: smooth; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); }
.chat-empty .ico { font-size: 2.4rem; display: block; }
.day-sep { align-self: center; font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: .15rem .8rem; border-radius: 999px; }
.cm { display: flex; gap: .55rem; align-items: flex-end; max-width: min(92%, 620px); align-self: flex-start; }
.cm.mine { align-self: flex-end; flex-direction: row-reverse; }
.cm .avatar { width: 34px; height: 34px; font-size: .85rem; }
.cm .avatar.r-accountant { background: var(--green); }
.cm .avatar.r-employee { background: #6B7A8C; }
.bubble { background: var(--bubble-in); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: .5rem .8rem .35rem; box-shadow: var(--shadow); min-width: 0; }
.cm.mine .bubble { background: var(--bubble-out); border-radius: 16px 16px 4px 16px; }
.cm-name { font-weight: 700; color: var(--navy); line-height: 1.2; }
.cm-pos { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; line-height: 1.3; color: var(--blue-dark); }
.cm-pos::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cm-pos.r-accountant { color: var(--green-dark); }
.cm-pos.r-employee { color: var(--chip-gray-fg); }
.cm-type { display: block; color: var(--muted); font-size: .76rem; line-height: 1.3; }
.cm-text { margin-top: .3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-time { display: block; text-align: right; color: var(--muted); font-size: .7rem; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.chat-form { display: flex; gap: .6rem; align-items: flex-end; padding: .75rem 1rem; border-top: 1px solid var(--line); background: var(--card); position: relative; }
.chat-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 160px; border-radius: 22px; padding: .6rem 1rem; line-height: 1.4; }
.send { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; color: var(--accent-ink); font-size: 1.15rem; background: var(--accent); }
.send:disabled { opacity: .5; cursor: default; }
.send:focus-visible { outline: 3px solid rgba(14, 143, 143, .45); outline-offset: 2px; }
.counter { position: absolute; right: 4.6rem; bottom: .2rem; font-size: .7rem; color: var(--muted); }
.counter.over { color: var(--danger); font-weight: 700; }
.chat-error { color: var(--danger); margin: 0; padding: 0 1rem .5rem; font-size: .9rem; background: var(--card); }
.jump { position: sticky; bottom: 0; align-self: center; margin-top: -2.2rem; z-index: 2; }
@media (max-width: 640px) { .cm { max-width: 96%; } .chat-log { height: 58vh; padding: .6rem; } }

/* ---- Паспорт объекта ---- */
.pp-item { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; padding: .6rem .75rem; margin: .4rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.pp-item.overdue { border-color: var(--danger); background: var(--danger-bg); }
.pp-item form { margin: 0; }
.addbox summary { cursor: pointer; list-style: none; display: inline-flex; }
.addbox summary::-webkit-details-marker { display: none; }
.addbox[open] { flex-basis: 100%; }
.addbox form { margin-top: .75rem; padding: .75rem; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--soft); }
.warn-note { background: var(--warn-bg); border-left: 4px solid #e0a800; padding: .5rem .75rem; border-radius: 6px; margin: .5rem 0; }
.danger-text { color: var(--danger); }
.toolbar h2 { margin: 0; }
@media (max-width: 640px) { .pp-item { flex-direction: column; } }

/* ---- Монтажные группы ---- */
.crew { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; overflow: hidden; }
.crew-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; padding: 1rem 1.25rem; color: #fff; background: var(--grad); }
.crew-head h2 { margin: 0; color: #fff; font-size: 1.3rem; }
.crew-chief { margin-top: .4rem; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: rgba(255,255,255,.2); color: #fff; }
.pill.dim { background: rgba(255,255,255,.12); font-weight: 500; opacity: .85; }
.pill.ok { background: var(--chip-green-bg); color: var(--green-dark); margin-top: .25rem; align-self: flex-start; }
.btn.light:hover { background: rgba(255,255,255,.3); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.crew-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; padding: 1rem 1.25rem 0; }
.stat { background: var(--soft); border-radius: var(--radius); padding: .6rem .9rem; border-left: 4px solid var(--blue); }
.stat.own { border-left-color: var(--teal); }
.stat.ext { border-left-color: var(--green); }
.stat-n { display: block; font-size: 1.7rem; font-weight: 800; color: var(--navy); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: .8rem; }
.crew-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1rem 1.25rem 1.25rem; }
.crew-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; background: var(--surface-2); }
.crew-panel h3 { margin: 0 0 .6rem; font-size: 1rem; color: var(--navy); }
.crew-panel > .actions { margin-top: .6rem; }
.person { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; margin: .35rem 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.person.lead { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.person-sub { color: var(--muted); font-size: .82rem; }
.person form { margin: 0; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--accent); color: var(--accent-ink); text-transform: uppercase; }
.avatar.ext { background: var(--green); color: #fff; }
.company { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem .45rem; margin: .5rem 0; background: var(--card); }
.company-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; padding-bottom: .4rem; border-bottom: 1px dashed var(--line); }
.company-head form { margin: 0; }
.company .person { background: var(--surface-2); }
.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-ico { font-size: 2.5rem; }
.toolbar .addbox[open] { flex-basis: 100%; }
@media (max-width: 760px) {
  .crew-grid { grid-template-columns: 1fr; padding: .75rem; }
  .crew-stats { padding: .75rem .75rem 0; gap: .5rem; }
  .stat { padding: .5rem .6rem; }
  .stat-n { font-size: 1.35rem; }
  .crew-head { padding: .9rem; flex-direction: column; }
}

/* ---- Язык и тема ---- */
.tools { display: flex; gap: 6px; align-items: center; }
.tools form { margin: 0; display: inline-flex; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 0 10px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; min-height: 32px; }
.seg button.on { background: var(--chip-blue-bg); color: var(--accent); }
.theme-btn { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; min-height: 32px; font: inherit; font-size: 14px; cursor: pointer; }
.theme-btn:hover, .seg button:hover { background: var(--surface-2); }
body.auth .tools { position: fixed; top: 12px; right: 12px; z-index: 10; }
body.auth .seg, body.auth .theme-btn { background: var(--card); }

/* ---- План работ, испытания, доступ ---- */
.chip { display: inline-flex; align-items: center; padding: .1rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--chip-blue-bg); color: var(--blue-dark); }
.chip.dim { background: var(--chip-gray-bg); color: var(--chip-gray-fg); font-weight: 500; }

.plan { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.plan-item, .trial { display: flex; gap: .85rem; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.plan-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--chip-blue-bg); color: var(--blue-dark); }
.plan-body { flex: 1 1 auto; min-width: 0; }
.plan-title { font-weight: 600; overflow-wrap: anywhere; }
.plan-meta { margin-top: .35rem; }
.plan-edit { margin-top: .4rem; }
.plan-edit summary { cursor: pointer; color: var(--blue-dark); }
.plan-edit form { margin-top: .6rem; padding: .75rem; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--soft); }

.trial { display: block; margin-bottom: .75rem; border-left: 5px solid var(--line-strong); }
.trial.passed { border-left-color: var(--green); }
.trial.failed { border-left-color: var(--danger); }
.trial-main { display: flex; gap: .85rem; align-items: flex-start; }
.state-chip { flex: none; display: inline-flex; align-items: center; padding: .15rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.state-chip.pending { background: var(--chip-gray-bg); color: var(--chip-gray-fg); }
.state-chip.passed { background: var(--ok-bg); color: var(--ok-fg); }
.state-chip.failed { background: var(--danger-bg); color: var(--danger); }
.trial-last { margin: .7rem 0 0 calc(30px + .85rem); }
.trial-comment { margin-top: .3rem; padding: .5rem .7rem; border-radius: 8px; background: var(--danger-bg); color: var(--text); overflow-wrap: anywhere; }
.trial.passed .trial-comment { background: var(--ok-bg); }
.shots { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.shot { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.trial-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin: .8rem 0 0 calc(30px + .85rem); }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ok:hover { background: var(--green); filter: brightness(1.1); color: #fff; }
.btn.bad { background: var(--card); color: var(--danger); border: 1px solid var(--danger); }
.btn.bad:hover { background: var(--danger-bg); filter: none; }
.failbox summary { list-style: none; cursor: pointer; display: inline-flex; }
.failbox summary::-webkit-details-marker { display: none; }
.failbox[open] { flex-basis: 100%; }
.failbox form { margin-top: .6rem; padding: .75rem; border: 1px dashed var(--danger); border-radius: var(--radius); background: var(--danger-bg); display: grid; gap: .4rem; }
.hist { margin: .7rem 0 0 calc(30px + .85rem); }
.hist summary { cursor: pointer; }
.hist-row { padding: .5rem 0; border-top: 1px solid var(--line); display: grid; gap: .25rem; }
.trial-sum { margin-top: 1rem; }
.bar { height: 10px; border-radius: 999px; background: var(--chip-gray-bg); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--grad-btn); border-radius: 999px; }
.trial-counts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }

table.access th.c, table.access td.c { text-align: center; }
.check { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--teal); }
.check input:disabled { opacity: .6; cursor: not-allowed; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tiny { font-size: .7rem; }

@media (max-width: 640px) {
  .trial-last, .trial-actions, .hist { margin-left: 0; }
  .trial-main { flex-wrap: wrap; }
}
@media (min-width: 641px) {
  .tabs { flex-wrap: wrap; overflow: visible; }
  .tabs a { padding: .65rem .8rem; }
}

/* ---- Понятность: подсказки, ход проекта, помощь ---- */
.hint { background: var(--info-bg); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: .7rem 1rem; margin: 0 0 1rem; }
.hint summary { display: flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none; min-height: 32px; }
.hint summary::-webkit-details-marker { display: none; }
.hint-toggle { margin-left: auto; color: var(--muted); text-decoration: underline; }
.hint[open] .t-open, .hint:not([open]) .t-close { display: none; }
.hint-body { margin-top: .5rem; display: grid; gap: .35rem; }
.hint-body p { margin: 0; line-height: 1.5; }

.tab-ico { margin-right: .4rem; }
.steps-card .bar { margin: .6rem 0 .3rem; }
.next-line { margin: .4rem 0 .8rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.step-row { display: flex; align-items: center; gap: .85rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.step-row.next { border-color: var(--accent); box-shadow: 0 0 0 3px var(--chip-blue-bg); }
.step-mark { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--chip-gray-bg); color: var(--chip-gray-fg); }
.step-row.done .step-mark { background: var(--ok-bg); color: var(--ok-fg); }
.step-row.doing .step-mark { background: var(--chip-blue-bg); color: var(--blue-dark); }
.step-row.attention .step-mark { background: var(--danger-bg); color: var(--danger); }
.step-row.attention { border-color: var(--danger); }
.step-main { flex: 1 1 auto; min-width: 0; }
.step-title { font-weight: 700; }
.step-text { color: var(--muted); }
.step-row.attention .step-text { color: var(--danger); font-weight: 600; }

.hero-sub { margin: .25rem 0 .9rem; opacity: .95; }
.btn.light { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.55); box-shadow: none; }
.alert-card { border-left: 5px solid var(--danger); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.proj-rows li { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .6rem 0; border-top: 1px solid var(--line); }
.proj-rows li:first-child { border-top: 0; }
.proj-name { flex: 1 1 200px; }

.howto { margin: 0; padding-left: 1.4rem; display: grid; gap: .7rem; line-height: 1.5; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.role { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; background: var(--soft); }
.role p { margin: .5rem 0 0; line-height: 1.5; }
.glossary { margin: 0; display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: .6rem 1.2rem; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0; line-height: 1.5; }
@media (max-width: 640px) {
  .glossary { grid-template-columns: 1fr; gap: .15rem; }
  .glossary dd { margin-bottom: .6rem; }
  .step-row { flex-wrap: wrap; }
  .step-main { flex-basis: calc(100% - 60px); }
}

/* ---------- Главная: показатели ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); display: block; }
a.kpi:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.kpi .v { font-size: 26px; font-weight: 650; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.kpi.bad .v { color: var(--danger); }
.kpi.ok .v { color: var(--ok-fg); }

/* ---------- Мобильный каркас: выдвижное меню + нижняя панель ---------- */
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim-nav { display: block; position: fixed; inset: 0; background: rgba(10, 16, 24, .5); z-index: 50; }
  .burger { display: inline-grid; }
  .gsearch { display: none; }
  .uname { display: none; }
  .userb { padding: 4px; }
  .top { padding: 6px 10px; }
  #view { padding: 12px 12px 84px; }
  .bnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bnav a, .bnav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 4px 2px; font: inherit; font-size: 11.5px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: none; }
  .bnav a.on { color: var(--accent); }
  body.auth .bnav { display: none; }
}

.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 750; }
.ibtn.burger { display: none; }
.gsearch input[type=search], .gsearch input { padding-left: 36px; }
@media (max-width: 900px) { .ibtn.burger { display: inline-grid; } }

/* ---------- Иконки внутри компонентов (вместо эмодзи) ---------- */
.btn svg.ic, .file-link svg.ic, .state-chip svg.ic, summary svg.ic, .pill svg.ic { width: 16px; height: 16px; }
.btn.small svg.ic { width: 15px; height: 15px; }
.file-link svg.ic { margin-right: 2px; }
.tab-ico { display: inline-flex; margin-right: 7px; color: inherit; opacity: .8; }
.tab-ico svg.ic { width: 17px; height: 17px; }
.tile .ico svg.ic { width: 22px; height: 22px; }
.empty-ico, .chat-empty .ico { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--chip-blue-bg); color: var(--accent); font-size: 0; }
.empty-ico svg.ic, .chat-empty .ico svg.ic { width: 28px; height: 28px; }
.thumb-ph { color: var(--muted); display: inline-grid; place-items: center; }
.thumb-ph svg.ic { width: 24px; height: 24px; }
.hint-ico svg.ic { width: 20px; height: 20px; color: var(--accent); }
.step-ico { display: inline-flex; vertical-align: -4px; color: var(--accent); }
.step-ico svg.ic { width: 18px; height: 18px; }
.step-mark svg.ic { width: 16px; height: 16px; stroke-width: 2.4; }
.next-line svg.ic, .umenu-pop svg.ic, .theme-btn svg.ic { width: 17px; height: 17px; vertical-align: -3px; margin-right: 4px; }
.theme-btn { display: inline-grid; place-items: center; }
.theme-btn svg.ic { margin: 0; }
.send svg.ic { width: 20px; height: 20px; margin: 0 auto; }
.chat-link { display: inline-flex; vertical-align: middle; margin-left: 6px; color: var(--muted); }
.chat-link:hover { color: var(--accent); }
.chat-link svg.ic { width: 17px; height: 17px; }
.btn.ghost svg.ic { width: 16px; height: 16px; margin: 0; }
h2 svg.ic { width: 20px; height: 20px; vertical-align: -4px; margin-right: 6px; color: var(--accent); }
.alert-card h2 svg.ic { color: var(--danger); }

/* ---------- Команды и ход работы ---------- */
.crew-spec { color: rgba(255,255,255,.8); font-size: 13.5px; margin: 2px 0 6px; }
.crew-head .pill { margin-right: 6px; }
.pill.bad { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.send-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0 0; }
.crew .send-row { padding: 0 4px 4px; }
.send-row select { width: auto; min-width: 200px; flex: 1 1 200px; max-width: 360px; }
.toolbar .send-row { margin: 0; }
.person-tasks { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.person { flex-wrap: wrap; }
.submit-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.submit-row input[type=text] { flex: 1 1 220px; margin: 0; }
.state-chip.st-todo { background: var(--chip-gray-bg); color: var(--chip-gray-fg); }
.state-chip.st-review { background: var(--info-bg); color: var(--info-fg); }
.state-chip.st-rework { background: var(--danger-bg); color: var(--danger); }
.state-chip.st-accepted { background: var(--ok-bg); color: var(--ok-fg); }
.trial.st-rework { border-left: 4px solid var(--danger); }
.trial.st-review { border-left: 4px solid var(--accent); }
.trial.st-accepted { border-left: 4px solid var(--green); }
.trial.st-todo { border-left: 4px solid var(--line-strong); }
.plan-meta .chip svg.ic { width: 14px; height: 14px; margin-right: 3px; vertical-align: -2px; }
.warn-hint { border-left-color: var(--warn-fg); background: var(--warn-bg); }

/* ---- Снабжение: заявки / закупки / поставки */
.sup-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.sup-filters input[type=search] { flex: 2 1 220px; width: auto; }
.sup-filters select { flex: 1 1 160px; width: auto; }
.sup-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.sup-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.sup-chip:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.sup-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cnt-mini { font-weight: 700; opacity: .8; }
.sup-st { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.sup-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sup-st.pending { background: var(--chip-gray-bg); color: var(--chip-gray-fg); }
.sup-st.info { background: var(--info-bg); color: var(--info-fg); }
.sup-st.warn { background: var(--warn-bg); color: var(--warn-fg); }
.sup-st.passed { background: var(--ok-bg); color: var(--ok-fg); }
.miss { color: var(--danger); font-weight: 700; }
.miss::before { content: "● "; font-size: .7em; vertical-align: .1em; }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.row-actions form { margin: 0; }
.accept-row { display: flex; gap: .4rem; align-items: center; margin: 0; }
.accept-row input { width: 90px; min-width: 0; }
.sup-table td:nth-child(2) { min-width: 160px; }
.sup-table td, .sup-table th { padding-left: .5rem; padding-right: .5rem; }
@media (max-width: 900px) { .row-actions { justify-content: flex-start; flex-wrap: wrap; } }
.sup-table th { white-space: normal; line-height: 1.2; }
.sup-table td:nth-child(4) { white-space: nowrap; }
.addbox input[type=date] { width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; min-height: 42px; }
.qty-in { width: 110px; min-width: 0; }
.chip.vol { font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: .55em; font-weight: 600; color: var(--muted); }


/* ---- Фирменный стиль БАЙТЕХ (из прототипа): синий #0E2E5B, зелёный #038D4B, заголовки Montserrat ---- */
h1, h2, h3, h4, .kpi .v { font-family: var(--head); letter-spacing: -.01em; }
body { background-color: var(--bg); background-image: radial-gradient(rgba(14,46,91,.07) 1px, transparent 1px); background-size: 22px 22px; }
.side { background: linear-gradient(180deg, #0E2E5B 0%, #0B2650 55%, #0A2347 100%); }
.side .brand { align-items: flex-end; padding: 8px 10px 18px; }
.side .brand img { height: 22px; display: block; }
.side .brand small { font: 700 11px var(--head); letter-spacing: .08em; color: #fff; background: var(--green); border-radius: 4px; padding: 2px 6px; line-height: 1.3; }
.side a:not(.brand).on { box-shadow: inset 3px 0 0 var(--green); }
.card, .kpi, .crew { box-shadow: var(--shadow); }
.btn.secondary, .btn.ghost { color: var(--text); }
:root[data-theme="dark"] body { background-image: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { background-image: none; } }

/* --- график работ */
.gantt-axis { position: relative; height: 1.4rem; margin-left: 38%; font-size: .75rem; color: var(--muted, #6b7a90); }
.gantt-axis span { position: absolute; transform: translateX(-50%); }
.gantt-row { display: grid; grid-template-columns: 38% 1fr; align-items: center; gap: .4rem .8rem; padding: .45rem 0; border-top: 1px solid #e6ecf3; }
.gantt-track { position: relative; height: 18px; background: #f1f5f9; border-radius: 9px; }
.gantt-bar { position: absolute; top: 3px; height: 12px; border-radius: 6px; background: #0E2E5B; }
.gantt-bar.st-review { background: #d98e04; } .gantt-bar.st-rework { background: #d64545; } .gantt-bar.st-accepted { background: #038D4B; }
.gantt-bar.late { box-shadow: 0 0 0 2px #d64545 inset; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #d64545; opacity: .6; }
.gantt-dates { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
@media (max-width: 700px) { .gantt-row { grid-template-columns: 1fr; } .gantt-axis { margin-left: 0; } }

/* --- карточки объектов и вход */
.obj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin-top: 1rem; }
.obj-card { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem; border-radius: 14px; background: #fff; border: 1px solid #e6ecf3;
  text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(14,46,91,.06); transition: transform .12s, box-shadow .12s; }
.obj-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(14,46,91,.14); }
.obj-card .badge { align-self: flex-start; }
.obj-bar { display: block; height: 8px; border-radius: 6px; background: #e6ecf3; overflow: hidden; }
.obj-bar i { display: block; height: 100%; background: #038D4B; }
.auth-brand { text-align: center; padding: 1.4rem 1rem; border-radius: 16px; margin-bottom: 1rem; color: #fff; background: linear-gradient(135deg, #0E2E5B, #038D4B); }
.auth-brand h1, .auth-brand p { color: #fff; }
.auth-logo { max-width: 180px; height: auto; display: block; margin: 0 auto .5rem; }

/* --- календарь */
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; }
.cal-day { min-height: 92px; padding: 4px; border: 1px solid #e6ecf3; border-radius: 8px; background: #fff; font-size: .8rem; overflow: hidden; }
.cal-day.out { background: #f6f8fb; opacity: .6; } .cal-day.today { border-color: #038D4B; box-shadow: 0 0 0 1px #038D4B inset; }
.cal-ev { display: block; margin-top: 2px; padding: 1px 5px; border-radius: 5px; color: #fff; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.plan { background: #0E2E5B; } .cal-ev.task { background: #d98e04; } .cal-ev.end { background: #038D4B; }
@media (max-width: 700px) { .cal-day { min-height: 56px; font-size: .7rem; } }

@media print{.no-print,nav,.tabs,header,.sidebar{display:none!important}}
.dsg-st-work{color:#b45309}.dsg-st-done{color:#15803d}.dsg-st-hold{color:#6b7280}
