/* WareManage — стили новых компонентов (поверх базовых стилей styles.css) */

/* Панели / сетки */
.panel { background: var(--surface, #fff); border: 1px solid var(--line, #e4ece9); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.panel h2, .panel h3 { margin: 0 0 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; align-items: start; }
.two-col > * { min-width: 0; }   /* иначе колонка распирается содержимым и вылезает за экран */
.muted { color: var(--muted, #6b7c77); }
.mt { margin-top: 12px; }
.mt-s { margin-top: 8px; display: block; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.rep-item { padding: 8px 0; border-bottom: 1px solid var(--line,#eef3f1); }
.rep-item:last-child { border-bottom: none; }
.rep-head { margin-bottom: 2px; }
.modal-sm { max-width: 380px; }
.paid-by { font-size: 11px; color: var(--muted,#6b7c77); margin-top: 2px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px); background: #12211d; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 3000; box-shadow: 0 8px 24px rgba(0,0,0,.28); font-size: 14px; max-width: 90%; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* wrap обязателен: на телефоне три кнопки (отчёт + работа + выпуск) не влезали в строку
   и уезжали за край экрана — flex-end прятал их слева */
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
/* на телефоне кнопки в полную ширину: в строку они всё равно не помещаются,
   а так по ним удобнее попадать пальцем */
@media (max-width: 640px) {
  .row-end { justify-content: stretch; }
  .row-end > .btn { flex: 1 1 100%; justify-content: center; }
}

/* Стат-бар + фиксы адаптива (после теста на телефоне) */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stats .stat { display: inline-flex; align-items: baseline; gap: 6px; background: var(--surface,#fff); border: 1px solid var(--line,#e4ece9); border-radius: 10px; padding: 8px 14px; flex: 0 0 auto; }
.stat-val { font-size: 18px; font-weight: 700; }
.stat-lbl { color: var(--muted,#6b7c77); font-size: 13px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* перебиваем .row-actions{display:flex} из styles.css — на <td> флекс ломает ячейку */
.data-table td.row-actions { display: table-cell; vertical-align: middle; text-align: right; white-space: nowrap; }
.amt, .chip, .nowrap { white-space: nowrap; }
.op-note { font-size: 12px; margin-top: 1px; }
/* таблица растёт по содержимому → обёртка реально скроллится вбок на телефоне */
.data-table { width: auto; min-width: 100%; }
.data-table th, .data-table td { white-space: nowrap; }
.data-table td.wrap { white-space: normal; max-width: 220px; }

/* Тулбар раздела */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; }

/* Панель фильтров и сортировки */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.filter-bar .flt {
  min-width: 0; max-width: 100%;
  padding: 7px 32px 7px 10px; font: inherit; font-size: 14px;
  color: var(--ink, #2b2620);
  background-color: var(--card, #fff);   /* не сокращённой записью: она стирает свою стрелку */
  border: 1px solid var(--line, #e7e1d8); border-radius: 10px;
  cursor: pointer;
}
.filter-bar .flt:focus { outline: none; border-color: var(--accent, #2f7d6d); }
.flt-count { font-size: 13px; }

/* Смену не закрыть без отчёта */
.shift-btn[disabled] { opacity: .4; cursor: not-allowed; filter: grayscale(.5); }
.shift-hint {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.45; color: #a4741b; background: #fdf3dd;
}

/* ── Единый вид контролов ────────────────────────────────────────────────
   Класс .input раньше нигде не был описан: поля стилизовались только внутри
   .field, поэтому поиск и всё, что стоит отдельно, выглядело дефолтным. */
.input, .textarea, .flt, .select {
  font: inherit; color: var(--ink, #2b2620); background: #fff;
  border: 1px solid var(--line, #e7e1d8); border-radius: 10px;
  padding: 9px 12px; outline: none; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .textarea:focus, .flt:focus, .select:focus,
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent, #2f7d6d); box-shadow: 0 0 0 3px rgba(47,125,109,.15);
}
.input::placeholder, .textarea::placeholder, .field input::placeholder, .field textarea::placeholder {
  color: #b8b0a5;
}

/* Поиск: iOS красит его как системный, поэтому сбрасываем и рисуем свою иконку */
input[type="search"] {
  -webkit-appearance: none; appearance: none;
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8177' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px center; background-size: 16px;
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button { -webkit-appearance: none; }
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none; width: 16px; height: 16px; cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8177' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center/14px no-repeat;
}

/* Выпадающие списки: своя стрелка вместо системной */
select.select, select.flt, .field select {
  -webkit-appearance: none; appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8177' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}

/* Числовые поля: убираем спиннеры — на телефоне они бесполезны и сужают поле */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Дата: иконка календаря в цвет темы */
input[type="date"] { -webkit-appearance: none; appearance: none; }
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: .55; cursor: pointer;
  filter: invert(52%) sepia(9%) saturate(420%) hue-rotate(0deg);
}

/* Флажки и поля в едином цвете */
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent, #2f7d6d); width: 16px; height: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.textarea { resize: vertical; min-height: 62px; }

/* На телефоне шрифт меньше 16px заставляет iOS приближать страницу при фокусе */
@media (max-width: 640px) {
  .input, .textarea, .flt, .select, .field input, .field select, .field textarea { font-size: 16px; }
}

/* Управление видами работ внутри модалки «Проделанная работа» */
.wt-manage { margin-top: 12px; border-top: 1px solid var(--line, #e7e1d8); padding-top: 10px; }
.wt-manage summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-deep, #246255); }
.wt-add { display: flex; gap: 8px; margin: 10px 0; }
.wt-add .input { flex: 1 1 auto; min-width: 0; }
.wt-add .btn-sm { flex: 0 0 auto; padding: 0 14px; }
.wt-list { display: flex; flex-direction: column; gap: 4px; }
.wt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line, #eef3f1); font-size: 14px; }

/* Импорт прайса из Excel */
.tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.imp-paste { width: 100%; box-sizing: border-box; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; white-space: pre; resize: vertical; }
.imp-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.imp-file { cursor: pointer; margin: 0; }
.imp-file input { display: none; }
.imp-check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 6px; cursor: pointer; }
.imp-check input { width: 16px; height: 16px; }
.imp-preview-wrap { max-height: 320px; overflow: auto; }
.imp-preview th { padding: 4px; }
.imp-preview .imp-mapsel { min-width: 120px; font-size: 12px; padding: 4px 6px; }
.imp-preview td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* Доступы по логину/паролю */
.pass-row { display: flex; gap: 8px; align-items: stretch; }
.pass-row input { flex: 1 1 auto; min-width: 0; }
.pass-row .btn-sm { flex: 0 0 auto; white-space: nowrap; }
.cred-box { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line, #e7e1d8); border-radius: 10px; background: var(--soft, #f6f2ea); }
.cred-box > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cred-box b { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 16px; user-select: all; }

/* Имя в «Выработке» — кликабельно, открывает разбивку по дням.
   Класс НЕ .link-btn: тот уже занят кнопками на экране входа (styles.css) */
.name-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-deep, #246255); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; }
.name-link:hover { color: var(--accent, #2f7d6d); }
.wt-hint { font-size: 12px; margin: -4px 0 8px; }

/* Разбивка дня в профиле сотрудника: что выпустил и что сделал */
.dd-block { margin-top: 6px; }
.dd-cap { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7c77); margin-bottom: 2px; }
.dd-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 1px 0; }
.dd-line b { white-space: nowrap; }

/* Владельцы: отдельной строкой под таблицей команды — видно, у кого полный доступ */
.owners { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line, #e7e1d8); }
.owner-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
.owner { display: inline-flex; align-items: center; gap: 9px; padding: 7px 10px 7px 13px;
  background: var(--surface, #fff); border: 1px solid var(--line, #e4ece9); border-radius: 999px; font-size: 14px; }
.owner b { font-weight: 400; font-size: 12.5px; }
.owner .mini-btn { margin: 0 }

/* Код устройства в отметках: обычный — серый, «общий на нескольких» — красный */
.dev-tag { display: inline-block; padding: 1px 6px; border-radius: 6px; background: #f1eee9; color: #8a8177;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 11px; letter-spacing: .04em; }
.dev-tag.warn { background: #fdecea; color: #b4483c; font-weight: 700; }
.warn-box { border: 1px solid #f2c9c3; background: #fdf5f4; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; line-height: 1.5; font-size: 14px; }
.warn-box b { color: #b4483c; }

/* Код для отметки: крупно, чтобы читалось с другого конца цеха */
.pc-box { text-align: center; margin: 16px 0; padding: 20px 10px; border: 1px solid var(--line, #e7e1d8); border-radius: 14px; background: var(--soft, #f6f2ea); }
.pc-value { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: clamp(40px, 12vw, 72px);
  font-weight: 700; letter-spacing: .06em; line-height: 1.1; color: var(--accent-deep, #246255); user-select: all; }
.pc-left { font-size: 13px; margin-top: 8px; }
/* поле ввода кода — крупное, по центру, цифровая клавиатура на телефоне */
.pin-in { width: 100%; box-sizing: border-box; text-align: center; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 30px; letter-spacing: .18em; padding: 12px; }

/* ── Киоск: страница кода для цеха (?code) ────────────────────────────────── */
body.kiosk-on { overflow: hidden; }
.kiosk { position: fixed; inset: 0; z-index: 5000; background: #12211d; color: #f4f1ec;
  display: flex; flex-direction: column; }
.kiosk-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; }
.kiosk-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: rgba(244,241,236,.85); }
.kiosk-brand .brand-icon { color: #7fd0bf; display: inline-flex; }
.kiosk-actions { display: flex; gap: 8px; }
.kiosk-btn { width: 42px; height: 42px; border-radius: 11px; border: 1px solid rgba(244,241,236,.18);
  background: rgba(244,241,236,.06); color: #f4f1ec; font-size: 18px; line-height: 1; cursor: pointer; transition: background .15s; }
.kiosk-btn:hover { background: rgba(244,241,236,.15); }
.kiosk-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 12px 20px; }
.kiosk-label { font-size: clamp(15px,2.4vw,26px); letter-spacing: .16em; text-transform: uppercase; color: rgba(244,241,236,.5); text-align: center; }
.kiosk-code { font-family: ui-monospace,"SF Mono",Consolas,monospace; font-weight: 700;
  font-size: clamp(64px,20vw,300px); line-height: 1; letter-spacing: .03em; color: #fff; user-select: all;
  text-align: center; text-shadow: 0 0 48px rgba(127,208,191,.28); white-space: nowrap; }
.kiosk-code .ck-gap { display: inline-block; width: .3em; }   /* зазор между тройками — заметный, но не разрывает код */
.kiosk-bar-wrap { width: min(62vw,540px); height: 8px; border-radius: 999px; background: rgba(244,241,236,.12); overflow: hidden; }
.kiosk-bar { height: 100%; background: #7fd0bf; border-radius: 999px; transform-origin: left; transform: scaleX(1); transition: transform .25s linear; }
.kiosk-left { font-size: clamp(15px,2vw,22px); color: rgba(244,241,236,.62); font-variant-numeric: tabular-nums; text-align: center; }
.kiosk-hint { padding: 16px 24px calc(28px + env(safe-area-inset-bottom)); text-align: center;
  font-size: clamp(13px,1.6vw,18px); line-height: 1.5; color: rgba(244,241,236,.48); max-width: 62ch; margin-inline: auto; }
.kiosk.ck-error .kiosk-code { color: #ffb4a6; text-shadow: none; font-size: clamp(40px,7vw,80px); white-space: normal; }
.kiosk.ck-error .kiosk-bar-wrap { visibility: hidden; }
.kiosk.ck-error .kiosk-left { color: #ffb4a6; }

/* ── Задачи: дашборд поручений ───────────────────────────────────────────── */
/* бейдж на вкладке «Задачи»: сколько новых поручений исполнитель ещё не открывал */
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; background: #e23b5a; color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1; vertical-align: middle;
}
.mb-s { display: inline-flex; margin-bottom: 12px; }
.file-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.file-pick .muted { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* верхний тумблер роли у владельца: Сотрудники ⇄ Менеджеры */
.tk-role-seg { display: inline-flex; margin: 0 0 12px; flex: 0 0 auto; }
.tk-role-seg .seg { flex: 0 0 auto; padding: 9px 22px; font-size: 14px; }

/* внутри роли — переключатель по людям (Все + имена) */
.tk-people { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* режим доски: рабочая или лист за день + навигация по датам */
.tk-modes { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.tk-mode-seg { margin: 0; flex: 0 0 auto; }
.tk-mode-seg .seg { flex: 0 0 auto; padding: 7px 16px; }
.tk-daynav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tk-daynav b { min-width: 150px; text-align: center; font-size: 15px; }
.tk-daynav .btn-sm { padding: 4px 12px; font-size: 16px; line-height: 1.2; }
.tk-daynav .btn-sm:disabled { opacity: .4; cursor: default; }

/* четыре колонки: новые / в работе / просрочено / выполнены — у каждой свой цвет */
.tk-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
.tk-col { background: var(--surface-2, #f1f5f3); border: 1px solid var(--line, #e4ece9); border-radius: 14px;
  padding: 10px; min-width: 0; border-top: 3px solid var(--tk-accent, #b9b1a4); }
.tk-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 10px; font-size: 14px; }
.tk-col-head b { color: var(--tk-accent, #6b7c77); }
.tk-count { background: var(--surface, #fff); border: 1px solid var(--line, #e4ece9); border-radius: 999px;
  min-width: 22px; text-align: center; padding: 1px 7px; font-size: 12px; font-weight: 700; color: var(--muted, #6b7c77); }

/* цвета колонок — по просьбе клиента: белый / зелёный / оранжевый / бирюзовый */
.tk-new  { --tk-accent: #9a9287; background: #ffffff; }
.tk-work { --tk-accent: #3f8f4a; background: #eef7ec; }
.tk-late { --tk-accent: #d97706; background: #fdf3e6; }
.tk-done { --tk-accent: #128b8b; background: #e4f5f5; }
.tk-late .tk-count { color: #c2410c; border-color: #f3d5ab; }
/* в белой колонке карточкам нужен более заметный контур — иначе сливаются с фоном */
.tk-new .task-card { border-color: #e2dbcf; }

/* те же цвета внутри карточки задачи: плашка статуса и переключатель */
.chip.tk-chip-new  { background: #fff; color: #6f675c; box-shadow: inset 0 0 0 1px #e2dbcf; }
.chip.tk-chip-work { background: #eef7ec; color: #3f8f4a; }
.chip.tk-chip-late { background: #fdf3e6; color: #c2410c; }
.chip.tk-chip-done { background: #e4f5f5; color: #128b8b; }
.td-status .seg-row { background: #f1eee9; border-radius: 11px; padding: 4px; gap: 4px; }
.td-status .seg.active.seg-late { color: #c2410c; background: #fdf3e6; box-shadow: 0 1px 3px rgba(194,65,12,.18); }
.td-status .seg:disabled { cursor: default; }
.tk-note { font-size: 12px; margin: 8px 0 0; line-height: 1.45; }
.td-status .seg.active.seg-new  { color: #6f675c; background: #fff; }
.td-status .seg.active.seg-work { color: #3f8f4a; background: #eef7ec; box-shadow: 0 1px 3px rgba(63,143,74,.18); }
.td-status .seg.active.seg-done { color: #128b8b; background: #e4f5f5; box-shadow: 0 1px 3px rgba(18,139,139,.18); }
.tk-col-body { display: flex; flex-direction: column; gap: 8px; }
.tk-empty { margin: 4px; font-size: 13px; }
.tk-done .task-card .task-title { color: var(--muted, #6b7c77); }
.tk-hint { font-size: 12px; margin-top: 10px; }

/* перетаскивание карточек между колонками */
.task-card.movable { cursor: grab; }
.task-card.movable:active { cursor: grabbing; }
.task-card.dragging { opacity: .45; }
.tk-col.drop-over { border-color: var(--accent, #2f7d6d); background: var(--accent-tint, #e8f1ee); }
.tk-col.drop-over .tk-col-body { outline: 2px dashed var(--accent, #2f7d6d); outline-offset: 4px; border-radius: 10px; min-height: 40px; }
.task-card:focus-visible { outline: 2px solid var(--accent, #2f7d6d); outline-offset: 2px; }
/* четыре колонки в ряд нужны широкому экрану: ниже — по две, на телефоне — одна */
@media (max-width: 1100px) { .tk-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .tk-board { grid-template-columns: 1fr; } }
.task-card { display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: var(--surface, #fff); border: 1px solid var(--line, #e4ece9); border-radius: 12px; padding: 12px 14px;
  transition: border-color .15s, transform .12s; }
.task-card:hover { border-color: var(--accent, #2f7d6d); }
.task-card:active { transform: scale(.99); }
.task-card.over { border-color: #f3d5ab; background: #fffdf8; }   /* в тон оранжевой колонке «Просрочено» */
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.task-title { font-weight: 600; line-height: 1.35; margin-bottom: 4px; }
.task-body { font-size: 13px; color: var(--muted, #6b7c77); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--muted, #6b7c77); }
.task-due { font-size: 12px; color: var(--muted, #6b7c77); white-space: nowrap; }
.task-due.hot { color: #c2410c; font-weight: 700; }
.task-late { font-size: 12px; font-weight: 700; color: #c2410c; white-space: nowrap; }

/* карточка задачи внутри модалки */
.td-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.td-text { white-space: pre-wrap; line-height: 1.55; margin: 0 0 12px; }
.td-files, .td-status, .td-reports { margin-bottom: 14px; }
.seg-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.td-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.td-add .textarea { flex: 1 1 100%; }
.tf-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line, #eef3f1); font-size: 13px; }
.tf-name { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; text-align: left;
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--accent-deep, #246255);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-name:hover { text-decoration: underline; }
.tf-name svg { flex: 0 0 auto; transform: rotate(180deg); }   /* стрелка вниз = скачать */

/* Клиент в заказе: селект + кнопка «новый» в один ряд; модалка клиента поверх заказа */
.cust-row { display: flex; gap: 8px; align-items: stretch; }
.cust-row .select { flex: 1 1 auto; min-width: 0; }
.cust-row .btn-sm { flex: 0 0 auto; padding: 0 14px; }
.modal-backdrop.raised { z-index: 110; }

/* Выбор роли карточками — вместо нативного списка */
.role-opt {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 10px 12px; margin-top: 6px;
  border: 1px solid var(--line, #e7e1d8); border-radius: 10px; background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
/* класс вешает JS: :has(input:checked) не всегда перерисовывается при программной смене */
.role-opt.sel { border-color: var(--accent, #2f7d6d); background: #f2f8f6; }
.role-opt input { margin-top: 2px; flex: 0 0 auto; }
.role-opt > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.role-opt b { font-size: 14px; color: var(--ink, #2b2620); }
.role-opt small { font-size: 12px; color: var(--muted, #8a8177); line-height: 1.35; }

/* Переключатель таблиц склада */
.seg-tabs { display: flex; gap: 4px; margin: 14px 0 10px; padding: 4px; border-radius: 12px; background: #f1eee9; }
.seg {
  flex: 1 1 0; min-width: 0; padding: 9px 6px; border: 0; border-radius: 9px;
  font: inherit; font-size: 13px; font-weight: 600; color: #6b645c; background: transparent;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg.active { color: var(--accent, #2f7d6d); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* Поиск по названию и коду */
.search-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.search-bar .input { flex: 1 1 auto; min-width: 0; }
.mv-item.dim { opacity: .45; }

/* Журнал склада: товары одной отгрузки — списком внутри одной записи */
.mv-items { line-height: 1.5; }
.mv-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 1px 0; }
.mv-item b { white-space: nowrap; }
.mv-item b.income  { color: #2f7d6d; }
.mv-item b.expense { color: #b4483c; }

/* Кнопка не заблокирована, а приглушена: нажатие принимается и объясняет причину */
.btn-dim { opacity: .55; }

/* ── Превью накладной в настройках (на экране, не при печати) ─────────── */
.ip-doc {
  background: #fff; border: 1px solid var(--line, #e7e1d8); border-radius: 10px;
  padding: 16px; font-size: 12px; color: #222; line-height: 1.5;
  overflow-x: auto;   /* накладная A4 на телефоне уже экрана — таблица прокручивается внутри, а не обрезается */
}
.ip-doc .ip-table { min-width: 300px; }
.ip-title { font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.ip-parties { margin-bottom: 10px; }
.ip-parties span { display: inline-block; min-width: 76px; color: #6b645c; }
.ip-req { margin-left: 76px; color: #6b645c; }
.ip-empty { color: #b8b0a5; font-style: italic; font-weight: 400; }
.ip-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 11px; }
.ip-table th, .ip-table td { border: 1px solid #cfc8bd; padding: 3px 5px; text-align: center; }
.ip-table .l { text-align: left; }
.ip-total { text-align: right; margin-bottom: 8px; }
.ip-novat { font-size: 11px; color: #6b645c; }
.ip-words { margin-bottom: 14px; }
.ip-sign { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ── Заказы: раскрытие, дни в сборке, цвета кнопок ────────────────────── */
.ord-row { cursor: pointer; }
.ord-row:hover { background: #faf8f5; }
.ord-row.open { background: #f3f7f5; }
.chev { font-size: 11px; opacity: .55; }

.days-badge {
  margin-top: 3px; display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; color: #8a8177; background: #f1eee9;
}
.days-badge.warm { color: #a4741b; background: #fdf3dd; }
.days-badge.hot  { color: #b4483c; background: #fbe9e7; font-weight: 600; }

.ord-details > td { background: #f8f6f2; padding: 10px 12px !important; }
.ord-items { width: 100%; font-size: 13px; }
.ord-items th { font-weight: 600; text-align: left; color: #8a8177; font-size: 12px; }
.ord-items td, .ord-items th { padding: 5px 8px; }
.ord-items tfoot td { border-top: 1px solid #e7e1d8; }
.ord-items-total td { font-size: 14px; }

/* Клиент просил: «Новый клиент» красная, «Новый заказ» светлее оттенком */
.btn-red { background: #b4483c; color: #fff; border: 1px solid #b4483c; }
.btn-red:hover { background: #9e3d33; border-color: #9e3d33; }
.btn-green-lt { background: #3f9c88; color: #fff; border: 1px solid #3f9c88; }
.btn-green-lt:hover { background: #368a78; border-color: #368a78; }

/* Конструктор заказа: прайс таблицей, количество в строке */
.price-pick th { font-size: 12px; color: #8a8177; }
/* поле ввода количества — самое нажимаемое место конструктора, поэтому не дефолтное */
.qty-in, .disc-in {
  font: inherit; color: var(--ink, #2b2620); background: #fff;
  border: 1px solid var(--line, #e7e1d8); border-radius: 8px;
  padding: 7px 9px; outline: none; text-align: center;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.qty-in:focus, .disc-in:focus {
  border-color: var(--accent, #2f7d6d); box-shadow: 0 0 0 3px rgba(47,125,109,.15);
}
.price-pick .qty-in { width: 74px; }
.price-pick tr.picked .qty-in { border-color: var(--accent, #2f7d6d); font-weight: 700; }
.price-pick tr.over   .qty-in { border-color: #b4483c; color: #b4483c; font-weight: 700; }
.price-pick tr.picked { background: #eef6f3; }
.price-pick tr.over   { background: #fbe9e7; }
.price-pick tr.over .stock-cell { color: #b4483c; font-weight: 700; }
.order-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

@media (max-width: 640px) {
  .ord-details > td { display: block; }
  .ord-details > td::before { content: none; }
  /* Вложенная таблица позиций остаётся ТАБЛИЦЕЙ: карточные правила внешней
     таблицы её не касаются, иначе каждая позиция превращается в свою карточку */
  /* специфичность выше, чем у карточных правил .data-table ниже по файлу */
  .data-table .ord-items { display: table; width: 100%; font-size: 12px; }
  .data-table .ord-items thead { display: table-header-group; }
  .data-table .ord-items tbody { display: table-row-group; }
  .data-table .ord-items tfoot { display: table-footer-group; }
  .data-table .ord-items tr { display: table-row; border: 0; border-radius: 0; margin: 0; padding: 0; background: none; }
  .data-table .ord-items td, .data-table .ord-items th { display: table-cell; padding: 3px 4px; white-space: normal; }
  .data-table .ord-items td::before, .data-table .ord-items th::before { content: none !important; }
  .data-table .ord-items th:first-child, .data-table .ord-items td:first-child { width: 18px; }
  .price-pick .qty-in { width: 62px; }
}

/* ── Деньги: список по дням ───────────────────────────────────────────── */
.data-table tr.day-head td {
  padding: 12px 10px 5px; border: 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.day-title { font-weight: 700; font-size: 14px; }
.day-sum { display: inline-flex; gap: 10px; font-size: 13px; }
.day-sum .income  { color: #2f7d6d; }
.day-sum .expense { color: #b4483c; }

/* Тонкие черты: зелёная — конец дня, красная — конец месяца */
.data-table tr.op-sep td { padding: 0; border: 0; height: 2px; }
.data-table tr.op-sep.day td   { background: #2f7d6d; opacity: .35; }
.data-table tr.op-sep.month td { background: #b4483c; opacity: .55; height: 3px; }

.op-time { width: 46px; white-space: nowrap; font-size: 12px; }
.auto-tag {
  margin-left: 5px; padding: 1px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: #2f7d6d; background: #e8f4ef;
}

/* Компактные плашки — клиент просил уместить больше на экране */
.kpi-grid.kpi-sm .kpi { padding: 10px 12px; }
.kpi-grid.kpi-sm .kpi-lbl { font-size: 11px; }
.kpi-grid.kpi-sm .kpi-val { font-size: 19px; }

@media (max-width: 640px) {
  .kpi-grid.kpi-sm { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .kpi-grid.kpi-sm .kpi { padding: 8px 6px; text-align: center; }
  .kpi-grid.kpi-sm .kpi-val { font-size: 15px; }
  .kpi-grid.kpi-sm .kpi-lbl { font-size: 10px; }
  /* в карточном режиме заголовок дня и черта должны остаться сплошной строкой */
  .data-table tr.day-head, .data-table tr.op-sep { display: block; }
  .data-table tr.day-head td::before, .data-table tr.op-sep td::before { content: none; }
  /* разделитель — тонкая черта, а не пустая карточка: снимаем рамку и отступы,
     которые карточный режим вешает на каждую строку таблицы */
  .data-table tr.op-sep {
    border: 0; border-radius: 0; background: none;
    margin: 2px 12px 10px; padding: 0;
  }
  .data-table tr.op-sep td { display: block; height: 2px; padding: 0; border: 0; }
  .data-table tr.op-sep.month td { height: 3px; }
  /* заголовок дня без рамки — он и так читается жирным, а рамка тратит место */
  .data-table tr.day-head {
    border: 0; background: none; margin: 12px 0 2px; padding: 0 2px;
  }
}

/* Статусы сотрудников в сводке владельца */
.chip.st-work { background: #e8f4ef; color: #2f7d6d; }
.chip.st-away { background: #fdf3dd; color: #a4741b; }
.chip.st-off  { background: #f1eee9; color: #8a8177; }

/* Свой календарь: нативную всплывашку не покрасить, поэтому рисуем сами.
   type=date оставлен источником значения (ISO), браузер показывает дату по локали. */
.dp-input { cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b625b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><path d='M16 2v4M8 2v4M3 10h18'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; }
.dp-input::-webkit-calendar-picker-indicator { display: none; -webkit-appearance: none; }
.dp-input::-webkit-inner-spin-button { display: none; }

.dp-pop { position: fixed; z-index: 4000; width: 268px; background: var(--surface, #fff);
  border: 1px solid var(--line, #e4ece9); border-radius: 14px; padding: 12px;
  box-shadow: 0 12px 32px -10px rgba(41,33,30,.28), 0 0 0 1px rgba(41,33,30,.04); }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head b { font-size: 14px; font-weight: 700; }
.dp-nav { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--muted, #6b7c77); }
.dp-nav:hover { background: var(--surface-2, #f1f5f3); color: var(--ink, #29211e); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow span { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted, #8a8177);
  text-transform: uppercase; letter-spacing: .02em; padding: 4px 0; }
.dp-day { border: 0; background: none; cursor: pointer; height: 32px; border-radius: 8px;
  font: inherit; font-size: 13px; color: var(--ink, #29211e); font-variant-numeric: tabular-nums; }
.dp-day:hover { background: var(--act-tint, #e8f1ee); }
.dp-day.off { color: var(--muted, #b3aca3); opacity: .6; }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--act, #2f7d6d); font-weight: 700; }
.dp-day.sel { background: var(--act, #2f7d6d); color: #fff; font-weight: 700; }
.dp-day.sel:hover { background: var(--act-deep, #246255); }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line, #eef3f1); }
.dp-foot button { border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px;
  font-weight: 600; color: var(--act-deep, #246255); padding: 4px 6px; border-radius: 6px; }
.dp-foot button:hover { background: var(--act-tint, #e8f1ee); }
.dp-clear { color: var(--muted, #8a8177) !important; }

/* Кастомный выпадающий список «Исполнитель» — тем же приёмом, что и календарь */
.cs { position: relative; width: 100%; }
.cs-trigger {
  width: 100%; box-sizing: border-box; display: flex; align-items: center;
  font: inherit; font-size: 14px; color: var(--ink, #2b2620); background: #fff;
  border: 1px solid var(--line, #e7e1d8); border-radius: 10px;
  padding: 9px 34px 9px 12px; cursor: pointer; text-align: left;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8177' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cs-trigger:focus-visible, .cs-trigger.cs-open {
  outline: none; border-color: var(--accent, #2f7d6d); box-shadow: 0 0 0 3px rgba(47,125,109,.15);
}
.cs-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-label.cs-placeholder { color: #b8b0a5; }
.cs-pop {
  position: fixed; z-index: 4000; min-width: 180px; max-height: 300px; overflow-y: auto;
  background: var(--surface, #fff); border: 1px solid var(--line, #e4ece9); border-radius: 14px; padding: 6px;
  box-shadow: 0 12px 32px -10px rgba(41,33,30,.28), 0 0 0 1px rgba(41,33,30,.04);
}
.cs-group + .cs-group { border-top: 1px solid var(--line, #eef3f1); margin-top: 4px; padding-top: 4px; }
.cs-grp-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #8a8177); padding: 6px 10px 4px; }
.cs-opt {
  display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--ink, #29211e); padding: 9px 10px; border-radius: 9px;
}
.cs-opt:hover { background: var(--act-tint, #e8f1ee); }
.cs-opt.sel { background: var(--act, #2f7d6d); color: #fff; font-weight: 600; }
.cs-opt.sel:hover { background: var(--act-deep, #246255); }
.cs-empty { padding: 10px; color: var(--muted, #8a8177); font-size: 13px; }
/* 16px на телефоне не для zoom (это кнопка), а чтобы пункты были крупнее под палец */
@media (max-width: 640px) { .cs-trigger, .cs-opt { font-size: 16px; } }

/* Плашка демо-режима */
.demo-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #29211e; color: #f4f1ec; padding: 9px 16px; font-size: 13.5px; line-height: 1.4; }
.demo-tag { background: var(--accent, #2f7d6d); color: #fff; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; flex: none; }
.demo-bar a { color: #f4f1ec; font-weight: 600; text-decoration: underline;
  text-underline-offset: 3px; white-space: nowrap; }
.demo-bar.busy { opacity: .5; pointer-events: none; }
.demo-lbl { flex: none; opacity: .7; }
.demo-roles { display: flex; gap: 3px; background: rgba(244,241,236,.1); border-radius: 10px; padding: 3px; flex: none; }
.demo-roles .seg { flex: 0 0 auto; padding: 5px 13px; font-size: 13px; color: rgba(244,241,236,.75); border-radius: 7px; }
.demo-roles .seg:hover { color: #f4f1ec; }
.demo-roles .seg.active { background: #f4f1ec; color: #29211e; box-shadow: none; }
.demo-note { opacity: .62; font-size: 12.5px; min-width: 0; }
/* «← На сайт» прижимается вправо, CTA идёт следом — обе ссылки в одном окне, без новых вкладок */
.demo-back { margin-left: auto; opacity: .75; font-weight: 400 !important; text-decoration: none !important; }
.demo-back:hover { opacity: 1; }
.demo-bar a + a { margin-left: 14px; }
@media (max-width: 900px) { .demo-note { display: none; } }
@media (max-width: 640px) { .demo-bar a { margin-left: 0; } }

/* Экран «доступа пока нет» */
.na-text { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--muted, #8a8073); text-align: center; }
#noAccess .login-card h1 { margin-bottom: 6px; }
#noAccess .btn-wide { margin-top: 6px; }

/* Подсказка на входе: у кого нет почты — пароль восстанавливает владелец */
.auth-note { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted, #8a8073); text-align: center; }
.auth-note a { color: var(--accent, #2f7d6d); font-weight: 600; text-decoration: none; }
.auth-note a:hover { text-decoration: underline; }

/* Заставка на время проверки сессии */
.boot-splash { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg, #f6f4f0); }
.boot-splash .login-logo { animation: bootPulse 1.1s ease-in-out infinite; }
@keyframes bootPulse { 0%, 100% { opacity: .35; transform: scale(.96); } 50% { opacity: 1; transform: scale(1); } }

/* Раздел закрыт до отметки прихода */
.locked-panel { text-align: center; padding: 30px 20px; }
.locked-panel h3 { margin: 10px 0 6px; }
.locked-panel p { margin: 0 auto 16px; max-width: 340px; }
.locked-ico { font-size: 34px; line-height: 1; }

/* Своё имя в шапке смены */
.who-btn {
  margin-top: 7px; display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; font: inherit; font-size: 13px; line-height: 1.5;
  color: var(--muted, #8a8177); background: transparent;
  border: 1px dashed var(--line, #e7e1d8); border-radius: 999px; cursor: pointer;
}
.who-btn:hover { color: var(--ink, #2b2620); border-color: var(--accent, #2f7d6d); }
.who-btn.empty { color: var(--accent, #2f7d6d); font-weight: 600; border-style: solid; border-color: var(--accent, #2f7d6d); }

/* Таблицы данных */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7c77); padding: 8px 10px; border-bottom: 2px solid var(--line, #e4ece9); }
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--line, #eef3f1); vertical-align: middle; }
.data-table tbody tr:hover, .data-table tr:hover { background: rgba(47,125,109,.04); }
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table td { padding: 6px 4px; border-bottom: 1px solid var(--line, #eef3f1); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .mini-btn { margin-left: 6px; vertical-align: middle; }

/* Мини-кнопки в строках */
.mini-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--line, #e4ece9); background: #fff; border-radius: 8px; cursor: pointer; color: var(--ink, #223); transition: .15s; }
.mini-btn:hover { border-color: var(--accent, #2f7d6d); color: var(--accent, #2f7d6d); }
.mini-btn.danger:hover { border-color: #e23b5a; color: #e23b5a; }
.mini-btn.ok { font-size: 15px; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* Замок приватности телефона */
.lock { color: #b06a2a; font-size: 13px; }
.stock-low { color: #e23b5a; }

/* Статы / KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface, #fff); border: 1px solid var(--line, #e4ece9); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi-lbl { font-size: 13px; color: var(--muted, #6b7c77); }
.kpi-val { font-size: 22px; font-weight: 700; }
.kpi.income .kpi-val { color: #15a35a; }
.kpi.expense .kpi-val { color: #e23b5a; }
.cat-bar { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line, #eef3f1); font-size: 14px; }

/* Чипы / бейджи */
.chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.chip.pay-red { background: #fdeaee; color: #c62a48; }
.chip.pay-green { background: #e7f6ee; color: #12894c; }
.chip.st-assembling { background: #fff3e0; color: #b3690c; }
.chip.st-shipped { background: #e7f6ee; color: #12894c; }
.amt.income { color: #15a35a; font-weight: 600; }
.amt.expense { color: #e23b5a; font-weight: 600; }

/* Навигация по месяцам */
.month-nav { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.month-nav .btn { padding: 4px 12px; }

/* ===== Смена ===== */
.shift-wrap { max-width: 720px; }
.shift-panel { padding: 20px; }
.shift-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.shift-head h2 { margin: 0; }
.shift-worked { display: inline-flex; align-items: center; gap: 6px; background: rgba(47,125,109,.1); color: var(--accent, #2f7d6d); padding: 6px 12px; border-radius: 20px; font-weight: 600; }
.shift-buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.shift-btn { flex: 1; min-width: 140px; padding: 18px; border: none; border-radius: 14px; font-size: 17px; font-weight: 600; color: #fff; cursor: pointer; transition: .15s; }
.shift-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.shift-btn.in { background: #15a35a; }
.shift-btn.out { background: #e23b5a; }
.shift-btn.leave { background: #e8890c; }
.shift-btn.return { background: #2f7db0; }
.shift-done { padding: 16px; background: #e7f6ee; color: #12894c; border-radius: 12px; font-size: 16px; width: 100%; text-align: center; }
.shift-log { display: flex; flex-wrap: wrap; gap: 6px; }
.punch-chip { font-size: 12px; padding: 3px 9px; border-radius: 20px; background: #f0f4f3; color: #4a5a55; }
.punch-chip.in { background: #e7f6ee; color: #12894c; }
.punch-chip.out { background: #fdeaee; color: #c62a48; }
.punch-chip.leave { background: #fff3e0; color: #b3690c; }
.punch-chip.return { background: #e8f1f8; color: #2160a0; }
.textarea { width: 100%; border: 1px solid var(--line, #e4ece9); border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; box-sizing: border-box; }

/* ===== Конструктор заказа ===== */
.modal-lg { max-width: 640px; }
.order-builder { border: 1px solid var(--line, #e4ece9); border-radius: 12px; padding: 12px; margin: 6px 0 12px; }
.order-add-row { display: grid; grid-template-columns: 1fr 90px 90px 44px; gap: 8px; margin-bottom: 10px; }
.order-add-row > * { min-width: 0; }        /* иначе длинный текст в select распирает модалку */
.order-add-row .qty-in, .order-add-row .disc-in { width: 100%; }
.lines-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.lines-table td { overflow: hidden; text-overflow: ellipsis; }
.lines-table th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted, #6b7c77); padding: 4px 6px; border-bottom: 1px solid var(--line, #e4ece9); }
.lines-table td { padding: 6px; border-bottom: 1px solid var(--line, #eef3f1); }
.order-total { text-align: right; font-size: 17px; margin-top: 10px; }
.order-total b { color: var(--accent, #2f7d6d); }

/* ===== Печать накладной ===== */
.invoice-print { display: none; }
@page { size: A4; margin: 12mm; }
@media print {
  body > *:not(.invoice-print) { display: none !important; }
  .invoice-print { display: block !important; padding: 0; color: #000; font-size: 13px; }
  /* Документ печатается чёрным: цветной принтер не тратит краску на служебный текст,
     а на чёрно-белом цветные надписи выходили бледно-серыми и терялись */
  .invoice-print, .invoice-print * { color: #000 !important; background: transparent !important; }
  .inv-table tr { page-break-inside: avoid; }
  .inv-sign { page-break-inside: avoid; }
  /* по образцу клиента: «Реализация товаров № 52 от 15 июля 2026 г.» */
  .inv-title { margin: 0 0 14px; font-size: 17px; font-weight: 700; }
  .inv-parties { margin-bottom: 12px; line-height: 1.55; }
  .inv-lbl { display: inline-block; min-width: 92px; }
  .inv-req { margin-left: 92px; font-size: 12px; }
  .inv-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 12px; }
  .inv-table th, .inv-table td { border: 1px solid #000; padding: 4px 6px; text-align: center; }
  .inv-table th { font-weight: 600; }
  .inv-table .l { text-align: left; }
  .inv-table .r { text-align: right; }
  .inv-totals { text-align: right; line-height: 1.6; margin-bottom: 10px; }
  .inv-grand { font-size: 15px; }
  .inv-novat { font-size: 12px; }
  .inv-words { margin-bottom: 26px; line-height: 1.6; }
  .inv-sign { display: flex; justify-content: space-between; gap: 20px; }

  /* Печать задач: текста много, поэтому мельче и с переносами */
  .tsk-print { table-layout: fixed; font-size: 10.5px; }
  .tsk-print th, .tsk-print td { padding: 3px 5px; vertical-align: top; word-wrap: break-word; overflow-wrap: anywhere; }
  .tsk-print th:nth-child(1), .tsk-print td:nth-child(1) { width: 14%; }
  .tsk-print th:nth-child(2), .tsk-print td:nth-child(2) { width: 30%; }
  .tsk-print th:nth-child(3), .tsk-print td:nth-child(3) { width: 14%; }
  .tsk-print th:nth-child(4), .tsk-print td:nth-child(4) { width: 8%; }
  .tsk-print th:nth-child(5), .tsk-print td:nth-child(5) { width: 34%; }
  /* строка дня: фон в печати запрещён, поэтому выделяем жирным и линией */
  .tsk-print .tp-day td { border-top: 2px solid #000; font-size: 11.5px; padding-top: 6px; }
  .tsk-print .tp-sub { font-size: 9.5px; margin-top: 2px; }
  .tsk-print tr { page-break-inside: avoid; }
}

/* Адаптив */
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .order-add-row { grid-template-columns: 1fr 1fr; }
}

/* На телефоне таблицы → карточки: поля «Ярлык: значение», кнопки отдельной строкой снизу */
@media (max-width: 640px) {
  /* модалка: высота по реально видимой области (под панелями браузера) */
  .modal { max-height: 88dvh; }
  .modal-body { padding: 14px 16px; }
  /* конструктор заказа: товар на всю ширину, ниже — кол-во / скидка / плюс */
  .order-add-row { grid-template-columns: 1fr 1fr auto; }
  .order-add-row select { grid-column: 1 / -1; }
  /* фильтры на телефоне — по два в ряд, без выезда за край */
  /* 16px — иначе iOS приближает страницу при фокусе и её потом не отмотать */
  .filter-bar .flt { flex: 1 1 calc(50% - 4px); font-size: 16px; padding: 8px 30px 8px 10px; }
  .qty-in, .disc-in { font-size: 16px; }
  /* позиции заказа на телефоне — компактными строками, без своей прокрутки */
  .lines-table { font-size: 13px; }
  .lines-table thead { display: none; }
  .lines-table, .lines-table tbody { display: block; }
  .lines-table tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 7px 0; border-bottom: 1px solid var(--line,#eef3f1); }
  .lines-table td { display: inline-block; border: none; padding: 0; }
  .lines-table td.pick-name, .lines-table td:nth-child(1) { flex: 1 1 100%; font-weight: 600; }
  /* подпись берём из data-l, поэтому она не зависит от порядка колонок */
  .lines-table td[data-l]::before { content: attr(data-l) ' '; color: var(--muted,#6b7c77); font-size: 11px; }
  .lines-table td.pick-qty { display: inline-flex; align-items: center; gap: 5px; }
  .lines-table td.pick-qty::before { font-weight: 700; color: var(--accent,#2f7d6d); }
  .lines-table td.line-sum { margin-left: auto; font-weight: 700; }
  /* Кнопки формы всегда внизу экрана: длинный прайс не заставляет их искать,
     и они не уезжают из-под пальца, когда закрывается клавиатура */
  .modal-body .modal-actions {
    position: sticky; bottom: 0; z-index: 2;
    margin: 10px -14px -14px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface, #fff); border-top: 1px solid var(--line, #e7e1d8);
  }
  /* палец промахивается по мелким кнопкам — держим комфортную высоту */
  .modal-actions .btn { min-height: 46px; touch-action: manipulation; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; }
  .data-table thead { display: none; }
  .data-table { min-width: 0; width: 100%; }
  .table-wrap { overflow-x: visible; border: 0; background: none; border-radius: 0; box-shadow: none; padding: 0; }
  .data-table tr { border: 1px solid var(--line,#e4ece9); border-radius: 12px; margin-bottom: 10px; padding: 10px 12px; background: var(--surface,#fff); }
  .data-table td { border: none; padding: 2px 0; white-space: normal; max-width: none; }
  .data-table td:empty { display: none; }
  .data-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted,#6b7c77); font-weight: 600; }
  .data-table td.row-actions { display: flex; gap: 8px; justify-content: flex-start; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line,#eef3f1); }
  .data-table td.row-actions .mini-btn { margin-left: 0; }
}
