:root {
  --bg: #0f1420;
  --bg-2: #171e2e;
  --card: #1c2436;
  --card-2: #232c42;
  --line: #2c3650;
  --text: #e7ecf5;
  --muted: #9aa6bf;
  --brand: #4f8cff;
  --brand-2: #6ea0ff;
  --ok: #2ecc71;
  --warn: #f5a623;
  --off: #e05561;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2b4d 0, transparent 60%), var(--bg);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--brand-2); }

/* ---------- LOGIN ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.brand .logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #9b6bff);
  display: grid; place-items: center;
  font-weight: 800; color: #fff;
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
.subtitle { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.field input:focus { border-color: var(--brand); }

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }

.switch { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.switch a { cursor: pointer; }

.alert {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  display: none;
}
.alert.show { display: block; }
.alert.error { background: rgba(224, 85, 97, .12); color: #ff8a94; border: 1px solid rgba(224,85,97,.3); }
.alert.ok { background: rgba(46, 204, 113, .12); color: #7ee2a8; border: 1px solid rgba(46,204,113,.3); }

/* ---------- DASHBOARD ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand h1 { font-size: 17px; }
.user-chip {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted);
}
.user-chip .badge {
  background: var(--card-2);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  text-transform: capitalize;
}
.live-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.live-dot i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--off); display: inline-block;
}
.live-dot.on i { background: var(--ok); box-shadow: 0 0 0 0 rgba(46,204,113,.7); animation: pulse 1.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46,204,113,.6); }
  70% { box-shadow: 0 0 0 8px rgba(46,204,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}

.container { max-width: 1100px; margin: 0 auto; padding: 26px 22px 60px; }
.page-title { margin: 4px 0 2px; font-size: 22px; }
.page-sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.area-block { margin-bottom: 32px; }
.area-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.area-head h3 { margin: 0; font-size: 16px; }
.area-head span { color: var(--muted); font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform .12s, border-color .12s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card .card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card .icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--card-2); display: grid; place-items: center;
  font-size: 20px;
}
.card h4 { margin: 0 0 4px; font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }

.status {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
  text-transform: capitalize; white-space: nowrap;
}
.status.activo { background: rgba(46,204,113,.15); color: #7ee2a8; }
.status.inactivo { background: rgba(224,85,97,.15); color: #ff8a94; }
.status.mantenimiento { background: rgba(245,166,35,.15); color: #ffcf7a; }

.empty {
  text-align: center; color: var(--muted); padding: 50px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius);
}
.flash { animation: flash 1.1s ease; }
@keyframes flash {
  0% { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,140,255,.35); }
  100% { border-color: var(--line); box-shadow: none; }
}
.center-loading { text-align: center; color: var(--muted); padding: 60px; }
