/* ═══════════════════════════════════════════════════════════════
   JEVON — управление мебельным цехом
   Цвета: фирменный синий цеха + сигнальный жёлтый станочной разметки.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --brand: #0a3554;
  --brand-2: #144b74;
  --signal: #f2b705;
  --signal-ink: #2a2100;
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #16232f;
  --muted: #5d6a77;
  --line: #d9dfe5;
  --grid: #c3ccd5; /* линии таблиц */
  --link: #145a8c;
  --st-new: #6a7886;
  --st-work: #2a66d1;
  --st-ready: #18874d;
  --st-issued: #7d8a97;
  --st-cancel: #b8403a;
  --danger: #b8403a;
  --ok: #18874d;
  --warn: #a86b00;
  /* Полупрозрачные оттенки вместо color-mix(): он не работает в Chrome < 111 (планшеты Android 5.1). */
  --danger-a08: rgba(184, 64, 58, .08); --danger-a12: rgba(184, 64, 58, .12); --danger-a45: rgba(184, 64, 58, .45);
  --ok-a15: rgba(24, 135, 77, .15); --work-a12: rgba(42, 102, 209, .12); --signal-a09: rgba(242, 183, 5, .09);
  --radius: 10px;
  --radius-s: 6px;
  --shadow: 0 1px 2px rgba(10, 53, 84, .08), 0 4px 14px rgba(10, 53, 84, .06);
  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b141c; --surface: #121f2a; --surface-2: #172634; --ink: #e4eaf0; --muted: #93a2b0;
    --line: #233646; --grid: #33495c; --link: #8cc1ea; --brand-2: #1d5f91; --st-new: #93a2b0; --st-work: #6a9cf0;
    --st-ready: #42b97a; --st-issued: #8795a3; --st-cancel: #e2776f; --danger: #e2776f; --ok: #42b97a;
    --warn: #e0a83a; --shadow: 0 1px 2px rgba(0, 0, 0, .35); color-scheme: dark;
    --danger-a08: rgba(226, 119, 111, .08); --danger-a12: rgba(226, 119, 111, .12); --danger-a45: rgba(226, 119, 111, .45);
    --ok-a15: rgba(66, 185, 122, .15); --work-a12: rgba(106, 156, 240, .12);
  }
}
:root[data-theme="dark"] {
  --bg: #0b141c; --surface: #121f2a; --surface-2: #172634; --ink: #e4eaf0; --muted: #93a2b0;
  --line: #233646; --grid: #33495c; --link: #8cc1ea; --brand-2: #1d5f91; --st-new: #93a2b0; --st-work: #6a9cf0;
  --st-ready: #42b97a; --st-issued: #8795a3; --st-cancel: #e2776f; --danger: #e2776f; --ok: #42b97a;
  --warn: #e0a83a; --shadow: 0 1px 2px rgba(0, 0, 0, .35); color-scheme: dark;
    --danger-a08: rgba(226, 119, 111, .08); --danger-a12: rgba(226, 119, 111, .12); --danger-a45: rgba(226, 119, 111, .45);
    --ok-a15: rgba(66, 185, 122, .15); --work-a12: rgba(106, 156, 240, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
body.no-scroll { overflow: hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; margin: 1rem 0 .4rem; }
p { margin: .3rem 0; }
small { font-size: .82em; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.strong { font-weight: 600; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.r { text-align: right; }
.lead { font-size: 1.02rem; }

/* ── Каркас ─────────────────────────────────────────────────── */
#app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; transition: grid-template-columns .18s ease; }
body.login-mode #app { display: block; }
.rail {
  position: sticky; top: 0; height: 100vh; background: var(--brand); color: #dfe8f0;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.rail-brand { display: flex; gap: 10px; align-items: center; color: #fff; padding: 4px 8px 22px; text-decoration: none !important; }
.rail-brand strong { display: block; font-family: var(--display); font-size: 1.05rem; letter-spacing: .04em; }
.rail-brand small { display: block; color: #9fb6c9; }
.logo-mark {
  width: 38px; height: 38px; flex: none; border-radius: 9px; background: var(--signal); color: var(--brand);
  display: grid; place-items: center; font: 700 1.25rem var(--display);
}
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: #c9d7e3; text-decoration: none; font-weight: 500;
}
.rail nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail nav a.active { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 3px 0 0 var(--signal); }
.ico { width: 22px; height: 22px; flex: none; }
.rail-foot { margin-top: auto; padding: 8px 12px; font-size: .85rem; }
.rail-foot .muted { color: #8ea7bb; }
.rail-logout, .rail-logout-m {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 8px; padding: 10px 12px; border: 0; border-radius: 8px;
  background: none; color: #c9d7e3; font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.rail-logout { margin-left: -12px; width: calc(100% + 24px); }
.rail-logout:hover, .rail-logout-m:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail-logout:focus-visible, .rail-logout-m:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.rail-logout-m { display: none; }
/* Верхний правый угол: кто вошёл, 🔔 уведомления (счётчик непрочитанных) и «Выйти» */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  max-width: 1380px; width: 100%; padding: 10px 32px 6px; background: var(--bg);
}
.topbar-spacer { margin-right: auto; }
.topbar-hello { margin-right: auto; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar-hello b { font-size: 1.05rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-hello small { color: var(--muted); font-size: .78rem; }
.home-actions { justify-content: flex-end; margin-bottom: 10px; }
.topbar-user { display: flex; flex-direction: column; align-items: flex-end; margin-right: 6px; line-height: 1.2; min-width: 0; }
.topbar-user b { font-weight: 600; font-size: .9rem; }
.topbar-user small { color: var(--muted); font-size: .76rem; }
.topbar-who { display: none; } /* на телефоне имени в шапке нет — кнопка «Кто вошёл» */
.topbar-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer;
}
.topbar-btn:hover { background: var(--surface-2); }
.topbar-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.earn-chip b { font-weight: 700; white-space: nowrap; }
.bell-n { position: absolute; top: -6px; right: -6px; min-width: 18px; padding: 1px 5px; border-radius: 99px; background: var(--signal); color: var(--brand); font-size: .7rem; font-weight: 700; text-align: center; line-height: 1.3; }
.notif-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 60vh; overflow-y: auto; }
.notif-list li { border-bottom: 1px solid var(--line); }
.notif-list button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 6px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.notif-list button:hover { background: var(--surface-2); }
.notif-list span { color: var(--muted); font-size: .9rem; }
.notif-list small { color: var(--muted); font-size: .78rem; }
.notif-list li:not(.unread) b { font-weight: 500; color: var(--muted); }
.notif-list li.unread { box-shadow: inset 3px 0 0 var(--signal); }
.rail-version { display: block; margin-top: 2px; font-size: .72rem; color: #7f98ad !important; letter-spacing: .02em; }
.rail-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: -12px 0 10px; padding: 8px 12px; border: 0; border-radius: 8px;
  background: none; color: #8ea7bb; font: inherit; font-size: .85rem; text-align: left; cursor: pointer;
}
.rail-toggle:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail-toggle:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.rail-toggle .ico { transition: transform .18s ease; }
/* Свёрнутое меню: только иконки, подписи — во всплывающих подсказках */
#app.rail-collapsed { grid-template-columns: 72px 1fr; }
#app.rail-collapsed .rail { padding-left: 8px; padding-right: 8px; }
#app.rail-collapsed .rail-brand { justify-content: center; padding-left: 0; padding-right: 0; }
#app.rail-collapsed .rail-label, #app.rail-collapsed .rail nav a span { display: none; }
#app.rail-collapsed .rail nav a, #app.rail-collapsed .rail-toggle, #app.rail-collapsed .rail-logout { justify-content: center; padding-left: 0; padding-right: 0; }
#app.rail-collapsed .rail-toggle .ico { transform: rotate(180deg); }
#app.rail-collapsed .rail-foot { padding-left: 0; padding-right: 0; }
#app.rail-collapsed .rail-logout { margin-left: 0; width: 100%; }

#page { padding: 14px 32px 60px; max-width: 1380px; width: 100%; outline: none; min-width: 0; }

@media (max-width: 860px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 40; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    flex-direction: row; box-shadow: 0 -2px 12px rgba(0, 0, 0, .18);
  }
  .rail-brand, .rail-foot, .rail-toggle { display: none; }
  #app.rail-collapsed { grid-template-columns: minmax(0, 1fr); }
  #app.rail-collapsed .rail nav a span { display: inline; }
  .rail nav { flex-direction: row; width: 100%; overflow-x: auto; gap: 0; scrollbar-width: none; }
  .rail nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: .64rem; text-align: center; }
  .rail nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail nav a.active { box-shadow: inset 0 3px 0 var(--signal); }
  .rail-logout-m { display: flex; flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; margin: 0; padding: 6px 2px; font-size: .64rem; text-align: center; }
  .topbar { padding: 8px 14px 4px; }
  .topbar-btn span, .topbar-user small { display: none; }
  .topbar-user { display: none; }
  .topbar-who { display: inline-flex; }
  .topbar-hello b { font-size: .92rem; }
  .rail-logout-m span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #page { padding: 8px 14px calc(24px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.35rem; }
}

/* ── Шапка страницы и панели инструментов ───────────────────── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-bottom: 8px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.search { flex: 1 1 260px; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); font-weight: 500; }

.seg, .tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg.wrap { margin-bottom: 16px; }
.seg button, .tabs button {
  border: 0; background: none; color: var(--muted); font: 500 .9rem var(--font); padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.seg button[aria-selected="true"], .seg button[aria-checked="true"], .tabs button[aria-selected="true"] {
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.seg.small button { padding: 4px 9px; font-size: .82rem; }

/* ── Счётчики ───────────────────────────────────────────────── */
.counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 4px; }
.counter {
  text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.counters.static .counter { cursor: default; }
.cat-share { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--surface-2, #eef1f4); vertical-align: middle; overflow: hidden; }
.cat-share > span { display: block; height: 100%; background: #c43d3d; }
.counter b { font: 600 1.45rem var(--display); letter-spacing: -.01em; }
.counter span { color: var(--muted); font-size: .88rem; }
.counter.ready b { color: var(--st-ready); }
.counter.alert b { color: var(--danger); }
button.counter:hover, a.counter:hover { border-color: var(--brand-2); }
a.counter { text-decoration: none; }
.counter.on { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
@media (max-width: 860px) { .counters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .counter b { font-size: 1.15rem; } }

/* ── Кнопки и поля ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 500 .92rem var(--font); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; text-decoration: none !important; white-space: nowrap; min-height: 38px;
}
.btn:hover { border-color: var(--brand-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.accent { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.stack { flex-direction: column; align-items: stretch; margin: 14px 0; }
.icon-btn {
  border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-height: 38px; width: 100%; max-width: 100%;
}
.toolbar input, .toolbar select, .btn-row input { width: auto; }
.toolbar .search { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(20, 75, 116, .18); }
input[readonly] { background: var(--surface-2); }

.form { display: grid; gap: 12px; }
.form.grid2 { grid-template-columns: 1fr 1fr; }
.form.grid3 { grid-template-columns: repeat(3, 1fr); }
.form.grid4 { grid-template-columns: repeat(4, 1fr); }
.form h3 { margin: 6px 0 -4px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: .85rem; font-weight: 500; color: var(--muted); }
.field small { color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
.check-list { display: grid; gap: 6px; max-height: 320px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.calc { font-weight: 600; margin: 0; min-height: 1.4em; }
.area-box { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
@media (max-width: 640px) {
  .form.grid2, .form.grid3 { grid-template-columns: 1fr; }
  .form.grid4 { grid-template-columns: 1fr 1fr; }
  .span2, .span3 { grid-column: auto; }
}

/* ── Карточки заказов ───────────────────────────────────────── */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; transition: opacity .15s; }
.order-grid .span-all { grid-column: 1 / -1; }
.order-grid.dim { opacity: .5; }
.order-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 13px; color: inherit; text-decoration: none !important; overflow: hidden;
}
.order-card:hover { border-color: var(--brand-2); box-shadow: var(--shadow); }
.order-card .thumb { margin: -11px -13px 4px; width: calc(100% + 26px); height: 110px; object-fit: cover; background: var(--surface-2); }
.order-card h3 { margin: 0; font-size: 1rem; line-height: 1.3; }
.order-card p { margin: 0; }
.oc-client { font-size: .88rem; }
.order-card.overdue { border-color: var(--danger-a45); }
.oc-head, .oc-foot, .oc-money { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.oc-foot { font-size: .86rem; color: var(--muted); }
.oc-money { font-size: .9rem; font-weight: 600; border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; }
.ono { font: 700 1.05rem var(--display); color: var(--brand); letter-spacing: .02em; }
:root[data-theme="dark"] .ono { color: var(--signal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ono { color: var(--signal); } }
.ono.big { font-size: 1.7rem; }

/* Лента этапов — как разметка на рулетке */
.track { display: flex; gap: 3px; margin: 4px 0 2px; }
.track i { flex: 1; height: 7px; border-radius: 2px; background: var(--line); }
.track i.on { background: var(--brand-2); }
.share-app { display: grid; gap: 6px; margin: 10px 0; }
.share-app:empty { display: none; }
.push-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.sec-states { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 4px 0 2px; }
.sec-st { font-size: .74rem; line-height: 1.5; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.sec-st.work { border-color: var(--signal); color: var(--ink); }
.sec-st.done { border-color: var(--ok); color: var(--ok); }
.st-ready .track i.on, .st-issued .track i.on { background: var(--st-ready); }
.track i.cur { background: repeating-linear-gradient(135deg, var(--signal) 0 4px, var(--signal-ink) 4px 6px); }
.st-cancelled .track i { opacity: .4; }

.badge {
  display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--surface-2); color: var(--st-new); border: 1px solid currentColor; white-space: nowrap;
}
.badge.st-in_progress { color: var(--st-work); }
.badge.st-ready { color: #fff; background: var(--st-ready); border-color: var(--st-ready); }
.badge.st-issued { color: var(--st-issued); }
.badge.st-cancelled { color: var(--st-cancel); }
.badge.emp-active { color: var(--ok); }
.badge.emp-vacation, .badge.emp-sick { color: var(--warn); }
.badge.emp-fired { color: var(--st-cancel); }
.prio { position: absolute; top: 0; right: 0; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-bottom-left-radius: 8px; background: var(--signal); color: var(--signal-ink); }
.order-card .thumb ~ .prio, .prio.urgent { background: var(--danger); color: #fff; }
.oh-line .prio { position: static; border-radius: 6px; }
.tag { display: inline-block; font-size: .74rem; padding: 0 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ── Карточка заказа ────────────────────────────────────────── */
.order-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.oh-main { flex: 1 1 520px; min-width: 0; }
.oh-main .track { max-width: 560px; margin: 12px 0 6px; }
.oh-main .track i { height: 9px; }
.oh-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.oh-client { font-size: 1.02rem; }
.oh-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 190px; }
.note { padding: 8px 12px; border-radius: 8px; }
.note.warn { background: var(--danger-a12); color: var(--danger); }
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .order-layout { grid-template-columns: minmax(0, 1fr); } .oh-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.panel > h2 { margin-bottom: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
details.panel summary { cursor: pointer; list-style: none; }
details.panel summary h2 { display: inline; }
details.panel summary::after { content: ' ▾'; color: var(--muted); }

.stages { list-style: none; margin: 0; padding: 0; }
/* «Этапы» в заказе — сворачиваются: строка-заголовок, тело раскрывается плавно */
.stages-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.stages-toggle .st-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.stages-toggle .st-title b { font-size: 1.05rem; }
.stages-toggle .st-cur { font-size: inherit; color: var(--ink); }
.stages-toggle:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 4px; border-radius: 6px; }
.st-chev { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .3s ease; margin: 0 4px 4px; }
.stages-panel.open .st-chev { transform: rotate(-135deg); margin-bottom: -4px; }
.stages-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.stages-body > div { overflow: hidden; min-height: 0; }
.stages-panel.open .stages-body { grid-template-rows: 1fr; }
.stages-body .stages { padding-top: 14px; }
@media (prefers-reduced-motion: reduce) { .stages-body, .st-chev { transition: none; } }
.stage { display: grid; grid-template-columns: 28px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.stage:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.stage.done:not(:last-child)::before { background: var(--brand-2); }
.stage .mark {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; font-weight: 700;
  border: 2px solid var(--line); background: var(--surface); color: var(--muted); position: relative; z-index: 1;
}
.stage.done .mark { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.stage.skipped .mark { border-style: dashed; }
.stage.in_progress .mark { border-color: var(--signal); color: var(--signal-ink); background: var(--signal); }
.stage.pending .stage-title b, .stage.skipped .stage-title b { color: var(--muted); font-weight: 500; }
.stage-title { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding-top: 3px; }
.stage-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ho-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.ho-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.ho-card p { margin: 0; }
.ho-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.ho-dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 4px 10px; margin: 0; font-size: .9rem; }
.ho-dl dt { color: var(--muted); }
.ho-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ho-mine .ho-card + .ho-card { margin-top: 10px; }
.ho-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.ho-kind button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 9px 10px; border-radius: 7px; cursor: pointer; }
.ho-kind button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ho-hint { margin: 2px 0 0; }
.ho-order { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: .92rem; }
.ho-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .ho-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .ho-dl { grid-template-columns: 1fr; } .ho-dl dt { margin-top: 4px; } }
.le-cnc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.le-cnc-row input[name="cnc"] { flex: 2 1 200px; min-width: 0; }
.le-cnc-row select { flex: 1 1 200px; min-width: 0; }
.le-cnc-row .le-cnc-q, .line-entry .le-cnc-row .le-cnc-q { flex: 0 0 80px; width: 80px; }
.est-cnc-btn { padding: 2px 8px; margin-left: 4px; }
.stage-parts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 0; font-size: .86rem; color: var(--muted); }
.stage-part.done { color: #1f8a4c; } .stage-part.in_progress { color: var(--ink); font-weight: 600; }
.stage.in_progress .stage-body { background: var(--signal-a09); margin-left: -6px; padding: 2px 10px 10px; border-radius: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.ts-pick { margin: 0 0 12px; }
.ts-pick input[type=search] { width: 100%; max-width: 420px; }
.ts-pick .chips { align-items: center; margin-top: 8px; }
.ts-pick .chip { cursor: pointer; color: inherit; font: inherit; font-size: .85rem; padding: 3px 10px; }
.ts-pick .chip:hover { border-color: var(--danger, #d33); }
.chip { font-size: .8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
/* Таблицы — обычной сеткой: линии между строками и колонками, шапка с фоном; заголовок — сортировка (app.js). */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; border: 1px solid var(--grid); }
.table th { text-align: left; font-weight: 600; color: var(--ink); font-size: .82rem; background: var(--surface-2);
  border: 1px solid var(--grid); padding: 7px 8px; }
.table td { border: 1px solid var(--grid); padding: 8px 8px; vertical-align: top; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table:not(.paint-table):not(.kp-lines):not(.invoice):not([data-nosort]) thead th { cursor: pointer; user-select: none; }
.table thead th[aria-sort]::after { content: ' ▲'; font-size: .7em; color: var(--brand-2); }
.table thead th[aria-sort="descending"]::after { content: ' ▼'; }
.table th.r, .table td.r { text-align: right; }
.table tfoot td { font-weight: 600; background: var(--surface-2); }
.table.compact td { padding: 6px 8px; }
.table tr.muted td { color: var(--muted); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: var(--surface-2); }
.tile { margin: 0; }
.tile figcaption { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--muted); }
.tile.cat-ready img { outline: 3px solid var(--st-ready); outline-offset: -3px; }
.tile.cat-damage img { outline: 3px solid var(--danger); outline-offset: -3px; }
.file-ico { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; background: var(--surface-2); font: 700 .9rem var(--display); color: var(--muted); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.mini-list li > span:first-child, .mini-list li > a:first-child { flex: 1; min-width: 0; }
.mini-list li small { display: block; color: var(--muted); }
.history .mini-list li { flex-direction: column; align-items: flex-start; gap: 0; }

.sum { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0 0 14px; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; text-align: right; }
.sum .strong { color: var(--ink); font-size: 1.05rem; }
.panel.money h3 { margin-top: 16px; }

.comments { list-style: none; margin: 0 0 10px; padding: 0; }
.comments li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comments small { color: var(--muted); }
.comment-form { display: flex; gap: 8px; }

/* ── Сотрудники ─────────────────────────────────────────────── */
/* Список сотрудников — таблица: аватар с ФИО, кнопки действий в строке. */
.emp-table .emp-name { display: inline-flex; align-items: center; gap: 8px; color: inherit; }
.emp-table .emp-acts .icon-btn { width: 32px; height: 32px; }
.emp-table td { vertical-align: middle; }
.access-line { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.person {
  display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; color: inherit; text-decoration: none !important;
}
.person:hover { border-color: var(--brand-2); }
.person b { display: block; }
.person .muted { display: block; font-size: .88rem; }
.person-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: .82rem; align-items: center; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center;
  background: var(--brand); color: #fff; font: 600 .85rem var(--display);
}
.avatar.sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar.lg { width: 54px; height: 54px; font-size: 1rem; }
.avatar.xl { width: 128px; height: 128px; font-size: 2rem; border-radius: 16px; }
.presence { font-size: .8rem; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); }
.presence.in { background: var(--ok-a15); color: var(--ok); font-weight: 600; }
.person-inline { display: inline-flex; gap: 8px; align-items: center; color: inherit; }
.person-inline small { display: block; color: var(--muted); }

.profile-head { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.photo-box { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.profile-main { flex: 1 1 380px; min-width: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.month-bar { display: flex; gap: 12px; align-items: center; margin: 4px 0 12px; }
.month-bar input { width: auto; }
.payslip { border-left: 4px solid var(--signal); }
.slip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.slip-grid span { display: block; color: var(--muted); font-size: .82rem; }
.slip-grid b { font-size: 1.05rem; }
.slip-grid .due b { font: 700 1.25rem var(--display); color: var(--brand); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

/* ── Табель ─────────────────────────────────────────────────── */
/* Табель во всю ширину без прокрутки: столбцы дней делят место поровну, имя сокращается. */
.sheet-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sheet { border-collapse: separate; border-spacing: 0; font-size: .74rem; width: 100%; table-layout: fixed; }
.sheet col.c-name { width: 170px; }
.sheet col.c-tot { width: 44px; }
.sheet th, .sheet td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; height: 34px; padding: 0 1px; position: relative; overflow: hidden; white-space: nowrap; }
.sheet thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; font-weight: 600; line-height: 1.1; }
.sheet thead th small { display: block; font-weight: 400; color: var(--muted); }
.sheet .name { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 4px 8px; z-index: 1; font-weight: 500; text-overflow: ellipsis; }
.sheet .name a, .sheet .name small { display: block; overflow: hidden; text-overflow: ellipsis; }
.sheet thead .name { z-index: 3; background: var(--surface-2); }
.sheet .name small { display: block; color: var(--muted); font-weight: 400; }
.sheet .wkend { background: var(--surface-2); }
.sheet th.today { background: var(--signal); color: var(--signal-ink); }
.sheet td[data-cell] { cursor: pointer; }
.sheet td[data-cell]:hover { box-shadow: inset 0 0 0 2px var(--brand-2); }
.sheet td.s-present { background: var(--work-a12); font-weight: 600; }
.sheet td.s-present.kiosk { background: var(--ok-a15); }
.sheet td.open { box-shadow: inset 0 0 0 2px var(--st-work); }
.sheet td.s-vacation, .sheet td.s-sick { color: var(--warn); font-weight: 600; }
.sheet td.s-absent { color: var(--danger); font-weight: 700; }
.sheet .tot { font-weight: 600; background: var(--surface-2); }
.sheet .cam { position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
@media (max-width: 1280px) {
  .sheet { font-size: .66rem; letter-spacing: -.02em; }
  .sheet col.c-name { width: 136px; }
  .sheet col.c-tot { width: 36px; }
  .sheet .name { padding: 4px 6px; }
  .sheet thead th small { font-size: .56rem; }
}
@media (max-width: 900px) {
  /* на телефоне месяц в ширину не помещается — прокрутка внутри таблицы */
  .sheet-wrap { overflow-x: auto; }
  .sheet { width: auto; min-width: 100%; }
  .sheet th, .sheet td { min-width: 30px; }
  .sheet col.c-name { width: 130px; }
}
.ts-pop { position: absolute; z-index: 60; width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28); padding: 10px 12px; font-size: .85rem; pointer-events: none; }
.ts-pop header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ts-pop header span { color: var(--muted); }
.ts-pop p { margin: 8px 0 0; }
.ts-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ts-photos figure { margin: 0; }
.ts-photos img, .ts-photos .no-photo { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: block; }
.ts-photos .no-photo { display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.ts-photos figcaption { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.modal .ts-photos { max-width: 360px; }
.legend { font-size: .85rem; margin-top: 10px; }

.payroll .due-cell { color: var(--brand); }
.payroll tr.advance-over td { background: var(--danger-a08); }
.payroll td { vertical-align: middle; }

/* ── Статистика ─────────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 6px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; }
.bar i { width: 100%; background: var(--brand-2); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar small { color: var(--muted); font-size: .66rem; margin-top: 3px; }

/* ── Настройки ──────────────────────────────────────────────── */
.settings-list .set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.settings-list .set-row:last-child { border-bottom: 0; }
.set-row b, .set-row span.muted { display: block; }
.stage-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stage-col ol { margin: 6px 0 8px; padding: 0; list-style: none; counter-reset: st; }
.stage-col li { counter-increment: st; display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.stage-col li > span:first-child::before { content: counter(st) '. '; color: var(--muted); }

/* ── Модальные окна, тосты ──────────────────────────────────── */
.modal-back {
  position: fixed; inset: 0; background: rgba(6, 20, 32, .55); z-index: 100; display: grid; place-items: center;
  padding: 16px; animation: fade .12s ease-out;
}
.modal {
  background: var(--surface); border-radius: 14px; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: rise .16s ease-out;
}
.modal.wide { width: min(760px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-body { padding: 16px 18px 18px; }
.photo-preview img { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 10px; background: var(--surface-2); }
.share-url { margin: 10px 0 0; }
.client-pick { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; font: inherit; color: inherit; cursor: pointer; }
.suggest button:hover { background: var(--surface-2); }
.suggest span { display: block; font-size: .82rem; color: var(--muted); }
@media (max-width: 640px) {
  .modal-back { place-items: end stretch; padding: 0; }
  .modal, .modal.wide { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
}

/* Плашка «Вышла новая версия» */
.update-bar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 210; display: flex; align-items: center; gap: 12px;
  background: var(--signal); color: var(--signal-ink); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; max-width: 92vw; }
.update-bar button { border: 0; border-radius: 8px; padding: 6px 12px; background: var(--brand); color: #fff; font: inherit; cursor: pointer; }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; animation: rise .15s ease-out; max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
.toast.out { opacity: 0; transition: opacity .3s; }
@media (max-width: 860px) { #toasts { bottom: 16px; } }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 10px; }
.loading-page { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand-2); animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Вход и киоск ───────────────────────────────────────────── */
body.login-mode, body.kiosk { background: var(--brand); color: #fff; min-height: 100vh; }
.login { max-width: 360px; margin: 0 auto; padding: 48px 20px; display: flex; flex-direction: column; gap: 10px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.login-brand strong { display: block; font: 700 1.2rem var(--display); letter-spacing: .05em; }
.login-brand span, .login .muted { color: #a8bccd; }
.login h1 { font-size: 1.5rem; }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 18px 0 6px; min-height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #8aa6bd; }
.pin-dots i.on { background: var(--signal); border-color: var(--signal); }
.login-error { min-height: 1.5em; text-align: center; color: #ffb4a8; margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label { display: flex; flex-direction: column; gap: 4px; }
.login-form label span { color: #a8bccd; font-size: .9rem; }
.login-form input {
  min-height: 48px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px;
  background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 1.05rem;
}
.login-form input:focus { outline: 2px solid var(--signal); outline-offset: 1px; }
.login-switch {
  margin-top: 8px; padding: 10px; border: 0; background: none; color: #a8bccd; font: inherit;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.login-switch:hover { color: #fff; }
.login-tabs { display: flex; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); margin-bottom: 8px; }
.login-tabs button { flex: 1; color: #c6d5e2; padding: 10px 8px; font-size: .95rem; }
.login-tabs button[aria-selected="true"] { background: #fff; color: var(--brand); }
.login-version { margin: 4px 0 0; text-align: center; font-size: .72rem; color: #7f98ad; letter-spacing: .02em; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 14px; }
.keypad button {
  height: 64px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06);
  color: #fff; font: 600 1.5rem var(--display); cursor: pointer;
}
.keypad button:active { background: rgba(255, 255, 255, .18); }
.keypad button.soft { font: 500 .95rem var(--font); color: #c6d5e2; }
.keypad.shake { animation: shake .3s; }
.login .btn.primary, .kiosk .btn.primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 600; min-height: 50px; font-size: 1.05rem; }

.kiosk #kiosk { max-width: 920px; margin: 0 auto; padding: 24px 20px 40px; }
.k-head { display: flex; gap: 12px; align-items: center; margin-bottom: 40px; }
.k-head strong { display: block; font: 700 1.1rem var(--display); letter-spacing: .05em; }
.k-head span { color: #a8bccd; font-size: .9rem; }
.k-head .seg { margin-left: auto; background: rgba(255, 255, 255, .08); border-color: transparent; }
.k-head .seg button { color: #c6d5e2; }
.k-head .seg button[aria-checked="true"] { background: #fff; color: var(--brand); }
.k-step h1 { font-size: 1.8rem; margin-bottom: 22px; }
.k-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.k-big {
  border: 0; border-radius: 20px; padding: 40px 24px; cursor: pointer; text-align: left; font: inherit;
  display: flex; flex-direction: column; gap: 10px; min-height: 220px; justify-content: flex-end;
}
.k-big b { font: 700 1.6rem var(--display); }
.k-big span { font-size: 1.05rem; opacity: .85; }
.k-big.in { background: var(--signal); color: var(--signal-ink); }
.k-big.out { background: #fff; color: var(--brand); }
.k-clock { margin-top: 28px; color: #a8bccd; font-size: 1.1rem; text-transform: capitalize; }
.k-pin-row { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.k-pin-row > div:last-child { grid-column: 2; }
.k-cam video { width: 100%; border-radius: 16px; background: #000; transform: scaleX(-1); }
.k-done { text-align: center; padding-top: 60px; cursor: pointer; }
.k-check { width: 110px; height: 110px; margin: 0 auto 20px; border-radius: 50%; background: var(--signal); color: var(--signal-ink); display: grid; place-items: center; font-size: 3.4rem; font-weight: 700; }
.k-name { font: 600 1.6rem var(--display); }
@media (max-width: 700px) {
  .k-actions, .k-pin-row { grid-template-columns: 1fr; }
  .k-pin-row > div:last-child { grid-column: auto; }
  .k-big { min-height: 150px; padding: 26px 20px; }
}

/* ── Публичная страница заказа ──────────────────────────────── */
body.public { background: var(--bg); }
.share { max-width: 620px; margin: 0 auto; padding: 24px 16px 60px; }
.share-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 26px; }
.share-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
.share-brand strong { font: 700 1rem var(--display); letter-spacing: .05em; }
.share-brand .logo-mark { width: 32px; height: 32px; font-size: 1rem; }
.share-card h1 { margin: 6px 0 8px; }
.share-card.st-ready h1 { color: var(--st-ready); }
.public-stages { margin: 20px 0; }
.share-card h2 { margin: 20px 0 10px; }

/* ── Печать ─────────────────────────────────────────────────── */
@media print {
  .rail, .topbar, .page-head .btn-row, .no-print, .btn, #toasts { display: none !important; }
  #app { display: block; }
  #page { padding: 0; }
  body { background: #fff; color: #000; font-size: 12px; }
  .panel, .counter { border-color: #bbb; }
}
/* без :has() — класс no-cam ставит hastu.js (Chrome < 105) */
.k-pin-row.no-cam { grid-template-columns: minmax(0, 360px); justify-content: center; }
.k-pin-row.no-cam > div:last-child { grid-column: 1; }
.btn.danger-text { color: var(--danger); }

.kiosk .muted { color: #a8bccd; }
.share-card .sum { margin-top: 18px; }
.share-pickup { margin: 16px 0 8px; display: flex; flex-direction: column; gap: 8px; }
.share-estimate { margin-top: 14px; }
.price-in { width: 110px; text-align: right; padding: 4px 8px; }
.price-in.empty::placeholder { color: var(--danger); }
.price-doc .ed-sec h3 { margin-top: 16px; }
.soft-pct .inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.soft-pct .inline-form .field { flex: 0 1 320px; margin: 0; }
.soft-pct .inline-form p { flex-basis: 100%; margin: 0; }
.share-est { margin-top: 20px; scroll-margin-top: 12px; }
.share-est .estimate-bar h2 { margin: 0; }
.share-est-doc { overflow-x: auto; border-radius: 10px; }
@media (max-width: 560px) { .share-est .ed-head, .share-est .ed-client, .share-est .ed-sec, .share-est .ed-foot { padding-left: 12px; padding-right: 12px; } .share-est .ed-total { margin-left: 12px; margin-right: 12px; } .share-est .estimate-doc { font-size: 13px; } }

/* Журнал входов — прокрутка внутри блока */
.log-scroll { max-height: 360px; overflow-y: auto; }

/* Отчёт переноса из старой системы */
.import-report {
  max-height: 460px; overflow: auto; padding: 12px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--line); font: 12.5px/1.45 ui-monospace, 'Cascadia Mono', Consolas, monospace; white-space: pre-wrap;
}

/* QR-карточка сотрудника */
.qr-card { width: 220px; margin: 0 auto 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #111; text-align: center; }
.qr-card .qr-img svg { width: 180px; height: 180px; display: block; margin: 0 auto; }
.qr-card b { display: block; margin-top: 8px; }
.qr-card span { font-size: .8rem; color: #555; }

/* ── Проекты: шаги, карточки, замеры ─────────────────────────── */
.badge.pst-lead { color: var(--st-new); }
.badge.pst-measure { color: var(--warn); }
.badge.pst-proposal { color: var(--st-work); }
.badge.pst-contract { color: #fff; background: var(--ok); border-color: var(--ok); }
.badge.pst-production { color: #fff; background: var(--brand-2); border-color: var(--brand-2); }
.badge.pst-done { color: var(--st-issued); }
.badge.pst-lost { color: var(--danger); }
.project-card .pc-desc, .measure-card .pc-desc {
  margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pc-measure { margin: 6px 0 0; font-size: .9rem; color: var(--warn); font-weight: 500; }

/* Полоса шагов проекта */
.p-steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 14px 0 8px; max-width: 640px; }
.p-steps li { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: var(--muted); }
.p-steps li i {
  display: flex; align-items: center; justify-content: center; height: 26px; border-radius: 6px; font-style: normal; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.p-steps li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.p-steps li.done i { background: var(--ok); border-color: var(--ok); color: #fff; }
.p-steps li.cur i { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.p-steps li.cur span { color: var(--ink); font-weight: 600; }
.p-steps li.lost i { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Миниатюры фото и файлов */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.thumb-item { position: relative; margin: 0; }
.thumb-item img, .thumb-item .file-ico {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 2rem;
}
.thumb-item figcaption { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.thumb-item .icon-btn { position: absolute; top: 2px; right: 2px; background: var(--surface); }

/* Замеры */
.measure-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.measure { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; }
.measure p { margin: 4px 0 0; }
.ms-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.badge.ms-planned { color: var(--warn); }
.badge.ms-done { color: var(--ok); }
.badge.ms-cancelled { color: var(--st-cancel); }
.measure.ms-cancelled { opacity: .65; }
.ms-result { background: var(--surface-2); border-radius: 6px; padding: 6px 8px; }
.day-title { margin: 18px 0 8px; font-size: 1rem; text-transform: capitalize; }
.measure-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.measure-card { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.measure-card h3 { margin: 4px 0 0; }
.measure-card p { margin: 0; }
.measure-card.late { border-color: var(--danger-a45); }
.mc-time { display: flex; justify-content: space-between; align-items: baseline; }
.mc-time b { font-size: 1.3rem; }
.small { font-size: .82rem; }

/* Воронка продаж */
.funnel { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.f-row { display: grid; grid-template-columns: 120px 1fr 48px 44px; gap: 10px; align-items: center; }
.f-bar { height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.f-bar i { display: block; height: 100%; background: var(--brand-2); border-radius: 6px; }
.f-row b { text-align: right; }
.f-row small { color: var(--muted); }

/* КП */
.kp-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.kp { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; }
.kp p { margin: 4px 0; }
.kp-total { margin-left: auto; }
.badge.kp-draft { color: var(--st-new); }
.badge.kp-sent { color: var(--st-work); }
.badge.kp-accepted { color: #fff; background: var(--ok); border-color: var(--ok); }
.badge.kp-rejected { color: var(--danger); }
.kp.kp-rejected { opacity: .7; }
.kp-lines input { width: 100%; min-width: 0; }
.kp-lines .num-in { max-width: 96px; text-align: right; }
.kp-sum { font-weight: 600; margin: 0; }

/* Оплата мастеров и проверка работ */
.pay-rules select { max-width: 190px; }
.num-in { max-width: 96px; text-align: right; }
.tag.rv-review { color: var(--warn); border-color: currentColor; }
.tag.rv-accepted { color: var(--ok); border-color: currentColor; }
.tag.rv-rejected { color: var(--danger); border-color: currentColor; }

/* ── Организационная структура ─────────────────────────────── */
.org-scroll { overflow-x: auto; padding-bottom: 6px; }
.org { min-width: 980px; display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.org-top { display: flex; justify-content: center; }
.org-boss { background: #1e3a8a; color: #fff; font-weight: 700; font-size: 1.1rem; padding: 10px 28px; border-radius: 10px; text-align: center; }
.org-boss small { display: block; font-weight: 400; font-size: .78rem; opacity: .85; }
.org-row { display: flex; gap: 12px; align-items: flex-start; }
.org-row.sub { margin-top: 10px; gap: 8px; }
.org-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.org-col.wide { flex: 3.6 1 0; }
.org-head { background: var(--c); color: #fff; font-weight: 700; font-size: .86rem; text-align: center; padding: 8px 8px; border-radius: 8px; }
.org-head-btn, .org-pos-btn { all: unset; cursor: pointer; display: block; width: 100%; }
.org-head-btn:focus-visible, .org-pos-btn:focus-visible { outline: 2px solid var(--signal); }
.org-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.org-list.center { align-items: center; }
.org-list.center .org-pos { width: min(100%, 320px); }
.org-pos {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 6px;
  padding: 6px 8px; font-size: .84rem; text-align: center;
}
.org-pos:hover { box-shadow: var(--shadow); }
.org-role, .org-people { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.org-people { color: var(--ink); }
.org-people.vacant { color: var(--muted); font-style: italic; }
.org-add { width: 100%; border: 1px dashed var(--line); background: none; border-radius: 6px; padding: 4px; color: var(--muted); cursor: pointer; font: inherit; font-size: .78rem; }
.org-add:hover { color: var(--ink); border-color: var(--muted); }
.org-loose { border-top: 1px dashed var(--line); padding-top: 10px; }
.org-loose .org-list { flex-direction: row; flex-wrap: wrap; margin-top: 6px; }

.merge-box { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; }
.merge-box legend { font-size: .85rem; color: var(--muted); padding: 0 4px; }
.merge-box select { max-width: 100%; }

.edit-pen { font-size: 1.1rem; }

/* Несколько ролей: выбор дополнительных должностей и ролей */
.extra-pos { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.pos-group { border: 0; border-left: 3px solid var(--c, var(--line)); margin: 0; padding: 0 0 0 8px; }
.pos-group legend { font-size: .78rem; font-weight: 600; color: var(--muted); padding: 0; }
.pos-group .check { font-size: .88rem; }
.extra-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 10px; max-height: 220px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.extra-roles .check { font-size: .86rem; }
.split-box { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.split-box .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ── «Как работать» ─────────────────────────────────────────── */
.hp-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 10px; }
.hp-stage { border: 1px solid var(--line); border-top: 4px solid var(--hc); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.hp-stage header b { display: block; font-size: 1rem; color: var(--hc); }
.hp-stage header small { color: var(--muted); }
.hp-stage ol { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.hp-stage li b { display: block; }
.hp-stage li span { color: var(--muted); }
.hp-sales { --hc: #2563eb; } .hp-design { --hc: #7c3aed; } .hp-production { --hc: #b91c1c; } .hp-finish { --hc: #16a34a; } .hp-money { --hc: #0d9488; }
.hp-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.hp-role { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.hp-role.mine { border-color: var(--signal); box-shadow: 0 0 0 2px var(--signal) inset; }
.hp-role h3 { margin: 0 0 6px; font-size: .98rem; }
.hp-role ul { margin: 0; padding-left: 18px; font-size: .88rem; }
.hp-daily { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.hp-rules, .hp-menu { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: .9rem; }
.hp-rules dt, .hp-menu dt { font-weight: 600; }
.hp-rules dd, .hp-menu dd { margin: 0; color: var(--muted); }
.hp-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
@media (max-width: 860px) { .hp-rules, .hp-menu { grid-template-columns: 1fr; } }
@media print { .hp-flow { grid-template-columns: repeat(3, 1fr); } }

/* Меню по группам: заголовки групп, виды заказов подпунктами, киоск — внешняя ссылка */
.rail { overflow-y: auto; scrollbar-width: thin; }
.rail nav a { padding-top: 8px; padding-bottom: 8px; }
.rail-group { margin: 12px 12px 4px; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #7f98ad; }
.rail-group:first-child { margin-top: 0; }
.rail nav a.rail-sub { padding: 5px 12px 5px 46px; font-size: .86rem; gap: 8px; position: relative; }
.rail nav a.rail-sub .dot { position: absolute; left: 22px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.rail nav a.rail-sub.active .dot { opacity: 1; background: var(--signal); }
#app.rail-collapsed .rail-group, #app.rail-collapsed .rail-sub { display: none; }
@media (max-width: 860px) {
  /* нижняя панель на телефоне: только основные разделы */
  .rail-group, .rail nav a.rail-sub, .rail nav a.rail-ext { display: none; }
}

/* Главная */
.dash-date::first-letter { text-transform: uppercase; }
.dash-sec { margin-bottom: 18px; }
.dash-sec h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 1rem; margin: 0 0 8px; }
.dash-sec h2 a { font-size: .85rem; font-weight: 500; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
a.dash-tile { text-decoration: none; color: inherit; }
a.dash-tile:hover { border-color: var(--brand-2); }
.counter.warn b { color: var(--warn); }
.dash-lists { margin-top: 6px; }
.dash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dash-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dash-list li:last-child { border-bottom: 0; }
/* «Очередь»: заказы по порядку в карточке работ */
.queue-tabs { flex-wrap: wrap; margin-bottom: 12px; }
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.queue-list li:last-child { border-bottom: 0; }
.queue-list li > div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.queue-n { flex: none; width: 2em; height: 2em; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.queue-list li.next .queue-n { background: var(--signal); color: var(--signal-ink); }
.queue-list .prio { position: static; border-radius: 6px; }
.queue-works { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.queue-list .queue-works li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0; border: 0; }
/* Упаковка: детали из файла Базиса для проверки, сканер бирок */
.scan-box { display: flex; flex-direction: column; gap: 10px; }
.scan-box video { width: 100%; max-height: 46vh; border-radius: 10px; background: #000; object-fit: cover; }
.scan-msg { margin: 0; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); font-weight: 600; }
.scan-msg.ok { background: #dcf5e4; color: #14663a; }
.scan-msg.warn { background: #fdf0d5; color: #8a5a00; }
.scan-msg.err { background: #fbe3e1; color: #a12a22; }
.scan-count { margin: 0; }
.pack-list summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.pack-list ul { list-style: none; margin: 4px 0 0; padding: 0; }
.pack-list li label { display: flex; gap: 10px; align-items: center; min-height: 40px; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.pack-list li input { flex: none; width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--brand); }
.pack-list .pack-pos { flex: none; min-width: 64px; font-weight: 600; }
.pack-list .pack-size { flex: 1; min-width: 0; }
.pack-list li input:checked ~ span, .pack-list li input:checked ~ b { text-decoration: line-through; color: var(--muted); }
.dash-list li.overdue b { color: var(--danger); }
@media (max-width: 860px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }

/* Выдача заказов */
.ho-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.ho-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.ho-card.long { border-color: var(--warn); box-shadow: inset 3px 0 0 var(--warn); }
.ho-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ho-card h3 { margin: 0; font-size: 1rem; }
.ho-card p { margin: 0; }
.ho-card .btn { margin-top: auto; }
.ho-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 4px 0 6px; font-size: .88rem; }
.ho-facts dt { color: var(--muted); }
.ho-facts dd { margin: 0; }
.ho-facts .debt { color: var(--danger); font-weight: 600; }
.ho-facts .paid, .form .paid { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); }
.ho-sub { margin: 22px 0 0; font-size: 1rem; }
.ho-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ho-photo img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; }

/* Заказ из проекта: блок оплаты по проекту в расчёте заказа */
.sum .sum-group { grid-column: 1 / -1; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 600; }

/* Переделки */
.rw-panel h2 { margin-bottom: 8px; }
.rw-card { border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 8px; padding: 10px 12px; margin-top: 8px;
  display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.rw-card.rw-approved { border-left-color: var(--ok); }
.rw-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rw-card p { margin: 0; }
.rw-sum b { font-size: 1.02rem; }
.rw-decision { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.tag.rw-st-open { color: var(--warn); border-color: currentColor; }
.tag.rw-st-proposed { color: var(--brand-2); border-color: currentColor; }
.tag.rw-st-approved { color: var(--ok); border-color: currentColor; }
.rw-seg { display: flex; gap: 8px; flex-wrap: wrap; }
.rw-seg label { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.rw-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 12px; }

/* Закупки по заказу */
.pur-panel .mini-list li { align-items: flex-start; }
.pur-right { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pur-receipt { font-size: .85rem; }
.pur-panel .btn { margin-top: 8px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand-2); font: inherit; font-size: .85rem; cursor: pointer; text-decoration: underline; }

/* Скидки в КП: общая «сом. / %», скидка на строку */
.disc-row { display: flex; gap: 8px; align-items: center; }
.disc-row input { flex: 1; min-width: 0; }
.kp-lines .pct-in { max-width: 70px; }

/* Результат замера в проекте и в редакторе КП */
.measure-summary { border-left: 3px solid var(--ok); }
.measure-summary .ms-big { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: .95rem; line-height: 1.5; margin: 8px 0; }
.thumbs-lg { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; }
.kp-measure { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.kp-measure summary { cursor: pointer; font-weight: 600; }
.kp-measure p { margin: 8px 0 0; }
.kp-measure .thumbs { margin-top: 8px; }
.kp-lines .dim-in { min-width: 110px; }
/* Окно КП: шире, колонки изделия, материала и размеров — основные */
.modal.xwide { width: min(1120px, 100%); }
.kp-lines { table-layout: fixed; width: 100%; }
.kp-lines th:nth-child(1) { width: 22%; }
.kp-lines th:nth-child(2) { width: 24%; }
.kp-lines th:nth-child(3) { width: 15%; }
.kp-lines th:nth-child(4) { width: 64px; }
.kp-lines th:nth-child(5) { width: 104px; }
.kp-lines th:nth-child(6) { width: 70px; }
.kp-lines th:nth-child(7) { width: 90px; }
.kp-lines th:nth-child(8) { width: 36px; }
.kp-lines .num-in, .kp-lines .pct-in, .kp-lines .dim-in { max-width: none; min-width: 0; }
@media (max-width: 860px) { .kp-lines { table-layout: auto; min-width: 760px; } }
/* Слоган цеха в настройках — поле шире */
[data-slogan] input { width: min(380px, 60vw); }

/* Роли и права */
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.role-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.role-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.role-card-head small { display: block; }
.chip.off { opacity: .55; text-decoration: line-through; }
.warn-tag { color: var(--warn); border-color: var(--warn); }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px 10px; margin: 0; display: grid; gap: 6px; }
.perm-group legend { font-weight: 600; padding: 0 4px; }
.perm-row { align-items: flex-start; }
.perm-row input { margin-top: 2px; flex: none; }
.perm-row small { display: block; }
@media (max-width: 420px) { .role-cards { grid-template-columns: 1fr; } }
.sheet td.late { background-image: linear-gradient(225deg, var(--danger) 0 6px, transparent 6px); }

/* Баланс доп. работ */
.extra-sum { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.extra-sum b { font-size: 1.4rem; }

/* Накладная на закупку */
.invoice input, .invoice select { width: 100%; min-width: 0; }
.invoice .num-in { text-align: right; max-width: 110px; }
.receipt-box { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.receipt-thumb { max-height: 90px; border-radius: 6px; border: 1px solid var(--line); }
@media print { .invoice input, .invoice select { border: 0; background: none; padding: 0; } }

/* «Заказы» с раскрывающимися видами заказов */
.rail-parent { display: flex; align-items: center; gap: 2px; }
.rail-parent > a { flex: 1; min-width: 0; }
.rail-expand { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: #8ea7bb; cursor: pointer; }
.rail-expand:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail-expand:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.rail-expand .ico { width: 18px; height: 18px; transition: transform .18s ease; }
.rail-expand[aria-expanded="true"] .ico { transform: rotate(180deg); }
.rail-subs { display: flex; flex-direction: column; gap: 2px; }
#app.rail-collapsed .rail-expand, #app.rail-collapsed .rail-subs { display: none; }
@media (max-width: 860px) {
  .rail-parent { display: contents; }
  .rail-expand, .rail-subs { display: none; }
}

/* Склад цеха и накладные по строкам */
.tag.ln-bought, .tag.mv-receipt { color: var(--ok, #2e7d32); border-color: currentColor; }
.tag.ln-stock, .tag.mv-issue { color: var(--brand-2); border-color: currentColor; }
.tag.mv-return { color: var(--ok, #1d7a3a); border-color: currentColor; }
.tag.ln-pending { color: var(--warn); border-color: currentColor; }
.tag.mv-sale { color: var(--signal-ink, #6a4b00); background: var(--surface-2); }
.sale-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(70px, 1fr) minmax(80px, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 6px; }
.sale-row .icon-btn { margin-bottom: 6px; }
.sale-row .sale-item-q { margin-bottom: 6px; } /* поиск товара над списком */
.seg-radio { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; cursor: pointer; }
.pick-list { max-height: 260px; overflow-y: auto; }
.pick-list .link-btn { text-decoration: none; text-align: left; }
tr.low-stock td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
@media (max-width: 640px) { .sale-row { grid-template-columns: 1fr 1fr; } }

/* Отчёт по заказам */
.report-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.report-filters .search { flex: 1; min-width: 180px; }
.report-table th { white-space: normal; vertical-align: bottom; font-size: .8rem; }
.report-row { cursor: pointer; }
.report-row:hover td, .report-row.open td { background: var(--surface-2); }
.report-row:focus-visible { outline: 2px solid var(--brand-2); outline-offset: -2px; }
.report-detail > td { background: var(--surface-2); padding: 10px 14px; }
.report-detail-box h3 { margin: 6px 0; font-size: .95rem; }
.pur-task { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.pur-task h3 { margin: 0 0 4px; font-size: .9rem; }
.tag.cash-in { color: var(--ok, #2e7d32); border-color: currentColor; }
tr.active-row td { background: var(--surface-2); }
.stage-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 6px; }
.stage-pick .check { font-size: .86rem; }

/* «Мои заказы» и «Моя работа» конструктора */
.mine-toggle[aria-pressed="true"] { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.designer-panel h3 { font-size: .95rem; margin: 16px 0 8px; }
.designer-panel details { margin-top: 12px; }
.designer-panel details summary { cursor: pointer; font-weight: 600; }
/* «Моя работа» компактно: плитки поменьше, подробности — под «По направлениям и по дням» */
.designer-panel.compact .dash-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.designer-panel.compact .dash-tile { padding: 10px 12px; }
.designer-panel.compact .dash-tile b { font-size: 1.15rem; }
.designer-panel.compact .dash-tile span { font-size: .78rem; }
.designer-panel.compact details { margin-top: 8px; }
/* «Мои задачи» на главной */
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.task-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: inherit; text-decoration: none; background: var(--surface); }
.task-list a:hover { border-color: var(--brand-2); }
.task-list li.now a { border-left: 3px solid var(--signal); }
.task-list .t-ico { font-size: 1.1rem; }
.task-list .t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-list .t-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-list .t-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
/* Строка ввода под «Сметой» и «Материалами»: первое поле — позиция/материал, остальные — по выбору */
.line-entry { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 0 2px; border-top: 1px dashed var(--line); margin-top: 6px; }
.line-entry [hidden] { display: none !important; }
.line-entry .le-f { flex: 1 1 140px; min-width: 0; }
.line-entry .le-pick { flex: 2 1 260px; }
.line-entry .le-detail { flex: 1.5 1 180px; }
.line-entry .le-prod { flex: 1.2 1 150px; }
.line-entry .le-proc { flex: 1.5 1 220px; }
.line-entry .le-s { flex: 0 1 112px; }
.line-entry .le-xs { flex: 0 1 64px; }
.line-entry input, .line-entry select { width: 100%; }
.line-entry .le-add { flex: 0 0 auto; min-width: 40px; font-size: 1.2rem; line-height: 1; }
.line-entry .le-hint { flex-basis: 100%; }
/* Строка детали покраски: «ЧПУ» (как поле строки) — вправо плавно выезжает поле «Вид ЧПУ» */
.line-entry .le-cnc-btn { flex: 0 0 auto; font: inherit; color: var(--brand-2); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; min-height: 38px; cursor: pointer; white-space: nowrap; }
.line-entry .le-cnc-btn:hover { border-color: var(--brand-2); }
.line-entry .le-cnc-btn[aria-expanded="true"] { border-color: var(--brand-2); background: var(--surface-2); }
.page-wide .line-entry .le-cnc-btn { min-height: 40px; }
.line-entry .le-cnc { flex: 1 1 240px; max-width: 0; margin-left: -6px; opacity: 0; overflow: hidden; transition: max-width .3s ease, opacity .25s ease, margin-left .3s ease; }
.line-entry .le-cnc.open { max-width: 640px; margin-left: 0; opacity: 1; }
.line-entry .le-cnc-in { display: flex; align-items: flex-start; gap: 6px; min-width: 200px; }
.line-entry .le-cnc-rows { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.line-entry .le-cnc-row { display: flex; align-items: center; gap: 4px; }
.line-entry .le-cnc-row input { flex: 1; }
.line-entry .le-cnc-plus { flex: 0 0 auto; font: inherit; font-size: 1.1rem; line-height: 1; color: var(--brand-2); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; width: 38px; min-height: 38px; cursor: pointer; }
.line-entry .le-cnc-plus:hover { border-color: var(--brand-2); }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav b { min-width: 9em; text-align: center; }
.designer-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.designer-split article { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.designer-split .sum { margin: 0; }

/* Смета: строка, рассчитанная по услуге (фурнитура, кромка) */
.line-derived td { color: var(--muted); font-size: .9rem; }
.line-derived td:first-child { padding-left: 22px; }

/* Детали покраски и расход краски по цветам */
.paint-table input, .paint-table select { width: 100%; min-width: 64px; padding: 6px 8px; }
.paint-table td:nth-child(2) input { min-width: 150px; }
.paint-table td:nth-child(8) select { min-width: 210px; }
.paint-table td:nth-child(9) input { min-width: 140px; }
.paint-table tfoot td { font-weight: 600; }
.paint-sum h3 { font-size: .95rem; margin: 0 0 8px; }
.paint-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.paint-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft, transparent); }
.paint-card strong { color: var(--brand-2); font-size: 1.05rem; }
.paint-table td input[name="unit_price"] { min-width: 90px; text-align: right; }

/* Материал подготовлен снабженцем */
.line-ready td { background: color-mix(in srgb, var(--ok) 8%, transparent); }

/* Фото материала — что купить */
.mat-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); margin-top: 4px; vertical-align: middle; }
.mat-thumb.big { width: 72px; height: 72px; }
@media print { .mat-thumb.big { width: 90px; height: 90px; } }

/* Графики «Работы» в статистике: один ряд, цвет --chart-1 (проверен для светлой и тёмной темы) */
:root { --chart-1: #2a78d6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chart-1: #3987e5; } }
:root[data-theme="dark"] { --chart-1: #3987e5; }
.works-stats { position: relative; }
.works-stats h3 { font-size: .95rem; margin: 18px 0 8px; }
.works-kpi { margin-bottom: 4px; }
.wc-cols-wrap { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.wc-axis { position: relative; width: 64px; height: 180px; }
.wc-axis span { position: absolute; right: 0; transform: translateY(50%); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.wc-cols { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 180px; border-bottom: 1px solid var(--line); }
.wc-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); pointer-events: none; }
.wc-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; position: relative; cursor: default; }
.wc-col i { display: block; background: var(--chart-1); border-radius: 4px 4px 0 0; min-height: 0; }
.wc-col:hover i { filter: brightness(1.12); }
.wc-col small { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: .66rem; color: var(--muted); margin-top: 3px; }
.wc-cols-wrap + .wc-table { margin-top: 22px; }
.wc-table summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.wc-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wc-hbars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 8px; font-size: .88rem; }
.wc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-track { height: 14px; }
.wc-track i { display: block; height: 100%; background: var(--chart-1); border-radius: 0 4px 4px 0; }
.wc-hbars li:hover .wc-track i { filter: brightness(1.12); }
.wc-hbars b { font-weight: 600; white-space: nowrap; color: var(--ink); }
.wc-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: .82rem; box-shadow: 0 4px 14px rgb(0 0 0 / .15); white-space: nowrap; }
@media (max-width: 600px) { .wc-axis { width: 52px; } .wc-hbars li { grid-template-columns: minmax(80px, 42%) 1fr auto; } }

/* «Мои работы»: карточки работ сотрудника цеха */
.work-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.work-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.work-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.work-card h2 { margin: 2px 0; font-size: 1.15rem; }
.work-card p { margin: 2px 0; color: var(--muted); }
.work-op { color: var(--brand-2); font-weight: 600; }
.work-volume summary { cursor: pointer; font-weight: 600; }
.wv-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.work-total { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); }
.work-total strong { font-size: 1.1rem; }
.work-card .btn.block { min-height: 44px; }
.lunch-form { max-width: 460px; }
.lunch-kind { display: flex; margin-bottom: 4px; }
.lunch-kind button { flex: 1; min-height: 44px; }
.lunch-photo { display: block; width: 100%; max-height: 220px; object-fit: contain; border-radius: 9px; background: var(--surface-2); }
.lunch-rate { margin-top: 16px; }
.lunch-rate .btn-row { align-items: flex-end; }
.work-tabs { display: flex; margin: 0 0 12px; }
.work-tabs button { flex: 1; min-height: 40px; }
/* Выбор раздела работ (Распил, Кромка…): кнопки-чипы, на телефоне — прокрутка в строку */
.chip-pick { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chip-btn { flex: none; min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); font: inherit; cursor: pointer; white-space: nowrap; }
.chip-btn[aria-pressed="true"] { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.work-volume h3 { margin: 16px 0 6px; font-size: 1rem; }
.work-volume .work-total { margin-top: 10px; }
.work-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-bottom: 8px; }
.work-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.work-volume .comment-form { display: flex; gap: 6px; }
.work-volume .comment-form input { flex: 1; min-width: 0; min-height: 40px; }
.work-actions { display: grid; gap: 8px; margin-top: 16px; }
.work-actions .btn { min-height: 44px; }
.works-lead li { align-items: center; }
.oc-parts { margin: 2px 0; font-size: .85rem; color: var(--brand-2); }
/* Категории услуги (Распил, Покраска…): несколько галочек-чипов */
.chip-pick.wrap { flex-wrap: wrap; overflow: visible; }
.field-label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.chip-check { position: relative; display: inline-flex; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { min-height: 36px; display: inline-flex; align-items: center; padding: 6px 14px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); }
.chip-check input:checked + span { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.chip-check input:checked + span::before { content: '✓ '; white-space: pre; }
.chip-check input:focus-visible + span { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.est-section + .est-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.est-section h3 { margin: 0 0 8px; font-size: 1rem; display: flex; justify-content: space-between; gap: 8px; }
/* Карточка заказа у конструктора — шире: смета, материалы, файлы */
#page.page-wide { max-width: 1840px; }
.page-wide .order-layout { grid-template-columns: minmax(0, 1fr) 400px; gap: 22px; }
@media (max-width: 1100px) { .page-wide .order-layout { grid-template-columns: minmax(0, 1fr); } }
.page-wide .line-entry input, .page-wide .line-entry select { min-height: 40px; font-size: 1rem; }
.page-wide .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
/* «Приём материала» */
.intake-form .suggest { position: static; margin-top: -6px; }
.intake-form .suggest span { display: block; color: var(--muted); font-size: .85rem; }
.intake-qty { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.intake-list li { align-items: center; }
.intake-h { margin: 6px 0 10px; font-size: 1.05rem; }
.work-card .wv-row .btn { align-self: center; min-height: 36px; }
/* «Статистика» сотрудника: полоса суммы за месяц */
.month-meter { display: block; height: 6px; margin-top: 4px; border-radius: 3px; background: var(--surface-2); min-width: 120px; }
.month-meter i { display: block; height: 100%; border-radius: 3px; background: var(--brand-2); }
@media (max-width: 640px) {
  .work-cards { grid-template-columns: 1fr; gap: 10px; }
  .work-card { padding: 12px; }
}

/* «Смета заказа» — документ для клиента (печать / PDF, ссылка /e/<токен>) */
.estimate-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.doc-bar { max-width: 820px; margin: 0 auto 14px; }
.doc-bar .btn-row { margin-left: auto; }
.doc-bar-note { width: 100%; margin: 0; text-align: right; }
@media (max-width: 560px) { .doc-bar .btn-row { margin-left: 0; width: 100%; } .doc-bar .btn-row .btn { flex: 1 1 auto; } .doc-bar-note { text-align: left; } }
.estimate-share { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.estimate-share input { flex: 1 1 260px; }
.estimate-public { max-width: 900px; margin: 0 auto; padding: 16px; }
.estimate-doc { max-width: 820px; margin: 0 auto; background: #fff; color: #173748; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 14px rgba(0,0,0,.08); font-size: 14px; }
.estimate-doc .muted, .estimate-doc small { color: #6c7d87; }
.ed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 28px; background: #0c354a; color: #fff; }
.ed-head small { display: block; color: #b7ded8; }
.ed-brand { font-size: 1.9rem; letter-spacing: .04em; }
.ed-no-box { text-align: right; }
.ed-no-box b { display: block; font-size: 1.5rem; }
.ed-client { padding: 18px 28px 4px; }
.ed-client h2 { margin: 0 0 4px; font-size: 1.2rem; }
.ed-sec { padding: 8px 28px; }
.ed-sec h3 { margin: 12px 0 0; padding: 8px 10px; background: #0c354a; color: #fff; font-size: 1.05rem; break-after: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ed-table { width: 100%; border-collapse: collapse; }
.ed-table th { background: #e9f3f4; text-align: left; padding: 7px 8px; font-size: .78rem; }
.ed-table td { padding: 7px 8px; border-bottom: 1px solid #dce6e9; vertical-align: top; }
.ed-table td small { display: block; }
.ed-table tbody tr:nth-child(even) { background: #f5f8f9; }
.ed-table tfoot td { font-weight: 600; border-bottom: 0; }
.ed-table .r { text-align: right; }
.ed-table tbody tr.ed-group td { background: #e9f3f4; font-weight: 700; text-align: center; padding: 6px 8px; }
.ed-table tbody tr.ed-group td.r { text-align: right; }
.est-table tr.est-group td { background: var(--surface-2, rgba(127,127,127,.08)); font-weight: 700; padding-top: 8px; padding-bottom: 8px; }
.est-table tr.est-group td small { font-weight: 400; margin-left: 8px; }
.est-group-in { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.est-group-btn { font-weight: 400; }
.est-design-end { display: flex; justify-content: flex-end; padding: 8px 12px 0; }
.ed-no { color: #6c7d87; width: 28px; }
.ed-total { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 12px 28px; padding: 14px 18px; background: #e1f3ed; border-radius: 8px; }
.ed-total dd { margin: 0; text-align: right; }
.ed-total .ed-grand { font-size: 1.25rem; font-weight: 700; color: #098569; }
.ed-foot { padding: 10px 28px 18px; color: #6c7d87; font-size: .78rem; }
@media print {
  body * { visibility: hidden; }
  .estimate-doc, .estimate-doc * { visibility: visible; }
  .estimate-doc { position: absolute; left: 0; top: 0; width: 100%; max-width: none; box-shadow: none; border-radius: 0; }
  .no-print { display: none !important; }
  .ed-head, .ed-table th, .ed-total, .ed-table tbody tr:nth-child(even) { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 12mm; }
}

/* Смета заказа в карточке — как в старой системе */
.est-table td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.est-table .est-sub { display: block; color: var(--muted); font-size: .82rem; margin-top: 3px; }
.est-table .est-color { display: block; width: 100%; max-width: 280px; min-height: 34px; margin: 6px 0 2px; padding: 4px 10px; font-size: .9rem; }
.est-table .est-qty small { display: block; color: var(--muted); font-size: .76rem; }
.est-table tfoot .est-total td { font-size: 1.05rem; padding-top: 14px; border-bottom: 0; }
.est-table tfoot .est-total td.r { font-size: 1.35rem; font-weight: 700; color: var(--brand-2); }

/* Смета и расходные материалы в карточке — лёгкая таблица (без сетки): разделители строк, итог крупно */
.table.est-table { border: 0; font-size: .93rem; }
.table.est-table th { background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--muted);
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 6px 10px; }
.table.est-table td { border: 0; border-bottom: 1px solid var(--line); padding: 12px 10px; }
.table.est-table tbody tr:last-child td { border-bottom: 0; }
.table.est-table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table.est-table .est-name b { font-weight: 600; }
.table.est-table .est-sum { font-weight: 700; }
.table.est-table .est-qty { font-variant-numeric: tabular-nums; }
.table.est-table .est-price, .table.est-table .est-sum { font-variant-numeric: tabular-nums; }
.table.est-table .est-act { width: 1%; padding-left: 4px; padding-right: 4px; }
/* Количество, цена, сумма — одной ширины во всех сметах заказа: столбцы стоят ровно друг под другом. */
.table.est-table th.est-qty, .table.est-table th.est-price, .table.est-table th.est-sum { width: 130px; }
.table.est-table .est-price .num-in { width: 100%; max-width: 110px; }
/* Деталь покраски в смете: «+ ЧПУ» и «+ Дизайн», под строкой — её ЧПУ и картинки дизайна */
.paint-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.paint-chip { border: 1px dashed var(--line); background: transparent; color: var(--brand-2); border-radius: 999px; padding: 2px 10px; font-size: .8rem; line-height: 1.5; cursor: pointer; white-space: nowrap; }
.paint-chip:hover { border-style: solid; }
.table.est-table tr:has(+ tr.est-extra:not([hidden])) td { border-bottom: 0; padding-bottom: 4px; }
.table.est-table tr.est-extra td { padding-top: 0; }
.table.est-table tbody tr.est-extra:hover td { background: transparent; }
.paint-extra-box { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.paint-cnc-row { display: flex; align-items: center; gap: 6px; }
.paint-cnc-row input { flex: 1; min-width: 0; min-height: 34px; padding: 4px 10px; font-size: .9rem; }
.paint-x-label { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; min-width: 52px; }
.paint-designs { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.paint-designs:empty { display: none; }
.paint-design { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.paint-design img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.paint-design figcaption { display: flex; align-items: center; gap: 2px; font-size: .75rem; }
.est-total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 4px; padding: 12px 10px 2px; border-top: 2px solid var(--line); }
.est-total-row span { font-size: 1rem; font-weight: 600; }
.est-total-row strong { font-size: 1.45rem; font-weight: 700; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.est-section h3 { padding: 8px 12px; background: var(--surface-2); border-radius: 8px; align-items: center; margin-bottom: 4px; }
.est-section + .est-section { border-top: 0; }
/* Разделы сметы — отдельные карточки со своим цветом: распил, покраска, ЧПУ, мягкая мебель */
.est-k-cutting { --est-c: #2563eb; } .est-k-painting { --est-c: #d97706; } .est-k-cnc { --est-c: #0891b2; } .est-k-soft { --est-c: #7c3aed; }
.est-section.est-card { margin-top: 14px; padding: 0 12px 12px; border: 1px solid var(--line); border-left: 4px solid var(--est-c, var(--line)); border-radius: 10px; }
.est-section.est-card h3 { margin: 0 -12px 8px; padding: 10px 12px; border-radius: 0 9px 0 0; font-size: 1.08rem; }
.est-section.est-card h3 > span:first-child { color: var(--est-c, inherit); }
@media (max-width: 600px) { .est-section.est-card { padding: 0 8px 8px; } .est-section.est-card h3 { margin: 0 -8px 8px; } }

/* ── Выдвижное меню на телефоне: свайп вправо / ☰ — открыть, свайп влево / затемнение — закрыть ── */
.drawer, .drawer-back, .topbar-menu { display: none; }
@media (max-width: 860px) {
  .topbar-menu { display: inline-flex; font-size: 1.25rem; line-height: 1; }
  .drawer-back {
    display: block; position: fixed; inset: 0; z-index: 60; background: rgba(8, 18, 28, .45);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .drawer {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 61;
    width: min(300px, 84vw); background: var(--brand); color: #dfe8f0; overflow-y: auto; overscroll-behavior: contain;
    padding: 14px 10px calc(14px + env(safe-area-inset-bottom)); box-shadow: 4px 0 24px rgba(0, 0, 0, .3);
    transform: translateX(-100%); transition: transform .22s ease; visibility: hidden;
  }
  #app.drawer-open .drawer, #app.drawer-drag .drawer { visibility: visible; }
  #app.drawer-open .drawer { transform: none; }
  #app.drawer-open .drawer-back { opacity: 1; pointer-events: auto; }
  #app.drawer-drag .drawer, #app.drawer-drag .drawer-back { transition: none; }
  .drawer-head { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px; }
  .drawer-head strong { display: block; color: #fff; font-family: var(--display); letter-spacing: .04em; }
  .drawer-head small { display: block; color: #9fb6c9; font-size: .78rem; }
  .drawer-x { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: #c9d7e3; font-size: 1.6rem; line-height: 1; cursor: pointer; }
  .drawer-x:hover { background: rgba(255, 255, 255, .07); color: #fff; }
  .drawer nav { display: flex; flex-direction: column; gap: 2px; }
  .drawer nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 8px;
    color: #c9d7e3; text-decoration: none; font-weight: 500;
  }
  .drawer nav a.active { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 3px 0 0 var(--signal); }
  .drawer nav a.rail-sub { padding: 7px 12px 7px 46px; font-size: .9rem; position: relative; }
  .drawer .rail-group { display: block; }
  .drawer-version { margin-top: auto; padding: 12px 12px 0; color: #7f98ad; font-size: .75rem; }
}
@media (max-width: 860px) {
  /* Свёрнутая на компьютере панель (rail-collapsed) не должна прятать группы и виды заказов в меню телефона. */
  #app .drawer .rail-group { display: block; }
  #app .drawer nav a.rail-sub { display: flex; }
  #app .drawer nav a span { display: inline; }
  .drawer nav a.rail-sub .dot { position: absolute; left: 22px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
  .drawer nav a.rail-sub.active .dot { opacity: 1; background: var(--signal); }
}
@media (max-width: 860px) {
  /* Нижней панели нет — все разделы в выдвижном меню (☰ / свайп вправо). */
  #app .rail { display: none; }
  /* Широкая таблица прокручивается внутри себя и не расширяет страницу (иначе браузер уменьшает масштаб,
     и значки шапки не доходят до правого края). */
  .main-col { overflow-x: clip; }
}

/* Заказ услуги ждёт аванс; аванс вычитается внизу сметы */
.advance-wait { margin: 0 0 10px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--ink); font-weight: 500; }
.est-advance { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.est-advance b { color: var(--ink); font-weight: 600; }
.est-discount { align-items: center; }
.est-discount-form { display: inline-flex; align-items: center; gap: 6px; }
.est-discount-form input { width: 5.5em; }
.soft-files { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.soft-files h3 { margin: 0; font-size: 1rem; }
.soft-notes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.soft-notes li { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.soft-notes p { margin: 0 0 2px; white-space: pre-wrap; }
.soft-note-form:not([hidden]) { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.work-notes { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.work-notes li { white-space: pre-wrap; }
.est-packing { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.est-tools .est-packing:first-of-type { border-top: 0; padding-top: 4px; }
.est-tools .est-packing:last-child { padding-bottom: 0; }

/* Карточка заказа в списке: в углу — вид (заказ цеха / заказ услуги) и статус */
.oc-tags { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.kind-tag { padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; border: 1px solid currentColor; }
.kind-tag.shop { color: var(--brand-2); }
.kind-tag.svc { color: var(--warn); }

/* ── Статистика чертежей конструктора: услуги (оранжевый) и цех (синий) ── */
:root { --ds-svc: #d9730d; --ds-shop: #2a78d6; --ds-up: #2e7d32; --ds-down: #c62828; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ds-svc: #f0a040; --ds-shop: #4a95ec; --ds-up: #5cc46a; --ds-down: #ef6a6a; } }
:root[data-theme="dark"] { --ds-svc: #f0a040; --ds-shop: #4a95ec; --ds-up: #5cc46a; --ds-down: #ef6a6a; }
.ds-total { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.ds-total > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.ds-total span { display: block; color: var(--muted); font-size: .82rem; }
.ds-total b { font: 700 1.5rem var(--display); }
.ds-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; align-items: start; }
.ds-grid > .panel { margin: 0; }
.ds-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; border-top: 4px solid var(--ds-c); }
.ds-card.svc, .ds-dot.svc { --ds-c: var(--ds-svc); }
.ds-card.shop, .ds-dot.shop { --ds-c: var(--ds-shop); }
.ds-card header { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.ds-card h2 { margin: 0; font-size: 1.1rem; }
.ds-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--ds-c); flex: none; margin-top: 5px; }
h2 .ds-dot { margin: 0 4px 0 0; vertical-align: middle; }
.ds-count { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--ds-c) 16%, transparent); color: var(--ds-c); font-weight: 700; white-space: nowrap; }
.ds-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ds-metrics > div { display: flex; flex-direction: column; gap: 2px; }
.ds-metrics span { color: var(--muted); font-size: .82rem; }
.ds-metrics b { font: 700 1.7rem/1.15 var(--display); color: var(--ds-c); }
.ds-delta { font-size: .78rem; color: var(--muted); }
.ds-delta.up { color: var(--ds-up); }
.ds-delta.down { color: var(--ds-down); }
.ds-facts { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 14px 0 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .9rem; }
.ds-facts dt { color: var(--muted); }
.ds-facts dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.ds-share { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.ds-share i { display: block; height: 100%; background: var(--ds-c); border-radius: 4px; }
.ds-legend { display: flex; gap: 16px; margin: 0 0 8px; font-size: .85rem; color: var(--muted); }
.ds-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.ds-legend i.svc, .ds-pair i.svc { background: var(--ds-svc); }
.ds-legend i.shop, .ds-pair i.shop { background: var(--ds-shop); }
.ds-chart { display: grid; grid-template-columns: auto 1fr; gap: 8px; height: 220px; }
.ds-axis { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 18px; font-size: .72rem; color: var(--muted); text-align: right; white-space: nowrap; }
.ds-cols { display: flex; align-items: stretch; gap: 2px; min-width: 0; border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--line), var(--line)) 0 0 / 100% 1px no-repeat, linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat; }
.ds-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.ds-pair { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 1px; }
.ds-pair i { flex: 0 1 12px; min-width: 2px; border-radius: 3px 3px 0 0; min-height: 0; transition: height .2s ease; }
.ds-col:hover .ds-pair i { filter: brightness(1.15); }
.ds-col small { height: 18px; line-height: 18px; text-align: center; font-size: .7rem; color: var(--muted); overflow: hidden; }
@media (max-width: 860px) {
  .ds-grid { grid-template-columns: minmax(0, 1fr); }
  .ds-total b { font-size: 1.15rem; }
  .ds-metrics b { font-size: 1.35rem; }
  .ds-chart { height: 180px; }
}
.paint-all { display: flex; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); }
.paint-all select { max-width: 200px; }
.paint-pass { display: grid; gap: 2px; margin-bottom: 6px; }
.paint-pass > small:first-child { color: var(--muted); font-size: .76rem; }

/* «Добавить оплату мастеров»: должности по отделам оргструктуры */
.pay-pos { border: 1px solid var(--line, rgba(255,255,255,.12)); border-radius: 8px; padding: 6px 12px 10px; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; }
.pay-pos legend { padding: 0 6px; font-weight: 600; font-size: .9em; }

/* Расходники заказов — главная снабженца */
.supply-panel .panel-head .search { min-width: 200px; }
.supply-order { border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 10px; background: var(--surface); padding: 10px 12px; margin-top: 8px; }
.supply-order:hover, .supply-order[open] { border-color: var(--brand-2); }
details.supply-order > summary.panel-head { margin: 0; gap: 6px 14px; flex-wrap: wrap; align-items: center; }
.supply-order h3 { margin: 0; font-size: 15px; }
.asm-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; align-items: center; }
.asm-filters .search { flex: 1 1 200px; max-width: 320px; margin: 0; }
.asm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.asm-list a { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; text-decoration: none; }
.asm-list a:hover { border-color: var(--brand-2); }
.asm-list li.hot a { border-color: #c43d3d; box-shadow: inset 4px 0 0 #c43d3d; }
.asm-list li.ph-ready:not(.hot) a { box-shadow: inset 4px 0 0 #1f8a4c; }
.asm-main { flex: 1 1 240px; min-width: 0; }
.asm-main small { display: block; color: var(--muted); margin-top: 2px; }
.asm-side { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.asm-tag { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.2; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2, transparent); color: var(--muted); white-space: nowrap; }
.asm-tag.ok { color: #1f8a4c; border-color: currentColor; }
.asm-tag.warn { color: #b26a00; border-color: currentColor; }
.asm-tag.buy { color: #2f6fd0; border-color: currentColor; }
.asm-heads { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; }
.asm-pos-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.asm-pos-head h3 { margin: 0; font-size: 1rem; }
.asm-pos-head small { display: block; }
.asm-pos.st-done, .asm-pos.st-skipped { opacity: .8; }
.asm-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 10px 0; }
.asm-nums > div { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.asm-nums dt { font-size: .78rem; color: var(--muted); }
.asm-nums dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.asm-info { margin: 6px 0; }
.asm-info.ok b { color: #1f8a4c; }
.asm-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.asm-act .field { flex: 1 1 220px; min-width: 0; max-width: 420px; margin: 0; }
.asm-act .asm-q { flex: 0 1 120px; }
.asm-rows { margin-top: 8px; }
.asm-rows summary { cursor: pointer; color: var(--muted); font-size: .86rem; }
.supply-order h3 small { display: block; font-weight: 400; margin-top: 2px; }
details.supply-order > summary { cursor: pointer; list-style: none; }
details.supply-order > summary::-webkit-details-marker { display: none; }
details.supply-order > summary h3::before { content: '▸'; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .15s; }
details.supply-order[open] > summary h3::before { transform: rotate(90deg); }
details.supply-order[open] > summary { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cash-note { color: var(--ink); opacity: .85; white-space: pre-line; }
.mini-list li.role-info { display: block; padding: 4px 0 10px; }
.mini-list li.role-info .role-card { gap: 4px; }
.mini-list li.role-info small { display: block; }
.imp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 16px; background: #fff4d6; color: #3d2c00; border-bottom: 2px solid #e0a800; font-size: .9rem; }
.imp-bar .btn { margin-left: auto; }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; min-width: 0; }
.pw-show { font-size: 1.05rem; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; line-height: 1.6; }
.acc-btns { flex-wrap: wrap; justify-content: flex-end; }
.mini-list li.acc-li { flex-wrap: wrap; }
.mini-list li.acc-li > span:first-child { flex: 1 1 240px; }
.earn-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; white-space: nowrap; }
.tag.ok-paid { color: var(--ok, #1a7f37); border-color: currentColor; }
.handover-wait { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.cloud-box { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.cloud-box h3 { margin: 0; }
.cloud-steps { padding-left: 18px; margin: 4px 0 10px; line-height: 1.6; }
/* «Как работать» → схема работы: шаги цепочкой со стрелками, кто делает — из оргструктуры */
.hp-scheme .seg { margin-bottom: 12px; flex-wrap: wrap; }
.fl-chain { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 26px; }
.fl-node { position: relative; flex: 1 1 180px; max-width: 260px; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 10px 38px;
  border: 1px solid var(--line); border-left: 4px solid var(--accent, #e0a800); border-radius: 10px; background: var(--surface); }
.fl-node.fl-sales { border-left-color: var(--ok); }
.fl-node::after { content: '→'; position: absolute; right: -21px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.1rem; }
.fl-node:last-child::after { content: none; }
.fl-n { position: absolute; left: 10px; top: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); font-size: .75rem;
  display: grid; place-items: center; font-weight: 700; }
.fl-node small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.fl-who span { display: block; }
.fl-who b { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .fl-chain { flex-direction: column; } .fl-node { max-width: none; } .fl-node::after { content: '↓'; right: auto; left: 16px; top: auto; bottom: -19px; transform: none; } }
/* Строка списка — кнопкой (доп. работа в «Моих работах»): как ссылка, текст слева */
.linklike { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.linklike small { color: var(--muted); }
/* «Статистика» сотрудника цеха: полоса по виду работы во всю ширину подписи */
.ws-bars .ws-bar-label { flex: 1; min-width: 0; }
.ws-bars .month-meter { height: 8px; min-width: 0; }
/* «Канбан производства»: колонки этапов в ряд (на телефоне — друг под другом), карточки заказов */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.kb-col { flex: 0 0 270px; background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kb-col h2 { font-size: 1rem; margin: 2px 4px 4px; }
.kb-empty { margin: 4px; }
.kb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.kb-card.urgent { border-left: 4px solid var(--warn); }
.kb-card.waiting { opacity: .75; }
.kb-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kb-card .chip.me { border-color: var(--brand-2); font-weight: 600; }
@media (max-width: 640px) { .kanban { flex-direction: column; } .kb-col { flex: 1 1 auto; width: 100%; } }
.kb-tabs { margin-bottom: 12px; }
.kb-card.done { opacity: .85; }
/* Задачи столяра («Заказы», «Услуги»): задача — слева что сделать, справа кнопки */
.task-list .task-row { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.task-list .task-row > div:first-child { flex: 1 1 260px; min-width: 0; }
/* Молярный цех: доска начальника и задания по деталям (в основном с телефона) */
.pt-search { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: inherit; font: inherit; margin-bottom: 12px; }
.pt-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.pt-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pt-tile strong { font-size: 1.4rem; line-height: 1.1; }
.pt-tile span { font-size: .85rem; color: var(--muted); }
.pt-tile[aria-pressed="true"] { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.pt-tile[aria-pressed="true"] span { color: rgba(255, 255, 255, .85); }
.pt-tile.hot:not([aria-pressed="true"]) { border-color: var(--warn); }
.pt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.pt-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.pt-card.urgent { border-left: 4px solid var(--warn); }
.pt-card.problem, .work-card.pt-problem { border-color: var(--danger); }
.pt-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.pt-no { font-size: 1.15rem; }
.pt-title { color: var(--muted); }
.pt-part { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.pt-part small, .pt-line small { display: block; color: var(--muted); }
.pt-progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pt-progress span { display: block; height: 100%; background: var(--ok); }
.pt-details { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px; border: 0; border-radius: 12px;
  background: var(--surface-2); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pt-details small { display: block; color: var(--muted); }
.pt-card .btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-card .btn-row .btn { min-height: 44px; flex: 1 1 auto; }
.pt-st-review { background: var(--signal-a09); border-color: var(--warn); }
.pt-st-working { background: var(--work-a12); }
.pt-st-done { background: var(--ok-a15); }
.pt-sheet { display: flex; flex-direction: column; gap: 8px; }
.pt-meta { display: flex; flex-direction: column; gap: 6px; }
.pt-label { font-weight: 600; color: var(--muted); font-size: .9rem; margin-top: 4px; }
.pt-lines { display: flex; flex-direction: column; gap: 8px; }
.pt-line { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); }
.pt-line.on { border-color: var(--brand-2); box-shadow: 0 0 0 1px var(--brand-2); }
.pt-line.full { opacity: .7; }
.pt-line-main { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.pt-line-main input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--brand-2); }
.pt-line .pt-who { color: inherit; }
.pt-qty { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.pt-qty .stepper { display: flex; align-items: center; gap: 10px; }
.pt-qty .stepper .icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 999px; font-size: 1.2rem; }
.pt-qty .stepper b { min-width: 24px; text-align: center; }
.pt-foot { position: sticky; bottom: 0; margin: 4px -18px -18px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--surface);
  border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pt-foot-sum { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.pt-foot .btn { min-height: 48px; }
@media (max-width: 860px) { .pt-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .pt-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pt-list { grid-template-columns: 1fr; }
}
/* «Детали заказа» молярного цеха: деталь раскрывается — внутри этапы (проходы) с сотрудником и «Назначить» */
.pt-line { padding: 0; overflow: hidden; }
.pt-line-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 12px 14px;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pt-line-head small { display: block; color: var(--muted); }
.pt-chev { font-size: 1.1rem; color: var(--muted); }
.pt-steps { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.pt-step { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.pt-step-head { display: flex; justify-content: space-between; gap: 10px; font-size: 1.02rem; }
.pt-step .field { margin: 0; }
.pt-step select { width: 100%; min-height: 44px; }
.pt-step .btn { min-height: 46px; }
.pt-step .pt-qty { margin-top: 0; }
.pt-who { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Канбан молярного цеха: заказы в колонках по состоянию; на телефоне — плитки и одна выбранная колонка */
.pt-kb-tiles { display: none; }
.pt-kanban .kb-col { flex: 0 0 300px; }
.pt-kanban .pt-card { padding: 12px; }
.pt-rv { display: flex; flex-direction: column; gap: 6px; }
.pt-rv-row { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: var(--signal-a09); }
.pt-rv-row small { display: block; color: var(--muted); }
@media (max-width: 640px) {
  .pt-kb-tiles { display: grid; }
  .pt-kanban .kb-col:not(.sel) { display: none; }
  .pt-kanban .kb-col { background: none; padding: 0; }
  .pt-kanban .kb-col h2 { display: none; }
}
/* Кабинет начальника малярного цеха: подписи пунктов меню, «Главная», «Мои работы», «Сотрудники», «Статистика» */
.rail-desc { display: block; font-size: .74rem; font-weight: 400; opacity: .7; line-height: 1.2; }
.ph-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ph-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  color: inherit; text-decoration: none; min-height: 96px; }
.ph-tile span { color: var(--muted); font-size: .9rem; }
.ph-tile strong { font-size: 1.8rem; line-height: 1.1; }
.ph-tile small { color: var(--muted); }
.ph-tile:hover { border-color: var(--brand-2); }
.ph-tile.hot, .ph-tile.warn { border-color: var(--warn); }
.ph-tile.bad { border-color: var(--danger); }
.ph-tile.bad strong { color: var(--danger); }
.ph-tile.ok strong { color: var(--ok); }
.ph-me { display: flex; justify-content: space-between; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.ph-me small { display: block; }
.ph-me .r { text-align: right; }
.pm-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pm-sum > div { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pm-sum > div.hot { border-color: var(--warn); }
.pm-sum span, .pm-sum small { color: var(--muted); font-size: .85rem; }
.pm-sum strong { font-size: 1.3rem; }
.pm-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 0; }
.pm-facts div { min-width: 0; }
.pm-facts dt { color: var(--muted); font-size: .8rem; }
.pm-facts dd { margin: 0; }
.pm-group h2 { font-size: 1.05rem; margin: 16px 0 8px; }
.pm-period { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.pm-period .seg button { min-height: 40px; }
.pm-dates { display: flex; gap: 8px; flex-wrap: wrap; }
.pm-dates input { min-height: 40px; }
.pm-h { font-size: 1.1rem; margin: 18px 0 8px; }
.pm-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pm-bar-top { display: flex; justify-content: space-between; gap: 10px; }
@media (max-width: 860px) { .ph-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Кабинет начальника производства: вкладки разделов, «Распределение» */
.hub-tabs { margin-bottom: 14px; }
.dist-areas { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dist-areas li { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.dist-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.dist-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.dist-people label { display: flex; gap: 8px; align-items: center; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.dist-people input { width: 20px; height: 20px; accent-color: var(--brand-2); }
.ph-grid button.ph-tile { font: inherit; text-align: left; cursor: pointer; }
/* «Входит в цену» у строки сметы заказа услуги */
.est-act .in-price { padding: 2px 8px; min-height: 28px; font-size: .78rem; margin-right: 4px; }
.est-act .in-price.on { background: var(--ok-a15); border-color: var(--ok); color: var(--ok); }

/* Кабинет менеджера по услугам: «Финансы» — заголовок подпунктов (без ссылки) */
.rail-subhead { display: flex; align-items: center; gap: 12px; padding: 8px 12px; color: #9fb3c4; font-weight: 500; }
#app.rail-collapsed .rail-subhead { display: none; }
@media (max-width: 860px) {
  .rail .rail-subhead { display: none; }
  .drawer .rail-subhead { display: flex; padding: 11px 12px; }
}

/* «Статистика услуг» и «Обзор» менеджера по услугам */
.svc-find { display: flex; gap: 8px; margin: 0 0 14px; }
.svc-find input { flex: 1; min-width: 0; }
.svc-h2 { margin: 18px 0 8px; font-size: 1.05rem; }
.svc-tabs { margin-bottom: 10px; overflow-x: auto; }
.svc-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.svc-filters select, .svc-filters input { flex: 1 1 160px; min-width: 0; max-width: 260px; }
.svc-loading { opacity: .55; transition: opacity .15s; }
.svc-kinds { margin: 0 0 10px; overflow-x: auto; flex-wrap: nowrap; }
.svc-q { max-width: 280px; }
.svc-row { cursor: pointer; }
.svc-row:hover td { background: rgba(127, 127, 127, .07); }
.svc-sub > td { background: rgba(127, 127, 127, .05); padding: 8px 10px 12px; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.svc-cols { display: flex; align-items: flex-end; gap: 2px; height: 170px; border-bottom: 1px solid var(--line); padding-top: 6px; }
.svc-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.svc-col > i, .svc-pair i { display: block; background: var(--chart-1, var(--signal)); border-radius: 3px 3px 0 0; }
.svc-col small { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: .68rem; color: var(--muted); }
.svc-cols { margin-bottom: 22px; }
.svc-pair { display: flex; align-items: flex-end; gap: 1px; height: 100%; }
.svc-pair i { flex: 1; }
.svc-pair i.prev, .svc-key.prev { opacity: .4; }
.svc-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--chart-1, var(--signal)); vertical-align: middle; margin-left: 8px; }
.svc-notes summary { cursor: pointer; font-weight: 600; }
.svc-profit td small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.svc-profit td:nth-child(2) { white-space: nowrap; vertical-align: top; font-variant-numeric: tabular-nums; }
.svc-profit .svc-act { width: 1%; white-space: nowrap; text-align: right; vertical-align: top; }
.svc-profit .svc-off td { opacity: .6; }
.svc-profit .svc-total td { font-weight: 700; border-top: 2px solid var(--line); }
.svc-profit .svc-result td { font-size: 1.1rem; }
.svc-profit .linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); text-decoration: underline; cursor: pointer; }
.svc-staff { list-style: none; margin: 6px 0 2px; padding: 0; font-size: .86rem; }
.svc-staff li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.svc-vars { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.svc-vars[hidden] { display: none; }
.svc-preview { min-height: 1.4em; margin: 0 0 8px; }
.svc-dept { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; }
.svc-dept > summary { cursor: pointer; }
.svc-tg { white-space: pre-line; font-size: .88rem; margin: 8px 0 4px; max-height: 300px; overflow: auto; }
.svc-dept > summary label { display: inline-flex; }
.svc-dept > label { display: flex; padding: 3px 0 3px 18px; }
@media (max-width: 600px) {
  .svc-filters select, .svc-filters input { max-width: none; flex-basis: 45%; }
  .svc-q { max-width: none; width: 100%; }
}

/* Сроки участков заказа: отметка участка, срок в рабочих днях, начало отсчёта */
.terms-box { display: grid; gap: 6px; }
.terms-box .field-label { font-weight: 600; font-size: .9rem; }
.terms-box > p { margin: 0 0 4px; }
.terms-row { display: grid; grid-template-columns: minmax(140px, 180px) 90px 1fr; gap: 10px; align-items: center; }
.terms-row input[type="number"] { width: 90px; }
@media (max-width: 560px) { .terms-row { grid-template-columns: 1fr 90px; } .terms-row > span { grid-column: 1 / -1; } }
.terms-line { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .9rem; }
/* Ведомость покраски: расход краски по цветам */
.sheet-paint { display: grid; gap: 2px; font-size: .88rem; padding: 6px 8px; border-radius: 8px; background: var(--surface-2, rgba(127,127,127,.08)); }

/* Зарплата: расшифровка оклада — опоздания, ночные часы */
.base-note { display: block; line-height: 1.35; white-space: nowrap; }
div.pay-rules { display: flex; flex-direction: column; gap: 2px; }
div.pay-rules small { font-size: .8rem; }
/* Расчётный лист в карточке сотрудника: начисления слева, выплаты справа — столбиком, суммы по правому краю */
.slip-head { margin: 0 0 10px; }
.slip-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 32px; margin-bottom: 12px; }
.slip-list { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; align-content: start; }
.slip-list dt { color: var(--muted); }
.slip-list dt small { margin-left: 4px; }
.slip-list dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; }
.slip-list .slip-sum { border-top: 1px solid var(--line); padding-top: 6px; color: var(--ink); font-weight: 700; }
.slip-list .slip-due { font: 700 1.2rem var(--display); color: var(--ok); }

/* Просмотр фото поверх сайта (ui.js photoViewer): закрыть ×, листать ‹ › или свайпом */
.photo-view { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom; }
.photo-view img { max-width: 100vw; max-height: 100vh; object-fit: contain; user-select: none; }
.photo-view button { position: absolute; border: 0; color: #fff; background: rgba(255, 255, 255, .14); border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.photo-view button:hover, .photo-view button:focus-visible { background: rgba(255, 255, 255, .28); }
.photo-view .pv-close { top: max(12px, env(safe-area-inset-top)); right: 12px; width: 48px; height: 48px; font-size: 30px; line-height: 1; }
.photo-view .pv-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 30px; line-height: 1; }
.photo-view .pv-prev { left: 10px; }
.photo-view .pv-next { right: 10px; }
.photo-view .pv-count { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px; background: rgba(0, 0, 0, .5); padding: 3px 10px; border-radius: 12px; }

/* Детали покраски: размеры в два столбца */
.pt-dims { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* Прайс-лист одной страницей: заголовок вида услуги */
.price-kind { margin: 22px 0 8px; font-size: 1.15rem; }

/* «Зарплата»: таблица по ширине экрана, шапка и итог закреплены при прокрутке сотрудников */
.payroll-wrap { max-height: calc(100vh - 150px); overflow: auto; margin: 0; }
.payroll { font-size: .84rem; }
.payroll th, .payroll td { padding: 6px 6px; }
.payroll thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--grid); }
.payroll tfoot td { position: sticky; bottom: 0; z-index: 2; box-shadow: inset 0 1px 0 var(--grid); }
.payroll .person-inline span { min-width: 0; }
.payroll .pr-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; min-width: 150px; }
.payroll .pr-acts .btn { padding: 4px 6px; font-size: .76rem; white-space: nowrap; }
@media print { .payroll-wrap { max-height: none; overflow: visible; } .payroll thead th, .payroll tfoot td { position: static; } }


/* Смета: реквизиты для оплаты — в строке подвала справа, под итогом («Оплата по номеру:», копировать, Alif, Dushanbe City) */
.ed-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ed-foot > span { min-width: 0; padding-top: 2px; }
/* «Оплата: номер ⧉» — первая строка; под номером — логотипы: Alif под началом номера, DC — справа */
.ed-pay { margin-left: auto; display: grid; grid-template-columns: auto auto auto; align-items: center; column-gap: 4px; row-gap: 5px;
  font-size: .84rem; color: #6c7d87; white-space: nowrap; }
.ed-pay b { color: #173748; font-size: .92rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.ed-pay-copy { border: 0; background: none; padding: 3px; margin: 0; color: #6c7d87; cursor: pointer; border-radius: 4px; line-height: 0; }
.ed-pay-copy:hover { color: #098569; background: #e1f3ed; }
.ed-pay-logos { grid-column: 2 / 4; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ed-pay img { display: block; width: auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
@media print { .ed-pay-logos { grid-column: 2 / 3; } }

/* Страница заказа клиента: «Уведомления» — в правом верхнем углу карточки, напротив «JEVON мебельный цех» */
.share-brand { min-width: 0; }
.share-brand .sb-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.share-push-slot { margin-left: auto; flex: none; }
.share-push-slot:empty { display: none; }
.share-push { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 11px; border-radius: 999px;
  font: 500 .86rem var(--font); color: var(--ink); cursor: pointer; white-space: nowrap;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent); border: 1px solid color-mix(in srgb, var(--signal) 35%, var(--line));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .2s, border-color .2s, box-shadow .2s, transform .12s; }
.share-push .sp-ico { flex: none; color: var(--signal); transform-origin: 50% 2px; }
button.share-push:hover { border-color: color-mix(in srgb, var(--signal) 70%, var(--line)); background: var(--signal-a09);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 14%, transparent); }
button.share-push:hover .sp-ico { animation: sp-ring .7s ease-in-out; }
button.share-push:active { transform: scale(.96); }
button.share-push:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
button.share-push:disabled { opacity: .6; cursor: progress; }
.share-push.on { cursor: default; color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: var(--ok-a15); }
.share-push.on .sp-ico { color: var(--ok); }
@keyframes sp-ring { 0%, 100% { transform: rotate(0) } 20% { transform: rotate(14deg) } 40% { transform: rotate(-11deg) } 60% { transform: rotate(7deg) } 80% { transform: rotate(-4deg) } }
@media (prefers-reduced-motion: reduce) { .share-push, button.share-push:hover .sp-ico { transition: none; animation: none; } }
/* Узкий экран: «мебельный цех» прячется первым, затем кнопка — только колокольчик */
@media (max-width: 400px) { .share-brand .sb-sub, .share-push .sp-more { display: none; } .share-push { font-size: .82rem; padding: 0 12px 0 10px; } }
@media (max-width: 340px) { .share-push { width: 36px; padding: 0; justify-content: center; } .share-push .sp-txt { display: none; } }
@media print { .share-push-slot { display: none; } }

/* «Завершить заказ — только чертёж»: тёмно-синяя, как «Принять оплату»; кнопка завершения, SVG-галочка вместо эмодзи */
.btn.btn-finish { --fin: var(--brand); --fin-2: var(--brand-2); background: var(--fin); border-color: var(--fin); color: #fff; font-weight: 600; gap: 7px;
  padding-left: 12px; box-shadow: 0 1px 2px rgba(10, 53, 84, .25); transition: background .15s, box-shadow .15s, transform .08s; }
.btn.btn-finish svg { flex: none; }
.btn.btn-finish .bf-note { font-weight: 400; opacity: .85; padding-left: 8px; margin-left: 1px; border-left: 1px solid rgba(255, 255, 255, .35); }
.btn.btn-finish:hover { background: var(--fin-2); border-color: var(--fin-2); box-shadow: 0 2px 8px rgba(10, 53, 84, .3); }
.btn.btn-finish:active { transform: translateY(1px); box-shadow: none; }
.btn.btn-finish:focus-visible { outline: 2px solid var(--fin); outline-offset: 2px; border-radius: 8px; }
.btn.btn-finish:disabled { background: var(--surface-2); border-color: var(--line); color: var(--muted); box-shadow: none; transform: none; cursor: not-allowed; opacity: 1; }
.btn.btn-finish:disabled .bf-note { border-left-color: var(--line); }
@media (max-width: 520px) { .panel-head .btn.btn-finish { width: 100%; } }

/* Иконки интерфейса (js/icons.js) — вместо эмодзи: цвет от текста, ровно по строке рядом с текстом и цифрами */
.ui-icon { display: inline-block; flex-shrink: 0; vertical-align: -0.18em; width: 16px; height: 16px; stroke: currentColor; }
.ui-icon--xs { width: 14px; height: 14px; }
.ui-icon--sm { width: 16px; height: 16px; }
.ui-icon--md { width: 18px; height: 18px; }
.ui-icon--lg { width: 20px; height: 20px; }
.ui-icon--ok { color: var(--ok); } .ui-icon--warn { color: var(--warn); } .ui-icon--danger { color: var(--danger); } .ui-icon--muted { color: var(--muted); }
.btn > .ui-icon, .topbar-btn > .ui-icon, h2 > .ui-icon { vertical-align: middle; }
h2 > .ui-icon { margin-right: 4px; }

/* Меню: квадрат со знаком — вровень с «JEVON», а не по центру всего блока */
.rail-brand { align-items: flex-start; }
.rail-brand .logo-mark { margin-top: 1px; }
#app.rail-collapsed .rail-brand { align-items: center; }

/* «Заказы» установщика и сборщика: этапы в карточке, 3D-чертёж, фото при завершении */
.fit-stages { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.fit-stage { font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.fit-stage.on { background: var(--work-a12); color: var(--st-work); border-color: transparent; }
.fit-card .work-total + .work-total { margin-top: -4px; }
.fit-scheme-modal { width: min(1100px, 96vw); }
.fit-scheme { height: min(72vh, 760px); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #f3f5f7; }
.fit-scheme iframe { width: 100%; height: 100%; border: 0; display: block; }
.fit-photo { display: grid; place-items: center; min-height: 180px; border: 1px dashed var(--grid); border-radius: 10px; text-align: center; overflow: hidden; background: var(--surface-2); }
.fit-photo img { width: 100%; max-height: 50vh; object-fit: contain; display: block; }
.fit-photo-btns .btn { flex: 1 1 160px; }
@media (max-width: 560px) { .fit-scheme { height: 62vh; } }

/* Зарплата: поиск и отдел */
.pr-filter { margin: 12px 0 10px; }
.pr-filter .search { flex: 1 1 240px; max-width: 360px; }
@media (max-width: 600px) { .pr-filter .search, .pr-filter select { flex: 1 1 100%; max-width: none; } }

/* Накладные склада: готовность заказа — когда собирать */
.sp-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; margin-left: 6px; }
.sp-phase { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.2; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface); white-space: nowrap; }
.sp-phase-work { color: #1d5fbf; border-color: #b7cdf0; background: #eef4fd; }
.sp-phase-soon { color: #a55a00; border-color: #f0cf9c; background: #fff5e6; }
.sp-phase-ready { color: #fff; border-color: #1f8a4c; background: #1f8a4c; }
.sp-alert { color: #fff; border-color: #c43d3d; background: #c43d3d; }
.supply-order.sp-urgent { box-shadow: inset 4px 0 0 #c43d3d; }
.supply-order.sp-ph-ready:not(.sp-urgent) { box-shadow: inset 4px 0 0 #1f8a4c; }
.supply-order.sp-ph-soon:not(.sp-urgent) { box-shadow: inset 4px 0 0 #e6a23c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sp-phase-work { color: #9cc2ff; border-color: #2f4f7f; background: #1a2a42; }
  :root:not([data-theme="light"]) .sp-phase-soon { color: #ffcf8a; border-color: #6b4a1a; background: #33260f; } }
:root[data-theme="dark"] .sp-phase-work { color: #9cc2ff; border-color: #2f4f7f; background: #1a2a42; }
:root[data-theme="dark"] .sp-phase-soon { color: #ffcf8a; border-color: #6b4a1a; background: #33260f; }

/* Упаковщик: номер заказа — текстом, карточку заказа не открыть */
body.packer-only a[href^="#/orders"] { pointer-events: none; color: inherit; text-decoration: none; }

/* «Управление сайтом» */
.sa-body { display: grid; gap: 14px; margin-top: 14px; }
.sa-two { display: grid; grid-template-columns: 200px 1fr 1fr; gap: 8px 12px; align-items: start; padding: 8px 0; }
.sa-l { font-weight: 600; font-size: .9rem; padding-top: 8px; }
.sa-f { display: grid; gap: 4px; }
.sa-f small { color: var(--muted); font-size: .72rem; font-weight: 700; }
.sa-f input, .sa-f textarea, .sa-f select { width: 100%; }
.sa-one { grid-template-columns: 200px 1fr; align-items: center; padding: 6px 0; }
.sa-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: var(--surface); }
.sa-card.off { opacity: .6; }
.sa-card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sa-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding-top: 6px; }
.sa-img { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sa-img img { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; }
.sa-photos { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
.sa-photos figure { position: relative; margin: 0; }
.sa-photos img { width: 140px; height: 100px; object-fit: cover; border-radius: 8px; }
.sa-photos .icon-btn { position: absolute; right: 4px; top: 4px; background: var(--surface); }
.sa-add-ph { width: 140px; height: 100px; border: 2px dashed var(--line); border-radius: 8px; background: none; cursor: pointer; color: var(--muted); font-weight: 600; }
.sa-sub { border-top: 1px dashed var(--line); margin-top: 6px; }
tr.sa-new td { background: rgba(255, 208, 47, .08); }
@media (max-width: 760px) { .sa-two, .sa-one { grid-template-columns: 1fr; } .sa-l { padding-top: 0; } }
