/* Фирменный стиль ОртоПринт: минимализм, 90/10 монохром.
   Основа — чёрный текст на белом; ОртоСиний #3AACE2 — только «маячки»
   (тонкие линии, точки статусов, ссылки), tint-фоны — для сообщений.
   Inter — фирменный шрифт; без CDN (панель живёт в LAN), fallback
   на Helvetica Neue / системные. */
:root {
  --bg: #fafafa; --card: #ffffff;
  --ink: #1a1a1a; --ink-soft: #2d2d2d; --muted: #777777;
  --line: #e5e5e5; --line-soft: #eeeeee;
  --accent: #3aace2; --accent-tint: #e8f5fc;
  --green: #95c93d; --green-tint: #f1f8e4;
  --red: #c8443c; --red-tint: #fdefee;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 Inter, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex; min-height: 100vh; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 600; }
.card h3 { margin: 0 0 14px; }

/* --- шапка: единственный крупный брендовый акцент — тонкая голубая линия */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 8px 16px;
  padding: 11px 24px; background: var(--card);
  border-bottom: 2px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-home {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink); font-weight: 600; white-space: nowrap;
}
.brand-home:hover { text-decoration: none; }
.brand-home svg { display: block; }
.crumb { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb b { color: var(--ink); font-weight: 600; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; font-size: 14px; }
.nav a { color: var(--ink-soft); padding: 2px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.active { border-bottom-color: var(--accent); color: var(--ink); font-weight: 500; }
.nav a.who { display: inline-flex; align-items: center; gap: 7px;
  color: var(--muted); font-size: 13px; }
.nav a.who:hover { color: var(--ink); }
.who-avatar { width: 24px; height: 24px; border-radius: 50%;
  object-fit: cover; background: var(--line); flex: none; }
.nav form { margin: 0; }

/* Кнопка-гамбургер и затемнение — только для мобильного выезжающего меню;
   на ПК скрыты (см. медиазапросы ниже). */
.nav-burger { display: none; background: none; border: none; padding: 4px;
  margin: -4px 2px -4px -4px; color: var(--ink); cursor: pointer;
  align-items: center; }
.nav-burger svg { display: block; }
.nav-scrim { display: none; }

/* Сегментированный переключатель (ЛК → раскладка меню). Минимализм: рамка,
   активный сегмент с лёгкой заливкой-акцентом. */
.seg { display: inline-flex; margin: 0; border: 1px solid #d6dade;
  border-radius: 8px; overflow: hidden; }
.seg-opt { position: relative; color: var(--ink-soft); font-size: 14px;
  padding: 8px 16px; cursor: pointer; user-select: none; }
.seg-opt + .seg-opt { border-left: 1px solid #d6dade; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt.on { background: var(--accent-tint); color: var(--ink); font-weight: 500; }

/* ------------------------------------------------- ПК: меню слева (сайдбар) */
/* Пользователь выбирает в ЛК (users.menu_layout). Только на широком экране —
   на узком меню всегда всплывает гамбургером (медиазапрос ниже перекрывает). */
@media (min-width: 641px) {
  .layout-side .topbar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 210px; z-index: 20;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 6px; padding: 16px 14px; overflow-y: auto;
    border-bottom: none; border-right: 2px solid var(--accent);
  }
  .layout-side .brand { flex-direction: column; align-items: flex-start; gap: 8px; }
  .layout-side .crumb { display: none; }
  .layout-side .nav { flex: 1; flex-direction: column; align-items: stretch;
    gap: 2px; width: 100%; margin-top: 6px; }
  .layout-side .nav a { padding: 8px 10px; border-bottom: none; border-radius: 8px; }
  .layout-side .nav a:hover { background: #f2f2f2; }
  .layout-side .nav a.active { background: var(--accent-tint); color: var(--ink);
    border-bottom: none; font-weight: 500; }
  .layout-side .nav a.who { margin-top: 6px; }
  .layout-side .nav a.who span { display: inline; }
  .layout-side .nav form { margin-top: auto; }
  .layout-side .nav form button { width: 100%; }
  .layout-side .wrap, .layout-side .foot { margin-left: 210px; }
  .layout-side .preview-bar { margin-left: 210px; }
}

/* Вторичная навигация раздела (подвкладки «Сотрудники»). Тот же язык, что и
   верхняя навигация — акцентное подчёркивание активной, но приглушённее и с
   разделительной линией снизу. На узком экране горизонтально прокручивается. */
.subnav { display: flex; align-items: center; gap: 22px; margin: 0 0 20px;
  border-bottom: 1px solid var(--line); overflow-x: auto; }
.subnav a { color: var(--muted); font-size: 14px; white-space: nowrap;
  padding: 4px 0 9px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--ink); font-weight: 500; border-bottom-color: var(--accent); }

.wrap { width: 100%; max-width: 1080px; margin: 24px auto; padding: 0 20px; flex: 1; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 22px 24px;
}
.card + .card, .callout + .card { margin-top: 18px; }

/* --- кнопки: чёрные (премиальный минимализм), цвет не тратим на заливку */
button, .btn {
  font: inherit; font-weight: 500; cursor: pointer; border: none;
  border-radius: 8px; padding: 9px 16px;
  background: var(--ink); color: #fff; transition: background .15s;
  display: inline-block; text-decoration: none;
}
button:hover, .btn:hover { background: var(--ink-soft); text-decoration: none; }
button.ghost, .btn.ghost {
  background: transparent; color: var(--ink-soft);
  border: 1px solid #d5d5d5; padding: 7px 12px;
}
button.ghost:hover, .btn.ghost:hover { background: transparent; border-color: var(--ink); }

input, select {
  font: inherit; padding: 9px 11px; border: 1px solid #d6dade;
  border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid rgba(58,172,226,.30); border-color: var(--accent); }
button:focus-visible { outline: 2px solid rgba(58,172,226,.45); outline-offset: 2px; }
label { color: var(--muted); font-size: 13px; }

/* --- таблицы по бренд-гайду: шапка без заливки, тонкая голубая линия снизу */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
thead th {
  color: var(--ink); font-weight: 600; font-size: 13px;
  border-bottom: 1.5px solid var(--accent); white-space: nowrap;
}
tbody th { color: var(--muted); font-weight: 500; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }

/* Затянувшиеся заказы: «маячок» слева + подсветка возраста в дате.
   Старше недели — жёлтый (внимание), старше двух — красный (критично).
   Заливка нарочито бледная, сигнал несут цветная кромка и число дней. */
tr.age-warn { background: #fdf7ea; }
tr.age-crit { background: #fbeceb; }
tr.age-warn:hover { background: #fbf1d9; }
tr.age-crit:hover { background: #f8e1df; }
tr.age-warn > td:first-child { box-shadow: inset 3px 0 0 #e0a83a; }
tr.age-crit > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.age-mark { font-weight: 600; white-space: nowrap; }
/* Обычный (не затянувшийся) заказ: подпись «N дн назад» без акцента. */
.age-plain { font-weight: 400; opacity: .7; }
tr.age-warn .age-mark { color: #9a7017; }
tr.age-crit .age-mark { color: #8c2f28; }

/* Склад: тот же язык подсветки, что у затянувшихся заказов.
   warn — остаток у порога (пора дозаказать), crit — критично низкий. */
tr.lowstock-warn { background: #fdf7ea; }
tr.lowstock-crit { background: #fbeceb; }
tr.lowstock-warn:hover { background: #fbf1d9; }
tr.lowstock-crit:hover { background: #f8e1df; }
tr.lowstock-warn > td:first-child { box-shadow: inset 3px 0 0 #e0a83a; }
tr.lowstock-crit > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.lowstock-num { font-weight: 600; }
tr.lowstock-warn .lowstock-num { color: #9a7017; }
tr.lowstock-crit .lowstock-num { color: #8c2f28; }
.dot-warn, .dot-crit { display:inline-block; width:9px; height:9px; border-radius:2px; vertical-align:-1px; margin-right:4px; }
.dot-warn { background: #fdf7ea; border: 1px solid #e0a83a; }
.dot-crit { background: #fbeceb; border: 1px solid var(--red); }
/* Правка остатка: одно поле со стрелками-спиннером */
.qty-inp { width: 72px; padding: 5px 6px; text-align: center; }
/* Напоминание об инвентаризации: давно не пересчитывали. Синий —
   информирующий, нарочно отличается от жёлто-красной подсветки остатка. */
.recount-due {
  display: inline-block; margin-top: 2px; font-weight: 600;
  color: #1a6e96;
}

/* --- Статистика: KPI-карточки, бар-чарты, блок внимания --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: #f7f7f7; border-radius: 8px; padding: 13px 16px; }
.kpi .k-label { color: var(--muted); font-size: 12px; }
.kpi .k-val { font-size: 26px; font-weight: 600; margin-top: 2px; letter-spacing: -0.01em; }
.sbar { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 14px; }
.sbar .s-label { width: 160px; color: var(--ink-soft); flex: none; }
.sbar .s-track { flex: 1; height: 14px; background: #eef0f2; border-radius: 4px; min-width: 40px; }
.sbar .s-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.sbar .s-fill-alt { background: #7e6bd6; }
.sbar .s-fill-scan { background: #e0a83a; }
/* Таймлайн этапов: узлы-кружки с числом на соединительной линии */
.timeline { display: flex; align-items: flex-start; margin-top: 6px; }
.tl-step { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; }
.tl-step:not(:first-child)::before {
  content: ''; position: absolute; top: 18px; left: -50%; right: 50%;
  height: 2px; background: var(--line); z-index: 0;
}
.tl-node {
  position: relative; z-index: 1; width: 38px; height: 38px; border-radius: 50%;
  background: var(--card); border: 2px solid #ccc; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px;
}
.tl-label { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.25; }
.tl-hint { display: none; }  /* подсказка «нажмите на этап» — только на узком экране */
/* Кружок этапа фокусируем по тапу (чтобы всплыла подсказка), но синюю рамку по
   тапу/клику НЕ рисуем — только для клавиатуры (:focus-visible). */
.tl-node:focus { outline: none; }
.tl-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tl-queued         { border-color: #e0a83a; color: #9a7017; }
.tl-prep_modeling  { border-color: #2fa39a; color: #1a6e63; }
.tl-modeling       { border-color: #8a63c9; color: #5f3f96; }
.tl-prep_printing  { border-color: #4c9f70; color: #2f6e4c; }
.tl-preprocessing  { border-color: #2fa39a; color: #1a6e63; }
.tl-printing       { border-color: var(--accent); color: #1a6e96; }
.tl-postprocessing { border-color: #cf7a45; color: #9a5326; }
.tl-shipping       { border-color: #7e6bd6; color: #5546a8; }
.tl-empty          { border-color: #dcdcdc; color: var(--muted); }
.sbar .s-val { width: 40px; text-align: right; font-weight: 600; flex: none; }
.attn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.attn {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 10px; background: #f7f7f7; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.attn:hover { text-decoration: none; border-color: #d5d5d5; background: #f2f2f2; }
.attn .a-val { font-size: 24px; font-weight: 600; flex: none; min-width: 28px; }
.attn .a-label { font-size: 13px; line-height: 1.35; }
.attn-warn { background: #fdf7ea; border-color: #f0dca8; }
.attn-warn .a-val { color: #9a7017; }
.attn-crit { background: var(--red-tint); border-color: #f2c9c6; }
.attn-crit .a-val { color: #8c2f28; }
.attn-info { background: var(--accent-tint); border-color: #bfe2f4; }
.attn-info .a-val { color: #1a6e96; }

/* --- статусы: нейтральная пилюля + цветная точка-маячок (не заливка) */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 11px 3px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  background: #f5f5f5; color: var(--ink-soft);
}
.pill::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: #c1c8cf; flex: none;
}
.st-uploading::before     { background: #9aa3ad; }
.st-queued::before        { background: #e0a83a; }
.st-prep_modeling::before { background: #2fa39a; }
.st-modeling::before      { background: #8a63c9; }
.st-prep_printing::before { background: #4c9f70; }
.st-preprocessing::before { background: #2fa39a; }
.st-printing::before      { background: var(--accent); }
.st-postprocessing::before{ background: #cf7a45; }
.st-shipping::before      { background: #7e6bd6; }
.st-done   { background: var(--green-tint); }
.st-done::before      { background: var(--green); }
.st-failed { background: var(--red-tint); color: #8c2f28; }
.st-failed::before     { background: var(--red); }
/* отменённый заказ: приглушённо-серый, зачёркнут — «снят с производства»,
   это не ошибка (красный) и не успех (зелёный) */
.st-cancelled { background: #eceef0; color: var(--muted); text-decoration: line-through; }
.st-cancelled::before  { background: #8b949e; text-decoration: none; }
.st-unknown::before    { background: #c1c8cf; }
/* статус-пилюля как кнопка выбора: невидимый select растянут поверх тега,
   клик по самому статусу открывает список доступных переходов */
.status-pick { position: relative; display: inline-block; margin: 0; }
.status-pick .pill { cursor: pointer; }
.status-pick .pill::after {
  content: '▾'; margin-left: 6px; font-size: 11px; opacity: .5;
}
.status-pick select {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0;
  -webkit-appearance: none; appearance: none;
}
.status-pick:hover .pill { filter: brightness(.96); }
.status-pick:focus-within .pill { outline: 2px solid var(--accent); outline-offset: 1px; }
/* тестовый заказ / режим отладки: нарочито «не боевой» вид — пунктир */
.st-test {
  background: #fff; border: 1px dashed #c1c8cf; color: var(--muted);
}
.st-test::before { background: #c1c8cf; }
/* рекламация: заказ переделывали после выдачи — заметный, но не «ошибочный» вид */
.st-reclaim { background: var(--red-tint); color: #8c2f28; }
.st-reclaim::before { background: var(--red); }

/* --- callout-блоки: tint-фон + тонкая цветная кромка слева */
.callout {
  border-radius: 8px; padding: 12px 16px; font-size: 14px;
  border-left: 3px solid var(--line); background: #f5f5f5;
  margin-bottom: 18px;
}
.callout.ok  { background: var(--green-tint); border-color: var(--green); color: #40590f; }
.callout.err { background: var(--red-tint);  border-color: var(--red);  color: #8c2f28; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button.small { padding: 5px 10px; font-size: 13px; }
/* Зарплата: выплаченный наряд визуально гаснет */
tr.paid-row { opacity: .6; }
tr.paid-row:hover { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 44px 0; }

/* --- Цвет оболочки: образец в строке; палитра раскрывается по клику */
.color-value { display: inline-flex; align-items: center; gap: 8px; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--line); vertical-align: middle; flex: none;
}
/* раскрывашка: значение-строка = summary, палитра — внутри */
.color-details summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center;
  gap: 8px; border-radius: 6px; padding: 2px 4px; margin: -2px -4px;
  transition: background .15s;
}
.color-details summary::-webkit-details-marker { display: none; }
.color-details summary:hover { background: rgba(0,0,0,.04); }
.color-caret { font-size: 11px; color: var(--muted); transition: transform .15s; }
.color-details[open] .color-caret { transform: rotate(180deg); }
.color-pick-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.color-pick {
  display: inline-flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer; padding: 6px; border: 2px solid var(--line);
  border-radius: 10px; transition: border-color .15s, background .15s;
  width: 78px; text-align: center;
}
.color-pick:hover { border-color: var(--accent); }
.color-pick.sel { border-color: var(--accent); background: rgba(0,0,0,.03); }
.color-pick input { position: absolute; opacity: 0; pointer-events: none; }
.color-pick img {
  width: 60px; height: 60px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); display: block;
}
.color-pick span { font-size: 13px; }
.color-pick:has(input:checked) { border-color: var(--accent); background: rgba(0,0,0,.03); }
@media (prefers-color-scheme: dark) {
  .color-details summary:hover { background: rgba(255,255,255,.06); }
  .color-pick.sel, .color-pick:has(input:checked) { background: rgba(255,255,255,.05); }
}

/* --- фото заказа */
.photos {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.photos a { display: block; }
.photos img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  border-radius: 8px; border: 1px solid var(--line); transition: border-color .15s;
}
.photos a:hover img { border-color: var(--accent); }
/* --- шапка карточки заказа: ФИО пациента отдельной строкой под заголовком
   (в таблице параметров строки «ФИО» нет — и так понятно, чьё это имя) */
.order-client {
  margin: 6px 0 0; font-size: 16px; font-weight: 500; color: var(--ink);
}

/* Две колонки: слева опорные кадры + кнопки, справа таблица параметров.
   Короткие значения не растягиваются на всю ширину карточки. */
.order-grid {
  display: grid; grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 22px; align-items: start; margin-top: 18px;
}
.order-photos { display: flex; flex-direction: column; gap: 10px; }
.order-photos a[target] { display: block; }
.order-photos img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border-radius: 8px; border: 1px solid var(--line); transition: border-color .15s;
}
.order-photos a[target]:hover img { border-color: var(--accent); }
.order-photos .btn { text-align: center; }
.key-photo-cap {
  display: block; margin-top: 5px; font-size: 12.5px; color: var(--muted);
}
/* телефон: колонки в стопку, кадры не занимают весь экран */
@media (max-width: 720px) {
  .order-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* --- дорожка этапов заказа (карточка): где заказ сейчас и что дальше.
   На ПК — горизонтальный степпер, на телефоне (медиазапрос ниже) лента
   сверху вниз. Пройденное — чёрным, текущий — акцентный кружок,
   следующий доступный шаг — пунктирный контур. */
.flow { list-style: none; margin: 0 0 12px; padding: 0; display: flex; }
.flow-step {
  flex: 1 1 0; min-width: 0; position: relative;
  padding: 28px 3px 0; text-align: center;
}
/* соединительная линия — две половинки по бокам кружка */
.flow-step::before, .flow-step::after {
  content: ''; position: absolute; top: 11px; height: 2px; background: var(--line);
}
.flow-step::before { left: 0; right: 50%; }
.flow-step::after  { left: 50%; right: 0; }
.flow-step:first-child::before, .flow-step:last-child::after { content: none; }
.flow-step.is-done::before, .flow-step.is-done::after,
.flow-step.is-current::before { background: var(--ink); }

.flow-dot {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 24px; border-radius: 50%; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; line-height: 1;
  background: var(--card); border: 2px solid var(--line); color: var(--muted);
}
.flow-name {
  display: block; font-size: 11px; line-height: 1.35; color: var(--muted);
  overflow-wrap: anywhere;   /* страховка на узком экране */
}
.is-done .flow-dot { background: var(--ink); border-color: var(--ink); color: #fff; }
.is-done .flow-name { color: var(--ink-soft); }
.is-current .flow-dot {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 0 0 4px var(--accent-tint);
}
.is-current .flow-name { color: var(--ink); font-weight: 600; }
.is-next .flow-dot { border-style: dashed; border-color: var(--ink); color: var(--ink); }
.is-next .flow-name { color: var(--ink-soft); }
.flow-cap { margin: 0 0 16px; font-size: 13.5px; }
.flow-cap b { font-weight: 600; }

/* форма смены статуса: главная кнопка + комментарий в одну строку */
.flow-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.next-move { padding: 11px 20px; font-size: 15px; font-weight: 600; }
.flow-note { flex: 1 1 220px; min-width: 0; }
.more-moves { flex-basis: 100%; margin-top: 4px; }
.more-moves summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center;
  gap: 7px; font-size: 13.5px; color: var(--muted); padding: 2px 0;
}
.more-moves summary::-webkit-details-marker { display: none; }
.more-moves summary::before { content: '▸'; font-size: 12px; line-height: 1; }
.more-moves[open] summary::before { content: '▾'; }
.more-moves summary:hover { color: var(--ink); }
.more-cap { margin: 12px 0 8px; font-size: 12.5px; color: var(--muted); }
.move-row { display: flex; flex-wrap: wrap; gap: 8px; }
button.danger { color: #8c2f28; border-color: #e6bdb9; }
button.danger:hover { border-color: var(--red); }

/* телефон: дорожка разворачивается в вертикальную ленту — подписи целиком,
   палец не мажет по 9 узким колонкам */
@media (max-width: 720px) {
  .flow { flex-direction: column; margin-bottom: 14px; }
  .flow-step {
    flex: none; text-align: left; padding: 4px 0 4px 36px; min-height: 34px;
    display: flex; align-items: center;
  }
  .flow-step::before, .flow-step::after {
    left: 12px; right: auto; width: 2px; height: auto;
  }
  .flow-step::before { top: 0; bottom: 50%; }
  .flow-step::after  { top: 50%; bottom: 0; }
  .flow-dot { top: 50%; left: 12px; transform: translate(-50%, -50%); }
  .flow-name { font-size: 13.5px; }
  .next-move { width: 100%; text-align: center; }
}

/* --- личные уведомления в ЛК: поле тянется, кнопка по содержимому */
.ntfy-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ntfy-form input { flex: 1 1 220px; min-width: 0; }

/* --- задачи между сотрудниками */
/* форма создания: одна строка, название тянется, остальное по содержимому */
.task-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.task-form .t-title { flex: 3 1 260px; min-width: 0; }
.task-form .t-order { flex: 0 1 120px; min-width: 0; }
.task-head {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px; margin-bottom: 14px;
}
/* активный фильтр — залитой кнопкой, как выбранный сегмент */
.btn.ghost.on { border-color: var(--ink); color: var(--ink); font-weight: 500; }
.tasks-table td { vertical-align: top; }
.t-name { font-weight: 500; }
/* закрытая задача гаснет: список остаётся про «что делать сейчас» */
.task-closed { opacity: .55; transition: opacity .15s; }
.task-closed:hover { opacity: 1; }
.task-move { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
/* срок: просрочка — красным, ближайшие дни — янтарным */
.due { font-variant-numeric: tabular-nums; }
.due-crit { color: #8c2f28; font-weight: 600; }
.due-warn { color: #8a5a00; font-weight: 500; }

/* пометка «раздел на обкатке» рядом с пунктом меню */
.nav-note { margin-left: 4px; font-size: 11px; color: var(--muted); }

/* бейдж с числом моих открытых задач в меню */
.nav-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 600; line-height: 1.5; vertical-align: 1px;
}

/* задачи по заказу в карточке — компактный список, без таблицы */
.order-tasks { list-style: none; margin: 0; padding: 0; }
.order-tasks li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.order-tasks li:last-child { border-bottom: none; }
.order-tasks .ot-title { flex: 1 1 200px; }

/* телефон: строка задачи разворачивается в карточку — список задач читают
   с телефона, а горизонтальная прокрутка таблицы для этого неудобна */
@media (max-width: 720px) {
  .tasks-table, .tasks-table tbody, .tasks-table tr, .tasks-table td {
    display: block; width: 100%;
  }
  .tasks-table thead { display: none; }
  .tasks-table tr {
    padding: 14px 0; border-bottom: 1px solid var(--line);
  }
  .tasks-table tr:last-child { border-bottom: none; }
  .tasks-table td { border: none; padding: 3px 0; }
  .tasks-table select { width: 100%; }
  /* кнопка удаления уезжает вправо, чтобы не занимать строку целиком */
  .tasks-table td:last-child { text-align: right; margin-top: -34px; }
  .task-form .t-title, .task-form .t-order { flex-basis: 100%; }
}

/* --- статистика: выбор периода и сравнение с предыдущим */
.period-card { padding: 12px 16px; }
.period-bar {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px;
}
.period-nav { display: inline-flex; align-items: center; gap: 10px; }
.period-label { font-size: 15px; white-space: nowrap; }
/* сегменты периода — ссылки, а не радио (страница перезагружается) */
.seg a.seg-opt { color: var(--ink-soft); text-decoration: none; }
.seg a.seg-opt:hover { background: rgba(0,0,0,.04); text-decoration: none; }
.seg a.seg-opt.on:hover { background: var(--accent-tint); }
.btn.ghost.disabled { opacity: .35; pointer-events: none; }
/* стрелка изменения под значением KPI */
.k-delta { margin-top: 4px; font-size: 12.5px; white-space: nowrap; }
.k-delta.tone-good { color: #4a7a10; }
.k-delta.tone-bad  { color: #8c2f28; }
.k-delta.tone-same { color: var(--muted); }
@media (max-width: 640px) {
  .period-bar { flex-direction: column; align-items: stretch; }
  .period-nav { justify-content: space-between; }
}

/* Идёт переделка по рекламации: активный блок обведён красноватой рамкой и
   стоит выше, а законченный первый круг гаснет (тот же приём, что у
   выплаченных нарядов) — чтобы исполнителя не назначили не в тот блок. */
.card.card-attn { border-color: #e6bdb9; }
.card.card-done { opacity: .62; transition: opacity .15s; }
.card.card-done:hover, .card.card-done:focus-within { opacity: 1; }

/* Подзаголовок внутри карточки (напр. «Работы по переделке» в блоке
   рекламации): тонкая линия сверху отделяет вторую половину блока. */
.card h4.sub-head {
  margin: 20px 0 10px; padding-top: 16px; font-size: 14px; font-weight: 600;
  border-top: 1px solid var(--line-soft);
}

/* --- рекламация: галочка + причина одной строкой */
.reclaim-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.reclaim-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.reclaim-form input[type="text"] { flex: 1; min-width: 220px; }

/* --- вход */
.login-wrap { max-width: 380px; margin: 9vh auto 0; padding: 0 20px; width: 100%; flex: 1; }
.accent-line { width: 40px; height: 3px; background: var(--accent); border-radius: 2px; }

.foot {
  padding: 14px 24px; text-align: center;
  color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line);
  background: var(--card);
}
.foot a { color: var(--muted); }

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .wrap { margin: 16px auto; padding: 0 12px; }
  .card { padding: 16px; }
  .me-head { flex-direction: column; text-align: center; }

  /* Мобильное меню всегда выезжает гамбургером (раскладка top/side с ПК
     здесь не действует). Кнопка ☰ — слева от логотипа. */
  .nav-burger { display: inline-flex; }
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0; width: 244px; z-index: 60;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 62px 14px 18px; overflow-y: auto;
    background: var(--card); border-right: 2px solid var(--accent);
    box-shadow: 0 0 26px rgba(0, 0, 0, .14);
    transform: translateX(-100%); transition: transform .22s ease;
  }
  body.nav-open .nav { transform: translateX(0); }
  .nav a { padding: 11px 10px; border-bottom: none; border-radius: 8px; }
  .nav a.active { background: var(--accent-tint); color: var(--ink);
    border-bottom: none; font-weight: 500; }
  .nav a.who { margin-top: 6px; }
  .nav a.who span { display: inline; }        /* в выезжающем меню имя показываем */
  .nav form { margin-top: 6px; }
  .nav form button { width: 100%; }
  /* Затемнение под открытым меню. z-index НИЖЕ topbar (10): меню (.nav)
     живёт внутри стек-контекста topbar, поэтому scrim должен быть под этим
     слоем, иначе перекрыл бы само меню. Слим-шапка остаётся видимой сверху. */
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 5;
    background: rgba(0, 0, 0, .38); opacity: 0; visibility: hidden;
    transition: opacity .22s ease; }
  body.nav-open .nav-scrim { opacity: 1; visibility: visible; }

  /* Таймлайн «Заказы по этапам»: на узком экране подписи под кружками
     наезжали друг на друга. Прячем их, название этапа показываем всплывающей
     подсказкой по тапу на кружок (фокус). Кружки помещаются в ряд без текста. */
  .tl-hint { display: block; }
  .tl-label { display: none; }
  .tl-node { cursor: pointer; }
  .tl-node::after {
    content: attr(data-label);
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; font-size: 12px; font-weight: 500;
    padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 6;
    opacity: 0; visibility: hidden; transition: opacity .15s ease; pointer-events: none;
  }
  .tl-node:focus::after, .tl-node:active::after { opacity: 1; visibility: visible; }
}

/* --- Личный кабинет (/panel/me) --- */
.me-head { display: flex; align-items: center; gap: 18px; }
.me-avatar { width: 96px; height: 96px; border-radius: 50%;
  object-fit: cover; background: var(--line); flex: none;
  border: 1px solid var(--line); }
.me-name { font-size: 20px; font-weight: 600; color: var(--ink); }
.me-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.me-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.me-row { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
