.s7md {
    clear: both;
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 18px auto;
    padding: 16px;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.single-product .s7md {
    float: none;
}

#s7md-footer-fallback {
    display: contents;
}

.s7md-product-choice {
    display: grid;
    gap: 12px;
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    background: #fff;
}

.s7md-product-choice__buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.s7md-product-choice__button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    text-align: center;
}

.s7md-designer-page {
    width: min(760px, calc(100% - 24px));
    margin: 16px auto 40px;
}

.s7md-message {
    width: min(900px, calc(100% - 32px));
    margin: 40px auto;
    padding: 18px;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    background: #fff;
}

.s7md__title {
    margin: 0 0 16px;
    font-size: 22px;
}

.s7md__format {
    margin: -8px 0 14px;
    color: #555;
    font-size: 14px;
    font-weight: 600;
}

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

.s7md__stage-wrap {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #d8d8d8;
    background:
        linear-gradient(45deg, #f4f4f4 25%, transparent 25%),
        linear-gradient(-45deg, #f4f4f4 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f4f4f4 75%),
        linear-gradient(-45deg, transparent 75%, #f4f4f4 75%);
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}

#s7md-canvas {
    display: block;
}

.s7md__stage-wrap .canvas-container {
    max-width: 100%;
    max-height: 100%;
}

.s7md__panel {
    display: grid;
    order: -1;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    align-items: end;
    padding-top: 4px;
}

.s7md__field,
.s7md__toggle {
    display: grid;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
}

.s7md__field:first-child input[type="file"] {
    min-height: 48px;
    padding: 10px;
    border: 2px dashed #111;
    background: #fafafa;
    cursor: pointer;
}

.s7md__field input,
.s7md__field select,
.s7md__field textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cfcfcf;
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
    box-sizing: border-box;
}

.s7md__field textarea {
    resize: vertical;
}

.s7md__field--text {
    grid-column: span 2;
}

.s7md__toggle {
    grid-template-columns: 20px 1fr;
    align-items: center;
    font-weight: 500;
}

.s7md__colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.s7md__colors button {
    width: 34px;
    height: 34px;
    border: 2px solid #d7d7d7;
    border-radius: 50%;
    background: var(--s7md-color);
    cursor: pointer;
}

.s7md__colors button.is-active {
    border-color: #111;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
}

.s7md__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    text-align: center;
    white-space: normal;
}

.s7md__actions {
    display: grid;
    grid-column: span 2;
    gap: 10px;
}

.s7md__tools {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.s7md__tool-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.s7md__status {
    grid-column: 1 / -1;
    min-height: 20px;
    margin: 0;
    font-size: 14px;
}

.s7md__status.is-success {
    color: #177245;
}

.s7md__status.is-error {
    color: #b42318;
}

.s7md__resolution-warning {
    display: none;
    grid-column: 1 / -1;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #f2b84b;
    border-radius: 6px;
    background: #fff8e5;
    color: #8a5a00;
    font-size: 13px;
    line-height: 1.35;
}

.s7md__legend {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    font-size: 13px;
    color: #333;
}

.s7md__legend-item::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 0;
    margin-right: 8px;
    vertical-align: middle;
    border-top: 2px solid currentColor;
}

.s7md__legend-item--bleed {
    color: #e64a4a;
}

.s7md__legend-item--net {
    color: #1f7ae0;
}

.s7md__legend-item--safe {
    color: #20a66a;
}

@media (max-width: 900px) {
    .s7md__legend {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .s7md-product-choice {
        padding: 12px;
    }

    .s7md-product-choice__buttons {
        grid-template-columns: 1fr;
    }

    .s7md {
        margin: 10px auto;
        padding: 10px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .s7md__layout,
    .s7md__panel {
        grid-template-columns: 1fr;
    }

    .s7md__layout {
        gap: 12px;
    }

    .s7md__title {
        margin-bottom: 10px;
        font-size: 20px;
    }

    .s7md__stage-wrap {
        width: 100% !important;
        max-width: none;
        margin-inline: auto;
    }

    .s7md__field--text,
    .s7md__actions {
        grid-column: auto;
    }

    .s7md__button,
    .s7md-product-choice__button {
        min-height: 44px;
        font-size: 14px;
    }

    .s7md__tool-row {
        grid-template-columns: 1fr 1fr;
    }

    .s7md__colors button {
        width: 40px;
        height: 40px;
    }

    .s7md__field input,
    .s7md__field select,
    .s7md__field textarea {
        min-height: 46px;
        font-size: 16px;
    }

    .s7md-designer-page {
        width: 100%;
        margin: 0 auto 32px;
    }
}

@media (max-width: 420px) {
    .s7md {
        padding: 10px;
    }

    .s7md__panel {
        gap: 10px;
    }

    .s7md__tool-row {
        grid-template-columns: 1fr;
    }

    .s7md__legend {
        font-size: 12px;
    }
}
