/* Кабинет: сайдбар (сворачивается), таблицы, сетка ячеек. Оформление 1:1 с «Отделом Закупа». */

:root { --sidebar-w: 14rem; }
body.sidebar-collapsed, html.pre-sidebar-collapsed body { --sidebar-w: 3.5rem; }
aside.app-sidebar { width: var(--sidebar-w); transition: width .2s ease; }
.app-main { margin-left: var(--sidebar-w); transition: margin-left .2s ease; }
.si { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sidebar-link { display: flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border-radius: .375rem; font-size: .875rem; color: #6b7280; transition: all .15s; cursor: pointer; }
.sidebar-link:hover { background: #f3f4f6; color: #1f2937; }
.sidebar-link.active { background: #eef2ff; color: #4338ca; font-weight: 600; }
.sidebar-section { font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; color: #9ca3af; padding: 1rem 1rem .25rem; font-weight: 600; }
.sidebar-toggle { width: 1.75rem; height: 1.75rem; display: flex; align-items: center; justify-content: center; border-radius: .375rem; color: #6b7280; cursor: pointer; transition: background .15s; }
.sidebar-toggle:hover { background: #f3f4f6; color: #1f2937; }
body.sidebar-collapsed .sidebar-link { padding: .5rem; justify-content: center; position: relative; }
body.sidebar-collapsed .sidebar-link .link-text, body.sidebar-collapsed .sidebar-section,
body.sidebar-collapsed .sidebar-brand, body.sidebar-collapsed .sidebar-user-text, body.sidebar-collapsed .sidebar-logout { display: none; }
body.sidebar-collapsed .sidebar-user-block { padding: .5rem; text-align: center; }
body.sidebar-collapsed .sidebar-link[data-title]:hover::after {
  content: attr(data-title); position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  margin-left: .5rem; background: #1f2937; color: #fff; padding: .25rem .5rem; border-radius: .25rem;
  font-size: .75rem; white-space: nowrap; z-index: 50; pointer-events: none; }
.theme-toggle-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; color: #6b7280; cursor: pointer; background: transparent; border: none; transition: all .15s; }
.theme-toggle-btn:hover { background: #f3f4f6; color: #1f2937; }
table.t { width: 100%; font-size: .82rem; }
table.t th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; font-weight: 600; padding: .5rem .6rem; background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
table.t td { padding: .45rem .6rem; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
table.t tr:hover td { background: #fafafa; }
.cell-box { border-radius: .4rem; border: 1px solid #e5e7eb; padding: .35rem; font-size: .7rem; cursor: pointer; min-height: 58px; }
.cell-box:hover { border-color: #818cf8; }
/* штрихкоды JsBarcode: svg приходит с фиксированной шириной в пикселях (длинный код LOC-53-A-01-1-01 -
   около 500 px) и в узкой колонке вылезал за карточку; ужимаем до ширины контейнера, пропорции
   держит viewBox. display:block - чтобы mx-auto центрировал */
svg.bc { display: block; max-width: 100%; height: auto; }

/* ── тёмная тема ── */
html.dark aside.app-sidebar { background: #1e293b !important; border-color: #334155 !important; }
html.dark .sidebar-link { color: #94a3b8; }
html.dark .sidebar-link:hover { background: #334155; color: #f1f5f9; }
html.dark .sidebar-link.active { background: #3730a3; color: #c7d2fe; }
html.dark .sidebar-section { color: #64748b; }
html.dark .sidebar-toggle:hover, html.dark .theme-toggle-btn:hover { background: #334155; color: #f1f5f9; }
html.dark .theme-toggle-btn { color: #cbd5e1; }
html.dark table.t th { background: #263140; color: #94a3b8; border-color: #334155; }
html.dark table.t td { border-color: #334155; }
html.dark table.t tr:hover td { background: #263140; }

/* ── Выбор складов (templates/_wh_picker.html) и тип склада («Склады сети»), 25.10.2026 ──
   Без JS (нет класса whp-js на <html>) - простой список галочек по группам; с JS - плашки и выпадающая панель. */
.whp [hidden], .whc-list [hidden], .whr [hidden], tr[hidden] { display: none !important; }
.kt { display: inline-flex; align-items: center; flex-shrink: 0; padding: 0 .35rem; border-radius: .25rem; font-size: .625rem; font-weight: 600; line-height: 1rem; white-space: nowrap; }
.kt-warehouse { background: #e0f2fe; color: #0369a1; }
.kt-store { background: #ede9fe; color: #6d28d9; }

/* плашки */
.whc-list { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.whc { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; padding: .125rem .5rem; border: 1px solid #e5e7eb; border-radius: 9999px; background: #fff; color: #1f2937; font-size: .75rem; line-height: 1.125rem; }
.whc-name { min-width: 0; max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whc.is-arch, .whc.is-lock { border-style: dashed; color: #6b7280; }
.whc.is-lock { background: #f9fafb; }
.whc.is-arch .kt { opacity: .75; }
.whc-x { display: inline-flex; align-items: center; justify-content: center; width: 1.125rem; height: 1.125rem; margin-right: -.3rem; border-radius: 9999px; color: #9ca3af; font-size: .9rem; line-height: 1; cursor: pointer; }
.whc-x:hover, .whc-x:focus-visible { background: #ffe4e6; color: #e11d48; outline: none; }
.whc-more { display: none; padding: .125rem .4rem; border-radius: 9999px; color: #4f46e5; font-size: .75rem; line-height: 1.125rem; cursor: pointer; white-space: nowrap; }
.whc-more:hover { background: #eef2ff; }
html.whp-js .whc-more { display: inline-flex; }
html.whp-js .whc-list:not(.is-all) .whc-over { display: none; }
.whp-empty { font-size: .8rem; color: #9ca3af; }

/* поле с плашками и кнопкой «+ Добавить склад» */
.whp { position: relative; }
.whp-field, .whp-head, .whp-archbtn { display: none; }
html.whp-js .whp-field { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; min-height: 2.5rem; padding: .375rem .5rem; border: 1px solid #d1d5db; border-radius: .5rem; background: #fff; }
html.whp-js .whp.is-open .whp-field { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.whp-add { display: inline-flex; align-items: center; padding: .125rem .625rem; border: 1px dashed #a5b4fc; border-radius: 9999px; background: transparent; color: #4f46e5; font-size: .75rem; font-weight: 600; line-height: 1.125rem; white-space: nowrap; cursor: pointer; }
.whp-add:hover, .whp.is-open .whp-add { background: #eef2ff; border-style: solid; }

/* панель: без JS - список под полем; с JS - выпадает у поля: fixed, место считает скрипт (place) - её не обрезает
   прокрутка таблицы, снизу не влезает - открывается вверх; на узком экране - снизу на всю ширину */
.whp-panel { display: flex; flex-direction: column; border: 1px solid #e5e7eb; border-radius: .5rem; background: #fff; overflow: hidden; }
.whp-list { min-height: 0; max-height: 16rem; overflow-y: auto; overscroll-behavior: contain; }
html.whp-js .whp-panel { display: none; position: fixed; z-index: 40; width: 25rem; max-width: calc(100vw - 1.5rem); box-shadow: 0 12px 32px -8px rgba(15, 23, 42, .25), 0 2px 6px rgba(15, 23, 42, .08); }
html.whp-js .whp.is-open .whp-panel { display: flex; }
html.whp-js .whp-head { display: block; padding: .5rem; border-bottom: 1px solid #f3f4f6; }
.whp-q { width: 100%; padding: .375rem .625rem; border: 1px solid #d1d5db; border-radius: .5rem; background: #fff; font-size: .875rem; }
.whp-q:focus { outline: none; border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.whp-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .375rem; color: #6b7280; font-size: .75rem; }
.whp-done { padding: .125rem .5rem; border-radius: .375rem; color: #4f46e5; font-weight: 600; cursor: pointer; }
.whp-done:hover { background: #eef2ff; }
.whp-gh { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: .375rem; padding: .375rem .75rem .25rem; background: #f9fafb; color: #6b7280; font-size: .65rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.whp-gn { color: #9ca3af; font-weight: 500; }
.whp-opt { display: flex; align-items: center; gap: .5rem; padding: .3rem .75rem; color: #1f2937; font-size: .8125rem; cursor: pointer; }
.whp-opt:hover { background: #f5f7ff; }
.whp-opt input { flex-shrink: 0; width: 1rem; height: 1rem; accent-color: #4f46e5; }
.whp-oname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whp-opt.is-on .whp-oname { font-weight: 600; }
.whp-opt .kt { display: none; }               /* в «Складах» и «Магазинах» тип ясен из заголовка группы */
.whp-arch .whp-opt { color: #6b7280; }
.whp-arch .whp-opt .kt { display: inline-flex; }
.whp-city { color: #9ca3af; font-size: .7rem; white-space: nowrap; }
html.whp-js .whp-archbtn { display: block; width: 100%; padding: .5rem .75rem; border-top: 1px solid #f3f4f6; color: #4f46e5; font-size: .75rem; text-align: left; cursor: pointer; }
.whp-archbtn:hover { background: #f5f7ff; }
.whp-nothing { padding: .75rem; color: #9ca3af; font-size: .8rem; text-align: center; }
@media (max-width: 767.98px) {
  html.whp-js .whp-panel { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-width: none; max-height: 80vh !important; border-radius: .75rem .75rem 0 0; }
  html.whp-js .whp-list { flex: 1 1 auto; max-height: none; }
}

/* строка сотрудника: плашки + «Изменить склады» (тот же выбор и «Сохранить») */
.whr { display: flex; flex-direction: column; align-items: flex-start; gap: .375rem; min-width: 13rem; }
.whr-edit { width: 100%; }
.whr-edit > summary { display: inline-flex; list-style: none; padding: .125rem .5rem; border: 1px solid #d1d5db; border-radius: .25rem; color: #374151; font-size: .75rem; cursor: pointer; user-select: none; }
.whr-edit > summary::-webkit-details-marker { display: none; }
.whr-edit > summary:hover { background: #f9fafb; }
.whr-edit[open] > summary .whr-closed, .whr-edit:not([open]) > summary .whr-opened { display: none; }
.whr-form { margin-top: .375rem; }
html:not(.whp-js) .whr-form { min-width: 18rem; }      /* без JS - список галочек прямо в строке */
.whr-cancel { display: none; }
html.whp-js .whr-cancel { display: inline-flex; }
html.whp-js .whr.is-editing .whr-view, html.whp-js .whr-edit[open] > summary { display: none; }
/* то же без ожидания события toggle (оно приходит следующей задачей) - плашки-просмотр не мигают рядом с правкой */
html.whp-js .whr:has(> .whr-edit[open]) > .whr-view { display: none; }
html.whp-js .whr-form { margin-top: 0; }

/* «Склады сети»: переключатель «Склад | Магазин» и фильтр строк по типу */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: .5rem; background: #f3f4f6; }
.seg-btn { padding: .125rem .55rem; border-radius: .375rem; color: #6b7280; font-size: .75rem; line-height: 1.25rem; white-space: nowrap; }
button.seg-btn { cursor: pointer; }
button.seg-btn:hover { background: #e5e7eb; color: #1f2937; }
.seg-btn.is-on { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .14); }
.seg-btn.is-on.k-warehouse { color: #0369a1; }
.seg-btn.is-on.k-store { color: #6d28d9; }
.kind-src { margin-top: .2rem; color: #9ca3af; font-size: .65rem; line-height: 1rem; }
.kind-src.is-manual { color: #d97706; }
.kind-src button { color: #4f46e5; cursor: pointer; }
.kind-src button:hover { text-decoration: underline; }
.ftab { display: inline-flex; align-items: center; gap: .375rem; padding: .375rem .75rem; border: 1px solid #e5e7eb; border-radius: .5rem; background: #fff; color: #4b5563; font-size: .75rem; cursor: pointer; }
.ftab:hover { background: #f9fafb; }
.ftab.is-on { border-color: #c7d2fe; background: #eef2ff; color: #4338ca; font-weight: 600; }
.ftab-n { color: #9ca3af; font-weight: 500; }

html.dark .kt-warehouse { background: rgba(12, 74, 110, .55); color: #7dd3fc; }
html.dark .kt-store { background: rgba(76, 29, 149, .5); color: #c4b5fd; }
html.dark .whc { border-color: #475569; background: #1e293b; color: #e2e8f0; }
html.dark .whc.is-arch, html.dark .whc.is-lock { color: #94a3b8; }
html.dark .whc.is-lock { background: #263140; }
html.dark .whc-x { color: #64748b; }
html.dark .whc-x:hover, html.dark .whc-x:focus-visible { background: rgba(159, 18, 57, .45); color: #fda4af; }
html.dark .whc-more, html.dark .whp-done, html.dark .whp-archbtn, html.dark .whp-add, html.dark .kind-src button { color: #a5b4fc; }
html.dark .whc-more:hover, html.dark .whp-done:hover, html.dark .whp-add:hover, html.dark .whp.is-open .whp-add { background: rgba(49, 46, 129, .35); }
html.dark .whp-add { border-color: rgba(129, 140, 248, .5); }
html.dark .whp-empty, html.dark .whp-gn, html.dark .whp-city, html.dark .whp-nothing, html.dark .kind-src { color: #64748b; }
html.dark.whp-js .whp-field { border-color: #475569; background: #1e293b; }
html.dark .whp-panel { border-color: #334155; background: #1e293b; }
html.dark.whp-js .whp-head, html.dark.whp-js .whp-archbtn { border-color: #334155; }
html.dark .whp-meta { color: #94a3b8; }
html.dark .whp-gh { background: #263140; color: #94a3b8; }
html.dark .whp-opt { color: #e2e8f0; }
html.dark .whp-arch .whp-opt { color: #94a3b8; }
html.dark .whp-opt:hover, html.dark .whp-archbtn:hover { background: #263140; }
html.dark .whr-edit > summary { border-color: #475569; color: #e2e8f0; }
html.dark .whr-edit > summary:hover { background: #263140; }
html.dark .seg { background: #0f172a; }
html.dark button.seg-btn { color: #94a3b8; }
html.dark button.seg-btn:hover { background: #334155; color: #f1f5f9; }
html.dark .seg-btn.is-on { background: #334155; box-shadow: none; }
html.dark .seg-btn.is-on.k-warehouse { color: #7dd3fc; }
html.dark .seg-btn.is-on.k-store { color: #c4b5fd; }
html.dark .kind-src.is-manual { color: #fbbf24; }
html.dark .ftab { border-color: #334155; background: #1e293b; color: #cbd5e1; }
html.dark .ftab:hover { background: #263140; }
html.dark .ftab.is-on { border-color: rgba(129, 140, 248, .4); background: rgba(49, 46, 129, .45); color: #c7d2fe; }
html.dark .ftab-n { color: #64748b; }

/* ── «Сотрудники склада»: права по разделам ТСД (П30) - плашки-галочки, 05.11.2026 ──
   .ops-new - форма «Добавить» (разделы карточками рядом), .ops-row - строка сотрудника (разделы друг под другом);
   отмечено - плашка с цветом и галочкой. Строка: «Сохранить» / «Отмена» - только когда галочки изменили (ops-js на
   <html> и is-dirty на форме ставит скрипт employees.html; без JS - видны всегда) */
.ops { display: grid; gap: .5rem; }
.ops-new { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; }
.ops-new .ops-sec { padding: .625rem .75rem .75rem; border: 1px solid #e5e7eb; border-radius: .5rem; background: #f9fafb; }
.ops-row { min-width: 22rem; gap: .45rem; }
.ops-t { margin-bottom: .3rem; color: #6b7280; font-size: .625rem; font-weight: 600; letter-spacing: .05em; line-height: .875rem; text-transform: uppercase; }
.ops-l { display: flex; flex-wrap: wrap; gap: .3rem; }
.opc { display: inline-flex; align-items: center; gap: .375rem; padding: .1875rem .625rem .1875rem .4375rem; border: 1px solid #e5e7eb; border-radius: 9999px; background: #fff; color: #6b7280; font-size: .75rem; line-height: 1.125rem; max-width: 100%; cursor: pointer; user-select: none; transition: background-color .12s, border-color .12s, color .12s; }
.opc:hover { border-color: #a5b4fc; color: #374151; }
.opc input { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: .875rem; height: .875rem; margin: 0; border: 1.5px solid #d1d5db; border-radius: .25rem; background: #fff no-repeat center / .625rem; cursor: pointer; }
.opc input:checked { border-color: #4f46e5; background-color: #4f46e5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.5-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.opc:has(input:checked), .opc.is-ro { border-color: #c7d2fe; background: #eef2ff; color: #3730a3; font-weight: 600; }
.opc:has(input:focus-visible) { outline: 2px solid #818cf8; outline-offset: 1px; }
.opc.is-ro { padding-left: .625rem; cursor: default; }
.ops-act { display: flex; align-items: center; gap: .375rem; }
.ops-save, .ops-reset { padding: .125rem .625rem; border: 1px solid #d1d5db; border-radius: .25rem; background: #fff; color: #374151; font-size: .75rem; line-height: 1.125rem; cursor: pointer; }
.ops-save:hover, .ops-reset:hover { background: #f9fafb; }
.ops-reset { display: none; }
html.ops-js .ops-reset { display: inline-flex; }
html.ops-js .ops-row:not(.is-dirty) .ops-act { display: none; }
.ops-row.is-dirty .ops-save { border-color: #4f46e5; background: #4f46e5; color: #fff; font-weight: 600; }
.ops-row.is-dirty .ops-save:hover { background: #4338ca; }

html.dark .ops-new .ops-sec { border-color: #334155; background: #263140; }
html.dark .ops-t { color: #94a3b8; }
html.dark .opc { border-color: #475569; background: #1e293b; color: #94a3b8; }
html.dark .opc:hover { border-color: #818cf8; color: #e2e8f0; }
/* common.css в тёмной теме красит все поля ввода с !important (фон целиком) - галочке плашки нужен свой */
html.dark .opc input { border-color: #64748b !important; background: #1e293b !important; }
html.dark .opc input:checked { border-color: #6366f1 !important; background: #6366f1 no-repeat center / .625rem url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.5-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important; }
html.dark .opc:has(input:checked), html.dark .opc.is-ro { border-color: rgba(129, 140, 248, .45); background: rgba(49, 46, 129, .45); color: #c7d2fe; }
html.dark .ops-save, html.dark .ops-reset { border-color: #475569; background: #1e293b; color: #e2e8f0; }
html.dark .ops-save:hover, html.dark .ops-reset:hover { background: #263140; }
html.dark .ops-row.is-dirty .ops-save { border-color: #6366f1; background: #4f46e5; color: #fff; }
