:root {
    --navy: #102f3d;
    --navy-deep: #0a242f;
    --teal: #0d7d70;
    --teal-dark: #08655c;
    --teal-soft: #e6f4f1;
    --lime: #d7ee8b;
    --ink: #17272f;
    --muted: #667780;
    --line: #dbe3e5;
    --line-strong: #c6d1d4;
    --surface: #ffffff;
    --canvas: #f3f6f5;
    --warning: #a86216;
    --danger: #bd3535;
    --success: #19755f;
    --shadow: 0 12px 34px rgba(16, 47, 61, .07);
    --radius: 16px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
    margin: 0;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 270px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 26px 20px 20px;
    overflow-y: auto;
    color: #f7fbfa;
    background:
        radial-gradient(circle at 0 100%, rgba(40, 151, 128, .22), transparent 38%),
        linear-gradient(165deg, #123848 0%, var(--navy-deep) 74%);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 7px; }
.brand-mark, .review-logo {
    display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
    color: var(--navy-deep); background: var(--lime); font-size: 27px; font-weight: 850;
}
.brand strong { display: block; font-size: 22px; letter-spacing: .04em; line-height: 1; }
.brand small { display: block; margin-top: 5px; color: #9db3bb; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }

.format-card {
    display: flex; align-items: center; gap: 10px; margin: 28px 5px 18px; padding: 13px 14px;
    border: 1px solid rgba(255,255,255,.11); border-radius: 12px; background: rgba(255,255,255,.055);
}
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: #72d5b8; box-shadow: 0 0 0 5px rgba(114,213,184,.1); }
.format-card strong, .format-card small { display: block; }
.format-card strong { font-size: 13px; }
.format-card small { margin-top: 2px; color: #8fa7af; font-size: 11px; }

.step-nav { display: grid; gap: 4px; }
.step-link {
    width: 100%; display: flex; gap: 12px; align-items: center; padding: 12px; color: #a9bbc1;
    text-align: left; border: 0; border-radius: 12px; background: transparent; transition: .18s ease;
}
.step-link:hover { color: #fff; background: rgba(255,255,255,.055); }
.step-link.is-active { color: #fff; background: rgba(215,238,139,.1); box-shadow: inset 3px 0 var(--lime); }
.step-number { width: 28px; color: #6f8a94; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.step-link.is-active .step-number { color: var(--lime); }
.step-link strong, .step-link small { display: block; }
.step-link strong { font-size: 13px; }
.step-link small { margin-top: 2px; color: #728b95; font-size: 11px; }
.step-link.is-active small { color: #9bb0b7; }

.drafts-block { margin-top: 26px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 5px 8px; }
.sidebar-heading h2 { margin: 0; color: #9fb3ba; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.icon-button { width: 27px; height: 27px; border: 0; border-radius: 8px; color: #9fb3ba; background: rgba(255,255,255,.05); }
.icon-button:hover { color: #fff; }
.drafts-list { display: grid; gap: 5px; }
.draft-item { width: 100%; display: block; padding: 9px 10px; text-align: left; border: 0; border-radius: 9px; color: #bed0d5; background: transparent; }
.draft-item:hover { background: rgba(255,255,255,.05); }
.draft-item strong, .draft-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-item strong { color: #e8f0f1; font-size: 12px; }
.draft-item small { margin-top: 3px; color: #6f8993; font-size: 10px; }
.sidebar-muted, .sidebar-note { color: #708993; font-size: 11px; }
.sidebar-muted { padding: 0 5px; }
.sidebar-note { margin: auto 5px 0; padding-top: 22px; }

.workspace { min-width: 0; grid-column: 2; padding: 0 42px 110px; }
.topbar {
    min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 22px;
    border-bottom: 1px solid var(--line);
}
.eyebrow, .section-kicker { margin: 0 0 5px; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.save-state { display: inline-flex; align-items: center; gap: 7px; margin-right: 6px; color: var(--muted); font-size: 11px; }
.save-state > span { width: 6px; height: 6px; border-radius: 50%; background: #5ec4a5; }
.save-state.is-saving > span { background: #dba552; animation: pulse 1s infinite; }

.notice { margin: 20px 0 -4px; padding: 12px 15px; border: 1px solid #b8ddd4; border-radius: 10px; color: #155f52; background: #eaf7f4; font-size: 13px; }
.notice.is-error { color: #8e2929; border-color: #e9bcbc; background: #fff0f0; }

.wizard-panel { display: none; max-width: 1240px; margin: 0 auto; padding: 36px 0 24px; }
.wizard-panel.is-active { display: block; animation: panelIn .24s ease both; }
.section-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 23px; }
.section-intro h2 { margin: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.035em; }
.section-intro p { max-width: 670px; margin: 7px 0 0; color: var(--muted); }
.document-badge { display: inline-flex; flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; color: #0b5f55; background: #d9f0eb; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.document-badge.muted { color: #53676f; background: #e8edee; }
.document-badge.warning { color: #875514; background: #fff0ce; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.form-card { margin-bottom: 16px; padding: 25px; }
.card-heading, .table-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.card-heading > div { display: flex; align-items: center; gap: 12px; }
.card-heading h3, .table-heading h3 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.card-heading p, .table-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.card-index { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; color: var(--teal); background: var(--teal-soft); font-size: 11px; font-weight: 900; }
.role-pill { display: grid; place-items: center; min-width: 36px; height: 31px; border-radius: 8px; color: var(--teal-dark); background: var(--teal-soft); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.role-pill.dark { color: var(--lime); background: var(--navy); }

.grid { display: grid; gap: 17px 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field-span-2 { grid-column: span 2; }
.field-span-3 { grid-column: span 3; }
.field-span-4 { grid-column: span 4; }

.field { min-width: 0; display: flex; flex-direction: column; gap: 6px; color: #35474f; font-size: 12px; font-weight: 650; }
.field > span { min-height: 17px; }
.cargo-tail-field > span { min-height: 35px; }
.field b { color: var(--danger); font-weight: 800; }
.field small { color: #8a989e; font-size: 10px; font-weight: 450; }
.field small.field-error { color: var(--danger); font-weight: 650; line-height: 1.35; }
.tag-spec-trigger {
    --tag-spec-tooltip-left: 0px;
    --tag-spec-arrow-left: 20px;
    position: relative; align-self: flex-start; cursor: help;
}
.tag-spec-tooltip {
    position: absolute; z-index: 30; top: calc(100% + 8px); left: var(--tag-spec-tooltip-left);
    width: max-content; max-width: min(620px, calc(100vw - 36px));
    display: none; align-items: center; gap: 8px; padding: 9px 11px;
    visibility: hidden; opacity: 0; pointer-events: none;
    color: #eef8f6; border: 1px solid rgba(255,255,255,.12); border-radius: 9px;
    background: var(--navy-deep); box-shadow: 0 12px 30px rgba(4,25,33,.25);
    font-size: 10px; font-weight: 550; line-height: 1.4;
    transform: translateY(-3px); transition: opacity .14s, transform .14s, visibility .14s;
}
.tag-spec-tooltip::before {
    position: absolute; top: -5px; left: var(--tag-spec-arrow-left); width: 9px; height: 9px;
    content: ""; background: var(--navy-deep); border-top: 1px solid rgba(255,255,255,.12);
    border-left: 1px solid rgba(255,255,255,.12); transform: rotate(45deg);
}
.tag-spec-number, .tag-spec-requirement, .tag-spec-type { flex: 0 0 auto; color: var(--lime); font-weight: 800; }
.tag-spec-trigger[data-spec-requirement="mandatory"] .tag-spec-requirement { color: var(--danger); }
.tag-spec-tag { min-width: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.tag-spec-divider { flex: 0 0 auto; color: #6f929d; }
.tag-spec-trigger:hover > .tag-spec-tooltip {
    display: flex; visibility: visible; opacity: 1; transform: translateY(0);
}
.field input, .field select, .field textarea {
    width: 100%; min-width: 0; min-height: 42px; padding: 10px 12px; color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: 9px; outline: none; background: #fcfdfd;
    font-size: 13px; font-weight: 450; transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #9fb0b5; }
.field input[readonly] { color: #53676f; background: #f2f6f5; cursor: default; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); background: #fff; box-shadow: 0 0 0 3px rgba(13,125,112,.1); }
.field input.is-invalid, .field select.is-invalid, .field textarea.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(189,53,53,.08); }
.uppercase { text-transform: uppercase; }

.info-strip { display: flex; gap: 14px; align-items: flex-start; margin-top: 18px; padding: 16px 18px; border-left: 3px solid var(--teal); color: #53656d; background: #eaf2f1; font-size: 12px; }
.info-strip strong { flex: 0 0 auto; color: var(--ink); }

.party-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.party-card { padding: 23px 25px; }
.compact-grid { gap: 14px 15px; }
.optional-fields { padding-top: 2px; border-top: 1px dashed var(--line); }
.optional-fields summary { padding: 13px 0 0; color: var(--teal); cursor: pointer; font-size: 11px; font-weight: 750; }
.nested-grid { padding-top: 14px; }
.accent-card { border-color: #b9d5cf; background: linear-gradient(105deg, #fbfefd, #f1f8f6); }

.route-grid { position: relative; }
.location-card { padding-top: 28px; }
.location-title { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.location-title small { color: var(--teal); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.location-title h3 { margin: 2px 0 0; font-size: 17px; }
.location-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px var(--teal-soft); }
.location-dot.delivery { background: var(--navy); box-shadow: 0 0 0 5px #e8edef; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { position: relative; padding: 18px 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.metric span, .metric small, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.metric strong { margin-top: 7px; font-size: 25px; letter-spacing: -.04em; }
.metric small { position: absolute; right: 17px; bottom: 18px; color: #96a3a8; font-size: 10px; }
.metric.highlight { color: #f7fffd; border-color: var(--navy); background: linear-gradient(135deg, var(--navy), #184d5d); }
.metric.highlight span, .metric.highlight small { color: #9fc0c8; }

.table-card { margin-bottom: 16px; overflow: hidden; }
.table-heading { margin: 0; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 13px; color: #7b8b92; text-align: left; border-bottom: 1px solid var(--line); background: #f8faf9; font-size: 9px; letter-spacing: .07em; text-transform: uppercase; }
td { padding: 14px 13px; border-bottom: 1px solid #edf1f1; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-button { border: 0; border-radius: 7px; color: var(--muted); background: #f0f4f3; font-size: 11px; padding: 6px 8px; }
.row-button:hover { color: var(--danger); background: #fff0f0; }
.empty-state { padding: 36px 20px 40px; text-align: center; }
.empty-state span { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 10px; border: 1px dashed #aebdc1; border-radius: 12px; color: #8da0a6; }
.empty-state strong { font-size: 13px; }
.empty-state p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.simple-list { min-height: 92px; }
.simple-list:empty::after { content: "Записів ще немає"; display: block; padding: 32px 22px; color: #89989e; text-align: center; font-size: 11px; }
.simple-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 20px; border-bottom: 1px solid #edf1f1; }
.simple-item:last-child { border-bottom: 0; }
.simple-item strong, .simple-item small { display: block; }
.simple-item strong { font-size: 12px; }
.simple-item small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.optional-card { margin-bottom: 16px; box-shadow: none; }
.optional-card > summary { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; cursor: pointer; list-style: none; }
.optional-card > summary::-webkit-details-marker { display: none; }
.optional-card summary strong, .optional-card summary small { display: block; }
.optional-card summary small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.optional-card summary i { font-style: normal; color: var(--teal); font-size: 20px; }
.optional-card[open] summary i { transform: rotate(45deg); }
.details-body { padding: 8px 22px 22px; border-top: 1px solid var(--line); }

.review-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); gap: 17px; align-items: start; }
.review-main { min-width: 0; display: grid; gap: 16px; }
.review-card { overflow: hidden; }
.review-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; color: #f5fbfa; background: var(--navy); }
.review-header > div { display: flex; align-items: center; gap: 13px; }
.review-header small { color: #9eb6be; font-size: 9px; letter-spacing: .09em; text-transform: uppercase; }
.review-header h3 { margin: 3px 0 0; font-size: 20px; }
.review-logo { width: 38px; height: 38px; font-size: 23px; }
.status-chip { padding: 6px 9px; border-radius: 999px; color: var(--lime); background: rgba(215,238,139,.1); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-item { padding: 18px 21px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.review-item:nth-child(2n) { border-right: 0; }
.review-item span, .review-item strong { display: block; }
.review-item span { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.review-item strong { margin-top: 5px; font-size: 13px; overflow-wrap: anywhere; }
.validation-card { overflow: hidden; }
.validation-placeholder { min-height: 118px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; color: var(--muted); }
.validation-placeholder span { font-size: 22px; }
.validation-placeholder p { margin: 0; font-size: 12px; }
.validation-list {
    margin: 0; padding: 12px 22px 18px; list-style: none; counter-reset: validation-error;
    color: #812f2f; background: #fff8f8; font-size: 11px;
}
.validation-list li {
    min-width: 0; display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center;
    gap: 8px; padding: 3px 0; counter-increment: validation-error;
}
.validation-list li::before { content: counter(validation-error) "."; text-align: right; font-weight: 650; }
.validation-error-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 17px 22px 10px; color: #812f2f; background: #fff8f8; }
.validation-error-summary strong { font-size: 13px; }
.validation-error-summary span { color: #9a6767; font-size: 10px; }
.validation-error-link { width: 100%; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 11px; text-align: left; color: #752929; border: 1px solid #f0cece; border-radius: 9px; background: #fff; }
.validation-error-link:hover { border-color: #d78e8e; background: #fffafa; }
.validation-error-link span { min-width: 0; overflow-wrap: anywhere; font-size: 11px; font-weight: 650; }
.validation-error-link small { flex: 0 0 auto; color: var(--teal); font-size: 9px; font-weight: 750; }
.validation-success { padding: 25px; color: var(--success); background: #f2faf7; font-size: 12px; font-weight: 700; }

.xml-panel { position: sticky; top: 18px; overflow: hidden; border: 1px solid #1a3c49; border-radius: var(--radius); background: #0c2631; box-shadow: 0 16px 40px rgba(6, 26, 34, .16); }
.xml-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; color: #e5f1f2; border-bottom: 1px solid rgba(255,255,255,.08); }
.xml-toolbar strong, .xml-toolbar small { display: block; }
.xml-toolbar strong { font-size: 12px; }
.xml-toolbar small { margin-top: 3px; color: #6d8b95; font-size: 9px; }
.copy-button { padding: 6px 9px; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; color: #a9bdc3; background: transparent; font-size: 9px; }
.copy-button:disabled { opacity: .4; cursor: not-allowed; }
.xml-panel pre { height: 360px; margin: 0; padding: 18px; overflow: auto; color: #a8d8ca; background: #0a222c; font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre; }
.xml-actions { display: grid; gap: 8px; padding: 14px 15px 10px; }
.xml-note { margin: 0; padding: 0 17px 16px; color: #6e8a94; font-size: 9px; line-height: 1.5; }

.button { min-height: 39px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 750; transition: transform .14s, background .14s, border-color .14s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; transform: none; cursor: not-allowed; }
.button-primary { color: #fff; border-color: var(--teal); background: var(--teal); }
.button-primary:hover { background: var(--teal-dark); }
.button-secondary { color: var(--ink); border-color: var(--line-strong); background: #fff; }
.button-secondary:hover, .button-ghost:hover { border-color: #9dabb0; background: #f8faf9; }
.button-ghost { color: #52656d; border-color: transparent; background: transparent; }
.button-small { min-height: 32px; padding: 6px 10px; color: var(--teal); border-color: #b8d8d1; background: #f6fbfa; font-size: 10px; }
.button-full { width: 100%; }
.logout-form { margin: 0; }

.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 85%, rgba(13, 125, 112, .16), transparent 34%),
        linear-gradient(145deg, var(--navy-deep), #17485a);
}
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
    width: min(430px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.18);
    border-radius: 20px; background: #fff; box-shadow: 0 28px 80px rgba(3, 21, 29, .35);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand strong { color: var(--navy); font-size: 22px; letter-spacing: .04em; line-height: 1; }
.auth-brand small { margin-top: 5px; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.auth-heading h1 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.auth-heading > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.auth-form { display: grid; gap: 17px; margin-top: 25px; }
.auth-error { margin-top: 20px; padding: 11px 13px; color: #8e2929; border: 1px solid #e9bcbc; border-radius: 9px; background: #fff0f0; font-size: 12px; }
.auth-note { margin: 18px 0 0; color: #87969c; text-align: center; font-size: 10px; }

.form-footer {
    position: fixed; z-index: 8; right: 0; bottom: 0; left: 270px; display: flex; align-items: center; justify-content: space-between; gap: 22px;
    padding: 14px 42px; border-top: 1px solid var(--line); background: rgba(255,255,255,.92); box-shadow: 0 -9px 30px rgba(17,45,57,.05); backdrop-filter: blur(12px);
}
.footer-status { min-width: 220px; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 10px; font-weight: 700; }
.progress { width: 140px; height: 4px; overflow: hidden; border-radius: 999px; background: #e5ebeb; }
.progress i { display: block; width: 20%; height: 100%; border-radius: inherit; background: var(--teal); transition: width .24s ease; }
.footer-actions { display: flex; gap: 8px; }

.modal { width: min(840px, calc(100vw - 34px)); max-height: calc(100vh - 34px); padding: 0; overflow: auto; border: 0; border-radius: 17px; color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgba(4, 25, 33, .35); }
.modal-small { width: min(580px, calc(100vw - 34px)); }
.modal::backdrop { background: rgba(8, 28, 36, .62); backdrop-filter: blur(3px); }
.modal-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; padding: 23px 25px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.modal-header h2 { margin: 0; font-size: 22px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 9px; color: #687a81; background: #f0f4f3; font-size: 22px; line-height: 1; }
.modal-body { padding: 24px 25px; }
.modal-footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 15px 25px; border-top: 1px solid var(--line); background: #fff; }

@keyframes panelIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 1120px) {
    .app-shell { grid-template-columns: 228px minmax(0, 1fr); }
    .sidebar { width: 228px; padding-inline: 15px; }
    .workspace { grid-column: 2; padding-inline: 28px; }
    .form-footer { left: 228px; padding-inline: 28px; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-4 > .field-span-3 { grid-column: span 2; }
    .grid-4 > .field-span-4 { grid-column: span 2; }
    .review-layout { grid-template-columns: 1fr; }
    .xml-panel { position: static; }
}

@media (max-width: 820px) {
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; padding: 15px 18px; overflow: visible; }
    .brand { display: none; }
    .format-card, .sidebar-note { display: none; }
    .step-nav { display: flex; gap: 4px; overflow-x: auto; }
    .step-link { min-width: max-content; padding: 9px 11px; }
    .step-link small { display: none; }
    .drafts-block { margin-top: 12px; padding-top: 12px; }
    .sidebar-heading { padding-bottom: 6px; }
    .drafts-list {
        display: flex; gap: 7px; padding-bottom: 2px; overflow-x: auto;
        -webkit-overflow-scrolling: touch; scrollbar-width: thin;
    }
    .draft-item { flex: 0 0 min(210px, 68vw); padding: 8px 10px; background: rgba(255,255,255,.045); }
    .drafts-list .sidebar-muted { flex: 0 0 auto; margin: 0; padding-block: 5px; }
    .workspace { padding: 0 18px 116px; }
    .topbar { min-height: 84px; }
    .top-actions .save-state { display: none; }
    .topbar h1 { font-size: 21px; }
    .wizard-panel { padding-top: 26px; }
    .form-footer { left: 0; padding: 12px 18px; }
    .footer-status { display: none; }
    .footer-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 620px) {
    .topbar { min-height: 0; display: grid; gap: 14px; padding: 18px 0; }
    .top-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .top-actions .button { width: 100%; padding-inline: 9px; white-space: nowrap; }
    .top-actions .logout-form { grid-column: 1 / -1; }
    .section-intro { display: block; }
    .section-intro .document-badge { margin-top: 13px; }
    .grid-2, .grid-3, .grid-4, .metric-grid, .review-grid { grid-template-columns: 1fr; }
    .field-span-2, .field-span-3, .field-span-4,
    .grid-4 > .field-span-3, .grid-4 > .field-span-4 { grid-column: span 1; }
    .cargo-tail-field > span { min-height: 17px; }
    .metric { min-height: 96px; }
    .review-item { border-right: 0; }
    .validation-error-summary { align-items: flex-start; flex-direction: column; gap: 4px; }
    .validation-list { padding-inline: 14px; }
    .validation-list li { grid-template-columns: 19px minmax(0, 1fr); gap: 6px; }
    .validation-error-link { align-items: flex-start; flex-direction: column; gap: 4px; }
    .form-card, .party-card { padding: 20px 17px; }
    .form-footer { align-items: stretch; }
    .footer-actions { display: grid; grid-template-columns: auto 1fr auto; }
    .footer-actions .button { padding-inline: 11px; }
    #save-draft { font-size: 0; }
    #save-draft::after { content: "Зберегти"; font-size: 12px; }
    .auth-card { padding: 27px 21px; }
}

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