/* «Учёт товара» в духе МойСклада: светлое меню разделов слева, плотные таблицы,
   зелёная кнопка создания документа, цветные статусы. */
:root {
  --sk-side: #f1f4f7;
  --sk-create: #2e9e4f;
  --sk-posted: #e6f4ea;
  --sk-posted-text: #1e7b39;
  --sk-draft: #f1f3f5;
  --sk-transit: #fff4dc;
  --sk-transit-text: #8a5a00;
  --sk-accepted: #e7f0fe;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sk-side: #141a20;
    --sk-create: #2f9e55;
    --sk-posted: #173523;
    --sk-posted-text: #6fd08f;
    --sk-draft: #222a33;
    --sk-transit: #3a2e12;
    --sk-transit-text: #f3d48a;
    --sk-accepted: #1a2a42;
  }
}

/* Разделы склада — в общей левой панели (STOCK_SECTIONS в app/web/__init__.py). */
.sk { min-height: 100vh; }
.sk-side { background: var(--sk-side); border-right: 1px solid var(--line); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.sk-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 10px 4px; }
.sk-link { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 14px; }
.sk-link:hover { background: var(--surface); }
.sk-link.on { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }
.sk-link.disabled { color: var(--muted); cursor: default; }
.sk-main { padding: 16px 24px 40px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.sk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.sk-head h1 { margin: 0; font-size: 22px; }
.sk-create { background: var(--sk-create); border-color: var(--sk-create); color: #fff; text-decoration: none; font-weight: 600; }
.sk-create:hover { filter: brightness(1.05); }
.sk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sk-actions a.btn { text-decoration: none; color: var(--text); }
.sk-filters, .sk-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.sk-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.sk-input { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); min-width: 140px; }
.sk-input.wide { min-width: 320px; flex: 1; }
.sk-input.num { width: 100px; min-width: 0; text-align: right; }
.sk-input:disabled { background: var(--surface-2); color: var(--text); }
.sk-hint { color: var(--muted); font-size: 13px; }
.sk-msg:empty { display: none; }

.sk-table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.sk-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sk-table th { background: var(--surface-2); color: var(--muted); font-weight: 500; font-size: 12px; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.sk-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sk-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sk-table td.bad { color: var(--bad); }
.sk-row { cursor: pointer; }
.sk-row:hover td, .sk-row:focus td { background: var(--accent-soft); outline: none; }
.sk-num a { color: var(--accent); font-weight: 600; text-decoration: none; }
.sk-comment { color: var(--muted); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-total td { background: var(--surface-2); font-weight: 600; }
.sk-product b { font-weight: 600; }
.sk-lines .sk-input { height: 28px; }
.sk-del { padding: 0 8px; }
.sk-empty { padding: 24px; text-align: center; color: var(--muted); }

.sk-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-draft { background: var(--sk-draft); color: var(--muted); }
.st-posted { background: var(--sk-posted); color: var(--sk-posted-text); }
.st-transit { background: var(--sk-transit); color: var(--sk-transit-text); }
.st-accepted { background: var(--sk-accepted); color: var(--accent); }

.sk-adder { position: relative; display: flex; }
.sk-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.sk-results:empty { display: none; }
.sk-result { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; }
.sk-result:hover { background: var(--accent-soft); }
.sk-doc-total { text-align: right; font-weight: 600; }

@media (max-width: 800px) {
  .sk-main { padding: 12px; }
  .sk-input.wide { min-width: 0; }
}

/* Реестр: «+ Операция» — меню видов операций; вид в строке — метка. */
.sk-create-menu { position: relative; margin-left: auto; }
.sk-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: flex; flex-direction: column;
  min-width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.sk-menu-item { padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.sk-menu-item:hover { background: var(--sb-hover, rgba(0, 0, 0, .05)); }
.sk-kind { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap;
  background: var(--line); }
.sk-kind.k-receipt, .sk-kind.k-opening, .sk-kind.k-customer_return { background: rgba(46, 160, 67, .15); }
.sk-kind.k-supply, .sk-kind.k-write_off, .sk-kind.k-supplier_return { background: rgba(207, 34, 46, .12); }
.sk-kind.k-transfer { background: rgba(9, 105, 218, .12); }

/* Реестр: таблица слева, виды операций справа. */
.sk-registry { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 12px; align-items: start; }
.sk-registry-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sk-types { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; position: sticky; top: 12px; }
.sk-types-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 8px 6px; }
.sk-type { display: flex; justify-content: space-between; gap: 8px; padding: 7px 8px; border: 0; border-radius: 6px;
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; text-decoration: none; }
.sk-type:hover { background: var(--accent-soft); }
.sk-type.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sk-type.warn { color: var(--bad); font-weight: 600; }
.sk-type-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.sk-kind.k-withdrawal { background: rgba(46, 160, 67, .15); }
@media (max-width: 900px) {
  .sk-registry { grid-template-columns: 1fr; }
  .sk-registry .sk-types-wrap { order: -1; }
  .sk-types { position: static; flex-direction: row; flex-wrap: wrap; }
}

/* Незавершённая приёмка: в реестре строка с красной полосой, в документе — блок. */
.sk-table tr.sk-open td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.sk-table tr.sk-open td { background: rgba(207, 34, 46, .05); }
.st-partial { background: #fde8e8; color: #9b1c1c; }
.sk-receive { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); }
.sk-receive.open { border-color: #f3b4b4; }
.sk-receive h2 { margin: 0; font-size: 16px; }
.sk-receive .sk-actions { align-items: center; }
.sk-receive .sk-input.num { width: 80px; }
/* Доставка и затраты документа: статьи — строками под адресом. */
.sk-cost-list { display: flex; flex-direction: column; gap: 6px; }
.sk-cost-list:empty { display: none; }
.sk-cost-row { align-items: center; flex-wrap: nowrap; }
.sk-cost-row .sk-input.wide { max-width: 520px; }
.sk-incoming-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
@media (prefers-color-scheme: dark) {
  .st-partial { background: #3b1717; color: #ffb4b4; }
  .sk-receive.open { border-color: #6b2a2a; }
}

/* Баннер: площадка везёт товар на склад — напоминание со ссылками на документы. */
.sk-incoming { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 8px;
  background: #fde8e8; border: 1px solid #f3b4b4; color: #7a1414; }
.sk-incoming a { color: inherit; font-weight: 600; }
.sk-incoming .btn { align-self: flex-start; }
@media (prefers-color-scheme: dark) {
  .sk-incoming { background: #3b1717; border-color: #6b2a2a; color: #ffd2d2; }
}

/* Остатки по товарам: строка товара раскрывается в партии. */
.sk-caret { display: inline-block; width: 16px; color: var(--muted); }
.sk-prod.open td { background: var(--surface-2); font-weight: 600; }
.sk-batch td { font-size: 13px; background: var(--surface); }
.sk-batch-name { padding-left: 34px !important; }
.sk-suggest { font-weight: 600; }
.sk-table .sk-sum { font-weight: 600; border-left: 1px solid var(--line); }
.sk-table td.good { color: var(--good, #1e7b39); }

/* Остаток на площадках — раскрывается по Ozon / WB. */
.sk-mp { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.sk-mp summary { cursor: pointer; }
.sk-mp-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 140px; gap: 8px; padding: 3px 0 3px 18px; }
.sk-mp-row.total { padding-left: 0; margin-top: 6px; font-weight: 600; }
.sk-mp-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.sk-mp .sk-hint { padding-left: 18px; }
