:root {
  --bg: #f4f4f2; --card: #fff; --ink: #141414; --mut: #6b6b6b; --line: #e3e3df; --red: #f01e23; --red-soft: #fde7e7;
  --booked: #fff3cd; --booked-ink: #8a6100; --sel: #e8f0ff; --ok: #1f7a3a; --transit: #e9f3ff; --focus: #2563eb;
  --r: 10px; font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.mut { color: var(--mut); }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: #fff; font-weight: 800; margin-right: 6px; }
.brand { font-weight: 800; letter-spacing: .02em; display: flex; align-items: center; white-space: nowrap; }

/* шапка */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
#nav a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); white-space: nowrap; }
#nav a.on { background: var(--ink); color: #fff; }
#nav a .cnt { margin-left: 6px; font-size: 12px; opacity: .7; }
.me { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--mut); }
main { padding: 12px 16px 24px; }

/* кнопки и поля */
.btn { text-decoration: none; display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #bbb; }
a.btn { color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.red { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 8px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
input[type=text], input[type=search], input[type=number], input[type=password], input:not([type]), input[type=date], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mut); }
label > input, label > select, label > textarea { font-size: 14px; color: var(--ink); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1; min-width: 140px; }

/* панель инструментов */
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.bar h1 { font-size: 20px; margin: 0 8px 0 0; }
.bar .grow { flex: 1; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }
.search { min-width: 200px; flex: 0 1 320px; }
.selbar { display: none; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px 10px; margin-bottom: 8px; background: var(--sel);
  border: 1px solid #c9dafc; border-radius: var(--r); }
.selbar.on { display: flex; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; background: #eee; font-size: 12px; }
.chip.red { background: var(--red-soft); color: #a40d11; }
.chip.amber { background: var(--booked); color: var(--booked-ink); }
.chip.blue { background: var(--transit); color: #1d4f8f; }
.hint { font-size: 12px; color: var(--mut); }

/* таблицы */
.grid { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tabulator { font-size: 13px; border: 0; background: #fff; }
.tabulator .tabulator-header { border-bottom: 1px solid var(--line); background: #fafaf8; }
.tabulator .tabulator-header .tabulator-col { background: #fafaf8; }
.tabulator .tabulator-col-title { font-weight: 600; }
.tabulator .tabulator-header-filter input { padding: 2px 5px !important; border-radius: 5px; font-size: 12px; border: 1px solid var(--line); }
.tabulator-row .tabulator-cell { padding: 5px 7px; border-right: 1px solid #f0f0ec; }
.tabulator-row.tabulator-row-even { background: #fcfcfb; }
.tabulator-row:not(.tabulator-group):hover { background: #f5f8ff !important; }
.tabulator-row.is-booked, .tabulator-row.is-booked.tabulator-row-even { background: var(--booked) !important; }
.tabulator-row.is-selected { background: var(--sel) !important; }
.tabulator-row.is-flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: #ffe58a; } 100% { background: inherit; } }
.tabulator .tabulator-cell.tabulator-editable:hover { box-shadow: inset 0 0 0 1px #c5d4f5; cursor: text; }
.tabulator .tabulator-cell.tabulator-editing { box-shadow: inset 0 0 0 2px var(--focus); }
.tabulator-row .tabulator-cell.cell-red { background: var(--red-soft); color: #a40d11; font-weight: 600; }
.tabulator-row .tabulator-cell.cell-mut { color: #b5b5b0; }
.tabulator .tabulator-group { background: #f1f1ee; border-top: 1px solid var(--line); font-weight: 700; padding: 5px 10px; }
.tabulator .tabulator-group.tabulator-group-level-1 { background: #f8f8f6; font-weight: 600; padding-left: 26px; }
.tabulator .tabulator-group span { color: var(--mut); font-weight: 400; margin-left: 6px; }
.tabulator .tabulator-placeholder span { color: var(--mut); font-size: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.lockline { color: var(--booked-ink); font-weight: 600; cursor: pointer; }
.cbx { width: 16px; height: 16px; cursor: pointer; }

/* карточки посылок */
.parcel { background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; }
.parcel-h { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafaf8; }
.parcel-h .t { font-weight: 700; font-size: 15px; }
.parcel-h .track { font-family: ui-monospace, Menlo, monospace; user-select: all; background: #fff; border: 1px dashed var(--line); padding: 1px 6px; border-radius: 6px; }
.parcel-h .grow { flex: 1; }
.parcel.received .parcel-h { background: #f3f7f3; }

/* окна */
.ov { position: fixed; inset: 0; background: rgba(20, 20, 20, .38); z-index: 50; display: grid; place-items: start center; padding: 40px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: min(1180px, 100%); padding: 18px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal.narrow { width: min(560px, 100%); }
.modal h2 { margin: 0 0 12px; font-size: 18px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; align-items: center; }
.modal .foot .grow { flex: 1; }
.modal textarea { width: 100%; min-height: 130px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.pick { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }
.pick div { padding: 6px 10px; border-bottom: 1px solid #f2f2ef; cursor: pointer; display: flex; gap: 8px; justify-content: space-between; }
.pick div:hover { background: #f5f8ff; }
.pick div.on { background: var(--sel); font-weight: 600; }

/* настройки */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.card .row { margin-bottom: 8px; }
table.perm { border-collapse: collapse; width: 100%; font-size: 13px; }
table.perm th, table.perm td { border-bottom: 1px solid #f0f0ec; padding: 5px 6px; text-align: center; }
table.perm th:first-child, table.perm td:first-child { text-align: left; }
table.perm th { font-weight: 600; font-size: 12px; color: var(--mut); }

/* уведомления */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 9px; max-width: 420px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.err { background: var(--red); }

/* вход */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login { background: #fff; padding: 26px; border-radius: 16px; width: 320px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); }
.login .brand { font-size: 18px; margin-bottom: 6px; }
.login .err { color: var(--red); min-height: 18px; font-size: 13px; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 8px; }
  main { padding: 10px; }
  .search { min-width: 0; flex: 1 1 100%; }
}

/* наличие «как в Excel» */
.tabulator .tabulator-cell.ln-cell { white-space: normal; line-height: 1.35; }
.ln { display: block; }
.ln-main { font-weight: 600; font-size: 14px; }
.ln-cm { font-size: 12px; color: #6b6b6b; }
.ln-pr { font-size: 14px; white-space: nowrap; }
.ln-np { font-size: 12px; color: #b5b5b0; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.tabulator-row.row-sep { border-top: 7px solid #f1f1ee; }
.view-one .tabulator .tabulator-group.tabulator-group-level-0,
.view-all .tabulator .tabulator-group.tabulator-group-level-1 { background: #8fe86a; color: #10260a; border-top: 1px solid #6cc94a; }
.view-one .tabulator .tabulator-group.tabulator-group-level-0 span,
.view-all .tabulator .tabulator-group.tabulator-group-level-1 span { color: #2d5a1e; }
.view-all .tabulator .tabulator-group.tabulator-group-level-0 { background: #141414; color: #fff; }
.view-all .tabulator .tabulator-group.tabulator-group-level-0 span { color: #bbb; }

/* места хранения: как заливка в Excel */
.tabulator-row.pl-orange, .tabulator-row.pl-orange.tabulator-row-even { background: #f7bf78 !important; }
.tabulator-row.pl-blue, .tabulator-row.pl-blue.tabulator-row-even { background: #d6e8ff !important; }
.tabulator-row.pl-gray, .tabulator-row.pl-gray.tabulator-row-even { background: #e6e6e3 !important; }
.tabulator-row.pl-green, .tabulator-row.pl-green.tabulator-row-even { background: #d9f5cc !important; }
.tabulator-row.is-booked { background: var(--booked) !important; }
.tabulator-row.is-booked.pl-orange { box-shadow: inset 6px 0 0 #e8892a; }
.tabulator-row.is-selected { background: var(--sel) !important; }
.chip.vit { background: #141414; color: #fff; font-size: 11px; vertical-align: 1px; }
.place-btn.pl-orange { background: #f7bf78; border-color: #e8a050; }
.place-btn.pl-blue { background: #d6e8ff; } .place-btn.pl-gray { background: #e6e6e3; } .place-btn.pl-green { background: #d9f5cc; }
#where { min-width: 150px; }

/* бронь важнее цвета склада, выделение — важнее брони (специфичность выше, чем у .pl-*) */
.grid .tabulator .tabulator-row.is-booked, .grid .tabulator .tabulator-row.is-booked.tabulator-row-even { background: var(--booked) !important; }
.grid .tabulator .tabulator-row.is-booked.pl-orange { box-shadow: inset 6px 0 0 #e8892a; }
.grid .tabulator .tabulator-row.is-selected, .grid .tabulator .tabulator-row.is-selected.tabulator-row-even { background: var(--sel) !important; }
.parcel .tabulator .tabulator-row.is-booked { background: var(--booked) !important; }
.pltab input, .pltab select { width: 100%; }
.pltab tr.pl-orange td { background: #fbe0bd; }
@media (min-width: 900px) { .card.wide2 { grid-column: span 2; } }
.pltab td:first-child { min-width: 170px; }
.ln-p30 { font-size: 13px; color: #555; font-weight: 600; }
.ln-pr b { font-size: 14px; }
.avt { font-size: 10px; font-weight: 700; color: #fff; background: #00aaff; border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.req { color: #f01e23; font-weight: 700; }
.due { flex: 1; min-width: 200px; font-size: 13px; color: var(--ink); padding-bottom: 6px; }
.chosen-dev { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid #c9dafc; background: var(--sel); border-radius: 8px; padding: 9px 12px; margin-top: 4px; }
.chosen-dev a { white-space: nowrap; }
.fifo { color: #8a6100; background: var(--booked); padding: 3px 8px; border-radius: 6px; display: inline-block; }
input[readonly] { background: #f6f6f3; color: #333; }
/* окно не раздувается широкой таблицей: таблица прокручивается внутри окна */
.ov { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal { min-width: 0; max-width: 100%; }
.modal .grid { max-width: 100%; overflow: hidden; }
.btn.big { padding: 14px 30px; font-size: 16px; flex: 1; }
.kit { display: flex; gap: 14px; padding: 8px 2px; }
.kit label { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }

/* ================= фирменный стиль PROSTORE (брендбук: Ruda, чёрный / белый / красный #F01E23) ================= */
@font-face { font-family: Ruda; src: url(/static/fonts/Ruda-Regular.ttf); font-weight: 400; font-display: swap; unicode-range: U+0000-218F, U+2200-FFFF; }   /* стрелки (U+2190–21FF) — системным шрифтом: в Ruda «→» выглядит как «↘» */
@font-face { font-family: Ruda; src: url(/static/fonts/Ruda-ExtraBold.ttf); font-weight: 600 800; font-display: swap; unicode-range: U+0000-218F, U+2200-FFFF; }   /* стрелки (U+2190–21FF) — системным шрифтом: в Ruda «→» выглядит как «↘» */
@font-face { font-family: Ruda; src: url(/static/fonts/Ruda-Black.ttf); font-weight: 900; font-display: swap; unicode-range: U+0000-218F, U+2200-FFFF; }   /* стрелки (U+2190–21FF) — системным шрифтом: в Ruda «→» выглядит как «↘» */
:root { --red: #F01E23; --red-dark: #C9151A; --grey: #9793A0; --soft: #F3F3F3; --line: #E6E5EA; --bg: #F3F3F3; --sel: #ECEBF0; --focus: #000; }
body, .tabulator, button, input, select, textarea { font-family: Ruda, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
.mut, .hint { color: var(--grey); }
.logo-img { height: 22px; display: block; }
.crm-tag { margin-left: 8px; font-size: 11px; font-weight: 900; letter-spacing: .08em; color: #fff; background: var(--red); border-radius: 6px; padding: 2px 6px; }
.top { border-bottom: 1px solid var(--line); }
#nav a { font-weight: 800; }
#nav a:hover { color: var(--red); }
#nav a.on, #nav a.on:hover { background: #000; color: #fff; }
.bar h1 { font-weight: 900; letter-spacing: -.01em; }
.btn { border-radius: 10px; font-weight: 800; border-color: var(--line); }
.btn:hover { border-color: #000; }
.btn.primary { background: #000; border-color: #000; color: #fff; }
.btn.primary:hover { background: var(--red); border-color: var(--red); }
.btn.red { background: var(--red); border-color: var(--red); }
.btn.red:hover { background: var(--red-dark); }
.btn.danger { color: var(--red); }
.cbx.other { opacity: .45; }
.chip.grp { background: #000; color: #fff; font-size: 11px; }
.grp-list { width: 100%; border-collapse: collapse; margin: 10px 0 4px; font-size: 13px; }
.grp-list td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.grp-list td.r { text-align: right; white-space: nowrap; }
.grp-list tr.tot td { border-bottom: 0; padding-top: 8px; }
.chip.work { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; vertical-align: 1px; margin-left: 6px; white-space: nowrap; }
.btn.danger:hover { border-color: var(--red); }
.seg button { font-weight: 800; }
.seg button.on { background: #000; }
input:focus, select:focus, textarea:focus { border-color: #000; box-shadow: 0 0 0 3px rgba(240, 30, 35, .12); }
.grid, .card, .parcel { border-color: var(--line); border-radius: 14px; }
.tabulator .tabulator-header, .tabulator .tabulator-header .tabulator-col { background: #fff; }
.tabulator .tabulator-col-title { font-weight: 800; }
.ln-main { font-weight: 800; }
.ln-pr b { font-weight: 900; }
/* заголовки групп: «Новое / Б/У» — чёрные, модели — фирменный светлый с красной полосой */
.view-all .tabulator .tabulator-group.tabulator-group-level-0 { background: #000; color: #fff; border-top-color: #000; }
.view-one .tabulator .tabulator-group.tabulator-group-level-0,
.view-all .tabulator .tabulator-group.tabulator-group-level-1 { background: var(--soft); color: #000; border-top: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--red); font-weight: 900; }
.view-one .tabulator .tabulator-group.tabulator-group-level-0 span,
.view-all .tabulator .tabulator-group.tabulator-group-level-1 span { color: var(--grey); }
.tabulator .tabulator-group { background: var(--soft); }
.tabulator-row.row-sep { border-top-color: var(--soft); }
.chip { background: var(--soft); }
.chip.vit { background: #000; color: #fff; }
.selbar { background: #fff; border-color: #000; }
.toast { background: #000; border-radius: 12px; font-weight: 800; }
.toast.err { background: var(--red); }
.login { border-radius: 22px; }
.login .brand { justify-content: center; }
.modal { border-radius: 22px; }
.modal h2 { font-weight: 900; }

/* бронь — серым, как в Excel PROSTORE (заливка #CCCCCC); выделение галочкой — светло-голубым, чтобы не путать */
:root { --booked: #D4D4D4; --booked-ink: #333; --sel: #E3EDFF; }
.grid .tabulator .tabulator-row.is-booked, .grid .tabulator .tabulator-row.is-booked.tabulator-row-even,
.parcel .tabulator .tabulator-row.is-booked { background: #D4D4D4 !important; }
.grid .tabulator .tabulator-row.is-selected, .grid .tabulator .tabulator-row.is-selected.tabulator-row-even { background: #E3EDFF !important; }
.lockline { color: #333; }
.chip.amber { background: #D4D4D4; color: #333; }
.fifo { background: #E6E6E6; color: #333; }

.search { min-width: 180px; flex: 0 1 260px; }
#where { min-width: 120px; max-width: 170px; }
.arr td { text-align: left !important; } .arr input { width: 100%; }
label > input:not([type=checkbox]):not([type=radio]), label > select { box-sizing: border-box; height: 36px; }   /* дата и списки — одной высоты, на одной линии */
.arr tr.abooked td { background: #D4D4D4; }   /* бронь — серым, как во всей CRM */
.arr td.actr { text-align: center !important; } .arr td.actr input { width: 80px; display: block; margin: 0 auto; text-align: center; }   /* страна — по центру под заголовком */
.arr td.actr select { display: block; margin: 0 auto; }   /* «Куда положили» — по центру под заголовком */
.tabulator-cell input.tick { width: 18px; height: 18px; accent-color: #000; cursor: pointer; margin: 0; vertical-align: middle; }

/* ---- продажа ---- */
.modal.wide { width: min(980px, 100%); }
#nav .sell-btn { margin-left: auto; padding: 7px 16px; }
.sale-find { position: relative; }
.sale-find input { width: 100%; font-size: 15px; padding: 9px 12px; box-sizing: border-box; height: auto; }
.sale-find .pick:empty { display: none; }
.sale-find .pick .is-bk { color: #777; }
.sale-tab { width: 100%; border-collapse: collapse; margin-top: 12px; }
.sale-tab th { text-align: left; font-size: 12px; color: var(--mut); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.sale-tab td { padding: 7px 8px; border-bottom: 1px solid #efefec; vertical-align: middle; }
.sale-tab td:nth-child(2) { width: 130px; } .sale-tab td:nth-child(3) { width: 150px; text-align: right; } .sale-tab td:nth-child(4) { width: 40px; }
.sale-tab .sp, .sale-tab .xp { width: 120px; text-align: right; font-weight: 700; }
.sale-tab tr.tin td { background: #fafaf7; }
.sale-add { margin-top: 8px; gap: 8px; }
.sale-due { margin: 10px 0 4px; padding: 10px 12px; background: #f6f6f3; border-radius: 10px; }
.sale-due:empty { display: none; }
.sale-due .big { font-size: 20px; font-weight: 800; margin-top: 4px; }
.neg { color: var(--red); }
.disc { font-size: 11px; color: var(--red); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.kpis { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: 12px; color: var(--mut); } .kpi b { font-size: 20px; } .kpi i { font-style: normal; font-size: 12px; color: var(--mut); }
.tabulator-row.is-returned .tabulator-cell { color: #999; text-decoration: line-through; }
.tabulator-row.is-returned .tabulator-cell .neg { text-decoration: none; }
#sg .tabulator-row { cursor: pointer; }
.row > label > span { white-space: nowrap; }   /* подпись поля в одну строку — поля на одной линии */
.sprint { flex-direction: row !important; align-items: center; gap: 6px; color: var(--ink) !important; font-size: 13px !important; white-space: nowrap; }
.tabulator-row.is-ret .tabulator-cell { background: #fff6f6; }
.ret-row td { color: #999; }
.ret-note { margin: 4px 0; padding: 6px 10px; background: #fff6f6; border-radius: 8px; font-size: 13px; }
.ret-tab tr.off td:not(:first-child) { opacity: .45; }
.ret-tab td:nth-child(1) { width: 28px; } .ret-tab td:nth-child(3) { width: 200px; } .ret-tab .ram, .ret-tab .rnp { width: 110px; text-align: right; }
.ret-tab td:nth-child(2) { width: auto; }
.ret-tab td:nth-child(4) { width: 90px; text-align: right; } .ret-tab td:nth-child(5), .ret-tab td:nth-child(6) { width: 120px; }

/* ---- фото посылки ---- */
.photos { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin: 6px 0; }
.photos .ph { position: relative; width: 112px; height: 112px; border-radius: 10px; overflow: hidden; background: #f3f3f0; border: 1px solid var(--line); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.photos .ph span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; color: #fff; background: rgba(0,0,0,.45); padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photos .phx { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; font-size: 11px; display: none; }
.photos .ph:hover .phx { display: block; }
.photos .ph.add { display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; border-style: dashed; color: var(--ink); gap: 2px; }
.photos .ph.add b { font-size: 30px; line-height: 1; } .photos .ph.add span { position: static; background: none; color: var(--mut); font-size: 11px; }
.photos .ph-st { align-self: center; }
.arr-ph { margin: 6px 0 10px; padding: 8px 10px; background: #fafaf7; border-radius: 10px; }
.phview img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto 10px; border-radius: 8px; }
@media (hover: none) { .photos .phx { display: block; } }

/* ---- гарантия ---- */
#nav .badge { background: var(--red); color: #fff; border-radius: 9px; font-size: 11px; padding: 1px 6px; margin-left: 4px; }
.claim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin-bottom: 8px; }
.claim-grid .mut { display: inline-block; min-width: 70px; }
#clg .tabulator-row, #clz .tabulator-row { cursor: pointer; }
.photos .ph.vid .vph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 34px; color: #999; cursor: pointer; }
.photos .ph .play { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); font-style: normal; color: #fff; font-size: 26px; text-shadow: 0 1px 6px rgba(0,0,0,.6); pointer-events: none; }
.photos .ph[data-id] { cursor: zoom-in; }
.phview video { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto 10px; border-radius: 8px; background: #000; }
.loan-box { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #fafaf7; border: 1px solid var(--line); }
.loan-box.open { background: #fff6f6; border-color: #f3c9c9; }
.kpi.big b { font-size: 26px; }
.tabulator-row.is-count .tabulator-cell { background: #f3f6ff; }
#sbg .tabulator-row { cursor: pointer; }
.photos .vph.pdf { font-size: 22px; font-weight: 800; color: #c33; }
.ti-calc .sale-due { margin-top: 10px; }
.ti-rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 14px; }
.ti-rules label:nth-last-child(-n+3) { grid-column: 1 / -1; }
#tig .tabulator-row { cursor: pointer; }
#tig { display: inline-block; max-width: 100%; } #tig .tabulator { width: auto; }
.row > label.sprint { flex: 0 0 auto; min-width: 0; }   /* галочки стоят рядом, а не разъезжаются по ширине */
.card.inst { margin-bottom: 10px; display: inline-block; min-width: 0; max-width: 100%; overflow-x: auto; margin-right: 10px; vertical-align: top; }
.inst-t { border-collapse: collapse; } .inst-t th, .inst-t td { padding: 5px 10px; text-align: right; border-bottom: 1px solid #efefec; white-space: nowrap; }
.inst-t th:first-child, .inst-t td:first-child { text-align: left; color: var(--mut); font-weight: 400; }
.inst-t th { font-size: 13px; } .inst-t th .mut { font-weight: 400; font-size: 11px; }
.inst-hint { margin-top: 6px; font-size: 12px; color: #555; }
/* меню: не прятать пункты за краем — если не помещаются, переносятся на вторую строку (Стас 16.10: «не вижу рассрочку») */
#nav { flex-wrap: wrap; overflow: visible; row-gap: 4px; min-width: 0; }
#nav a { padding: 6px 10px; }
/* рассрочка — как лист Excel: ввёл сумму за наличные, всё посчиталось */
.inst-top { display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; }
.inst-cash span, .inst-up span { display: block; font-size: 13px; color: var(--mut); font-weight: 600; }
.inst-cash input { font-size: 26px; font-weight: 800; color: var(--red); width: 190px; height: auto; padding: 4px 10px; }
.inst-up b { display: block; font-size: 22px; padding: 6px 0; min-width: 120px; }
.inst-dev { display: flex; align-items: flex-end; gap: 10px; flex: 1; min-width: 300px; }
.inst-dev label { flex: 1; }
table.inst-x { border-collapse: collapse; margin-top: 12px; background: #fff; font-size: 15px; }
table.inst-x th, table.inst-x td { padding: 8px 14px; text-align: right; border-bottom: 1px solid #e6e6e2; white-space: nowrap; min-width: 92px; }
table.inst-x th:first-child, table.inst-x td:first-child { text-align: left; min-width: 170px; }
table.inst-x tr.hd th { background: #aec4f2; font-weight: 800; }
table.inst-x tr.pm td { background: #dfeedd; font-weight: 800; }

/* ---- проверка как дизайнер (16.10) ---- */
/* подсказка в пустом поле — светлее, чтобы не путать с введённым («+7 905 079 7265» выглядело как уже вписанный номер) */
input::placeholder, textarea::placeholder { color: #b9b9b6; opacity: 1; }
/* ряды полей в окнах — одинаковый отступ (в окне брони подписи прилипали к полям выше) */
.modal .row + .row { margin-top: 8px; }
/* поле с ошибкой — красная рамка */
.bad, .bad:focus { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(240, 30, 35, .14) !important; }
.photos.bad { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 10px; }
.perm.hist td { text-align: left !important; }
.perm.hist td:first-child { white-space: nowrap; width: 110px; }
/* телефон: меню — одной строкой с прокруткой пальцем, «Продажа» первой; раньше меню занимало весь экран */
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; }
  #nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  #nav::-webkit-scrollbar { display: none; }
  #nav .sell-btn { order: -1; margin-left: 0; }
  .seg { flex-wrap: wrap; height: auto; }
  .seg button { white-space: normal; }
  .modal { padding: 16px 14px; }
}

/* ---- правки по проверке дизайна, часть 2 (16.10) ---- */
/* 4) стрелки сортировки — только при наведении и у столбца, по которому уже отсортировано */
.tabulator .tabulator-col .tabulator-col-sorter { opacity: 0; transition: opacity .15s; }
.tabulator .tabulator-col:hover .tabulator-col-sorter,
.tabulator .tabulator-col[aria-sort="ascending"] .tabulator-col-sorter,
.tabulator .tabulator-col[aria-sort="descending"] .tabulator-col-sorter { opacity: 1; }
@media (hover: none) { .tabulator .tabulator-col .tabulator-col-sorter { opacity: .45; } }
/* 1) списки-теги */
.lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: text; margin-top: 4px; }
.tags .tg { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: #f1f1ee; color: var(--ink); font-size: 13px; cursor: grab; user-select: none; }
.tags .tg.drag { opacity: .4; }
.tags .tg button { border: 0; background: none; color: #888; font-size: 15px; line-height: 1; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; padding: 0; }
.tags .tg button:hover { background: #e2e2de; color: var(--red); }
.tags .tg-in { border: 0 !important; box-shadow: none !important; outline: none; flex: 1 0 110px; min-width: 110px; height: 26px !important; padding: 0 4px; font-size: 13px; background: transparent; }
/* 2) сотрудники: список и карточка */
.users-t td, .users-t th { text-align: left !important; }
.users-t tr[data-id] { cursor: pointer; } .users-t tr[data-id]:hover td { background: #f6f8ff; }
.users-t tr.off td { color: #999; }
.chip.ok { background: #e6f4ea; color: #1e6b34; }
.u-h { margin: 14px 0 6px; font-size: 15px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; }
.perm-groups .pg { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.perm-groups .pg b { font-size: 13px; margin-bottom: 2px; }
.sw { flex-direction: row !important; align-items: center; gap: 8px; cursor: pointer; color: var(--ink) !important; font-size: 13px !important; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw i { width: 34px; height: 20px; border-radius: 10px; background: #d6d6d2; position: relative; flex: 0 0 auto; transition: background .15s; }
.sw i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.sw input:checked + i { background: #111; }
.sw input:checked + i::after { left: 16px; }
.sw input:disabled + i { opacity: .5; } .sw input:focus-visible + i { outline: 2px solid var(--red); outline-offset: 2px; }
/* атрибут hidden должен прятать и подписи (label у нас display:flex — без этого «скрытое» поле оставалось видно) */
[hidden] { display: none !important; }
/* многострочные ячейки таблиц — перенос, а не обрезка «…обмен на про» */
.tabulator .tabulator-cell .ln { white-space: normal; }
/* меню: пункты не растягиваются по высоте строки — текст в «таблетке» по центру (Стас 16.10: «Наличие» выше середины) */
#nav { align-items: center; }
#nav a { display: inline-flex; align-items: center; height: 34px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
.brand { text-decoration: none; color: inherit; cursor: pointer; }
/* тестовая копия CRM для сотрудников */
.sandbox-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 999; background: #f01e23; color: #fff; text-align: center; font-weight: 800; font-size: 13px; padding: 6px 10px; letter-spacing: .02em; pointer-events: none; }
body[data-sandbox] { padding-bottom: 30px; }
body[data-sandbox] .top { box-shadow: inset 0 3px 0 #f01e23; }

/* ---- телефон: строки таблиц карточками (16.10) ---- */
.tabulator .tabulator-cell.mc-cell { white-space: normal; padding: 0; }
.mc { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; font-size: 14px; line-height: 1.35; }
.mc-hd { font-size: 12px; color: var(--mut); display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; }
.mc-hd .ln { display: inline; } .mc-hd .ln div { display: inline; }
.mc-dot { color: #c4c4c0; }
.mc-mn { display: flex; gap: 10px; align-items: flex-start; }
.mc-main { flex: 1; min-width: 0; } .mc-main .mc-f { display: block; }
.mc-rt { text-align: right; white-space: nowrap; }
.mc-rt .mc-f { display: block; }
.mc-grid { display: grid; grid-template-columns: minmax(84px, 38%) 1fr; gap: 3px 10px; font-size: 13px; }
.mc-r { display: contents; }
.mc-l { color: var(--mut); font-size: 12px; }
.mc-inline .mc-grid { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; color: #555; }
.mc-inline .mc-r { display: inline-flex; gap: 4px; align-items: center; }
.mc-ac { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.mc-ac .mc-f { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.mc-ac .btn { flex: 1; padding-top: 8px; padding-bottom: 8px; }
.mc-f.cell-red { color: var(--red); font-weight: 700; }
.mc .tick { width: 18px; height: 18px; }
@media (max-width: 760px) {
  #nav.more { -webkit-mask-image: linear-gradient(to right, #000 78%, transparent); mask-image: linear-gradient(to right, #000 78%, transparent); }
  .inst-top { gap: 12px; }
  .inst-cash, .inst-cash input { width: 100%; }
  .inst-dev { min-width: 0; flex-wrap: wrap; flex: 1 1 100%; }
  .inst-dev label, .inst-dev .btn { flex: 1 1 100%; }
  table.inst-m { width: 100%; font-size: 14px; }
  table.inst-m th, table.inst-m td { padding: 7px 6px; min-width: 0; }
  table.inst-m th:first-child, table.inst-m td:first-child { min-width: 0; }
  table.inst-m tr.sub th { font-size: 12px; color: var(--mut); font-weight: 600; background: #fff; }
  table.inst-m td.pmc { background: #dfeedd; }
}
@media (max-width: 760px) {
  .seg { max-width: 100%; }
  .seg button { flex: 1 1 auto; }
  .row > label { min-width: 0; max-width: 100%; flex-shrink: 1 !important; }
  .sprint { white-space: normal; }                                /* длинные подписи у галочек переносим, иначе страница едет вбок */
  input, select, textarea { max-width: 100%; box-sizing: border-box; }
  table.perm { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.perm > tbody { display: table; min-width: 100%; }        /* иначе строки вылезают за край: прокручивается только сама таблица */
  .card, .kpi, .pay-sum { max-width: 100%; box-sizing: border-box; }
}
.mc-more { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 34px; height: 30px; font-size: 18px; line-height: 1; cursor: pointer; flex: 0 0 auto; }
.sheet { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sheet .btn { padding: 12px; font-size: 15px; }
@media (max-width: 760px) {           /* панель «В работе у вас» — внизу экрана, под пальцем */
  .selbar.on { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 40; margin: 0;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18); max-height: 45vh; overflow-y: auto; }
  main { padding-bottom: 120px; }
}

/* «Наличие»: отметили галочкой — кнопки встают в строку поиска вместо фильтров, таблица не сдвигается (Стас 17.10) */
.bar-std { display: contents; }
.selbar.inbar { margin: 0; }
#sbar { min-height: 36px; }
@media (min-width: 761px) {
  .bar.selecting > .bar-std { display: none; }
  .selbar.inbar.on { flex: 1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 3px 8px; }
  .selbar.inbar::-webkit-scrollbar { display: none; }
}
/* полоса заголовка раздела ниже: меньше воздуха над и под строкой поиска, шрифт тот же (Стас 17.10) */
main { padding-top: 5px; }
.bar { margin-bottom: 6px; }
.ext-w { display: inline-flex; margin-top: 6px; padding: 3px 8px; border-radius: 8px; background: #fff3e6; border: 1px solid #f3c48f; font-size: 13px; color: var(--ink); }
/* полоса прокрутки страницы — всегда на месте: иначе на границе «влезает / не влезает» таблица бесконечно перерисовывается */
html { overflow-y: scroll; }
.fbx-acc { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #efefec; }
.fbx-acc code { font-family: ui-monospace, Menlo, monospace; background: #f4f4f2; padding: 2px 6px; border-radius: 6px; }
.fbx-acc b { min-width: 90px; }

/* зарплата и табель */
.pay-sum { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0 10px; }
.pay-sum div { display: flex; flex-direction: column; } .pay-sum span { font-size: 12px; color: var(--mut); } .pay-sum b { font-size: 18px; }
.pay-sum .tot b { font-size: 22px; color: var(--red); }
.pay-days td, .pay-t td { vertical-align: top; }
.pay-t tr[data-u] { cursor: pointer; } .pay-t tr[data-u]:hover { background: #f6f6f3; }
.tabel-wrap { overflow-x: auto; }
.tabel { border-collapse: collapse; font-size: 12px; }
.tabel th, .tabel td { border: 1px solid #e6e6e2; min-width: 24px; height: 26px; text-align: center; padding: 0 2px; }
.tabel td.nm { text-align: left; white-space: nowrap; padding: 0 8px; font-weight: 700; }
.tabel td[data-d] { cursor: pointer; } .tabel td[data-d]:hover { background: #f1f1ee; } .tabel td.on { background: #e3f4dd; font-weight: 800; }
.rules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 12px; }
#mymarks table.perm td, .modal table.perm td, .pay-days th, .pay-days td { text-align: left; }
@media (min-width: 761px) { #nav a { padding-left: 8px; padding-right: 8px; } }   /* + «Зарплата» — меню в одну строку */
.certs-t td { vertical-align: middle; } .certs-t td:last-child { white-space: nowrap; }

/* меню: не влезло — под «☰» (компьютер) */
@media (min-width: 761px) {
  #nav { flex-wrap: nowrap; overflow: visible; }
  .nav-more { position: relative; margin-left: auto; }
  .nav-more + .sell-btn { margin-left: 8px; }
  .nav-burger { height: 34px; min-width: 40px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 18px; cursor: pointer; font-weight: 800; }
  .nav-burger:hover { border-color: #000; } .nav-burger.on { background: #000; color: #fff; border-color: #000; }
  .nav-drop { position: absolute; right: 0; top: 40px; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .14); display: flex; flex-direction: column; min-width: 200px; }
  .nav-drop[hidden] { display: none !important; }
  .nav-drop a { display: block !important; height: auto !important; padding: 9px 12px !important; border-radius: 8px; }
  .nav-drop a:hover { background: #f4f4f2; }
}
/* «Снято видео распаковки» — как кнопка рядом: та же высота, рамка, отмечено — чёрным (Стас 17.10) */
.sale-add { align-items: center; }
.chk-pill { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px; box-sizing: border-box; height: 26px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink) !important; font-size: 13px !important; font-weight: 800; cursor: pointer; user-select: none; }
.chk-pill:hover { border-color: #000; }
.chk-pill input { margin: 0; width: 13px; height: 13px; accent-color: #000; }
.chk-pill:has(input:checked) { background: #000; color: #fff !important; border-color: #000; }

/* задачи на смену */
.tsk-g { margin-top: 8px; } .tsk-g b { font-size: 13px; color: var(--mut); }
.tsk { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; padding: 7px 6px; border-bottom: 1px solid #f2f2ef; cursor: pointer; }
.tsk input { width: 18px; height: 18px; accent-color: #000; flex: 0 0 auto; }
.tsk span { flex: 1; color: var(--ink); font-size: 14px; }
.tsk i { font-style: normal; font-size: 12px; color: var(--mut); white-space: nowrap; }
.tsk.done span { text-decoration: line-through; color: var(--mut); }
.tsk-t td { text-align: left; } .tsk-t .tt { width: 100%; }
.devs-t td { text-align: left; vertical-align: middle; } .devs-t td:last-child { white-space: nowrap; }
