@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  
  --border: #e2e8f0;
  --border-sidebar: #1e293b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Plus Jakarta Sans', sans-serif; }
body { background-color: var(--bg-body); color: var(--text-main); overflow: hidden; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* REUSABLE */
.btn { padding: 12px 20px; border-radius: 8px; border: none; font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.primary-btn { background: var(--primary); color: white; }
.primary-btn:hover { background: var(--primary-hover); }
.secondary-btn { background: white; color: var(--text-main); border: 1px solid var(--border); }
.secondary-btn:hover { background: #f8fafc; }

.card { background: var(--bg-card); border-radius: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); padding: 24px; }
.badge { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* AUTH */
#auth-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: url('fondo.jpg') center/cover; position: relative; }
#auth-view::before { content: ''; position: absolute; inset:0; background: rgba(15,23,42,0.85); backdrop-filter: blur(8px); }
.auth-card { background: var(--bg-card); padding: 40px; border-radius: 20px; width: 420px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); position: relative; z-index: 1; text-align: center; }
.auth-card input { width: 100%; padding: 14px; border-radius: 10px; border: 2px solid var(--border); margin-bottom: 15px; font-size:14px; outline:none; }
.auth-card input:focus { border-color: var(--primary); }
.auth-card button { width: 100%; padding: 14px; font-size:15px; }

/* APP LAYOUT */
#app-view { display: none; height: 100vh; }
.app-container { display: flex; height: 100%; }

/* SIDEBAR */
.sidebar { width: 280px; background: var(--bg-sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--border-sidebar); flex-shrink: 0; }
.sidebar-header { height: 80px; display: flex; align-items: center; padding: 0 24px; color: white; font-weight: 800; font-size: 18px; border-bottom: 1px solid var(--border-sidebar); }
.sidebar-nav { padding: 20px 12px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.nav-item { padding: 14px 16px; border-radius: 10px; color: var(--text-sidebar); display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; font-size: 14px; transition: 0.2s; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-sidebar-active); }
.nav-item.active { background: var(--primary); color: white; }

/* MAIN CONTENT */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 80px; background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 40px; flex-shrink: 0; }
.page-title { font-size: 24px; font-weight: 800; }
.content-wrapper { flex: 1; padding: 40px; overflow-y: auto; }

/* MODULES */
.module { display: none; animation: fadeIn 0.3s ease; }
.module.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* DASHBOARD GRIDS */
.kpi-grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; margin-bottom: 20px; }
.kpi-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 20px; }
.kpi-card { background: white; border-radius: 16px; padding: 20px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.kpi-card h4 { font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; font-weight:700; }
.kpi-card .val { font-size: 26px; font-weight: 900; color: var(--text-main); }
.kpi-card .val.green { color: var(--success); }
.kpi-card .val.red { color: var(--danger); }

/* CHARTS */
.chart-wrapper-large { height: 400px; width: 100%; margin-top: 15px; }
.chart-wrapper-medium { height: 300px; width: 100%; margin-top: 15px; }

.two-col-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 30px; }

/* FORMS (Settings & Users) */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform:uppercase; }
.form-group input, .form-group select { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; font-weight:500; outline:none; }
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }

/* TABLES */
.table-container { background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: #f8fafc; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: white; padding: 16px 24px; font-size: 12px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight:700; }
td { padding: 16px 24px; font-size: 14px; border-bottom: 1px solid var(--border); font-weight:500; }
tr:hover td { background: #f1f5f9; }

/* MODAL */
#alert-modal { display:none; position:fixed; inset:0; background:rgba(15,23,42,0.6); z-index:9999; align-items:center; justify-content:center; backdrop-filter:blur(4px); }
.modal-content { background:white; border-radius:24px; padding:40px; width:500px; position:relative; box-shadow:0 25px 50px -12px rgba(0,0,0,0.25); }

/* TOAST */
#toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 9999; display: flex; flex-direction: column; gap: 15px; }
.toast { background: var(--bg-sidebar); color: white; padding: 16px 24px; border-radius: 12px; box-shadow: 0 10px 15px rgba(0,0,0,0.1); border-left: 4px solid var(--success); font-weight:600; font-size:14px; animation: slideIn 0.3s forwards; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
