:root {
    --celeste: #00b4d8;
    --celeste-light: #90e0ef;
    --celeste-dark: #0096c7;
    --violeta: #6e45e2;
    --violeta-light: #9d7bea;
    --fondo: #f7f8fc;
    --blanco: #ffffff;
    --gris-claro: #e9ecf2;
    --gris-texto: #64748b;
    --texto: #1e293b;
    --ok: #119e6f;
    --danger: #c53030;
    --gradiente: linear-gradient(135deg, var(--violeta) 0%, var(--celeste) 100%);
    --gradiente-suave: linear-gradient(135deg, rgba(110, 69, 226, 0.1) 0%, rgba(0, 180, 216, 0.1) 100%);
    --sombra-suave: 0 4px 20px rgba(0, 0, 0, 0.08);
    --sombra-media: 0 10px 36px rgba(31, 41, 55, 0.14);
    --radio-md: 16px;
    --radio-lg: 24px;
    --radio-xl: 40px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: "Poppins", "Segoe UI", sans-serif;
    color: var(--texto);
    background: var(--fondo);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle at 15% 20%, rgba(144, 224, 239, 0.45) 0%, rgba(144, 224, 239, 0) 40%),
        radial-gradient(circle at 85% 78%, rgba(157, 123, 234, 0.34) 0%, rgba(157, 123, 234, 0) 38%);
}

.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.page.page-full {
    display: block;
    padding: 0;
}

.card,
.dashboard {
    background: var(--blanco);
    border: 1px solid var(--gris-claro);
    box-shadow: var(--sombra-media);
}

.card {
    width: min(470px, 100%);
    border-radius: var(--radio-lg);
    padding: 32px;
    position: relative;
    overflow: hidden;
}

.card::before,
.dashboard::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 5px;
    background: var(--gradiente);
}

.logo {
    display: inline-flex;
    align-items: center;
    margin-bottom: 8px;
}

.logo img {
    height: 46px;
    width: auto;
}

h1 {
    margin: 8px 0 10px;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.2;
}

p {
    margin: 0 0 18px;
    color: var(--gris-texto);
    line-height: 1.6;
}

label {
    display: block;
    margin: 14px 0 7px;
    color: var(--texto);
    font-size: 0.92rem;
    font-weight: 600;
}

input {
    width: 100%;
    border: 2px solid var(--gris-claro);
    background: #fdfdff;
    color: var(--texto);
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--celeste);
    box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.15);
}

.btn {
    text-decoration: none;
    width: 100%;
    border: 0;
    margin-top: 18px;
    border-radius: var(--radio-xl);
    padding: 12px 18px;
    background: var(--gradiente);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(110, 69, 226, 0.24);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(110, 69, 226, 0.3);
}

.alert {
    margin-top: 14px;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 0.92rem;
    border: 1px solid transparent;
}

.dashboard-alert {
    margin: 16px 20px 0;
}

.alert.error {
    border-color: rgba(197, 48, 48, 0.26);
    background: rgba(197, 48, 48, 0.1);
    color: var(--danger);
}

.alert.success {
    border-color: rgba(17, 158, 111, 0.3);
    background: rgba(17, 158, 111, 0.12);
    color: var(--ok);
}

.dashboard {
    width: min(1000px, 100%);
    border-radius: var(--radio-lg);
    overflow: hidden;
    position: relative;
}

.app-shell {
    display: flex;
    min-height: inherit;
}

.sidebar {
    width: 74px;
    background: #fdfdff;
    border-right: 1px solid var(--gris-claro);
    padding: 16px 8px;
    overflow: hidden;
    transition: width 0.26s ease;
}

.sidebar:hover,
.sidebar:focus-within {
    width: 246px;
}

.sidebar-brand {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    width: 100%;
    flex: 0 0 auto;
}

.sidebar-brand img {
    width: 46px;
    height: 46px;
    max-width: none;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.sidebar:hover .sidebar-brand img,
.sidebar:focus-within .sidebar-brand img {
    width: 52px;
    height: 52px;
}

.sidebar:not(:hover):not(:focus-within) .sidebar-brand img {
    width: 46px;
    height: 46px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px;
    border-radius: 14px;
    color: #4f5f77;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar:hover .nav-item,
.sidebar:focus-within .nav-item {
    justify-content: flex-start;
}

.sidebar:not(:hover):not(:focus-within) .nav-item {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
}

.nav-item:hover {
    background: var(--gradiente-suave);
    border-color: rgba(110, 69, 226, 0.14);
    color: var(--violeta);
}

.nav-item.active {
    background: var(--gradiente-suave);
    color: var(--violeta);
    border-color: rgba(110, 69, 226, 0.22);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
}

.nav-icon svg {
    width: 22px;
    height: 22px;
}

.nav-label {
    white-space: nowrap;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    font-size: 0.92rem;
    font-weight: 600;
    transition: max-width 0.24s ease, opacity 0.18s ease;
}

.sidebar:hover .nav-label,
.sidebar:focus-within .nav-label {
    max-width: 140px;
    opacity: 1;
}

.sidebar:not(:hover):not(:focus-within) .nav-label {
    display: none;
}

.app-content {
    flex: 1;
    min-width: 0;
}

.coming-soon {
    margin: 22px;
    padding: 48px 36px;
    border-radius: var(--radio-lg);
    border: 1px solid var(--gris-claro);
    background: linear-gradient(135deg, rgba(110, 69, 226, 0.08) 0%, rgba(0, 180, 216, 0.08) 100%);
    text-align: center;
    box-shadow: var(--sombra-suave);
}

.coming-soon h2 {
    margin: 0 0 12px;
    color: var(--violeta);
    font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.coming-soon p {
    margin: 0 auto;
    max-width: 680px;
    font-size: 1.02rem;
}

.dashboard.dashboard-full {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gris-claro);
    background: var(--gradiente-suave);
}

.topbar-subtitle {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--gris-texto);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stripe-balance {
    margin: 0;
    font-size: 0.92rem;
    white-space: nowrap;
}

.topbar .logo {
    margin: 0 0 6px;
}

.title {
    margin: 0;
    font-size: 1.24rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 20px;
}

.box {
    border: 1px solid var(--gris-claro);
    border-radius: var(--radio-md);
    background: #fff;
    padding: 16px;
    box-shadow: var(--sombra-suave);
}

.box h2 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--violeta);
}

.payments-grid {
    align-items: start;
}

.table-box {
    grid-column: 1 / -1;
}

.payments-search {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--gris-claro);
    border-radius: 14px;
    background: #fbfcff;
}

.payments-search-fields {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

.payments-search-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.payments-search-actions .btn {
    margin-top: 0;
    width: auto;
    min-width: 120px;
}

.btn.btn-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--violeta);
    border: 2px solid rgba(110, 69, 226, 0.28);
    box-shadow: none;
    text-decoration: none;
}

.btn.btn-clear:hover {
    transform: translateY(-1px);
    box-shadow: none;
}

.payment-message {
    width: 100%;
    min-height: 160px;
    border: 2px solid var(--gris-claro);
    border-radius: 14px;
    padding: 12px;
    resize: vertical;
    font: inherit;
    color: var(--texto);
    background: #fff;
}

.copy-btn {
    margin-top: 10px;
}

.copy-feedback {
    margin: 10px 0 0;
    color: var(--gris-texto);
    font-size: 0.9rem;
}

.table-wrap {
    overflow-x: auto;
}

.superadmin-grid {
    align-items: start;
}

.inline-action-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-action-form input[type="password"] {
    min-width: 180px;
}

.btn.btn-inline {
    margin-top: 0;
    width: auto;
    min-width: 105px;
    padding: 8px 12px;
    border-radius: 999px;
    box-shadow: none;
}

.btn.btn-inline:hover {
    box-shadow: none;
}

.btn.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.payments-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

.payments-table th,
.payments-table td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid var(--gris-claro);
    font-size: 0.92rem;
}

.payments-table th {
    color: #475569;
    font-weight: 700;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pending {
    background: rgba(2, 132, 199, 0.12);
    color: #0369a1;
}

.status-paid {
    background: rgba(17, 158, 111, 0.14);
    color: #0b7d58;
}

.status-failed,
.status-expired {
    background: rgba(197, 48, 48, 0.12);
    color: #9f1239;
}

.status-refunded {
    background: rgba(100, 116, 139, 0.16);
    color: #334155;
}

.btn-refund {
    margin-top: 0;
    width: auto;
    min-width: 112px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    box-shadow: none;
}

.refund-disabled {
    color: var(--gris-texto);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1200;
}

.modal-backdrop.active {
    display: flex;
}

.modal-panel {
    width: min(520px, 100%);
    background: #fff;
    border: 1px solid var(--gris-claro);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--sombra-media);
}

.modal-panel h3 {
    margin: 0 0 10px;
    color: var(--texto);
}

.modal-panel p {
    margin: 0 0 10px;
}

.refund-modal-info {
    font-size: 0.92rem;
    color: #334155;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--gris-claro);
    background: #f8fafc;
}

.refund-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.refund-actions .btn {
    margin-top: 0;
    width: auto;
    min-width: 140px;
}

.mono {
    font-family: "Consolas", "Menlo", monospace;
    font-size: 0.9rem;
}

.logout {
    width: auto;
    margin: 0;
    padding-inline: 20px;
}

@media (max-width: 760px) {
    .card {
        padding: 24px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-right {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .stripe-balance {
        white-space: normal;
    }

    .logout {
        width: 100%;
    }

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

    .page.page-full {
        padding: 0;
    }

    .coming-soon {
        margin: 14px;
        padding: 34px 20px;
    }

    .payments-search-fields {
        grid-template-columns: 1fr;
    }

    .payments-search-actions {
        flex-direction: column;
    }

    .payments-search-actions .btn {
        width: 100%;
    }

    .btn-refund {
        width: 100%;
    }

    .inline-action-form {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-action-form input[type="password"] {
        min-width: 0;
    }

    .btn.btn-inline,
    .btn.btn-danger {
        width: 100%;
    }

    .refund-actions {
        flex-direction: column;
    }

    .refund-actions .btn {
        width: 100%;
    }
}

@media (max-width: 992px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar,
    .sidebar:hover,
    .sidebar:focus-within {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--gris-claro);
        padding: 12px;
    }

    .sidebar-brand {
        justify-content: flex-start;
        margin-bottom: 10px;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .nav-item,
    .sidebar:hover .nav-item,
    .sidebar:focus-within .nav-item {
        justify-content: flex-start;
        min-width: 140px;
    }

    .nav-label,
    .sidebar:hover .nav-label,
    .sidebar:focus-within .nav-label {
        max-width: 140px;
        opacity: 1;
    }
}
