:root {
    --primary: #21c15a;
    --primary-foreground: #ffffff;
    --ring: #21c15a;
}

.dark {
    --primary: #2ad66d;
    --primary-foreground: #ffffff;
    --ring: #2ad66d;
}

.page-bg {
    background-image: url('/metronic-assets/media/images/2600x1200/bg-10.png');
}

.dark .page-bg {
    background-image: url('/metronic-assets/media/images/2600x1200/bg-10-dark.png');
}

.text-danger,
.field-validation-error {
    color: #dc2626;
    font-size: 12px;
}

.validation-summary-errors {
    color: #dc2626;
    font-size: 13px;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 16px;
}

.kt-table td form {
    margin: 0;
}

button.plan-option {
    width: 100%;
    text-align: left;
    cursor: pointer;
    background: transparent;
    border: 1px solid #d1d5db;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

button.plan-option:hover {
    border-color: var(--primary);
}

button.plan-option.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

button.plan-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 193, 90, 0.25);
}

.landing-plans-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.chatbot-stats-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

.client-dashboard-row {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

.billing-cycle-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.billing-cycle-option {
    width: 100%;
    text-align: left;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.billing-cycle-option:hover {
    border-color: var(--primary);
}

.billing-cycle-option.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.billing-cycle-option.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.billing-cycle-option.is-disabled:hover {
    border-color: #d1d5db;
}

.billing-cycle-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 193, 90, 0.22);
}

.clip-checkout-host {
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #ffffff;
    min-height: 240px;
    padding: 12px;
}

.clip-checkout-error {
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.4;
}

.payment-submit-btn {
    min-width: 190px;
    font-weight: 600;
    background: #22c55e !important;
    border: 1px solid #22c55e !important;
    color: #ffffff !important;
}

.payment-submit-btn:hover:not(:disabled) {
    background: #16a34a !important;
    border-color: #16a34a !important;
}

.payment-submit-btn:disabled {
    opacity: 0.65 !important;
    color: #ffffff !important;
}

.payment-submit-btn #pay-subscription-btn-label {
    color: inherit !important;
    -webkit-text-fill-color: currentColor;
}

.payments-history-table-wrap {
    padding-bottom: 20px;
}

.payment-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
}

.payment-status-paid {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.payment-status-pending {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde047;
}

.payment-status-failed {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.payment-status-refunded {
    background: #dbeafe;
    color: #1e3a8a;
    border-color: #93c5fd;
}

@media (min-width: 768px) {
    .landing-plans-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .landing-plan-option-wide {
        grid-column: 1 / -1;
    }

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

    .client-dashboard-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .chatbot-stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .billing-cycle-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.context-upload-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 18px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.context-upload-dropzone.is-dragover {
    border-color: var(--primary);
    background: #f0fdf4;
}

.context-upload-queue {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

.context-upload-item {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fff;
}

.context-upload-item.status-uploaded {
    border-color: #86efac;
    background: #f0fdf4;
}

.context-upload-item.status-error {
    border-color: #fca5a5;
    background: #fef2f2;
}

.context-upload-item.status-uploading {
    border-color: #93c5fd;
    background: #eff6ff;
}

.context-upload-item-main {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.context-upload-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.context-upload-item-meta {
    font-size: 12px;
    color: #6b7280;
}

.context-upload-item-message {
    font-size: 12px;
    color: #374151;
}

.chatbot-endpoint-accordion {
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}

.chatbot-endpoint-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f9fafb;
}

.chatbot-endpoint-summary::-webkit-details-marker {
    display: none;
}

.chatbot-endpoint-content {
    padding: 14px;
    border-top: 1px solid #e5e7eb;
}

.chatbot-endpoint-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    user-select: none;
}

.chatbot-endpoint-switch input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #22c55e;
}

.endpoint-test-result {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    padding: 10px 12px;
}

.endpoint-test-result.is-success {
    border-color: #86efac;
    background: #f0fdf4;
}

.endpoint-test-result.is-error {
    border-color: #fca5a5;
    background: #fef2f2;
}

.endpoint-test-meta {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.endpoint-test-body {
    margin: 0;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 260px;
    overflow: auto;
}

.whatsapp-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #fca5a5;
    background: #fef2f2;
    color: #991b1b;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    max-width: 100%;
}

.whatsapp-status-text {
    display: block;
}

.app-header-shell {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.header-mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.header-user-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem;
    width: 100%;
}

.header-user-actions form {
    flex-shrink: 0;
}

.header-whatsapp-pill {
    min-width: 0;
    flex: 1 1 auto;
}

.whatsapp-status-pill.connected {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.whatsapp-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #ef4444;
    flex-shrink: 0;
}

.whatsapp-status-pill.connected .whatsapp-status-dot {
    background: #22c55e;
    animation: whatsapp-status-pulse 1.2s ease-in-out infinite;
}

@media (min-width: 64rem) {
    .app-header-shell {
        flex-wrap: nowrap;
        gap: 1rem;
    }

    .header-mobile-brand {
        display: none;
    }

    .header-user-actions {
        width: auto;
        margin-left: auto;
        justify-content: flex-end;
    }

    .header-whatsapp-pill {
        flex: 0 0 auto;
        max-width: 320px;
    }
}

.qr-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
}

.qr-image {
    width: min(360px, 100%);
    height: auto;
    image-rendering: crisp-edges;
}

@keyframes whatsapp-status-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
        opacity: 1;
    }

    70% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
        opacity: 0.9;
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
        opacity: 1;
    }
}
