/* Detailng CRM — кастомная админка.
   Стиль: тёмный рейл-сайдбар, светлый контент, карточки со скруглениями,
   пастельные бейджи, оранжевый фирменный акцент. */

:root {
  --ink: #101b28;
  --ink-soft: #3d4754;
  --muted: #8a93a2;
  --border: #e7ecf2;
  --bg: #eef3f9;
  --card: #ffffff;
  --accent: #e8820c;
  --accent-soft: #fdf1e0;
  --green: #22a45d;
  --green-soft: #e1f6e8;
  --red: #dc2626;
  --red-soft: #fdecec;
  --blue: #2f7df6;
  --blue-soft: #eaf1fb;
  --amber: #e8a20c;
  --amber-soft: #fdf6de;
  --violet: #8b5cf6;
  --violet-soft: #f1eafe;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 27, 40, .05), 0 8px 24px -12px rgba(16, 27, 40, .12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 20% -10%, #dbe9fb 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
a.link { color: var(--accent); }
a.link:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; cursor: pointer; }

/* ── Каркас ─────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.rail {
  width: 76px;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.rail .logo {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
  margin-bottom: 18px;
  letter-spacing: .5px;
}

.rail-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #8fa0b3;
  transition: background .15s, color .15s;
  position: relative;
}
.rail-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-btn.active { background: var(--accent); color: #fff; }
.rail-btn svg { width: 21px; height: 21px; }

.rail .spacer { flex: 1; }

/* всплывающая подпись */
.rail-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: 58px; top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
  z-index: 50;
  box-shadow: var(--shadow);
}
.rail-btn:hover::after { opacity: 1; }

.main { flex: 1; min-width: 0; padding: 26px 30px 40px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.topbar h1 { font-size: 24px; font-weight: 800; }
/* Ссылка-бренд в шапке платформы (Task 8): класс .sub в этом файле везде
   заскоуплен под другие блоки (.card-head .sub, .login-card .sub и т.д.), под
   топбар не попадает — без этого правила ссылка рисовалась бы обычным текстом.
   Селектор идёт через `.topbar > div`, а не просто `.topbar .sub`: у топбара
   админки (layouts/admin.blade.php) первый прямой потомок — сразу `<h1>`, без
   оборачивающего div, поэтому правило не задевает админку. */
.topbar > div a.sub { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.topbar > div a.sub:hover { color: var(--ink); text-decoration: underline; }
.topbar .who { display: flex; align-items: center; gap: 10px; }
.topbar .who .meta { text-align: right; }
.topbar .who .name { font-weight: 700; font-size: 13.5px; }
.topbar .who .role { color: var(--muted); font-size: 12px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  flex-shrink: 0;
}

/* ── Карточки и сетки ───────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card, .stack > * + * { margin-top: 16px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head .head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card-head h2 { font-size: 16.5px; font-weight: 800; }
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .grid.cols-2 { grid-template-columns: 1fr; } }

/* ── Стат-карточки ──────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.stat .top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.stat .label { font-weight: 700; font-size: 13.5px; color: var(--ink-soft); }
.stat .value { font-size: 27px; font-weight: 800; letter-spacing: -.5px; }
.stat .foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 20px; }

.icon-tile {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
}
.icon-tile svg { width: 20px; height: 20px; }
.tone-blue   { background: var(--blue-soft);   color: var(--blue); }
.tone-amber  { background: var(--amber-soft);  color: var(--amber); }
.tone-green  { background: var(--green-soft);  color: var(--green); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-red    { background: var(--red-soft);    color: var(--red); }
.tone-accent { background: var(--accent-soft); color: var(--accent); }

.trend {
  font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
}
.trend.up { background: var(--green-soft); color: var(--green); }
.trend.down { background: var(--red-soft); color: var(--red); }
.trend.flat { background: var(--blue-soft); color: var(--blue); }
.stat .hint { color: var(--muted); font-size: 12px; }

/* ── Таблицы ────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; transition: background .12s; }
tbody tr.clickable:hover { background: #f7fafc; }

.cell-main { font-weight: 700; }
.cell-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.num { font-variant-numeric: tabular-nums; }
/* Комментарий к операции: длинный текст обрезаем, полный — в title при наведении */
.cell-note { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

.entity { display: flex; align-items: center; gap: 11px; }
.entity .avatar { width: 36px; height: 36px; font-size: 12.5px; }

/* ── Бейджи статусов ────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  padding: 4px 11px; border-radius: 999px;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-reception   { background: var(--blue-soft);   color: var(--blue); }
.st-in_progress { background: var(--amber-soft);  color: #b45309; }
.st-ready       { background: var(--green-soft);  color: var(--green); }
.st-delivered   { background: #eff1f4;            color: #5b6572; }
.ts-assigned    { background: var(--blue-soft);   color: var(--blue); }
.ts-in_progress { background: var(--amber-soft);  color: #b45309; }
.ts-paused      { background: #eff1f4;            color: #5b6572; }
.ts-done        { background: #e0f2fe;            color: #0369a1; }
.ts-accepted    { background: var(--green-soft);  color: var(--green); }
.ts-rework      { background: var(--red-soft);    color: var(--red); }
.badge.overdue  { background: var(--red);         color: #fff; }
/* Статусы тенанта на платформе */
.tn-active    { background: var(--green-soft); color: var(--green); }
.tn-suspended { background: var(--red-soft);   color: var(--red); }
/* Бейдж-кнопка «изменён» у суммы: приглушённый, чтобы не спорить с суммой строки */
.badge.edited { background: transparent; color: var(--muted); border: 1px solid var(--border); font-weight: 500; cursor: pointer; margin-left: 8px; }
.badge.edited:hover { color: var(--ink); border-color: var(--muted); }
.pay-paid    { background: var(--green-soft);  color: var(--green); }
.pay-partial { background: var(--amber-soft);  color: #b45309; }
.pay-unpaid  { background: var(--red-soft);    color: var(--red); }

/* ── Формы и кнопки ─────────────────────────────── */
.input, select.input, textarea.input {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font: inherit;
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label {
  font-size: 11px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700; font-size: 13.5px;
  background: var(--accent); color: #fff;
  transition: filter .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn.dark { background: var(--ink); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn.danger { background: var(--red); }
.btn.success { background: var(--green); }
.btn.sm { padding: 7px 13px; font-size: 12.5px; border-radius: 10px; }
.btn svg { width: 15px; height: 15px; }

.search-box { position: relative; }
.search-box .input { padding-left: 38px; min-width: 240px; }
.search-box svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted);
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 600; font-size: 13px;
  color: var(--ink-soft);
}
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
/* Корзина актов: отдельный режим, а не статус — выделяем красным в обоих состояниях */
.chip.danger { background: var(--red-soft); border-color: var(--red-soft); color: var(--red); }
.chip.danger.active { background: var(--red); border-color: var(--red); color: #fff; }

/* ── Модалка ────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 27, 40, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  width: 100%; max-width: 720px;
  margin: auto;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.modal-head h2 { font-size: 17px; font-weight: 800; }

/* ── Панель фильтров (акты) ─────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end;
  margin-bottom: 16px; padding: 14px 16px;
  background: #f7f9fb; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.filter-bar .fb { display: flex; flex-direction: column; gap: 5px; }
.filter-bar label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700;
}
.filter-bar .range { display: flex; align-items: center; gap: 6px; }
.filter-bar .range .input { max-width: 155px; }
.filter-bar .range .dash { color: var(--muted); }
.filter-bar .fb-actions { display: flex; gap: 8px; margin-left: auto; align-items: flex-end; }

.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 130px; }

/* ── Флеш и ошибки ──────────────────────────────── */
.flash {
  background: var(--green-soft); color: var(--green);
  font-weight: 700; font-size: 13.5px;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.errors {
  background: var(--red-soft); color: var(--red);
  font-weight: 600; font-size: 13.5px;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.errors ul { margin-left: 18px; }

/* ── Дашборд: услуги ────────────────────────────── */
.bar-row { display: grid; grid-template-columns: 200px 1fr 90px; gap: 12px; align-items: center; padding: 8px 0; }
.bar-row .name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #f0f4f9; border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { background: linear-gradient(90deg, var(--accent), #f5a942); height: 100%; border-radius: 999px; }
.bar-row .val { text-align: right; color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* ── Карточка заказа ────────────────────────────── */
.order-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.order-head .plate { font-size: 24px; font-weight: 800; letter-spacing: 1px; }
.order-head .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; }
.kv .k { color: var(--ink-soft); }
.kv .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.kv.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 11px; }
.kv .v.danger { color: var(--red); }
.kv .v.ok { color: var(--green); }

.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-tile { text-align: center; }
.photo-tile img {
  width: 104px; height: 104px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}
.photo-tile .cap { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.photo-tile img { cursor: zoom-in; transition: transform .12s ease, border-color .12s ease; }
.photo-tile:hover img { transform: scale(1.03); border-color: var(--accent); }

/* ── Лайтбокс (просмотр фото) ───────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 14, 22, .82);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 56px 64px;
}
.lightbox[hidden] { display: none; }
.lightbox-figure {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 100%; max-height: 100%;
}
.lightbox-figure img {
  max-width: 100%; max-height: calc(100vh - 140px);
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .6);
  background: rgba(255, 255, 255, .06);
}
.lightbox-cap {
  color: rgba(255, 255, 255, .8); font-size: 13px; font-weight: 600;
  text-align: center; max-width: 640px;
}
.lightbox-btn {
  position: absolute; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .1);
  color: #fff; font-size: 20px; line-height: 1;
  border-radius: 50%; cursor: pointer;
  transition: background .12s ease;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, .22); }
.lightbox-close { top: 16px; right: 20px; }
.lightbox-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lightbox[data-single] .lightbox-prev,
.lightbox[data-single] .lightbox-next { display: none; }
.lightbox-count {
  position: absolute; top: 22px; left: 24px;
  color: rgba(255, 255, 255, .7); font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .lightbox { padding: 56px 12px; }
  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
}

.timeline { list-style: none; }
.timeline li { display: flex; gap: 12px; padding: 7px 0; font-size: 13px; }
.timeline .t { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; width: 110px; flex-shrink: 0; }
.timeline .who { color: var(--muted); font-size: 12px; }

/* Подсказка «такой клиент уже есть» под телефоном в форме создания акта.
   Показ/скрытие — inline display из JS: display здесь перебивает [hidden]. */
.client-match {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--accent); background: var(--accent-soft);
  border-radius: var(--radius-sm);
}
.client-match.on { border-color: var(--green); background: var(--green-soft); }
.client-match .sub { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.client-match .text { flex: 1; }
.input.locked { background: #f4f6f8; color: var(--ink-soft); }

.task-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; scroll-margin-top: 16px; }
.task-block + .task-block { margin-top: 10px; }
.task-block:target { border-color: var(--accent); background: var(--accent-soft); }
.task-block .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-block .title { font-weight: 700; font-size: 14.5px; }
.task-block .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.task-block .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.task-block .actions form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.defect { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.defect:last-child { border-bottom: none; }
.defect .kind { font-size: 11px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }

/* ── Пагинация ──────────────────────────────────── */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.pager a, .pager span {
  min-width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px;
  border-radius: 10px;
  font-weight: 600; font-size: 13px;
  color: var(--ink-soft);
  border: 1px solid var(--border);
  background: #fff;
}
.pager .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .dots { border: none; background: none; }

.pager-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.pager-bar .pager { margin-top: 0; }
.pager-info { font-size: 13px; color: var(--muted); }
.pager-info b { color: var(--ink); font-weight: 700; }
.pager-per { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 13px; color: var(--muted); }
.pager-per .input { width: auto; padding: 7px 10px; font-size: 13px; }

/* ── Логин ──────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 34px;
}
.login-card .logo {
  width: 54px; height: 54px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
  margin-bottom: 16px;
}
.login-card .logo svg { width: 26px; height: 26px; }
/* Логотип картинкой: без плашки — жёлтая марка на светло-оранжевом фоне почти сливается */
.login-card .logo.brand { width: 64px; height: 64px; background: none; margin-bottom: 14px; }
.login-card .logo.brand img { width: 100%; height: 100%; object-fit: contain; }
.login-card h1 { font-size: 23px; font-weight: 800; }
.login-card .sub { color: var(--muted); margin: 4px 0 20px; }
.login-card .field + .field { margin-top: 12px; }
.login-card .btn { width: 100%; margin-top: 18px; padding: 13px; }

/* --- Справочник v2: аккордеон, inline-редактирование, тосты --- */
.toolbar { margin-bottom: 14px; }
.toolbar .js-search { max-width: 340px; }
.cat-add { display: flex; gap: 8px; margin-bottom: 12px; }
.cat-add .input { flex: 1; }
.acc-list, .cat-list { border-top: 1px solid var(--border); }
.acc-item + .acc-item, .cat-list .cat-row { border-top: 1px solid var(--border); }
.cat-view { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; }
.cat-view:hover { background: #f7f9fb; }
.cat-view.js-toggle { cursor: pointer; }
.cat-view .name { font-weight: 600; }
.cat-view .muted { color: var(--muted); font-size: 12.5px; }
.cat-view .actions { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.cat-row:hover .actions, .cat-row:focus-within .actions { opacity: 1; }
/* inline-grid, а не дефолт: у <a class="icon-btn"> инлайн-бокс игнорировал бы width/height */
.icon-btn { display: inline-grid; place-items: center; vertical-align: middle; border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 28px; height: 28px; cursor: pointer; color: var(--ink); font-size: 13px; line-height: 1; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.chev { transition: transform .15s; font-size: 11px; color: var(--muted); flex: none; }
.acc-item.open > .cat-row .chev { transform: rotate(90deg); }
.acc-body { padding: 2px 0 12px 30px; }
.acc-body .cat-add { margin: 8px 0 0; max-width: 420px; }
.cat-edit { display: flex; gap: 8px; align-items: center; padding: 6px 8px; }
.cat-edit .input { flex: 1; max-width: 320px; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); flex: none; display: inline-block; }
.color-input { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; flex: none; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 50; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(16, 27, 40, .25); animation: toast-in .15s ease-out; }
.toast.err { background: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Склад: миниатюра в таблице остатков и фото на карточке товара */
.product-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; }
.product-thumb.empty { background: #eef1f5; }
.product-photo { width: 100%; border-radius: 12px; object-fit: cover; display: block; }
.product-photo.empty {
    display: flex; align-items: center; justify-content: center;
    height: 180px; background: #eef1f5; color: var(--muted); font-size: 13px;
}

/* Склад: пункт комбобокса товара — название слева, ед. изм. и остаток справа */
.combo-item .nm { font-weight: 600; }
.combo-item .mu { float: right; color: var(--muted); font-size: 12.5px; white-space: nowrap; padding-left: 12px; }
.combo-item .mu.empty { color: var(--red); }

/* Остальные поля нового товара — только в режиме «новый товар» */
.picker-new {
    margin-top: 10px; padding: 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: #f7f9fb;
}
.combo:not(.is-new) + .picker-new { display: none; }
.picker-new-hint { margin-top: 10px; color: var(--muted); font-size: 12.5px; }

/* ── Комбобокс с поиском (js/admin-combo.js) ─────── */
.combo { display: flex; flex-direction: column; gap: 5px; }
.combo-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.combo-head .search-box { position: relative; flex: 1 1 240px; }
.combo-head .search-box .input { min-width: 0; }
/* режим «новая статья»: поле перестаёт быть поиском — убираем лупу */
.combo.is-new .search-box svg { display: none; }
.combo.is-new .search-box .input { padding-left: 13px; }
.combo-list {
    position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 240px; overflow-y: auto; padding: 4px;
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.combo-list[hidden] { display: none; }
.combo-item {
    display: block; width: 100%; text-align: left; cursor: pointer;
    padding: 9px 11px; border: 0; border-radius: 9px;
    background: none; font: inherit; color: var(--ink);
}
.combo-item[hidden] { display: none; }
.combo-item:hover, .combo-item.active { background: var(--bg); }
.combo-item.combo-new { color: var(--accent); font-weight: 700; }
.combo-empty { padding: 9px 11px; color: var(--muted); }
.combo-empty[hidden] { display: none; }
.combo-hint { font-size: 11px; font-weight: 600; color: var(--accent); }
.combo-hint[hidden] { display: none; }

/* ── Множественный выбор в выпадающем списке (js/admin-multiselect.js) ─────── */
.ms { position: relative; }
.ms-head {
    display: flex; align-items: center; gap: 8px; width: 100%;
    text-align: left; cursor: pointer; font: inherit; color: var(--ink);
}
.ms-head::after {
    content: ''; flex: none; margin-left: auto; width: 7px; height: 7px;
    border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
    transform: translateY(-2px) rotate(45deg);
}
.ms-head .js-ms-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms.is-active .ms-head { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ms-list {
    position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; min-width: 220px;
    padding: 8px; background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.ms-list[hidden] { display: none; }
.ms-search { margin-bottom: 6px; }
.ms-items { max-height: 240px; overflow-y: auto; }
.ms-item {
    display: flex; align-items: center; gap: 9px; cursor: pointer;
    padding: 8px 9px; border-radius: 9px;
}
.ms-item[hidden] { display: none; }
.ms-item:hover { background: var(--bg); }
.ms-item input { flex: none; }
.ms-empty { padding: 9px 11px; color: var(--muted); }
.ms-empty[hidden] { display: none; }
.ms-list .js-ms-clear { width: 100%; margin-top: 6px; }

/* ── Шторка: заголовок-переключатель, по клику раскрывает содержимое ─────── */
.disclosure { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.disclosure > summary {
    display: flex; align-items: center; gap: 9px; cursor: pointer; list-style: none;
    padding: 11px 14px; background: #f7f9fb;
    font-size: 13px; font-weight: 700; color: var(--ink);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
    content: ''; width: 7px; height: 7px; margin-left: 2px;
    border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg); transition: transform .15s;
}
.disclosure[open] > summary::before { transform: rotate(45deg); }
.disclosure > summary:hover { background: var(--bg); }
.disclosure > summary .sub { margin-left: auto; font-weight: 400; }
.disclosure[open] > summary { border-bottom: 1px solid var(--border); }

/* ── Ведомость ЗП: расчёт раскрывается вторым tr под строкой сотрудника ───── */
/* Парное правило к [hidden] обязательно: UA-шное [hidden]{display:none}
   проигрывает любому авторскому display, а его тут задают вложенные .row/.field */
tr.salary-detail[hidden] { display: none; }
tr.salary-detail > td { background: #f9fbfd; padding: 4px 14px 18px; }
tbody tr.js-salary-toggle.open { background: #f0f4f9; }
tbody tr.js-salary-toggle > td:first-child::before { content: '▸ '; color: var(--muted); }
tbody tr.js-salary-toggle.open > td:first-child::before { content: '▾ '; }

/* Превью снимка в форме приёмки: заполненный кадр либо пунктирная заглушка */
.shot-thumb {
    width: 74px; height: 74px; flex: 0 0 74px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    object-fit: cover; background: var(--bg);
}
.shot-thumb.empty { border-style: dashed; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

/* ── Финансовая секция дашборда ─────────────────── */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 26px 0 14px; }
.section-head h2 { font-size: 17px; font-weight: 800; }
.section-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.section-head .chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mini-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; }
.mini-row + .mini-row { border-top: 1px solid var(--line, #eef2f7); }
.mini-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.mini-value { font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ── Дашборд: дебиторка и долг по ЗП ────────────── */
.alert-value { font-size: 29px; font-weight: 800; letter-spacing: -.5px; }
.alert-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.alert-danger { display: inline-block; margin-top: 12px; padding: 7px 11px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 700; text-decoration: none; }
.alert-ok { margin-top: 12px; color: var(--muted); font-size: 13px; }
.alert-note { margin-top: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }

/* ── Столбиковый график дашборда (без JS-библиотек) ── */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 190px; overflow-x: auto; padding-top: 6px; }
.chart-col { flex: 1 1 0; min-width: 14px; display: flex; flex-direction: column; height: 100%; }
.chart-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.chart-bar { width: 45%; max-width: 12px; min-height: 2px; border-radius: 3px 3px 0 0; }
.chart-bar.in { background: var(--green); }
.chart-bar.out { background: var(--red); }
.chart-label { height: 18px; margin-top: 6px; text-align: center; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend .dot.in { background: var(--green); }
.legend .dot.out { background: var(--red); }

/* Кнопка «Убрать» (.btn) и поле комментария (.field) в карточке «Фото приёмки»
   задают свой display, поэтому дефолтный UA-стиль [hidden]{display:none}
   проигрывает каскаду и не прячет их. Перебиваем явно — только в границах
   этих двух контейнеров, чтобы не задеть .field/.btn на остальных экранах. */
#intake-shots [hidden],
#extra-shots [hidden] {
    display: none;
}

/* Произвольный период в переключателе дашборда: форма стоит в одном ряду с чипами,
   поэтому поля дат сжаты до их высоты. Без JS — обычный GET-сабмит. */
.period-form { display: inline-flex; align-items: center; gap: 6px; }
.period-form .input.sm { padding: 6px 9px; font-size: 12.5px; width: auto; }
.period-dash { color: var(--muted); font-size: 12.5px; }

/* Знак денег в плитках: расходы всегда красные, прибыль зелёная, а при убытке красная. */
.stat .value.pos { color: var(--green); }
.stat .value.neg { color: var(--red); }

/* ── Логотип детейлинга в списке платформы ──────── */
.tn-logo {
  width: 32px; height: 32px; flex: 0 0 32px;
  border: 1px solid var(--border); border-radius: 8px;
  object-fit: contain; background: #fff;
}
.tn-logo.empty {
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: var(--muted); background: var(--bg);
}
.tn-name { display: flex; align-items: center; gap: 10px; }
.tn-name .sub { font-size: 12px; color: var(--muted); }
.tn-over { color: var(--red); font-weight: 600; }

/* ── Логин с суффиксом тенанта ──────────────────── */
.login-group { display: flex; align-items: stretch; }
.login-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.login-group .suffix {
  display: flex; align-items: center; padding: 0 10px;
  border: 1px solid var(--border); border-left: none;
  border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm);
  background: var(--bg); color: var(--muted); font-size: 13px; white-space: nowrap;
}
