@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { display: flex; height: 100vh; background-color: #0B101E; color: #CBD5E1; overflow: hidden; }

.fab-whatsapp { position: fixed; bottom: 30px; right: 30px; background-color: #25D366; color: white; width: 60px; height: 60px; border-radius: 50%; display: flex; justify-content: center; align-items: center; box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4); cursor: pointer; z-index: 2000; transition: transform 0.3s ease; }
.fab-whatsapp:hover { transform: scale(1.1); }
.fab-whatsapp .material-icons { font-size: 32px; }

.login-overlay, .modal-overlay { position: fixed; inset: 0; background: rgba(11, 16, 30, 0.95); z-index: 1000; display: flex; justify-content: center; align-items: center; padding: 20px; }
.login-box, .modal-content { background: #131A2A; padding: 40px; border-radius: 20px; width: 100%; max-width: 400px; text-align: center; box-shadow: 0 15px 35px rgba(0,0,0,0.5); border: 1px solid #1F2A3D; }
.login-box h2, .modal-content h2 { color: #FFFFFF; letter-spacing: 1px; margin-bottom: 25px; font-weight: 800; }
.login-box span { color: #FE4F5A; }
.link-auth { color: #2ED0FF; font-size: 13px; margin-top: 20px; cursor: pointer; transition: 0.2s; font-weight: 600; }
.link-auth:hover { color: #FE4F5A; text-decoration: underline; }

input, select { width: 100%; padding: 14px; margin-bottom: 15px; border: 1px solid #1F2A3D; border-radius: 10px; font-size: 14px; background: #0B101E; color: #FFFFFF; transition: 0.3s; }
input:focus, select:focus { outline: none; border-color: #FE4F5A; background: #131A2A; }
input::placeholder { color: #64748B; }
.input-readonly { background: #1F2A3D !important; color: #94A3B8 !important; cursor: not-allowed; border: none; }

button { width: 100%; padding: 14px; background: #1F2A3D; color: #CBD5E1; border: none; border-radius: 10px; cursor: pointer; font-weight: 700; transition: 0.3s; }
button:hover { background: #2A374A; color: white; }
.btn-primary { background: linear-gradient(90deg, #FE505B, #F83645); color: white; box-shadow: 0 4px 10px rgba(254, 80, 91, 0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(254, 80, 91, 0.4); background: linear-gradient(90deg, #FF6B74, #FA525F); }
.btn-icon { background:transparent; width:auto; padding:5px; color:#64748B; box-shadow:none; } 
.btn-icon:hover { color:#FE4F5A; background:transparent; transform:none; }

.sidebar { width: 260px; background: #131A2A; color: white; display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid #1F2A3D; }
.logo { padding: 30px 20px; font-size: 22px; font-weight: 800; border-bottom: 1px solid #1F2A3D; text-align:center; }
.logo span { color: #FE4F5A; }
nav { flex: 1; padding: 20px 0; overflow-y: auto; }
.nav-item { padding: 14px 20px; margin: 5px 15px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: #94A3B8; border-radius: 12px; font-size: 14px; font-weight: 600; transition: 0.2s; }
.nav-item i { font-style: normal; font-size: 18px; }
.nav-item:hover { background: #1F2A3D; color: white; }
.nav-item.active { background: linear-gradient(90deg, #FE505B, #F83645); color: white; box-shadow: 0 4px 10px rgba(254, 80, 91, 0.3); }
.user-info { padding: 20px; border-top: 1px solid #1F2A3D; }

.main-content { flex: 1; padding: 40px; overflow-y: auto; }
.title-pill { background: #131A2A; padding: 12px 25px; border-radius: 30px; display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; color: #FFFFFF; box-shadow: 0 4px 15px rgba(0,0,0,0.2); margin-bottom: 30px; border: 1px solid #1F2A3D; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.kpi { padding: 25px; border-radius: 16px; color: white; position: relative; overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.kpi-red { background: linear-gradient(135deg, #FF4B6B, #FF7B54); }
.kpi-green { background: linear-gradient(135deg, #00D287, #53D94A); }
.kpi-orange { background: linear-gradient(135deg, #FF6A00, #FFA200); }
.kpi-blue { background: linear-gradient(135deg, #2ED0FF, #2EA0FF); }
.kpi-purple { background: linear-gradient(135deg, #8B3BFF, #5A29E4); }
.kpi span { font-size: 11px; text-transform: uppercase; font-weight: 700; opacity: 0.9; letter-spacing: 0.5px; display: block; margin-bottom: 10px; }
.kpi h3 { font-size: 28px; font-weight: 800; margin: 0; }
.kpi i { position: absolute; top: 20px; right: 20px; font-size: 20px; opacity: 0.8; font-style: normal; }

.card { background: #131A2A; padding: 30px; border-radius: 20px; border: 1px solid #1F2A3D; box-shadow: 0 10px 30px rgba(0,0,0,0.3); margin-bottom: 30px; }
.card h3 { margin-bottom: 20px; color: #FFFFFF; font-weight: 700; }
.form-grid { display: grid; gap: 15px; }

table { width: 100%; border-collapse: collapse; background: #131A2A; border-radius: 16px; overflow: hidden; }
th { background: #0B101E; padding: 18px 15px; text-align: left; font-size: 12px; color: #94A3B8; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #1F2A3D; }
td { padding: 18px 15px; border-bottom: 1px solid #1F2A3D; font-size: 14px; color: #CBD5E1; font-weight: 500; }

.loader { position: fixed; inset: 0; background: rgba(11, 16, 30, 0.9); z-index: 2000; display: none; justify-content: center; align-items: center; font-weight: 800; color: #FFFFFF; font-size: 24px; letter-spacing: 1px; }

.chart-container { width: 100%; overflow-x: auto; overflow-y: hidden; padding-bottom: 10px; }
.chart-container::-webkit-scrollbar { height: 8px; }
.chart-container::-webkit-scrollbar-track { background: #0B101E; border-radius: 10px; }
.chart-container::-webkit-scrollbar-thumb { background: #1F2A3D; border-radius: 10px; }
.chart-container::-webkit-scrollbar-thumb:hover { background: #2ED0FF; }
.chart-scroll-area { height: 250px; position: relative; }

.table-wrapper { max-height: 450px; overflow-y: auto; overflow-x: auto; border-radius: 16px; background: #131A2A; box-shadow: inset 0 0 10px rgba(0,0,0,0.2); }
.table-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: #0B101E; border-radius: 10px; }
.table-wrapper::-webkit-scrollbar-thumb { background: #1F2A3D; border-radius: 10px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: #2A374A; }
.table-wrapper table { box-shadow: none; border-radius: 0; margin: 0; min-width: 600px; }
.table-wrapper th { position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #1F2A3D; color: #FFFFFF; padding: 15px 25px; border-radius: 12px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.toast.show { transform: translateX(0); }
.toast .material-icons { font-size: 20px; }
.toast-error { border-left: 5px solid #FE4F5A; }
.toast-error .material-icons { color: #FE4F5A; }
.toast-success { border-left: 5px solid #00D287; }
.toast-success .material-icons { color: #00D287; }

@media (max-width: 850px) {
  body { flex-direction: column; overflow-y: auto; }
  .fab-whatsapp { bottom: 20px; right: 20px; width: 50px; height: 50px; }
  .fab-whatsapp .material-icons { font-size: 26px; }
  .sidebar { width: 100%; height: auto; box-shadow: 0 4px 10px rgba(0,0,0,0.5); z-index: 50; border-right: none; border-bottom: 1px solid #1F2A3D; }
  .logo { padding: 15px; font-size: 20px; border-bottom: none; }
  nav { display: flex; flex-direction: row; padding: 0 15px 15px 15px; border-bottom: 1px solid #1F2A3D; }
  .nav-item { margin: 0 10px 0 0; padding: 10px 15px; flex-shrink: 0; border-radius: 30px; font-size: 13px; }
  .user-info { flex-direction: row; display: flex; justify-content: space-between; align-items: center; padding: 15px; border-top: none; }
  .user-info div { margin-bottom: 0 !important; }
  .main-content { padding: 15px; width: 100%; overflow-y: visible; padding-bottom: 80px; }
  div[style*="display:flex; justify-content:space-between; align-items:center; margin-bottom:20px;"] { flex-direction: column; gap: 15px; }
  .title-pill { font-size: 16px; padding: 10px 20px; width: 100%; justify-content: center; text-align: center; }
  button[onclick="cargarDatos()"] { width: 100% !important; }
  .form-grid { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns: 2fr 1fr"], div[style*="grid-template-columns: 1fr 1fr"] { display: flex !important; flex-direction: column !important; gap: 15px !important; }
  .kpi-grid { grid-template-columns: 1fr; gap: 15px; margin-bottom: 20px; }
  .card { padding: 20px; margin-bottom: 20px; }
  .modal-content { padding: 25px; width: 95%; max-height: 90vh; overflow-y: auto; }
  th, td { padding: 12px 10px; font-size: 13px; }
}