.bes-modal[hidden],
#bes-engraving-modal[hidden],
#bes-engraving-modal [hidden],
#bes-engraving-modal [aria-hidden="true"].bes-is-hidden {
    display: none !important;
}

.bes-trigger-summary[hidden],
.bes-trigger-summary.is-hidden {
    display: none !important;
}

:root {
    --bes-ink: #111111;
    --bes-muted: #666666;
    --bes-line: #d9d3ce;
    --bes-panel: #f4f1ee;
    --bes-accent: #e9e3dc;
    --bes-white: #ffffff;
    --bes-shadow: 0 22px 60px rgba(0, 0, 0, 0.12);
    --bes-radius-lg: 24px;
    --bes-radius-md: 16px;
    --bes-radius-sm: 12px;
}

html.bes-modal-open,
html.bes-modal-open body {
    overflow: hidden;
}

.bes-trigger-wrap {
    display: grid;
    gap: 14px;
    margin: 18px 0 22px;
}

.bes-trigger-button.button {
    width: 100%;
    min-height: 54px;
    border: 1px solid var(--bes-ink);
    border-radius: 999px;
    background: transparent;
    color: var(--bes-ink);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.bes-trigger-button.button:hover,
.bes-trigger-button.button:focus {
    background: var(--bes-ink);
    color: var(--bes-white);
}

.bes-trigger-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bes-panel);
    border: 1px solid var(--bes-line);
    border-radius: 20px;
}

.bes-trigger-summary__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 4px 10px;
    background: var(--bes-white);
    border: 1px solid var(--bes-line);
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.bes-trigger-summary__text {
    color: var(--bes-muted);
    font-size: 13px;
}

.bes-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.bes-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(16, 16, 16, 0.55);
    backdrop-filter: blur(4px);
}

.bes-modal__dialog {
    position: relative;
    width: min(1240px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    margin: 14px auto;
    overflow: auto;
    background: #f8f7f5;
    border-radius: 28px;
    box-shadow: var(--bes-shadow);
}

#bes-engraving-modal .bes-modal__close {
    position: absolute;
    top: clamp(18px, 2vw, 24px);
    right: clamp(18px, 2vw, 24px);
    left: auto;
    inset-inline-start: auto;
    inset-inline-end: clamp(18px, 2vw, 24px);
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--bes-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--bes-ink);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(17, 17, 17, 0.08);
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.bes-modal__close:hover,
.bes-modal__close:focus {
    background: var(--bes-ink);
    color: var(--bes-white);
    transform: translateY(-1px);
}

.bes-modal__header,
.bes-modal__footer {
    padding: 28px 34px;
}

.bes-modal__header {
    display: grid;
    gap: 14px;
    border-bottom: 1px solid var(--bes-line);
}

.bes-modal__eyebrow,
.bes-panel__step,
.bes-confirm-card__label {
    margin: 0 0 8px;
    color: var(--bes-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.bes-modal__header h2 {
    margin: 0;
    color: var(--bes-ink);
    font-size: clamp(34px, 4vw, 52px);
    line-height: 0.98;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

.bes-modal__subtitle {
    max-width: 820px;
    margin: 0;
    color: var(--bes-muted);
    font-size: 15px;
    line-height: 1.7;
}

.bes-modal__body {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.8fr);
    gap: 26px;
    padding: 28px 34px;
}

.bes-modal__main,
.bes-modal__aside {
    display: grid;
    gap: 18px;
    align-content: start;
}

.bes-panel,
.bes-preview-card,
.bes-confirm-card {
    padding: 24px;
    background: var(--bes-white);
    border: 1px solid var(--bes-line);
    border-radius: var(--bes-radius-lg);
}

.bes-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.bes-panel__head--compact {
    margin-bottom: 16px;
}

.bes-panel__head h3,
.bes-preview-card__head h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.bes-panel__help {
    margin: 0 0 14px;
    color: var(--bes-muted);
    line-height: 1.6;
}

.bes-segmented {
    display: inline-grid;
    grid-auto-flow: column;
    gap: 6px;
    padding: 6px;
    background: var(--bes-panel);
    border-radius: 999px;
}

.bes-segmented__button,
.bes-symbol-tabs__button {
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    border-radius: 999px;
}

.bes-segmented__button {
    min-height: 42px;
    padding: 0 18px;
    color: var(--bes-muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.bes-segmented__button.is-active,
.bes-symbol-tabs__button.is-active {
    background: var(--bes-ink);
    color: var(--bes-white);
}

.bes-text-input {
    width: 100%;
    min-height: 62px;
    padding: 16px 18px;
    border: 1px solid var(--bes-line);
    border-radius: 999px;
    background: #fcfbfa;
    color: var(--bes-ink);
    font-size: clamp(24px, 5vw, 34px);
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bes-char-counter {
    color: var(--bes-muted);
    font-size: 13px;
}

.bes-font-grid,
.bes-symbol-grid {
    display: grid;
    gap: 14px;
}

.bes-font-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bes-symbol-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#bes-engraving-modal .bes-font-card,
#bes-engraving-modal .bes-symbol-card {
    display: grid;
    align-content: center;
    gap: 10px;
    min-height: 112px;
    padding: 18px 28px;
    border: 1px solid var(--bes-line);
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #faf7f4 100%);
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#bes-engraving-modal .bes-font-card:hover,
#bes-engraving-modal .bes-symbol-card:hover,
#bes-engraving-modal .bes-font-card.is-active,
#bes-engraving-modal .bes-symbol-card.is-active {
    transform: translateY(-2px);
    border-color: var(--bes-ink);
    box-shadow: 0 12px 26px rgba(15, 15, 15, 0.08);
}

#bes-engraving-modal .bes-font-card.is-active,
#bes-engraving-modal .bes-symbol-card.is-active {
    background: linear-gradient(180deg, #faf6f2 0%, #eee7df 100%);
}

#bes-engraving-modal .bes-font-card__preview {
    font-size: clamp(24px, 3vw, 40px);
    line-height: 1.15;
}

#bes-engraving-modal .bes-font-card__label,
#bes-engraving-modal .bes-symbol-card__label {
    color: var(--bes-ink);
    font-size: 14px;
    font-weight: 600;
}

.bes-symbol-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

#bes-engraving-modal .bes-symbol-tabs__button {
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--bes-panel);
    color: var(--bes-ink);
    font-size: 13px;
    font-weight: 600;
}

#bes-engraving-modal .bes-symbol-card {
    min-height: 126px;
    justify-items: center;
    text-align: center;
}

.bes-symbol-card__art {
    display: grid;
    place-items: center;
    min-height: 62px;
}

.bes-symbol-card__art img,
.bes-preview-symbol img {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.bes-preview-card {
    position: static;
    gap: 18px;
}

.bes-preview-card__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.bes-price-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid var(--bes-line);
    border-radius: 999px;
    background: var(--bes-panel);
    color: var(--bes-ink);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bes-preview-frame {
    padding: 22px;
    background: linear-gradient(180deg, #f6f4f1 0%, #efebe6 100%);
    border-radius: 22px;
}

.bes-preview-frame__canvas {
    display: none;
    min-height: 220px;
    place-items: center;
    text-align: center;
}

.bes-preview-frame__canvas.is-active {
    display: grid;
}

.bes-preview-text {
    color: var(--bes-ink);
    font-size: clamp(34px, 6vw, 72px);
    line-height: 1.1;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    word-break: break-word;
}

.bes-preview-text.is-placeholder {
    max-width: 16ch;
    color: var(--bes-muted);
    font-size: clamp(12px, 1.7vw, 18px);
    line-height: 1.35;
    letter-spacing: 0.02em;
    text-transform: none;
}

.bes-preview-symbol {
    display: grid;
    place-items: center;
    min-height: 80px;
}

.bes-preview-symbol img {
    width: 88px;
    height: 88px;
}

.bes-preview-meta,
.bes-confirm-card__text,
.bes-empty-state {
    color: var(--bes-muted);
    line-height: 1.7;
}

.bes-empty-state {
    padding: 16px 18px;
    border: 1px dashed var(--bes-line);
    border-radius: 16px;
}

.bes-modal__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--bes-line);
}

.bes-footer-button {
    min-height: 56px;
    padding: 0 26px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
}

.bes-footer-button--ghost {
    border: 1px solid var(--bes-line);
    background: var(--bes-white);
    color: var(--bes-ink);
}

.bes-footer-button--solid {
    border: 1px solid var(--bes-ink);
    background: var(--bes-ink);
    color: var(--bes-white);
}

@media (max-width: 980px) {
    .bes-modal__body {
        grid-template-columns: 1fr;
    }

    .bes-font-grid,
    .bes-symbol-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .bes-modal__dialog {
        width: 100vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .bes-modal__header,
    .bes-modal__body,
    .bes-modal__footer {
        padding: 22px 18px;
    }

    .bes-font-grid,
    .bes-symbol-grid {
        grid-template-columns: 1fr;
    }

    .bes-footer-button {
        width: 100%;
    }
}


#bes-engraving-modal .bes-font-card,
#bes-engraving-modal .bes-symbol-card,
#bes-engraving-modal .bes-segmented__button,
#bes-engraving-modal .bes-symbol-tabs__button,
#bes-engraving-modal .bes-footer-button,
#bes-engraving-modal .bes-modal__close {
    -webkit-appearance: none;
    appearance: none;
}


/* Hard overrides to beat theme styles */
#bes-engraving-modal,
#bes-engraving-modal * {
    box-sizing: border-box;
}

#bes-engraving-modal .bes-modal__header,
#bes-engraving-modal .bes-modal__body,
#bes-engraving-modal .bes-modal__footer {
    position: relative;
    z-index: 1;
}

#bes-engraving-modal .bes-modal__close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
    bottom: auto !important;
    inset: auto 20px auto auto !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 9999 !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    float: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#bes-engraving-modal .bes-modal__close span {
    display: block !important;
    line-height: 1 !important;
}

#bes-engraving-modal .bes-segmented,
#bes-engraving-modal .bes-symbol-tabs {
    border-radius: 999px !important;
}

#bes-engraving-modal .bes-segmented__button,
#bes-engraving-modal .bes-symbol-tabs__button,
#bes-engraving-modal .bes-font-card,
#bes-engraving-modal .bes-symbol-card,
#bes-engraving-modal .bes-footer-button,
#bes-engraving-modal .bes-price-pill,
#bes-engraving-modal .bes-trigger-summary__badge {
    border-radius: 999px !important;
}

#bes-engraving-modal .bes-font-card,
#bes-engraving-modal .bes-symbol-card {
    overflow: hidden;
}

#bes-engraving-modal .bes-preview-text.is-placeholder {
    font-size: clamp(11px, 0.95vw, 16px) !important;
    line-height: 1.25 !important;
    letter-spacing: 0.01em !important;
    max-width: 12ch !important;
}

#bes-engraving-modal[data-mode="text"] [data-bes-panel="symbol"],
#bes-engraving-modal[data-mode="symbol"] [data-bes-panel="text"],
#bes-engraving-modal[data-mode="symbol"] [data-bes-panel="fonts"] {
    display: none !important;
}

#bes-engraving-modal[data-mode="text"] [data-bes-panel="text"],
#bes-engraving-modal[data-mode="text"] [data-bes-panel="fonts"],
#bes-engraving-modal[data-mode="symbol"] [data-bes-panel="symbol"] {
    display: block !important;
}

#bes-engraving-modal .bes-panel__step {
    min-width: 2ch;
}

#bes-engraving-modal .bes-symbol-tabs__button,
#bes-engraving-modal .bes-segmented__button {
    min-height: 46px !important;
}
