:root {
    --ink: #171717;
    --muted: #6f7275;
    --line: #e9ece8;
    --paper: #ffffff;
    --wash: #f7f8f6;
    --site-content-top-gap: 8px;
}

* {
    letter-spacing: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}

main {
    flex: 1 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.header-bar {
    min-height: 51px;
    display: grid;
    grid-template-columns: 38px minmax(96px, 141px) 1fr;
    align-items: center;
    gap: 18px;
    padding: 0 28px 0 18px;
}

.brand,
.drawer-brand {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
}

.brand img,
.drawer-brand img {
    width: auto;
    max-width: 96px;
    max-height: 27px;
    object-fit: contain;
    display: block;
}

.menu-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    align-content: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    color: var(--ink);
    background: transparent;
    padding: 0;
}

.menu-button span {
    display: block;
    width: 25px;
    height: 2px;
    background: currentColor;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 28px;
}

.top-nav .nav-link {
    color: var(--ink);
    padding: 4px 0;
    font-size: 13px;
    font-weight: 520;
    text-transform: uppercase;
    text-decoration: none;
}

.top-nav-icon {
    display: none;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.site-drawer {
    --bs-offcanvas-width: min(88vw, 430px);
    border: 0;
    color: var(--ink);
    background: #fff;
}

.drawer-head {
    min-height: 112px;
    display: flex;
    align-items: center;
    gap: 34px;
    padding: 28px 30px 18px;
}

.drawer-close {
    position: relative;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    padding: 0;
}

.drawer-close::before,
.drawer-close::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 14px;
    width: 2px;
    height: 28px;
    background: var(--ink);
}

.drawer-close::before {
    transform: rotate(45deg);
}

.drawer-close::after {
    transform: rotate(-45deg);
}

.drawer-body {
    padding: 36px 30px 44px;
}

.drawer-nav {
    display: grid;
    gap: 22px;
}

.drawer-group {
    display: grid;
    gap: 8px;
}

.drawer-link {
    color: var(--ink);
    text-decoration: none;
    text-transform: uppercase;
}

.drawer-parent {
    font-size: 18.48px;
    line-height: 1.18;
    font-weight: 520;
}

.drawer-toggle {
    appearance: none;
    width: auto;
    max-width: 100%;
    display: inline-grid;
    grid-template-columns: auto 14px;
    align-items: center;
    justify-content: start;
    gap: 8px;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.drawer-toggle::after {
    content: "";
    width: 9px;
    height: 9px;
    justify-self: end;
    border-right: 1.8px solid #9b9f9c;
    border-bottom: 1.8px solid #9b9f9c;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .18s ease;
}

.drawer-toggle.is-open::after {
    transform: translateY(3px) rotate(225deg);
}

.drawer-link-label {
    min-width: 0;
}

.drawer-submenu {
    display: none;
    gap: 9.6px;
    padding: 0;
}

.drawer-group.is-open > .drawer-submenu {
    display: grid;
}

.drawer-child {
    color: #2c2c2c;
    font-size: 14.9688px;
    line-height: 1.22;
    font-weight: 430;
}

.drawer-category {
    margin-top: 22px;
}

.drawer-subgroup {
    display: grid;
    gap: 8px;
    margin: 0;
}

.drawer-grandchild {
    color: #3b3b3b;
    font-weight: 430;
}

.offcanvas-backdrop.show {
    opacity: 1;
    background: rgba(0, 0, 0, .42);
}

.page-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.page-hero {
    padding: var(--site-content-top-gap) 16px 18px;
}

.hero-copy {
    max-width: 760px;
}

.site-breadcrumbs {
    max-width: 100%;
    margin: 0 0 14px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.site-breadcrumbs::-webkit-scrollbar {
    display: none;
}

.site-breadcrumbs ol {
    display: inline-flex;
    align-items: center;
    min-width: max-content;
    gap: 7px;
    margin: 0;
    padding: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
    list-style: none;
    white-space: nowrap;
}

.site-breadcrumbs li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.site-breadcrumbs li + li::before {
    content: "›";
    color: #9a9a9a;
}

.site-breadcrumbs a {
    color: var(--ink);
    text-decoration: none;
}

.site-breadcrumbs a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-breadcrumbs span {
    color: var(--muted);
}

h1 {
    margin: 0;
    font-size: 30.6px;
    line-height: .98;
    font-weight: 500;
}

.content-block {
    padding: 20px 16px 28px;
    max-width: 700px;
    line-height: 1.75;
}

.content-block p {
    margin-bottom: 15px;
}

.child-grid {
    display: grid;
    gap: 1px;
    padding: 0 16px 40px;
    background: var(--line);
}

.child-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    color: var(--ink);
    background: var(--paper);
    text-decoration: none;
}

.child-card span {
    font-size: 18px;
    font-weight: 500;
}

.site-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.footer-inner {
    padding: 20px 16px;
    font-size: 13px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.footer-link {
    color: var(--muted);
    text-decoration: none;
}

.footer-link:hover {
    color: var(--ink);
}

@media (min-width: 992px) {
    .header-bar {
        grid-template-columns: 38px 141px 1fr;
        gap: 28px;
        min-height: 58px;
        padding: 0 27px 0 17px;
    }

    .site-drawer {
        --bs-offcanvas-width: min(45vw, 520px);
    }

    .drawer-head {
        padding: 34px 38px 22px;
    }

    .drawer-body {
        padding: 48px 38px 54px;
    }

    .page-hero {
        padding: var(--site-content-top-gap) 28px 28px;
    }

    h1 {
        font-size: 49.2px;
    }

    .content-block {
        padding: 26px 28px 42px;
    }

    .child-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 28px 56px;
    }

    .footer-inner {
        padding: 26px 28px;
    }
}

@media (max-width: 767.98px) {
    .header-bar {
        grid-template-columns: 38px minmax(68px, 82px) minmax(0, 1fr);
        gap: 10px;
        padding: 0 10px 0 12px;
    }

    .brand,
    .top-nav {
        min-width: 0;
    }

    .brand img {
        max-width: 78px;
    }

    .top-nav {
        gap: 7px;
    }

    .top-nav .nav-link.has-top-nav-icon {
        position: relative;
        width: 30px;
        height: 38px;
        display: grid;
        place-items: center;
        padding: 0;
    }

    .top-nav .nav-link.has-top-nav-icon .top-nav-icon {
        display: block;
    }

    .top-nav .nav-link.has-top-nav-icon .top-nav-text {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }
}


body.drawer-open {
    overflow: hidden;
}

.site-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1055;
    width: min(88vw, 430px);
    color: var(--ink);
    background: #fff;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .28s ease, visibility .28s ease;
    overflow-y: auto;
}

.site-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}

.site-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    border: 0;
    background: rgba(0, 0, 0, .42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
}

.site-drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.site-header {
    z-index: 1200;
}

.menu-button {
    position: relative;
    z-index: 1201;
    cursor: pointer;
    text-decoration: none;
    pointer-events: auto;
}

.site-drawer:target {
    transform: translateX(0);
    visibility: visible;
}

.site-drawer:target + .site-drawer-target-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.site-drawer-target-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(0, 0, 0, .42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
}

.drawer-close {
    display: block;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    z-index: 1060;
}

.drawer-close::before,
.drawer-close::after {
    display: block;
}

.site-drawer {
    z-index: 1300;
}

.site-drawer-backdrop,
.site-drawer-target-backdrop {
    z-index: 1290;
}

.drawer-close {
    z-index: 1310;
}

.drawer-head {
    position: relative;
    z-index: 1310;
}

.drawer-close {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    color: var(--ink) !important;
    font-size: 56px;
    font-weight: 300;
    line-height: 1;
    text-decoration: none !important;
}

.drawer-close::before,
.drawer-close::after {
    content: none !important;
}

/* Final drawer behavior: the header stays fixed, and the hamburger turns into the close control. */
.site-header {
    z-index: 1400;
}

.menu-button {
    position: relative;
    display: block;
    width: 38px;
    height: 38px;
    z-index: 1401;
}

.menu-button span {
    position: absolute;
    left: 6px;
    top: 50%;
    width: 25px;
    height: 2px;
    background: currentColor;
    transform-origin: center;
    transition: transform .22s ease, opacity .16s ease;
}

.menu-button span:nth-child(1) {
    transform: translateY(-8px);
}

.menu-button span:nth-child(2) {
    transform: translateY(0);
}

.menu-button span:nth-child(3) {
    transform: translateY(8px);
}

body.drawer-open .menu-button span:nth-child(1) {
    transform: translateY(0) rotate(45deg);
}

body.drawer-open .menu-button span:nth-child(2) {
    opacity: 0;
}

body.drawer-open .menu-button span:nth-child(3) {
    transform: translateY(0) rotate(-45deg);
}

.site-drawer {
    z-index: 1300;
}

.site-drawer-backdrop,
.site-drawer-target-backdrop {
    z-index: 1250;
}

.drawer-head {
    display: none !important;
}

.drawer-body {
    padding: 30px 30px 44px;
}

.drawer-child {
    font-size: 14.9688px;
    line-height: 1.28;
}

.menu-button {
    transform: translateY(-2px);
}

body.drawer-open .menu-button span:nth-child(1) {
    transform: translateY(0) rotate(45deg);
}

body.drawer-open .menu-button span:nth-child(3) {
    transform: translateY(0) rotate(-45deg);
}

.menu-button {
    transform: none;
}

.brand {
    transform: translate(-2px, 2px);
}

@media (min-width: 992px) {
    .menu-button {
        transform: translateX(5px);
    }

    .brand {
        transform: translate(-6px, 2px);
    }
}

@media (min-width: 860px) {
    :root {
        --site-content-top-gap: 20px;
    }
}

/* Модуль «Сотрудники»: блок входа по коду на странице-модуле */
.employee-auth {
    display: flex;
    justify-content: center;
}

.employee-login-box {
    width: 100%;
    max-width: 420px;
}

.employee-login-note {
    color: #6c757d;
    margin-bottom: 16px;
}

.employee-auth .login-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* Модуль «Заявки»: список заявок, форма формирования, экраны взвешивания и приемки */
.supply-requests {
    max-width: 920px;
    margin: 0 auto;
}

.request-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.request-back {
    display: inline-block;
    margin-bottom: 14px;
    color: #6c757d;
    text-decoration: none;
}

.request-back:hover {
    color: var(--ink, #17191f);
}

.request-subtitle {
    font-size: 24px;
    margin-bottom: 16px;
}

.request-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}

.request-head .request-subtitle {
    margin-bottom: 0;
}

.request-note {
    color: #6c757d;
}

.request-route-arrow {
    color: #6c757d;
    padding: 0 2px;
}

.request-link {
    font-weight: 600;
}

.request-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.request-status.status-request {
    background: #e7f1ff;
    color: #0d6efd;
}

.request-status.status-shipment {
    background: #fff3cd;
    color: #8a6d00;
}

.request-status.status-arrival {
    background: #d1e7dd;
    color: #146c43;
}

/* Финал: заявка отработана и закрыта, действий по ней больше нет. */
.request-status.status-closed {
    background: #e2e3e5;
    color: #41464b;
}

/* Строка своего create-черновика в списке заявок. */
.request-status.status-draft {
    background: #e9ecef;
    color: #495057;
}

/* Бейдж «Напечатана» рядом со статусом «Заявка»: бланк напечатан,
   состав зафиксирован, заявка ждет отправку. */
.request-status.status-printed {
    background: #e8e6f8;
    color: #5a4fa8;
}

.request-draft-delete {
    margin-left: 10px;
    padding: 1px 7px;
    font-size: 12px;
    border-radius: 8px;
}

.request-table th {
    white-space: nowrap;
}

.request-meta {
    display: grid;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 22px;
}

.request-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.request-meta-row > span {
    min-width: 110px;
    color: #6c757d;
}

.request-points {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
}

.request-point-field {
    flex: 1 1 240px;
}

.request-search {
    margin-bottom: 6px;
}

.request-search .form-control {
    min-height: 48px;
}

.request-category-title {
    font-size: 19px;
    margin: 26px 0 10px;
}

.request-product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid #eceff1;
}

.request-product-name {
    flex: 1 1 auto;
}

/* Крупные контролы количества: планшет — основной сценарий использования */
.request-qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.request-qty-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #ced4da;
    background: #fff;
    font-size: 22px;
    line-height: 1;
    color: #333;
}

.request-qty-btn:active {
    background: #e9ecef;
}

.request-qty-input {
    width: 92px;
    min-height: 44px;
    text-align: center;
    font-size: 17px;
}

.request-qty-input.is-invalid {
    border-color: #dc3545;
}

/* Расхождение факта прихода с весом отправки; ставится из requests.js после blur. */
.request-qty-input.request-qty-mismatch {
    border-color: #dc3545;
}

.request-qty-unit {
    /* Ширины хватает самой длинной подписи единицы («порц»), чтобы поля ввода
       в соседних строках не съезжали друг относительно друга. */
    min-width: 40px;
    color: #6c757d;
    font-size: 14px;
}

.request-fact-col {
    width: 210px;
}

.request-fact-control {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.request-submit-bar {
    margin-top: 26px;
}

.request-submit-bar .btn {
    min-width: 240px;
    min-height: 52px;
}

.request-diff {
    color: #b02a37;
    font-weight: 600;
}

/* Автосохранение черновиков заявок: плашка восстановления и тихий индикатор. */
.request-draft-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.request-draft-banner .btn {
    white-space: nowrap;
}

.request-submit-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.request-draft-status {
    color: #6c757d;
    font-size: .85rem;
}

.request-draft-status:empty {
    display: none;
}

/* Модальные окна уведомлений и подтверждений — стиль стандартной админки
   (.admin-notice-modal / .admin-confirm-modal в admin.css). */
.site-notice-modal .modal-dialog {
    width: min(100% - 28px, 430px);
}

.site-notice-modal .modal-content {
    border: 1px solid rgba(255, 255, 255, .74);
    border-radius: 24px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 22px 65px rgba(30, 36, 48, .12);
    backdrop-filter: blur(28px) saturate(1.35);
}

.site-notice-modal .modal-body {
    display: grid;
    gap: 14px;
    padding: 22px;
}

.site-notice-modal h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 760;
}

.site-notice-modal p {
    margin: 0;
    color: #3f4652;
    font-size: 13px;
    line-height: 1.45;
}

.site-notice-modal .btn {
    justify-self: end;
}

.confirm-modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.site-confirm-modal .btn {
    justify-self: auto;
}

.site-confirm-modal p {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* Подтверждение может открываться поверх другого открытого окна (удаление
   фото из окна фото позиции, перезапись значений из окна распознавания).
   Все модалки Bootstrap лежат на одном z-index (1055), и выше оказалась бы
   та, что позже в DOM, — а confirm подключён в разметке раньше остальных.
   Поэтому confirm поднят отдельно: он всегда верхний. */
.site-confirm-modal {
    --bs-modal-zindex: 1075;
    z-index: 1075;
}

/* Распознавание фото бланка заявки: окно загрузки снимков и экран сверки. */
.site-recognize-modal .modal-dialog {
    width: min(100% - 28px, 720px);
}

.site-recognize-modal .modal-body {
    gap: 18px;
}

.site-recognize-modal p {
    margin: 0;
}

/* Шаг модалки — собственная сетка: иначе всё внутри шага слипается,
   потому что gap задан только у modal-body. */
.site-recognize-modal [data-recognize-step] {
    display: grid;
    gap: 18px;
}

.site-recognize-modal [data-recognize-step][hidden] {
    display: none;
}

/* Кнопки внутри окна не тянуть вправо: justify-self: end приходит
   от .site-notice-modal и ломает центровку в дропзоне. */
.site-recognize-modal .btn {
    justify-self: auto;
}

.recognize-dropzone {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 32px 20px;
    border: 1.5px dashed #c2c8d2;
    border-radius: 18px;
    background: rgba(255, 255, 255, .6);
    text-align: center;
    transition: border-color .15s ease, background-color .15s ease;
}

.recognize-dropzone.is-dragover {
    border-color: var(--ink, #17191f);
    background: rgba(23, 25, 31, .04);
}

.recognize-dropzone .bi {
    font-size: 26px;
    color: #6c757d;
}

.recognize-dropzone-text {
    color: #6c757d;
    font-size: 14px;
}

/* Кнопки дропзоны в ряд: «Снять фото» (её показывает requests.js только на
   устройствах с камерой) и «Выбрать файлы». */
.recognize-dropzone-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

/* Нижняя зона окна отделена линией, как нижняя зона форм админки. */
.site-recognize-modal .confirm-modal-actions {
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid rgba(23, 25, 31, .1);
}

.recognize-files {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.recognize-files:empty {
    display: none;
}

.recognize-file {
    position: relative;
    width: 92px;
    height: 92px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(30, 36, 48, .14);
}

.recognize-file img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recognize-file-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(23, 25, 31, .68);
    color: #fff;
    font-size: 15px;
    line-height: 1;
}

.recognize-loading {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 26px 0;
    text-align: center;
}

.recognize-table th,
.recognize-table td {
    vertical-align: middle;
}

.recognize-table .request-qty-input {
    max-width: 110px;
}

/* Неуверенное распознавание и пустые клетки — то, что нужно просмотреть глазами. */
.recognize-table .request-qty-input.is-unsure {
    border-color: #e0a800;
    background: #fff8e5;
}

.recognize-table .request-qty-input.is-empty {
    background: #f4f5f7;
}

/* Фото позиций на экране «Создать приход»: кнопка-камера в строке таблицы
   со счётчиком приложенных снимков; само окно переиспользует стили
   распознавания (дропзона, миниатюры). */
.request-photo-col {
    width: 56px;
    text-align: center;
}

.request-photo-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #c2c8d2;
    border-radius: 12px;
    background: #fff;
    color: #3f4652;
    font-size: 17px;
    transition: border-color .15s ease, color .15s ease;
}

.request-photo-btn:hover {
    border-color: var(--ink, #17191f);
    color: var(--ink, #17191f);
}

.request-photo-count {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--ink, #17191f);
    color: #fff;
    font-size: 11px;
    font-weight: 650;
    line-height: 18px;
}

.site-item-photo-modal .item-photo-name {
    font-weight: 650;
}

/* Счётчик «Фото: N из 5» слева, кнопка «Готово» справа. */
.site-item-photo-modal .confirm-modal-actions {
    justify-content: space-between;
    align-items: center;
}

.item-photo-counter {
    color: #6c757d;
    font-size: .85rem;
}

/* Снимок, который ещё грузится: полупрозрачный, со спиннером по центру. */
.recognize-file.is-uploading img {
    opacity: .45;
}

.recognize-file .item-photo-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    color: #3f4652;
}

/* Лимит в 5 фото достигнут: дропзона гаснет, кнопка выбора выключена. */
.recognize-dropzone.is-full {
    opacity: .55;
}
