:root {
    --blue: #0b8cc5;
    --blue-dark: #0872a3;
    --blue-soft: #e7f5fb;
    --red: #ef3b3b;
    --green: #2f8f62;
    --ink: #202734;
    --muted: #8a93a1;
    --line: #e2e7ed;
    --line-strong: #cad3dc;
    --surface: #ffffff;
    --page: #f4f7fa;
    --shadow: 0 18px 42px rgba(27, 45, 66, 0.08);
    --radius: 8px;
    --font: "Segoe UI", Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--page);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.service-header,
.page {
    width: min(100%, 1280px);
    margin: 0 auto;
    padding-inline: 24px;
}

.service-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 82px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #147cb0;
    text-decoration: none;
}

.logo__mark {
    position: relative;
    width: 35px;
    height: 31px;
}

.logo__mark::before,
.logo__mark::after {
    position: absolute;
    content: "";
    border-radius: 999px;
    transform-origin: left center;
}

.logo__mark::before {
    left: 0;
    top: 15px;
    width: 20px;
    height: 6px;
    background: var(--blue);
    transform: rotate(45deg);
}

.logo__mark::after {
    left: 12px;
    top: 25px;
    width: 37px;
    height: 6px;
    background: var(--red);
    transform: rotate(-52deg);
}

.logo__text {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.logo__text span {
    color: var(--red);
}

.service-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    padding: 5px;
}

.service-nav a {
    min-height: 34px;
    border-radius: 999px;
    padding: 7px 14px;
    color: #536071;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.service-nav a:hover {
    background: var(--blue-soft);
    color: var(--blue-dark);
}

.service-nav .service-nav__app-return {
    color: #fff;
    background: var(--blue);
}

.service-nav .service-nav__app-return:hover {
    color: #fff;
    background: var(--blue-dark);
}

.service-nav .service-nav__back {
    background: var(--blue);
    color: #fff;
}

.service-nav .service-nav__back:hover {
    background: var(--blue-dark);
    color: #fff;
}

.page {
    padding-bottom: 64px;
}

.intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 28px;
    align-items: end;
    margin: 28px 0 28px;
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(34px, 4vw, 56px);
    font-weight: 300;
    line-height: 1.08;
}

.intro p {
    max-width: 720px;
    margin: 0;
    color: #687383;
    font-size: 18px;
}

.intro__note {
    display: grid;
    gap: 4px;
    border-left: 4px solid var(--green);
    border-radius: 6px;
    background: #f0fbf5;
    padding: 16px 18px;
    color: #286746;
}

.intro__note strong {
    font-size: 18px;
}

.intro__note span {
    color: #4f7b64;
    font-size: 14px;
}

.tool {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 24px;
    align-items: start;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.upload-panel {
    min-width: 0;
    overflow: hidden;
}

.settings-panel {
    position: sticky;
    top: 18px;
    padding: 22px;
}

.panel__titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
}

.settings-panel .panel__titlebar {
    margin: -22px -22px 20px;
}

.panel h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
}

.panel p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.ghost-button,
.primary-button,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.ghost-button {
    padding: 0 14px;
    border-color: var(--line-strong);
    background: #fff;
    color: #667181;
}

.ghost-button:hover {
    border-color: #aeb9c5;
}

.ghost-button svg,
.primary-button svg,
.download-button svg {
    width: 20px;
    height: 20px;
}

.dropzone {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    margin: 24px;
    min-height: 156px;
    border: 2px dashed #bddbea;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f8fcfe 0%, #eef8fc 100%);
    padding: 24px;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease;
}

.dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.dropzone.is-dragover {
    border-color: var(--blue);
    background: #e2f4fb;
}

.dropzone__icon {
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    background: #fff;
    color: var(--blue);
    box-shadow: 0 10px 25px rgba(11, 140, 197, 0.14);
}

.dropzone__icon svg {
    width: 38px;
    height: 38px;
}

.dropzone__copy {
    display: grid;
    gap: 5px;
}

.dropzone__copy strong {
    font-size: 23px;
}

.dropzone__copy small,
.format-option small {
    color: var(--muted);
    font-size: 14px;
}

.dropzone__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 6px;
    background: var(--blue);
    color: #fff;
    font-weight: 800;
}

.queue {
    overflow-x: auto;
    border-top: 1px solid var(--line);
}

table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 24px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
}

th {
    color: #626a75;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

td {
    color: #2b313a;
    font-size: 15px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.queue__file {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    font-weight: 700;
}

.queue__file svg {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    color: var(--blue);
}

.queue__file span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-size: 13px;
    font-weight: 800;
}

.queue__empty td {
    color: var(--muted);
    text-align: center;
}

.check-panel {
    border-top: 1px solid var(--line);
    background: #f8fcfe;
    padding: 20px 24px 24px;
}

.check-panel__title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.check-panel h3 {
    margin: 0;
    color: #203447;
    font-size: 18px;
}

.check-panel p {
    margin: 4px 0 0;
}

.check-panel__stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.check-stat {
    display: grid;
    gap: 2px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    padding: 11px 12px;
}

.check-stat strong {
    color: #22384c;
    font-size: 22px;
    line-height: 1;
}

.check-stat span {
    color: #758191;
    font-size: 12px;
    font-weight: 700;
}

.check-stat.is-good {
    border-color: #b9e0cb;
    background: #f4fcf7;
}

.check-stat.is-good strong {
    color: #2f8f62;
}

.check-stat.is-warning {
    border-color: #f3d6aa;
    background: #fffaf0;
}

.check-stat.is-warning strong {
    color: #b36c10;
}

.check-panel__list,
.history-list {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.check-panel__list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-top: 1px solid #e5edf2;
    padding: 10px 0;
}

.analysis-select {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-width: 0;
    cursor: pointer;
}

.analysis-select input {
    width: 18px;
    height: 18px;
    margin: 3px 0 0;
    accent-color: var(--blue);
}

.analysis-select input:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.analysis-select span {
    display: grid;
    min-width: 0;
}

.check-panel__list strong,
.check-panel__list small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.check-panel__list strong {
    color: #33475a;
    font-size: 14px;
}

.check-panel__list small {
    color: #8290a0;
    font-size: 12px;
}

.analysis-tag {
    flex: 0 0 auto;
    border-radius: 999px;
    background: #e6f5fb;
    padding: 4px 8px;
    color: #0574a9;
    font-size: 11px;
    font-weight: 800;
}

.analysis-tag.is-already_printed,
.analysis-tag.is-batch_duplicate {
    background: #fff0d8;
    color: #a75c00;
}

.analysis-tag.is-same_order {
    background: #f2edf9;
    color: #7251a6;
}

.check-panel__more {
    justify-content: center !important;
    color: #718093;
    font-size: 13px;
    font-weight: 700;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.field span,
.format-list legend {
    color: #626a75;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.field select {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 0 14px;
    outline: none;
}

.field select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(11, 140, 197, 0.12);
}

.format-list {
    display: grid;
    gap: 10px;
    margin: 0 0 24px;
    padding: 0;
    border: 0;
}

.print-mode {
    display: grid;
    gap: 8px;
    margin: 0 0 24px;
    padding: 0;
    border: 0;
}

.print-mode legend {
    margin-bottom: 8px;
    color: #626a75;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.print-mode__option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 11px 12px;
    cursor: pointer;
}

.print-mode__option:has(input:checked) {
    border-color: #9fd1e8;
    background: var(--blue-soft);
}

.print-mode__option input {
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: var(--blue);
}

.print-mode__option span {
    display: grid;
    gap: 2px;
}

.print-mode__option strong {
    font-size: 14px;
}

.print-mode__option small {
    color: var(--muted);
    font-size: 12px;
}

.format-list legend {
    margin-bottom: 8px;
}

.format-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.format-option:hover {
    border-color: #bfd8e4;
    background: #fbfdfe;
}

.format-option:has(input:checked) {
    border-color: #9fd1e8;
    background: var(--blue-soft);
    box-shadow: inset 4px 0 0 var(--blue);
}

.format-option input {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    margin: 2px 0 0;
}

.format-option span {
    display: grid;
    gap: 3px;
}

.format-option strong {
    font-size: 16px;
}

.primary-button,
.download-button {
    width: 100%;
    min-height: 54px;
    padding: 0 18px;
    color: #fff;
}

.primary-button {
    background: var(--blue);
    box-shadow: 0 10px 22px rgba(11, 140, 197, 0.24);
}

.primary-button:hover {
    background: var(--blue-dark);
}

.primary-button:disabled {
    background: #aeb8c1;
    box-shadow: none;
    cursor: wait;
}

.download-button {
    background: var(--green);
}

.download-button:hover {
    background: #24754f;
}

.result {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.result__meta {
    border: 1px solid #c8e9d7;
    border-radius: 8px;
    background: #f0fbf5;
    color: #256545;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
}

.result__packing {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
}

.alert {
    margin-top: 18px;
    border: 1px solid #f3bbbb;
    border-radius: 8px;
    background: #fff5f5;
    color: #9c2828;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
}

.history-panel {
    margin-top: 24px;
    overflow: hidden;
}

.history-panel__body {
    padding: 4px 24px 20px;
}

.history-panel__clear {
    flex: 0 0 auto;
}

.history-panel__empty {
    max-width: 680px;
    color: var(--muted);
}

.history-panel__note {
    margin-top: 16px;
    color: #5d6c7b;
    font-size: 14px;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 28px;
}

.history-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 12px 0;
    color: #667484;
    font-size: 13px;
    font-weight: 700;
}

.history-list li > span:first-child {
    display: grid;
}

.history-list strong {
    color: #2c3f52;
    font-size: 15px;
}

.history-list small {
    color: #8994a1;
    font-size: 12px;
    font-weight: 400;
}

body.is-modal-open {
    overflow: hidden;
}

.preview-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
}

.preview-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 30, 43, 0.58);
    backdrop-filter: blur(4px);
}

.preview-modal__dialog {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(280px, 1fr) auto;
    width: min(980px, 100%);
    max-height: min(860px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(7, 19, 35, 0.35);
}

.preview-modal__head,
.preview-modal__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
}

.preview-modal__head {
    border-bottom: 1px solid var(--line);
}

.preview-modal__head h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.preview-modal__head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.preview-modal__close {
    display: grid;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: #697383;
    cursor: pointer;
}

.preview-modal__close:hover {
    background: #f7fafc;
}

.preview-modal__close svg {
    width: 22px;
    height: 22px;
}

.preview-modal__viewer {
    min-height: 0;
    background: #222;
}

.preview-modal__viewer iframe {
    display: block;
    width: 100%;
    height: 64vh;
    min-height: 420px;
    border: 0;
    background: #303030;
}

.preview-modal__actions {
    border-top: 1px solid var(--line);
    background: #fff;
}

.preview-modal__secondary,
.preview-modal__download {
    width: auto;
    min-width: 190px;
    padding-inline: 18px;
}

.preview-modal__download {
    min-width: 270px;
}

@media (max-width: 1020px) {
    .intro,
    .tool {
        grid-template-columns: 1fr;
    }

    .settings-panel {
        position: static;
    }
}

@media (max-width: 720px) {
    .service-header,
    .page {
        padding-inline: 16px;
    }

    .service-header {
        align-items: flex-start;
        flex-direction: column;
        padding-top: 18px;
        padding-bottom: 16px;
    }

    .service-nav {
        width: 100%;
        overflow-x: auto;
    }

    .service-nav a {
        white-space: nowrap;
    }

    .intro {
        margin-top: 18px;
    }

    h1 {
        font-size: 38px;
    }

    .intro p {
        font-size: 16px;
    }

    .panel__titlebar,
    .settings-panel {
        padding: 18px;
    }

    .settings-panel .panel__titlebar {
        margin: -18px -18px 18px;
    }

    .dropzone {
        grid-template-columns: 1fr;
        margin: 18px;
        padding: 20px;
        text-align: center;
    }

    .dropzone__icon {
        margin: 0 auto;
    }

    .dropzone__button {
        width: 100%;
    }

    .check-panel,
    .history-panel__body {
        padding-inline: 18px;
    }

    .check-panel__stats,
    .history-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .history-list {
        gap: 0;
    }

    .ghost-button {
        width: 46px;
        padding: 0;
        font-size: 0;
    }

    .ghost-button svg {
        width: 22px;
        height: 22px;
    }

    table {
        min-width: 0;
    }

    th,
    td {
        padding: 14px 18px;
    }

    th:nth-child(3),
    td:nth-child(3) {
        display: none;
    }

    .queue__file {
        max-width: 150px;
    }

    .preview-modal {
        padding: 12px;
    }

    .preview-modal__dialog {
        grid-template-rows: auto minmax(240px, 1fr) auto;
        max-height: calc(100vh - 24px);
    }

    .preview-modal__head,
    .preview-modal__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .preview-modal__head {
        align-items: center;
        flex-direction: row;
    }

    .preview-modal__viewer iframe {
        height: 58vh;
        min-height: 320px;
    }

    .preview-modal__secondary,
    .preview-modal__download {
        width: 100%;
        min-width: 0;
    }

    .preview-modal__secondary {
        min-height: 44px;
        padding: 0 18px;
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}


/* ---------- пояснение к режиму печати ---------- */

/*
 * Значок «?» у каждого режима. На складе формат выбирают на бегу, и подпись
 * «сетка 2 x 4» ничего не объясняет: по нажатию показываем, для чего режим,
 * какого размера выйдет накладная и как ярлыки лягут на листе.
 */
.format-option {
    position: relative;
}

.format-hint {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #d7dfe8;
    background: #fff;
    color: #7a8899;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
}

.format-hint:hover {
    border-color: #0b8dcb;
    color: #0b8dcb;
}

.hint-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hint-modal[hidden] {
    display: none;
}

.hint-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 28, 44, .45);
}

.hint-modal__card {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: #fff;
    border-radius: 16px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 24px 60px rgba(16, 28, 44, .25);
}

.hint-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hint-modal__head h3 {
    margin: 0;
    font-size: 17px;
    color: #16233a;
}

.hint-modal__close {
    width: 30px;
    height: 30px;
    border: none;
    background: #f1f5f9;
    border-radius: 9px;
    cursor: pointer;
    color: #5b6b80;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hint-modal__close svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.hint-modal__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: #4d5c70;
}

.hint-modal__example {
    display: flex;
    gap: 16px;
    align-items: center;
    background: #f7fafd;
    border: 1px solid #e4ecf4;
    border-radius: 12px;
    padding: 14px;
}

/* Схема листа: прямоугольники стоят ровно так, как лягут накладные. */
.hint-sheet {
    display: grid;
    gap: 3px;
    background: #fff;
    border: 1px solid #d7dfe8;
    border-radius: 4px;
    padding: 4px;
    width: 84px;
    height: 118px;
    flex: 0 0 auto;
}

.hint-sheet--land {
    width: 118px;
    height: 84px;
}

.hint-sheet span {
    background: #cfe3f3;
    border-radius: 2px;
}

.hint-modal__size {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.hint-modal__size span {
    font-size: 12px;
    color: #7a8899;
}

.hint-modal__size strong {
    font-size: 16px;
    color: #16233a;
}

.hint-modal__size small {
    font-size: 12px;
    color: #7a8899;
    line-height: 1.45;
}