:root {
    color-scheme: light;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --line: #d2d2d7;
    --soft: #f5f5f7;
    --blue: #0066cc;
    --blue-dark: #004f9f;
    --ok: #147a3f;
    --warn: #9a5b00;
    --bad: #b3261e;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #fff;
    color: var(--text);
    font-family:
        -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    line-height: 1.45;
}

main {
    width: min(920px, calc(100% - 32px));
    margin: 0 auto;
    padding: 44px 0 64px;
}

header {
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(34px, 7vw, 64px);
    line-height: 1.04;
    letter-spacing: 0;
}

.lead {
    max-width: 720px;
    margin: 18px 0 0;
    color: #424245;
    font-size: 19px;
}

.layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 28px;
    align-items: start;
}

.panel,
.side {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.panel {
    min-height: 500px;
    padding: 28px;
}

.side {
    padding: 20px;
    position: sticky;
    top: 18px;
}

.progress {
    height: 4px;
    margin-bottom: 28px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--soft);
}

.progress span {
    display: block;
    width: var(--progress, 0%);
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
    transition: width 0.2s ease;
}

.step-label {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

h2 {
    margin: 0;
    font-size: 30px;
    line-height: 1.14;
    letter-spacing: 0;
}

.description {
    margin: 12px 0 0;
    color: #424245;
    font-size: 17px;
}

.options {
    display: grid;
    gap: 12px;
    margin: 28px 0 0;
}

button {
    font: inherit;
}

.option {
    width: 100%;
    min-height: 64px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.option:hover,
.option:focus-visible {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
    outline: none;
}

.option:disabled {
    background: var(--soft);
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.65;
}

.option:disabled:hover,
.option:disabled:focus-visible {
    border-color: var(--line);
    box-shadow: none;
}

.option-title {
    display: block;
    font-size: 17px;
    font-weight: 600;
}

.option-desc {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 14px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.primary,
.secondary {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 8px;
    cursor: pointer;
}

.primary {
    border: 0;
    background: var(--blue);
    color: #fff;
    font-weight: 600;
}

.primary:hover,
.primary:focus-visible {
    background: var(--blue-dark);
    outline: none;
}

.secondary {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.secondary:hover,
.secondary:focus-visible {
    border-color: var(--blue);
    outline: none;
}

.result {
    display: grid;
    gap: 18px;
}

.result-badge {
    width: fit-content;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--soft);
    color: #424245;
    font-size: 13px;
    font-weight: 600;
}

.result-badge.ok {
    background: #eaf7ee;
    color: var(--ok);
}

.result-badge.warn {
    background: #fff4df;
    color: var(--warn);
}

.result-badge.bad {
    background: #fdecea;
    color: var(--bad);
}

.product {
    display: grid;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.product strong {
    font-size: 19px;
}

.engraving-form {
    display: grid;
    gap: 18px;
    margin-top: 24px;
}

.reciept-form {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.reciept-table-scroll {
    max-width: 100%;
    overflow: auto;
    border-radius: 8px;
}

.reciept-upload {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.reciept-upload-text {
    flex-basis: 100%;
    margin: 0;
    color: #424245;
    font-size: 14px;
}

.reciept-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.reciept-upload-button {
    display: inline-flex;
    align-items: center;
}

.reciept-upload-name {
    color: var(--muted);
    font-size: 14px;
}

.reciept-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #424245;
    font-size: 14px;
    line-height: 1.35;
}

.reciept-checkbox input {
    margin-top: 2px;
}

.reciept-grid {
    display: grid;
    min-width: 720px;
    grid-template-columns: 120px repeat(6, minmax(88px, 1fr));
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.reciept-cell {
    min-height: 52px;
    padding: 8px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.reciept-cell:nth-child(7n) {
    border-right: 0;
}

.reciept-cell:nth-last-child(-n + 7) {
    border-bottom: 0;
}

.reciept-header,
.reciept-eye {
  display: flex;
  align-items: center;
  background: var(--soft);
    font-size: 13px;
  font-weight: 700;
}

.help-marker {
    position: relative;
    display: inline-grid;
    margin-left: 3px;
    color: var(--blue);
    cursor: pointer;
    line-height: 1;
    place-items: center;
    touch-action: manipulation;
}

.help-marker:focus-visible {
    outline: 2px solid rgba(0, 102, 204, 0.35);
    outline-offset: 2px;
}

.help-tooltip {
    position: fixed;
    z-index: 2147483647;
    top: var(--tooltip-top, 0);
    left: var(--tooltip-left, 50%);
    display: none;
    width: max-content;
    max-width: min(260px, 70vw);
    padding: 8px 10px;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
}

.help-marker.is-open .help-tooltip {
    display: block;
}

.reciept-cell input,
.reciept-cell select {
    min-height: 36px;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
}

.reciept-cell input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.reciept-cell input[type="number"]::-webkit-inner-spin-button,
.reciept-cell input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

.reciept-number-control {
    position: relative;
}

.reciept-number-control input {
    padding-right: 36px;
}

.reciept-number-control-buttons {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    width: 30px;
    overflow: hidden;
    border-left: 1px solid var(--line);
    border-radius: 0 5px 5px 0;
    background: #fff;
}

.reciept-number-control-button {
    -webkit-appearance: none;
    appearance: none;
    display: grid;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    line-height: 1;
    place-items: center;
    cursor: pointer;
    touch-action: manipulation;
}

.reciept-number-control-button + .reciept-number-control-button {
    border-top: 1px solid var(--line);
}

.reciept-number-control-button:hover,
.reciept-number-control-button:focus-visible {
    color: var(--blue);
    outline: none;
}

.reciept-cell input:focus,
.reciept-cell select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
    outline: none;
}

.reciept-cell.reciept-important input,
.reciept-cell.reciept-important select {
    border-color: var(--bad);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.14);
}

.engraving-preview {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.engraving-preview img {
    display: block;
    width: 100%;
    max-width: 552px;
    height: auto;
}

.engraving-text {
    position: absolute;
    top: 67%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #1d1d1f;
    font-size: clamp(22px, 4vw, 34px);
    /* font-weight: 700; */
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
    pointer-events: none;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.required-label {
    color: var(--bad);
}

.required-label::after {
    content: " *";
}

.field input {
    min-height: 48px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
}

.field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
    outline: none;
}

.field-important input {
    border-color: var(--bad);
    box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.14);
}

.field-error {
    min-height: 20px;
    color: var(--bad);
    font-size: 14px;
    line-break: anywhere;
}

.identity-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.strengths {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.strengths li {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.note {
    margin-top: 20px;
    padding: 14px 16px;
    border-left: 3px solid var(--blue);
    background: #f7fbff;
    color: #424245;
    font-size: 14px;
}

.side h3 {
    margin: 0 0 12px;
    font-size: 17px;
}

.side ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: #424245;
    font-size: 14px;
}

.history {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.history ol {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 20px;
    color: #424245;
    font-size: 14px;
}

.history-question {
    display: block;
    color: var(--text);
    font-weight: 700;
}

.history-answer {
    display: block;
    margin-top: 2px;
}

.qr {
    margin-top: 18px;
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fff;
}

.iv-article {
    max-width: 760px;
    margin: 0 0 36px;
    padding: 0 0 30px;
    border-bottom: 1px solid var(--line);
}

.iv-article h2 {
    margin-top: 30px;
    font-size: 28px;
}

.iv-article h3 {
    margin: 22px 0 8px;
    font-size: 20px;
}

.iv-article p,
.iv-article li {
    color: #424245;
    font-size: 17px;
}

.iv-article ol,
.iv-article ul {
    padding-left: 24px;
}

.iv-note {
    margin: 18px 0;
    padding: 14px 16px;
    border-left: 3px solid var(--blue);
    background: #f7fbff;
}

@media (max-width: 780px) {
    main {
        width: min(100% - 24px, 920px);
        padding-top: 28px;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .side {
        position: static;
    }

    .panel {
        padding: 20px;
    }

    .identity-fields {
        grid-template-columns: 1fr;
    }
}
