* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f172a; --surface: #1e293b; --surface2: #334155;
  --accent: #3b82f6; --accent2: #8b5cf6; --green: #22c55e;
  --red: #ef4444; --yellow: #eab308; --text: #f1f5f9; --text2: #94a3b8;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--surface); padding: 2rem; border-radius: 12px; width: 100%; max-width: 360px; }
.login-box h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.login-box input { width: 100%; padding: 0.75rem; border-radius: 8px; border: 1px solid var(--surface2); background: var(--bg); color: var(--text); font-size: 1rem; margin-bottom: 1rem; }
.login-box button { width: 100%; padding: 0.75rem; border-radius: 8px; border: none; background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer; font-weight: 600; }
.login-box button:hover { background: #2563eb; }
.login-error { color: var(--red); font-size: 0.875rem; margin-bottom: 0.5rem; display: none; }

.app { display: none; }
.app.active { display: flex; }
.sidebar { width: 240px; background: var(--surface); padding: 1rem; flex-shrink: 0; border-right: 1px solid var(--surface2); display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.sidebar h2 { font-size: 1.25rem; margin-bottom: 1.5rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar nav a { padding: 0.75rem 1rem; border-radius: 8px; color: var(--text2); text-decoration: none; cursor: pointer; transition: all 0.15s; font-size: 0.9rem; }
.sidebar nav a:hover { background: var(--surface2); color: var(--text); }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar .logout { margin-top: auto; padding: 0.75rem 1rem; border-radius: 8px; color: var(--red); cursor: pointer; font-size: 0.9rem; background: none; border: none; text-align: left; }
.sidebar .logout:hover { background: rgba(239,68,68,0.1); }
.main { flex: 1; padding: 1.5rem 2rem; overflow-y: auto; height: 100vh; }
.page { display: none; }
.page.active { display: block; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.page-header p { color: var(--text2); font-size: 0.875rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.stat-card { background: var(--surface); border-radius: 12px; padding: 1.25rem; }
.stat-card .label { font-size: 0.8rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; }
.stat-card .value.green { color: var(--green); }
.stat-card .value.red { color: var(--red); }
.stat-card .value.yellow { color: var(--yellow); }
.stat-card .value.blue { color: var(--accent); }

#map { height: 500px; border-radius: 12px; }
.map-legend { display: flex; gap: 1rem; margin-bottom: 1rem; font-size: 0.85rem; }
.map-legend span { display: flex; align-items: center; gap: 0.4rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.table-wrap { background: var(--surface); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { padding: 0.75rem 1rem; text-align: left; font-size: 0.8rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--surface2); background: var(--surface2); }
td { padding: 0.75rem 1rem; font-size: 0.875rem; border-bottom: 1px solid var(--surface2); }
tr:hover td { background: rgba(59,130,246,0.05); }

.badge { padding: 0.25rem 0.75rem; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.badge.green { background: rgba(34,197,94,0.15); color: var(--green); }
.badge.red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge.yellow { background: rgba(234,179,8,0.15); color: var(--yellow); }
.badge.blue { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge.purple { background: rgba(139,92,246,0.15); color: var(--accent2); }

.btn { padding: 0.5rem 1rem; border-radius: 8px; border: none; font-size: 0.8rem; cursor: pointer; font-weight: 600; transition: all 0.15s; }
.btn.sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #2563eb; }
.btn.danger { background: rgba(239,68,68,0.15); color: var(--red); }
.btn.danger:hover { background: rgba(239,68,68,0.25); }
.btn.success { background: rgba(34,197,94,0.15); color: var(--green); }
.btn.success:hover { background: rgba(34,197,94,0.25); }

.tarifas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.tarifa-card { background: var(--surface); border-radius: 12px; padding: 1.5rem; }
.tarifa-card .clave { font-size: 0.8rem; color: var(--text2); text-transform: uppercase; margin-bottom: 0.25rem; }
.tarifa-card .desc { font-size: 0.85rem; margin-bottom: 1rem; color: var(--text2); }
.tarifa-card .input-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.tarifa-card .input-row input { min-width: 0; }
.tarifa-card input { flex: 1; padding: 0.6rem 0.75rem; border-radius: 8px; border: 1px solid var(--surface2); background: var(--bg); color: var(--text); font-size: 1rem; }
.tarifa-card .saved { color: var(--green); font-size: 0.8rem; margin-top: 0.5rem; opacity: 0; transition: opacity 0.3s; }
.tarifa-card .saved.show { opacity: 1; }

.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; padding: 0.75rem 1.25rem; border-radius: 8px; font-size: 0.875rem; z-index: 9999; opacity: 0; transition: opacity 0.3s; }
.toast.show { opacity: 1; }
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--red); color: #fff; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 1rem; }
}
