*,
*::before,
*::after {
    border-radius: 0 !important;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --ink-deep: #080f26;
    --header-h: 80px;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Jost', sans-serif;
    background-color: var(--ink-deep);
    min-height: 100vh;
    min-height: 100dvh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(8, 15, 38, 0.74), rgba(8, 15, 38, 0.74)),
        url('./assets/bg.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}


.card {
    background: #fff;
    width: 70%;
    max-width: 100%;
    padding: 40px;
    margin: calc(var(--header-h) + 20px) auto 100px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header img {
    max-width: 150px;
    height: auto;
}

.header h1 {
    font-size: 24px;
    color: #080f26;
    margin-bottom: 5px;
    font-weight: 300;
}

.header p {
    color: #64748b;
    font-size: 14px;
}

.alert {
    padding: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid transparent;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #4ade80;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #f87171;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    font-weight: 300 !important;
    font-size: 16px;
    color: #334155;
    margin: 15px 0 15px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    font-family: inherit;
    font-size: 16px;
    outline: none;
    background-color: #fff;
    transition: border-color 0.2s;
}

.field input:focus,
.field textarea:focus {
    border-color: #6557e8;
}

.field textarea {
    resize: vertical;
    min-height: 120px;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
    gap: 12px;
    margin-top: 5px;
    border-bottom: 1px solid var(--ink-deep);
}

.type-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    color: #475569;
    transition: all 0.2s ease;
    user-select: none;
}

.type-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.type-card:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.type-card:has(input:checked) {
    border-color: #080f26;
    background: #080f26;
    color: #fff;
}

.price-display {
    background: #f8fafc;
    padding: 16px;
    font-weight: 300;
    font-size: 18px;
    color: #6557e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

button {
    padding: 14px 24px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 300;
    cursor: pointer;
    border: none;
    transition: background 0.2s, opacity 0.2s;
}

button.primary {
    background: #6557e8;
    color: #fff;
    flex: 1;
}

button.primary:hover {
    background: #4f46e5;
}

button.secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

button.secondary:hover {
    background: #e2e8f0;
}

.announcement-template {
    font-size: 16px;
    line-height: 2.4;
    color: #1a1a1a;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.blank-wrapper {
    display: inline-block;
    position: relative;
    max-width: 100%;
}

.field .blank-input[type="text"] {
    border: none;
    border-bottom: 2px solid #6557e8;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #6557e8;
    text-align: center;
    outline: none;
    padding: 0 4px;
    width: 120px;
    min-width: 120px;
    max-width: 100%;
    transition: border-color 0.2s;
}

.field .blank-input[type="text"]:focus {
    border-bottom-color: #4f46e5;
    background: #f0f0ff;
}

.blank-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
    font-style: italic;
}

.custom-select {
    position: relative;
    width: 100%;
    user-select: none;
}

.custom-select select.custom-select-native {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1a1a1a;
    font-family: inherit;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-select-trigger:hover {
    border-color: #94a3b8;
}

.custom-select.is-open .custom-select-trigger {
    border-color: #6557e8;
    box-shadow: 0 0 0 1px #6557e8;
}

.custom-select-trigger.is-placeholder {
    color: #94a3b8;
}

.custom-select-trigger[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

.custom-select-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #64748b;
    transition: transform 0.2s;
}

.custom-select.is-open .custom-select-arrow {
    transform: rotate(180deg);
    color: #6557e8;
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.custom-select.is-open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.custom-select-option:hover,
.custom-select-option.is-active {
    background: #f1f5f9;
}

.custom-select-option.is-selected {
    color: #6557e8;
    font-weight: 500;
    background: #f0f0ff;
}

.custom-select-option.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dynamic-fields {
    display: none;
    grid-column: 1 / -1;
    gap: 20px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dynamic-fields.active {
    display: grid;
}

dialog.pay-modal {
    margin: auto;
    width: min(460px, calc(100% - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 0;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #1a1a1a;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

dialog.pay-modal::backdrop {
    background: rgba(26, 26, 26, 0.55);
}

.pay-panel {
    padding: 32px;
}

.pay-panel[hidden] {
    display: none;
}

.pay-panel h2 {
    font-size: 20px;
    color: #6557e8;
    margin-bottom: 6px;
}

.pay-panel p {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
}

.pay-panel .price-display {
    margin: 0 0 8px;
}

.pay-panel .actions {
    margin-top: 20px;
}

.pay-error {
    color: #991b1b;
    font-weight: 500;
    min-height: 20px;
    margin: 8px 0 0 !important;
}

.pay-failed h2 {
    color: #991b1b;
}

.pay-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #6557e8;
    border-radius: 50% !important;
    margin-bottom: 16px;
    animation: pay-spin 0.9s linear infinite;
}

@keyframes pay-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .pay-spinner {
        animation: none;
        border-right-color: #6557e8;
    }
}

@media (max-width: 1024px) {
    .card {
        width: 90%;
        padding: 32px;
    }
}

@media (max-width: 768px) {
    .card {
        width: 94%;
        padding: 24px;
        margin-bottom: 40px;
    }

    .form-grid,
    .dynamic-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .field label {
        margin: 8px 0;
    }

    .announcement-template {
        padding: 16px;
        line-height: 2.6;
    }

    .actions {
        margin-top: 24px;
    }
}

@media (max-width: 640px) {
    :root {
        --header-h: 64px;
    }

    .card {
        width: calc(100% - 24px);
        padding: 20px 16px;
        margin-bottom: 24px;
    }

    .header {
        margin-bottom: 20px;
    }

    .header img {
        max-width: 120px;
    }

    .header h1 {
        font-size: 20px;
    }

    .price-display {
        padding: 14px;
        font-size: 16px;
    }

    .actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .actions .primary {
        order: -1;
    }

    .pay-panel {
        padding: 24px 20px;
    }
}

.empty-state-svg {
    margin-bottom: 20px;
}

.empty-state-svg svg {
    color: #f5f5f5;
}

.empty-state h2 {
    font-weight: 300;
}

.header-section {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    height: var(--header-h);
    padding: 8px clamp(12px, 3vw, 32px);
    padding-left: max(clamp(12px, 3vw, 32px), env(safe-area-inset-left, 0px));
    padding-right: max(clamp(12px, 3vw, 32px), env(safe-area-inset-right, 0px));
    background-color: #fff;
    box-sizing: border-box;
}

.header-right-section,
.header-left-section {
    display: flex;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}

.header-left-section {
    margin-left: auto;
}

.header-section a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    padding: 0 20px;
    background-color: #fff;
    color: var(--ink-deep);
    border: 1.5px solid var(--ink-deep);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.1;
    text-decoration: none;
    text-transform: capitalize;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s, color 0.2s;
}

.header-left-section a {
    flex-direction: column;
    gap: 6px;
    padding: 0 16px;
}

.header-section a:hover {
    background-color: var(--ink-deep);
    color: #fff;
}

.header-section a:focus-visible {
    outline: 2px solid var(--ink-deep);
    outline-offset: 2px;
}

.header-section svg {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
}

.header-section span {
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 720px) {
    .header-section {
        align-items: center;
        gap: 8px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .header-right-section,
    .header-left-section {
        height: 100%;
    }

    .header-section a {
        font-size: 14px;
    }

    .header-right-section a {
        gap: 4px;
        padding: 0 12px;
    }

    .header-left-section a {
        width: 44px;
        padding: 0;
    }

    .header-left-section a span {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .header-section svg {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 360px) {
    .header-section {
        gap: 6px;
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(8px, env(safe-area-inset-right, 0px));
    }

    .header-right-section a {
        padding: 0 8px;
        font-size: 13px;
    }

    .header-left-section a {
        width: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-section a {
        transition: none;
    }
}