/* Перетаскивание плиток */
[data-reorder] [data-key] { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
[data-reorder].is-reordering { cursor: grabbing; }
[data-reorder] .is-lifted { transform: scale(1.04); outline: 3px solid var(--accent); outline-offset: -3px; position: relative; z-index: 1; }
.reorder-footer { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; font-size: .9rem; }
/* Заказ: добавление продуктов вручную и дата у каждого поставщика */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.order-add { margin: 16px 0 8px; }
.order-add .search { margin-bottom: 0; }
.order-add .search input { background: var(--field); }
.order-pick:not(:empty) { margin-top: 16px; }
.order-pick-tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.order-pick-tile { min-height: 110px; border: 0; font: inherit; color: var(--text); cursor: pointer; text-align: center; background: var(--field); }
.order-pick .order-pick-tile { background: var(--surface); }
.order-add .order-pick-tile { background: var(--field); }
.order-pick-tile:active { background: var(--surface-pressed); }
.order-pick-tile:disabled { opacity: .5; cursor: default; }
.order-pick-hint { margin: 12px 0 0; font-size: .9rem; }
.order-more { margin-top: 8px; }
.order-supplier { margin-top: 32px; }
.order-supplier + .order-supplier { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--field); }
.order-supplier-heading { margin-bottom: 20px; padding: 18px 22px; border-left: 4px solid var(--accent); border-radius: 12px; background: var(--surface); }
.order-supplier-heading h2 { margin: 0; color: var(--text); font-size: 1.35rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .order-supplier-heading { padding: 16px 18px; }
  .order-supplier-heading h2 { font-size: 1.2rem; }
}
.order-date { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 12px; }
.order-date .field-label { margin: 0; }
.order-date input[type=date] { min-height: 60px; padding: 0 18px; font: inherit; font-size: 1.1rem; color: var(--text); border: 0; border-radius: 14px; background: var(--surface); }
.order-date .errorlist { flex-basis: 100%; }
.order-quantity .btn-icon { vertical-align: middle; }
/* Маркировка: «Открыто» и выбор срока */
.mark-opened, .mark-shelf { max-width: 720px; margin: 32px auto; }
.mark-opened { text-align: center; }
.mark-until { font-size: 1.4rem; margin: 16px 0 40px; }
.mark-button { min-height: 110px; font-size: 1.7rem; margin: 24px 0; }
.mark-shelf h2 { font-size: 1.4rem; color: var(--text); margin-bottom: 8px; }
.mark-choices { gap: 12px; margin-top: 24px; }
.mark-choices .choice span { min-width: 100px; min-height: 72px; justify-content: center; font-size: 1.2rem; }
.mark-custom { margin-top: 16px; }
.mark-custom summary { list-style: none; }
.mark-custom summary::-webkit-details-marker { display: none; }
.mark-custom .row { align-items: center; margin-top: 12px; }
.mark-custom input[type=text] { min-height: 64px; max-width: 160px; padding: 0 18px; font: inherit; font-size: 1.2rem; color: var(--text); border: 0; border-radius: 14px; background: var(--surface); }
/* Новая позиция от повара */
.tabs-action { margin-left: auto; flex: none; }
.badge-new { display: inline-block; padding: 2px 10px; border-radius: 8px; background: var(--check-bg); color: var(--text); font-size: .8rem; font-weight: 600; }
.quick-similar { margin: -12px 0 24px; }
.quick-similar .choices { margin-top: 12px; }
.quick-groups .choice[hidden] { display: none; }
.review-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; padding: 24px; }
.review-row > div:first-child { display: flex; flex-direction: column; gap: 6px; }
.review-name { font-size: 1.25rem; }
.review-similar { color: var(--text); font-weight: 600; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quick-new-group { margin-top: 12px; }
/* Карточка продукта у шефа */
.item-groups .choice[hidden], [data-shelf-block][hidden] { display: none; }
.shelf-custom { align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.shelf-custom > * { flex: none; }
.shelf-custom input[type=number] { width: 110px; }
.shelf-custom select { width: auto; }
.item-more { margin-bottom: 28px; }
.item-more summary { list-style: none; margin-bottom: 20px; }
.item-more summary::-webkit-details-marker { display: none; }

/* Закупка: рабочий список, расчёт раскрывается по запросу. */
.purchase-page { max-width: 960px; margin: 0 auto; }
.purchase-mobile-title { display: none; }

/* Остатки: стоимость включается отдельно от рабочего списка. */
.stock-page { max-width: 1040px; margin: 0 auto; }
.stock-mobile-title { display: none; }
.stock-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.stock-search { margin: 0 0 16px; }
.stock-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 20px; }
.stock-controls .tabs { margin: 0; flex-wrap: wrap; }
.stock-cost-toggle { display: inline-flex; align-items: center; min-height: 44px; font-size: .85rem; color: var(--muted); text-decoration: none; }
.stock-cost-toggle:hover { color: var(--accent); }
.stock-products { padding: 0 24px; }
.stock-columns, .stock-product { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 24px; align-items: center; }
.stock-columns { padding: 20px 0; font-size: .8rem; }
.stock-product { padding: 24px 0; border-top: 1px solid var(--field); text-decoration: none; color: var(--text); }
.stock-product > div { min-width: 0; }
.stock-product-name { overflow-wrap: anywhere; }
.stock-product-name > strong { font-weight: 600; }
.stock-status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: .8rem; margin-top: 8px; color: var(--muted); }
.stock-status .icon { width: 16px; height: 16px; flex: none; }
.stock-status-problem { color: var(--problem); }
.stock-status-check { color: var(--check); }
.stock-product-qty { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-product-qty > span { color: var(--muted); font-size: .9rem; }
.stock-with-cost .stock-columns, .stock-with-cost .stock-product { grid-template-columns: minmax(0, 1fr) 130px 150px 160px; gap: 20px; }
.stock-product-price, .stock-product-value { font-size: .9rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stock-value-summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; border-radius: 16px; background: var(--surface); margin-bottom: 20px; }
.stock-value-summary small { display: block; margin-top: 6px; font-size: .8rem; }
.stock-value-summary > strong { font-size: 1.3rem; white-space: nowrap; }
.stock-mobile-label { display: none; }
@media (max-width: 850px) {
  .stock-with-cost .stock-columns { display: none; }
  .stock-with-cost .stock-product { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 24px; }
  .stock-with-cost .stock-product:first-of-type { border: 0; }
  .stock-with-cost .stock-product-qty { text-align: right; }
  .stock-mobile-label { display: block; color: var(--muted); font-size: .75rem; margin-bottom: 6px; }
}
@media (max-width: 600px) {
  .stock-products { padding: 0 18px; }
  .stock-columns, .stock-product { grid-template-columns: minmax(0, 1fr) 100px; gap: 16px; }
  .stock-product-qty { text-align: right; font-size: .95rem; }
  .stock-product-name { font-size: .95rem; }
  .stock-value-summary { flex-wrap: wrap; padding: 18px; font-size: .9rem; }
}

@media (max-width: 420px) {
  .stock-topbar-title { display: none; }
  .stock-mobile-title { display: block; font-size: 1.5rem; margin: 0 0 20px; }
}

/* Списания: один список за выбранный период, отдельный журнал. */
.writeoffs-page { max-width: 960px; margin: 0 auto; }
.writeoffs-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.writeoffs-heading h1 { margin: 0; font-size: 1.8rem; }
.writeoffs-date-range { font-size: .85rem; margin: 8px 0 0; }
.writeoffs-period { max-width: 100%; min-width: 0; }
.writeoffs-period select { width: 160px; max-width: 100%; min-height: 48px; padding: 10px 16px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; }
.writeoffs-total { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; padding: 20px 24px; background: var(--surface); border-radius: 18px; }
.writeoffs-total > div { min-width: 0; overflow-wrap: anywhere; }
.writeoffs-total > div > span { font-size: .9rem; }
.writeoffs-total small { display: block; margin-top: 6px; font-size: .8rem; }
.writeoffs-total strong { font-size: 1.5rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.writeoffs-tabs { display: flex; gap: 32px; border-bottom: 1px solid var(--field); margin: 24px 0 16px; }
.writeoffs-tabs a { display: flex; align-items: center; min-height: 56px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; }
.writeoffs-tabs a[aria-current] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.writeoffs-rows { padding: 0 24px; }
.writeoffs-product, .writeoffs-reason { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 24px 0; text-decoration: none; color: var(--text); }
.writeoffs-product { grid-template-columns: minmax(0, 1fr) auto 20px; }
.writeoffs-product + .writeoffs-product, .writeoffs-reason + .writeoffs-reason, .writeoffs-entry + .writeoffs-entry { border-top: 1px solid var(--field); }
.writeoffs-product > span, .writeoffs-reason > span { min-width: 0; overflow-wrap: anywhere; }
.writeoffs-rows small { display: block; font-size: .85rem; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.writeoffs-product > .icon { width: 20px; height: 20px; color: var(--muted); }
.writeoffs-product:hover > .icon { color: var(--accent); }
.writeoffs-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.writeoffs-entry { padding: 24px 0; overflow-wrap: anywhere; }
.writeoffs-entry-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; }
.writeoffs-entry-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: .8rem; }
.writeoffs-cancel { text-align: right; margin-top: 8px; }
.writeoffs-cancel .btn { color: var(--problem); font-size: .8rem; min-height: 44px; padding: 0 8px; }
.writeoffs-cancelled { opacity: .65; }
.writeoffs-comment { font-size: .85rem; margin: 12px 0; }
.writeoffs-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.writeoffs-filter .btn { font-size: .85rem; padding: 0 8px; }
.writeoffs-filter .icon { width: 16px; height: 16px; }
.writeoffs-pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 20px; }
.writeoffs-warning { margin: 20px 0; font-size: .9rem; line-height: 1.5; }
.writeoffs-warning summary { cursor: pointer; }
.writeoffs-warning ul { margin-bottom: 0; }
@media (max-width: 600px) {
  .writeoffs-heading { align-items: flex-start; gap: 16px; }
  .writeoffs-heading h1 { font-size: 1.5rem; }
  .writeoffs-period select { width: 120px; }
  .writeoffs-date-range { font-size: .75rem; }
  .writeoffs-total { padding: 18px; gap: 16px; }
  .writeoffs-total strong { font-size: 1.25rem; }
  .writeoffs-tabs { gap: 24px; }
  .writeoffs-tabs a { font-size: .95rem; }
  .writeoffs-rows { padding: 0 18px; }
  .writeoffs-product, .writeoffs-reason, .writeoffs-entry-main { gap: 12px; font-size: .95rem; }
  .writeoffs-product { grid-template-columns: minmax(0, 1fr) auto 16px; }
  .writeoffs-product > .icon { width: 16px; height: 16px; }
  .writeoffs-total { font-size: .9rem; }
  .writeoffs-topbar-title { display: none; }
}
