/* ===== ESTILOS MEJORADOS - PESTAÑAS CLÁSICAS ===== */
* {
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background: #eef2f5;
    color: #1e293b;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Barra superior */
.top-bar {
    background: white;
    border-radius: 20px;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.top-bar select {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
    background: white;
    min-width: 200px;
}

.top-bar button {
    background: #b91c1c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.top-bar button:hover { background: #991b1b; }

/* Pestañas */
.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    background: white;
    padding: 10px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.tab {
    background: transparent;
    color: #475569;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    font-size: 0.95rem;
}
.tab:hover { background: #f1f5f9; }
.tab.active {
    background: #1e6f3f;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(30,111,63,0.2);
}

/* Contenido */
.panel {
    display: none;
}
.panel.active {
    display: block;
}

/* Tarjetas */
.card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid #f1f5f9;
}

/* Panel de precios de ley */
.precio-leyes-panel {
    background: #e8f0fe;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
}

/* Grid de estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border-left: 4px solid #1e6f3f;
}
.stat-card.warning { border-left-color: #d97706; }
.stat-card.danger { border-left-color: #dc2626; }
.stat-card.success { border-left-color: #16a34a; }
.stat-card .stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; font-weight: 600; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: #0f172a; }

/* Tablas */
table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
}
th {
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
}
td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Formularios */
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: flex-end;
}
.form-group {
    flex: 1;
    min-width: 150px;
}
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}
input, select, button {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
    background: white;
    transition: 0.2s;
}
input:focus, select:focus {
    border-color: #1e6f3f;
    outline: none;
    box-shadow: 0 0 0 3px rgba(30,111,63,0.1);
}
button {
    background: #1e6f3f;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
button:hover { opacity: 0.9; }
button.secondary { background: #6b7280; }
button.secondary:hover { background: #4b5563; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }
button.warning { background: #d97706; }

/* Login (centrado) */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    background: #eef2f5;
}
.login-box {
    background: white;
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    text-align: center;
}
.login-box h2 {
    margin-bottom: 24px;
    color: #1e6f3f;
}
.login-box input {
    width: 100%;
    margin-bottom: 16px;
}

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal-content {
    background: white;
    padding: 32px;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}
.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: white;
    padding: 14px 24px;
    border-radius: 40px;
    z-index: 999;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.chat-messages {
    flex: 1;
    padding: 20px;
    background: #f8fafc;
    overflow-y: auto;
}
.chat-message {
    margin-bottom: 12px;
    padding: 10px 16px;
    background: white;
    border-radius: 20px;
    max-width: 80%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
}
.chat-input-area input { flex: 1; }

/* Responsive */
@media (max-width: 900px) {
    body {
        padding: 10px;
    }
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 16px;
    }
    .top-bar .user-info {
        font-size: 0.9rem;
    }
    .top-bar select {
        min-width: 150px;
        width: 100%;
    }
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        gap: 6px;
        padding: 8px 12px;
        -webkit-overflow-scrolling: touch;
    }
    .tab {
        padding: 10px 16px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stat-card .stat-value {
        font-size: 1.3rem;
    }
    .form-row {
        flex-direction: column;
        gap: 8px;
    }
    .form-group {
        min-width: 100%;
    }
    table {
        font-size: 0.8rem;
    }
    th, td {
        padding: 8px 10px;
    }
    .card {
        padding: 16px;
    }
    .modal-content {
        padding: 20px;
        width: 95%;
    }
    .chat-container {
        height: 400px;
    }
}

@media (max-width: 500px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .top-bar {
        padding: 10px 12px;
    }
}
/* ===== TICKET MODAL ===== */
.ticket-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.ticket-content {
    background: white;
    border-radius: 24px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
}
.ticket-content h3 {
    margin-bottom: 16px;
    color: #1e6f3f;
    font-size: 1.3rem;
}
.ticket-content img {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-width: 100%;
}
.ticket-content .modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}
.ticket-content button {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}