* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background:
        radial-gradient(circle at top left, #1f3d73 0%, #0f1b33 45%, #091325 100%);
    color: #fff;
    min-height: 100vh;
}

a {
    color: #9dc3ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.auth-wrap,
.panel-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
}

.panel-wrap-wide {
    padding: 24px 10px;
}

.card {
    width: 100%;
    max-width: 720px;
    background: rgba(20, 31, 54, 0.94);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.card-ultra-wide {
    max-width: 1460px;
}

.card-top {
    padding: 38px 30px 24px;
    text-align: center;
    background: rgba(255, 255, 255, 0.07);
}

.card-top img {
    max-width: 320px;
    width: 100%;
    height: auto;
    margin-bottom: 14px;
}

.card-top h1 {
    margin: 10px 0 8px;
    font-size: 42px;
}

.card-top p {
    margin: 0;
    color: #c7d0e0;
    font-size: 16px;
}

.card-body {
    padding: 32px;
}

.form-group {
    margin-bottom: 22px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

input,
select {
    width: 100%;
    height: 56px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: #3a4761;
    color: #fff;
    font-size: 18px;
    padding: 0 16px;
}

input::placeholder {
    color: #bfc8d7;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 56px;
    border: 0;
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    line-height: 1.2;
    white-space: normal;
}

.btn:hover {
    text-decoration: none;
    opacity: .97;
}

.btn-primary {
    background: linear-gradient(90deg, #3e7bf0, #2456d9);
    color: #fff;
    box-shadow: 0 8px 22px rgba(36, 86, 217, 0.35);
}

.btn-danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 8px 22px rgba(220, 38, 38, 0.35);
}

.btn-success {
    background: linear-gradient(90deg, #10b981, #059669);
    color: #fff;
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.10);
}

.alert {
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    font-weight: bold;
}

.alert-error {
    background: #451a1a;
    color: #fecaca;
    border: 1px solid #7f1d1d;
}

.alert-success {
    background: #173a2a;
    color: #bbf7d0;
    border: 1px solid #166534;
}

.alert-info {
    background: #1e3a5f;
    color: #dbeafe;
    border: 1px solid #1d4ed8;
}

.user-box {
    background: #3a4761;
    border-radius: 16px;
    padding: 22px;
    margin: 24px 0;
}

.user-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.user-row:last-child {
    border-bottom: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.topbar h2 {
    margin: 0;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

.btn-topbar {
    width: auto;
    min-width: 180px;
}

.search-form {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1 1 520px;
}

.search-box input {
    width: 100%;
}

.search-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-search {
    width: auto;
    min-width: 140px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 16px;
}

.stat-card .stat-label {
    display: block;
    font-size: 13px;
    color: #c7d0e0;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
}

.filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 14px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

.table-wrap {
    overflow-x: auto;
    background: rgba(255,255,255,0.04);
    border-radius: 16px;
    padding: 12px;
}

.table-wrap-usuarios {
    overflow-x: hidden;
}

.usuarios-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
}

.usuarios-table th,
.usuarios-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    vertical-align: top;
    word-break: break-word;
}

.usuarios-table th {
    white-space: normal;
}

.col-id { width: 8%; }
.col-nombre { width: 18%; }
.col-mail { width: 18%; }
.col-perfil { width: 9%; }
.col-rol { width: 7%; }
.col-estado { width: 9%; }
.col-fecha { width: 10%; }
.col-aprobado { width: 8%; }
.col-fecha-aprob { width: 10%; }
.col-acciones { width: 13%; }

.td-acciones {
    min-width: 150px;
}

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: bold;
}

.badge-ok {
    background: #14532d;
    color: #bbf7d0;
}

.badge-pend {
    background: #78350f;
    color: #fde68a;
}

.badge-no {
    background: #7f1d1d;
    color: #fecaca;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.actions-stack {
    flex-direction: column;
    align-items: stretch;
}

.btn-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    min-width: 120px;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

.btn-mini:hover {
    text-decoration: none;
    opacity: .9;
}

.btn-aprobar {
    background: #059669;
}

.btn-rechazar {
    background: #dc2626;
}

.sin-acciones {
    color: #c7d0e0;
}

.link-center {
    text-align: center;
    margin-top: 18px;
}

.mobile-users {
    display: none;
}

.user-mobile-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 14px;
}

.user-mobile-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.user-mobile-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.user-mobile-sub {
    margin: 4px 0 0;
    color: #c7d0e0;
    font-size: 13px;
}

.user-mobile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin-top: 12px;
}

.user-mobile-item {
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 10px 12px;
}

.user-mobile-label {
    display: block;
    font-size: 12px;
    color: #b8c5dc;
    margin-bottom: 4px;
}

.user-mobile-value {
    display: block;
    font-size: 14px;
    font-weight: bold;
    word-break: break-word;
}

.user-mobile-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.user-mobile-actions .btn-mini {
    white-space: normal;
    min-height: 44px;
}

.empty-box {
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 22px;
    text-align: center;
    color: #c7d0e0;
}

@media (max-width: 1280px) {
    .card-ultra-wide {
        max-width: 98vw;
    }
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .table-wrap-usuarios {
        overflow-x: auto;
    }

    .usuarios-table {
        min-width: 1180px;
        table-layout: auto;
    }

    .usuarios-table th {
        white-space: nowrap;
    }

    .col-id,
    .col-nombre,
    .col-mail,
    .col-perfil,
    .col-rol,
    .col-estado,
    .col-fecha,
    .col-aprobado,
    .col-fecha-aprob,
    .col-acciones {
        width: auto;
    }
}

@media (max-width: 640px) {
    .card-top h1 {
        font-size: 30px;
    }

    .card-top img {
        max-width: 250px;
    }

    .card-body {
        padding: 20px;
    }

    input,
    select {
        font-size: 16px;
        height: 52px;
    }

    .user-row {
        flex-direction: column;
        gap: 6px;
    }

    .topbar {
        align-items: stretch;
    }

    .topbar-actions {
        width: 100%;
    }

    .btn-topbar {
        width: 100%;
        min-width: 0;
    }

    .search-form {
        flex-direction: column;
    }

    .search-box,
    .search-actions {
        width: 100%;
    }

    .search-actions .btn-search {
        width: 100%;
        min-width: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-value {
        font-size: 24px;
    }

    .filters-bar {
        padding: 12px;
        gap: 8px;
    }

    .filter-chip {
        width: 100%;
        justify-content: center;
    }

    .table-wrap.desktop-only {
        display: none;
    }

    .mobile-users {
        display: block;
    }

    .user-mobile-grid {
        grid-template-columns: 1fr;
    }

    .user-mobile-actions .btn-mini {
        flex: 1 1 100%;
        padding: 12px 14px;
    }
}

.btn-editar {
    background: #f59e0b;
    color: #fff;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-form-action {
    width: auto;
    min-width: 180px;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .btn-form-action {
        width: 100%;
        min-width: 0;
    }
}