/* =========================================================
   "Tạo thiệp" pages (public, mobile-first)
   Colours come from the landing page variables (landing.css).
========================================================= */
.gw-page {
    --gw-radius: 16px;
    --gw-border: #ecdede;
    padding: 88px 0 calc(12px + env(safe-area-inset-bottom));
    background: var(--color-bg, #fff8f8);
    min-height: 5vh;
    color: var(--color-dark);
    font-family:
        "Be Vietnam Pro",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
}
.gw-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px;
}
.gw-container-form {
    max-width: 720px;
}
.gw-title {
    margin: 8px 0 8px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-dark);
}
.gw-lead {
    margin: 0 0 20px;
    color: var(--color-text, #666);
    font-size: 15px;
    line-height: 1.6;
}
.gw-muted {
    display: block;
    font-size: 12px;
    color: var(--color-text, #666);
}
.gw-center {
    text-align: center;
    margin: 24px 0 0;
}
.gw-empty {
    padding: 24px;
    border-radius: var(--gw-radius);
    background: #fff;
    text-align: center;
}

/* ---------------------------------------------------- steps */
.gw-steps {
    display: flex;
    gap: 6px;
    margin: 8px 0 16px;
    padding: 0;
    list-style: none;
    counter-reset: none;
}
.gw-step {
    position: relative;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
    font-size: 11px;
    color: #9a8b8b;
    text-align: center;
}
.gw-step-number {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: #fff;
    border: 1px solid var(--gw-border);
}
.gw-step.is-done .gw-step-number {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: transparent;
}
.gw-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 13px;
    left: calc(50% + 18px);
    width: calc(100% - 30px);
    height: 2px;
    background: var(--gw-border);
}
.gw-step.is-done::after {
    background: var(--color-primary);
}

/* Compact shared creation form: schema field types determine the layout. */
.gw-create-page .gw-container {
    padding-inline: 12px;
}
.gw-create-page .gw-card {
    padding: 12px;
    margin-bottom: 12px;
}
.gw-create-page .gw-fields {
    gap: 10px;
}
.gw-create-page .gw-input {
    min-height: 38px;
    padding: 6px 10px;
    box-sizing: border-box;
}
.gw-create-page .gw-lead {
    margin-bottom: 14px;
}
.gw-create-page .gw-notice {
    padding: 12px;
}
.gw-create-page .gw-fields > .gw-field-portrait {
    grid-column: span 1;
}
.gw-create-page .gw-field-portrait .gw-upload-list {
    grid-template-columns: minmax(0, 1fr);
    max-width: 120px;
}
@media (max-width: 575.98px) {
    .gw-create-page .gw-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .gw-create-page .gw-fields > .gw-field {
        grid-column: 1 / -1;
    }
    .gw-create-page
        .gw-fields
        > :is([data-field-type="date"], [data-field-type="time"]),
    .gw-create-page .gw-fields > .gw-field-portrait {
        grid-column: span 1;
    }
}
.gw-step.is-current {
    color: var(--color-primary);
    font-weight: 600;
}
.gw-step.is-current .gw-step-number {
    background: var(--color-primary);
    color: #fff;
    border-color: transparent;
}

/* ---------------------------------------------------- buttons */
.gw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.2s,
        color 0.2s,
        box-shadow 0.2s;
}
.gw-btn:focus-visible {
    outline: 3px solid rgba(var(--color-primary-rgb), 0.35);
    outline-offset: 2px;
}
.gw-btn[disabled] {
    opacity: 0.6;
    cursor: wait;
}
.gw-btn-primary {
    background: var(--color-primary);
    color: #fff;
}
.gw-btn-primary:hover {
    color: #fff;
    box-shadow: 0 10px 24px rgba(var(--color-primary-rgb), 0.22);
}
.gw-btn-outline {
    background: #fff;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.gw-btn-outline:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}
.gw-btn-light {
    background: #fff;
    color: var(--color-dark);
    border-color: var(--gw-border);
}
.gw-btn-sm {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 14px;
}
.gw-btn-block {
    width: 100%;
}
.gw-auth-form .gw-btn-google {
    margin-top: 12px;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #747775;
    color: #1f1f1f;
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.25px;
}
.gw-auth-form .gw-btn-google:hover {
    background: #f8faff;
    color: #1f1f1f;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
}
.gw-auth-form .gw-btn-google:focus-visible {
    outline: 3px solid #4285f4;
    outline-offset: 2px;
}
.gw-btn-google svg {
    flex: 0 0 20px;
}
.gw-link-danger {
    border: 0;
    background: none;
    color: #b42318;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 4px;
    cursor: pointer;
}

/* ---------------------------------------------------- template list */
.gw-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    margin: 8px 0 20px;
    list-style: none;
    font-size: 14px;
    overflow-wrap: anywhere;
}
.gw-breadcrumb li + li::before {
    content: "/";
    margin-right: 8px;
    color: var(--color-text, #666);
}
.gw-breadcrumb a {
    color: var(--color-primary);
}
.gw-catalogue-banner {
    display: block;
    overflow: hidden;
    aspect-ratio: 3 / 1;
    border-radius: var(--gw-radius);
    margin-bottom: 20px;
}
.gw-catalogue-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gw-catalogue-heading {
    margin-bottom: 24px;
}
.gw-catalogue-pagination {
    margin-top: 24px;
}
.gw-catalogue-pagination .pagination {
    flex-wrap: wrap;
    gap: 4px;
}
.gw-catalogue-pagination .page-link {
    color: var(--color-primary);
}
.gw-catalogue-pagination .active > .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.gw-template-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.gw-template-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--gw-radius);
    background: #fff;
    box-shadow: 0 8px 24px rgba(var(--color-primary-rgb), 0.08);
}
.gw-template-thumb {
    display: block;
    position: relative;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--color-primary-light);
}
.gw-template-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}
.gw-template-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    flex: 1;
}
.gw-template-name {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--color-dark);
}
.gw-template-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}
.gw-template-actions .gw-btn {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 14px;
}

/* ---------------------------------------------------- form */
.gw-template-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: var(--gw-radius);
    background: #fff;
    border: 1px solid var(--gw-border);
}
.gw-template-summary img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.gw-template-summary-text {
    flex: 1;
    min-width: 0;
}
.gw-template-summary-text strong {
    display: block;
    overflow-wrap: anywhere;
}
.gw-template-summary-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.gw-template-summary-links .gw-btn {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}
.gw-center a {
    color: var(--color-primary);
    font-weight: 600;
}
.gw-card {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: var(--gw-radius);
    background: #fff;
    border: 1px solid var(--gw-border);
}
.gw-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.gw-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--color-dark);
}
.gw-card-help {
    margin-top: 6px;
}
.gw-card-body {
    min-width: 0;
    margin: 12px 0 0;
    padding: 0;
    border: 0;
}
.gw-card-body[hidden] {
    display: none;
}
.gw-card-muted {
    background: #faf6f6;
}
.gw-card-secret {
    border-color: var(--color-primary);
}
.gw-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}
.gw-field {
    min-width: 0;
}
.gw-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-dark);
}
.gw-required {
    margin-left: 2px;
    color: #b42318;
}
.gw-input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d9c9c9;
    background: #fff;
    font-size: 16px; /* no zoom on iOS */
    line-height: 1.4;
    color: var(--color-dark);
}
/* iOS Safari: native date/time inputs ignore width:100% and overflow their container */
.gw-input[type="date"],
.gw-input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    text-align: left;
}
.gw-input[type="date"]::-webkit-date-and-time-value,
.gw-input[type="time"]::-webkit-date-and-time-value {
    margin: 0;
    text-align: left;
}
textarea.gw-input {
    min-height: 88px;
    resize: vertical;
}
body .gw-page .gw-input:focus,
body .gw-page .gw-input:focus-visible {
    outline: none;
    border-color: rgba(var(--color-primary-rgb), 0.9);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.08);
}
.has-error .gw-input {
    border-color: #b42318;
}
.gw-help {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text, #666);
}
.gw-error {
    margin: 6px 0 0;
    font-size: 13px;
    color: #b42318;
    font-weight: 600;
}
.gw-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

/* switches */
.gw-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
}
.gw-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.gw-switch-track {
    position: relative;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: #d9c9c9;
    transition: background-color 0.2s;
}
.gw-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}
.gw-switch input:checked + .gw-switch-track {
    background: var(--color-primary);
}
.gw-switch input:checked + .gw-switch-track::after {
    transform: translateX(18px);
}
.gw-switch input:focus-visible + .gw-switch-track {
    outline: 3px solid rgba(var(--color-primary-rgb), 0.35);
    outline-offset: 2px;
}
.gw-switch-row + .gw-switch-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gw-border);
}

/* photo upload */
.gw-upload-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.gw-upload-item,
.gw-upload-add {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
}
.gw-upload-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gw-upload-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.gw-upload-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 2px dashed #d9c9c9;
    background: #fffafa;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
.gw-upload-add[hidden] {
    display: none;
}
.gw-upload-add:focus-within {
    outline: 3px solid rgba(var(--color-primary-rgb), 0.35);
}
.gw-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.gw-upload-plus {
    font-size: 26px;
    line-height: 1;
}
.gw-upload-item.is-uploading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3e9e9;
    font-size: 12px;
    color: var(--color-text, #666);
}
.gw-upload-status:empty {
    display: none;
}
.gw-upload-status {
    margin-top: 6px;
    font-size: 13px;
    color: #b42318;
    font-weight: 600;
}

/* repeaters */
.gw-repeater-items {
    display: grid;
    gap: 12px;
    margin-bottom: 10px;
}
.gw-repeater-item {
    padding: 12px;
    border-radius: 12px;
    background: #fdf8f8;
    border: 1px solid var(--gw-border);
}
.gw-repeater-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.gw-repeater-title {
    font-weight: 700;
    font-size: 14px;
}

/* appearance */
.gw-choice-group {
    margin: 16px 0 0;
    padding: 0;
    border: 0;
    min-width: 0;
}
.gw-choices {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.gw-choices-swatch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.gw-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--gw-border);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
}
.gw-choice.is-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.15);
}
.gw-choice input {
    accent-color: var(--color-primary);
    flex-shrink: 0;
}
.gw-choice-text {
    min-width: 0;
    overflow-wrap: anywhere;
}
.gw-choice-default {
    display: block;
    font-size: 11px;
    color: var(--color-text, #666);
}
.gw-audio {
    width: 100%;
    height: 40px;
}

/* notices */
.gw-alert {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.55;
}
.gw-alert ul,
.gw-notice ul,
.gw-list {
    margin: 6px 0 0;
    padding-left: 20px;
}
.gw-alert-error {
    background: #fdecea;
    color: #8a1c12;
    border: 1px solid #f5c2bd;
}
.gw-alert-warning {
    background: #fff6e5;
    color: #6b4a00;
    border: 1px solid #f3d999;
}
.gw-notice {
    margin: 0 0 16px;
    padding: 14px;
    border-radius: var(--gw-radius);
    background: #fff;
    border: 1px dashed var(--color-primary);
    font-size: 14px;
    line-height: 1.6;
}
.gw-list {
    font-size: 14px;
    line-height: 1.6;
}
.gw-list li + li,
.gw-notice li + li {
    margin-top: 4px;
}

/* sticky actions (thumb reach on phones) */
.gw-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 248, 248, 0.96);
    border-top: 1px solid var(--gw-border);
    backdrop-filter: blur(8px);
}

/* Public create/edit forms keep their controls at the viewport bottom, including safe areas. */
.gw-editor-page {
    padding-bottom: calc(var(--gw-actions-height, calc(100px + env(safe-area-inset-bottom))) + 12px);
}
.gw-editor-page .gw-actions {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 720px;
    margin: 0;
    border-radius: 16px 16px 0 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    z-index: 1035;
    box-shadow: 0 -4px 20px rgba(31, 31, 31, 0.08);
}
.gw-editor-page .gw-actions > .gw-btn {
    min-width: 0;
}
.gw-editor-page :is(input, textarea, select) {
    scroll-margin-bottom: calc(var(--gw-actions-height, calc(100px + env(safe-area-inset-bottom))) + 12px);
}

/* Terms checkbox of the "Tạo thiệp" form: first row of the action bar, above the buttons. */
.gw-editor-page.gw-has-terms {
    padding-bottom: calc(var(--gw-actions-height, calc(164px + env(safe-area-inset-bottom))) + 12px);
}
.gw-editor-page.gw-has-terms :is(input, textarea, select) {
    scroll-margin-bottom: calc(var(--gw-actions-height, calc(164px + env(safe-area-inset-bottom))) + 12px);
}
.gw-terms {
    grid-column: 1 / -1;
}
.gw-terms-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-dark);
    cursor: pointer;
}
.gw-terms-check input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--color-primary);
}
.gw-terms-check a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.gw-terms-error {
    margin-top: 4px;
    padding-left: 30px;
}

/* Legal pages (Chính sách bảo mật, Điều khoản sử dụng) */
.gw-legal-updated {
    margin: -12px 0 16px;
    font-size: 13px;
    color: var(--color-text, #666);
}
.gw-legal-content {
    font-size: 15px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}
.gw-legal-content > :first-child {
    margin-top: 0;
}
.gw-legal-content > :last-child {
    margin-bottom: 0;
}
.gw-legal-content :is(h2, h3, h4) {
    margin: 24px 0 8px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--color-dark);
}
.gw-legal-content :is(h3, h4) {
    margin: 16px 0 6px;
    font-size: 15px;
}
.gw-legal-content :is(p, ul, ol) {
    margin: 0 0 12px;
}
.gw-legal-content :is(ul, ol) {
    padding-left: 22px;
}
.gw-legal-content li + li {
    margin-top: 4px;
}
.gw-legal-content a {
    color: var(--color-primary);
    text-decoration: underline;
}
.gw-legal-content img {
    max-width: 100%;
    height: auto;
}
.gw-legal-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}
.gw-legal-content :is(td, th) {
    padding: 6px 10px;
    border: 1px solid var(--gw-border);
}
.gw-legal-more {
    margin: 16px 0 0;
    font-size: 14px;
}
.gw-legal-more a {
    color: var(--color-primary);
    font-weight: 600;
}

/* success */
.gw-success-head {
    text-align: center;
}
.gw-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e7f6ec;
    color: #1e7b3c;
    font-size: 28px;
    font-weight: 700;
}
.gw-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.gw-copy-value {
    font-size: 15px;
}
.gw-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: center;
}
.gw-copy-feedback {
    min-height: 20px;
    margin: 6px 0 8px;
    font-size: 13px;
    color: #1e7b3c;
    font-weight: 600;
}

/* preview overlay: the invitation keeps its mobile width on every screen */
.gw-preview {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: rgba(31, 31, 31, 0.7);
}
.gw-preview[hidden] {
    display: none;
}
.gw-preview-dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 430px;
    background: #fff;
}
.gw-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--gw-border);
}
.gw-preview-frame {
    flex: 1;
    width: 100%;
    border: 0;
    background: #fff;
}
body.gw-preview-open {
    overflow: hidden;
}

@media (min-width: 576px) {
    .gw-title {
        font-size: 28px;
    }
    .gw-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .gw-field-wide {
        grid-column: 1 / -1;
    }
    .gw-upload-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .gw-choices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .gw-choices-swatch {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .gw-copy {
        flex-direction: row;
    }
    .gw-copy .gw-input {
        flex: 1;
    }
    .gw-template-actions {
        flex-direction: row;
    }
    .gw-template-actions .gw-btn {
        flex: 1;
    }
}

@media (min-width: 768px) {
    .gw-page {
        padding-top: 110px;
    }
    .gw-template-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }
    .gw-card {
        padding: 20px 24px;
    }
    .gw-actions {
        margin: 0;
        border: 1px solid var(--gw-border);
        border-radius: var(--gw-radius);
        bottom: 12px;
    }
    .gw-preview {
        padding: 24px 0;
    }
    .gw-preview-dialog {
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    }
}

@media (min-width: 992px) {
    .gw-template-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .gw-btn,
    .gw-switch-track,
    .gw-switch-track::after {
        transition: none;
    }
}

/* =========================================================
   Customer area (Phase 3B): account pages, "Thiệp của tôi",
   ownership claims and trial status. Mobile-first.
========================================================= */
.gw-container-narrow {
    max-width: 440px;
}
.gw-fields-single {
    grid-template-columns: minmax(0, 1fr) !important;
}
.gw-mt {
    margin-top: 16px;
}
.gw-mt-sm {
    margin-top: 8px;
}
.gw-small {
    font-size: 14px;
}
.gw-break {
    overflow-wrap: anywhere;
}
.gw-check-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-size: 15px;
    cursor: pointer;
}
.gw-check-inline input {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}
.gw-alert-success {
    background: #e7f6ec;
    color: #14532d;
    border: 1px solid #b7e1c4;
}
.gw-account-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 8px;
    font-size: 14px;
    color: var(--color-text, #666);
}
.gw-account-email {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gw-link-plain {
    flex: none;
    min-height: 44px;
    padding: 0 4px;
    border: 0;
    background: none;
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.gw-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 0 0 16px;
    padding: 4px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--gw-border, #ecdede);
}
.gw-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--color-dark);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}
.gw-tab.is-active {
    background: var(--color-primary);
    color: #fff;
}
.gw-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 12px;
}
.gw-page-head .gw-title {
    margin: 0;
}
.gw-wedding-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.gw-wedding-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 10px;
}
.gw-wedding-head .gw-card-title {
    min-width: 0;
    overflow-wrap: anywhere;
}
.gw-help-tight {
    margin-top: 4px;
}
.gw-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.gw-badge-warning {
    background: #fff6e5;
    color: #6b4a00;
}
.gw-badge-danger {
    background: #fdecea;
    color: #8a1c12;
}
.gw-badge-success {
    background: #e7f6ec;
    color: #14532d;
}
.gw-badge-secondary {
    background: #f1eeee;
    color: #555;
}
.gw-trial-line {
    margin: 8px 0 0;
    font-size: 14px;
    font-weight: 600;
    color: #6b4a00;
}
.gw-trial-line.is-expired {
    color: #8a1c12;
}
.gw-card-trial {
    border-color: #f3d999;
    background: #fffaf0;
}
.gw-trial-text {
    margin: 8px 0 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.55;
}
.gw-activation-help {
    margin-top: 12px;
}
.gw-contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.gw-facts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    margin: 12px 0 0;
    font-size: 15px;
}
.gw-facts dt {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text, #666);
}
.gw-facts dd {
    margin: 0;
}
.gw-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.gw-account-note {
    font-size: 14px;
}
@media (min-width: 576px) {
    .gw-facts {
        grid-template-columns: 140px minmax(0, 1fr);
        gap: 8px 12px;
    }
    .gw-facts dt {
        margin-top: 0;
    }
}

/* ---------------------------------------------------- Phase 3C: price, invoice and bank transfer QR */
.tpl-price {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
}
.tpl-price-original {
    color: var(--color-text, #666);
    font-size: 13px;
}
.tpl-price-amount {
    color: var(--color-primary);
}
.gw-template-price {
    display: flex;
    margin-top: 2px;
    font-size: 15px;
}
.gw-card-payment {
    border-color: #f3d999;
}
.gw-trial-notice {
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.55;
}
.gw-invoice,
.gw-transfer {
    display: grid;
    gap: 6px;
    margin: 14px 0 0;
}
.gw-invoice > div,
.gw-transfer > div {
    display: grid;
    grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}
.gw-invoice dt,
.gw-transfer dt {
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text, #666);
}
.gw-invoice dd,
.gw-transfer dd {
    margin: 0;
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.gw-invoice-total dd {
    color: var(--color-primary);
    font-size: 20px;
}
.gw-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 16px 0 0;
    text-align: center;
}
.gw-qr img {
    width: min(296px, 100%);
    height: auto;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--gw-border);
    border-radius: 12px;
    background: #fff;
    image-rendering: pixelated;
}
.gw-qr figcaption {
    max-width: 320px;
}
.gw-copy-inline {
    display: flex;
    gap: 6px;
}
.gw-copy-inline .gw-input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 6px 10px;
    font-weight: 700;
}
.gw-copy-inline .gw-btn {
    flex: none;
    min-height: 40px;
}
.gw-payment-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
}
.gw-order-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 10px 0 0;
    font-size: 14px;
}
@media (max-width: 359px) {
    .gw-invoice > div,
    .gw-transfer > div {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }
}

/* =========================================================
   Phase 3D: management of a paid invitation (customer area)
========================================================= */
.gw-back-link {
    display: inline-block;
    margin: 4px 0 2px;
    font-size: 14px;
    color: var(--color-text, #666);
}
.gw-manage-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin-bottom: 12px;
}
.gw-manage-head .gw-title {
    margin: 0;
    overflow-wrap: anywhere;
}
.gw-manage-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
/* Tabs scroll sideways on small screens instead of wrapping into a second row. */
.gw-manage-tabs {
    display: flex;
    gap: 6px;
    margin: 0 -16px 16px;
    padding: 2px 16px 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.gw-manage-tabs::-webkit-scrollbar {
    display: none;
}
.gw-manage-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--gw-border, #ecdede);
    background: #fff;
    color: var(--color-dark);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.gw-manage-tab:hover {
    color: var(--color-primary);
}
.gw-manage-tab.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.gw-manage-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 4px 0 8px;
}
.gw-manage-locked {
    margin: 4px 0 10px;
}
.gw-publish-state {
    margin: 0 0 8px;
    font-size: 14px;
}
.gw-publish-state.is-changed {
    color: #9a5b00;
}
.gw-publish-dirty {
    margin: 0 0 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #fff4e5;
    color: #7a4500;
    font-size: 14px;
}
.gw-publish-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.gw-publish-actions form,
.gw-publish-actions .gw-btn {
    width: 100%;
}
.gw-textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.5;
}
.gw-guest-list,
.gw-wish-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}
.gw-guest-item,
.gw-wish-item {
    padding: 12px 0;
    border-top: 1px solid var(--gw-border, #ecdede);
}
.gw-guest-item.is-new {
    margin: 0 -12px;
    padding: 12px;
    border-radius: 12px;
    background: #f1fbf4;
}
.gw-guest-name,
.gw-wish-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}
.gw-guest-item .gw-copy {
    margin-top: 6px;
}
.gw-guest-item .gw-copy-feedback {
    margin: 4px 0 0;
}
.gw-guest-actions,
.gw-wish-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.gw-guest-rename {
    flex: 1 1 220px;
}
.gw-guest-rename summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
    font-weight: 600;
}
.gw-inline-form {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.gw-inline-form .gw-input {
    flex: 1 1 auto;
    min-width: 0;
}
.gw-guest-actions .gw-link-danger,
.gw-wish-actions .gw-link-danger {
    min-height: 44px;
}
.gw-wish-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}
.gw-wish-message {
    margin: 6px 0 8px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.55;
}
.gw-wish-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.gw-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 8px 0 12px;
}
.gw-stat {
    padding: 10px 12px;
    border-radius: 12px;
    background: #faf5f5;
}
.gw-stat dt {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text, #666);
}
.gw-stat dd {
    margin: 2px 0 0;
    font-size: 24px;
    font-weight: 700;
}
.gw-stat.is-yes dd {
    color: #1e7b3c;
}
.gw-stat.is-no dd {
    color: #b42318;
}
.gw-stat-wide {
    grid-column: 1 / -1;
}
.gw-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 4px;
}
.gw-filter-item {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--gw-border, #ecdede);
    color: var(--color-dark);
    font-size: 13px;
    text-decoration: none;
}
.gw-filter-item.is-active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 700;
}
@media (min-width: 768px) {
    .gw-manage-tabs {
        margin: 0 0 20px;
        padding: 2px 0 6px;
    }
    .gw-manage-actions {
        grid-template-columns: repeat(4, 1fr);
    }
    .gw-stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .gw-guest-item .gw-copy {
        flex-direction: row;
    }
    .gw-guest-item .gw-copy .gw-input {
        flex: 1 1 auto;
    }
}
