:root {
    --bg: #f3f6f5;
    --bg-soft: #ffffff;
    --panel: #ffffff;
    --panel-2: #e8f3f1;

    --border: rgba(0, 0, 0, 0.08);

    --text: #1f2d2b;
    --muted: #6b8a86;

    --primary: #64CCB8;
    --primary-2: #329B8C;

    --success: #64CCB8;
    --danger: #ef4444;
    --warning: #f59e0b;

    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

.container {
    width: min(1120px, 92%);
    margin: 42px auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding: 18px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--primary-2);
}

.brand-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.card + .card {
    margin-top: 22px;
}

h1, h2, h3 {
    margin-top: 0;
    color: var(--text);
    letter-spacing: 0.3px;
}

p {
    color: var(--muted);
    line-height: 1.55;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.panel-link {
    display: block;
    width: 100%;
    text-decoration: none;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.panel-link:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(100, 204, 184, 0.2);
    background: #f8fcfb;
    text-decoration: none;
}

.panel-link strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--primary-2);
}

.panel-link span {
    color: var(--muted);
    font-size: 0.94rem;
}

form {
    display: grid;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(100, 204, 184, 0.18);
    background: #ffffff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button,
input[type="submit"],
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    color: white;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    box-shadow: 0 10px 24px rgba(50, 155, 140, 0.2);
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
    transform: translateY(-2px);
    opacity: 0.96;
    text-decoration: none;
}

.btn-secondary {
    background: #ffffff;
    color: var(--primary-2);
    border: 1px solid var(--border);
    box-shadow: none;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

thead {
    background: #edf7f5;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

th {
    color: var(--primary-2);
    font-size: 0.95rem;
}

td {
    color: var(--text);
}

tr:hover td {
    background: rgba(100, 204, 184, 0.06);
}

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-success {
    background: rgba(100, 204, 184, 0.16);
    color: #237d72;
    border: 1px solid rgba(50, 155, 140, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.18);
}

.flash-messages {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.flash {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.flash-success {
    border-color: rgba(100, 204, 184, 0.35);
    color: #237d72;
}

.flash-danger {
    border-color: rgba(239, 68, 68, 0.28);
    color: #dc2626;
}

.flash-warning {
    border-color: rgba(245, 158, 11, 0.28);
    color: #b45309;
}

.flash-info {
    border-color: rgba(50, 155, 140, 0.28);
    color: #2b7a70;
}

.inline-filter {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
    margin-bottom: 18px;
}

.inline-filter .field {
    min-width: 220px;
    flex: 1;
}

a {
    color: var(--primary-2);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.small-text {
    color: var(--muted);
    font-size: 0.9rem;
}

/* DASHBOARD */
.dashboard-hero {
    margin-bottom: 24px;
    background: var(--panel-2);
}

.dashboard-menu .panel-link {
    text-align: left;
    cursor: pointer;
    font: inherit;
}

/* POPUPS */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31, 45, 43, 0.35);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 999;
}

.popup-overlay.active {
    display: flex;
}

.popup-card {
    width: min(820px, 96%);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 24px;
    animation: popupFade 0.22s ease;
}

.popup-card-small {
    width: min(520px, 96%);
}

@keyframes popupFade {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.popup-header h3 {
    margin: 0 0 6px;
    font-size: 1.25rem;
    color: var(--primary-2);
}

.popup-header p {
    margin: 0;
    color: var(--muted);
}

.popup-close {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    background: #f3f6f5;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: none;
}

.popup-close:hover {
    transform: none;
    background: #e8f3f1;
}

.popup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.popup-option {
    display: block;
    text-decoration: none;
    color: var(--text);
    background: #f7fbfa;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.popup-option:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(100, 204, 184, 0.16);
    background: #e6f7f3;
    text-decoration: none;
}

.popup-option strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
    color: var(--primary-2);
}

.popup-option span {
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.45;
}

.danger-option {
    border-color: rgba(239, 68, 68, 0.14);
}

.danger-option:hover {
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.12);
    background: #fff5f5;
}

@media (max-width: 768px) {
    .container {
        width: 94%;
        margin: 22px auto;
    }

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

    table {
        font-size: 0.92rem;
    }

    th, td {
        padding: 12px 10px;
    }

    .popup-card {
        padding: 18px;
        border-radius: 18px;
    }

    .popup-grid {
        grid-template-columns: 1fr;
    }
}
/* RADIO BUTTONS */
.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 400;
}

.radio-option input[type="radio"] {
    width: auto;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.radio-option span {
    font-weight: 400;
}

/* TABLAS RESPONSIVE */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 1000px;
}

/* FORMULARIOS RESPONSIVE */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    form {
        gap: 14px;
    }

    input,
    select,
    textarea {
        font-size: 1rem;
        padding: 11px 12px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .actions .btn,
    .actions button,
    .actions a {
        width: 100%;
    }

    .card {
        padding: 20px;
        border-radius: 18px;
    }

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

    .popup-card,
    .popup-card-small {
        width: 96%;
        max-height: 88vh;
        overflow-y: auto;
    }
}