/* ============================================================
   QuorumIQ — styles.css
   Tema oscuro profesional
   ============================================================ */
:root {
  --bg: #0b1120;
  --bg2: #0f172a;
  --panel: #141c2b;
  --panel2: #1a2438;
  --border: #243149;
  --text: #e6edf7;
  --muted: #93a4c0;
  --accent: #4f8cff;
  --accent2: #6ea8ff;
  --verde: #22c55e;
  --ambar: #f59e0b;
  --rojo: #ef4444;
  --purple: #7c5cff;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(79,140,255,.10), transparent 60%),
              radial-gradient(900px 500px at -10% 10%, rgba(124,92,255,.08), transparent 55%),
              var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: 0 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
p { margin: 0 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,17,32,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; padding-bottom: 12px; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff; font-weight: 800; font-size: 1rem;
}
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  padding: 7px 12px; border-radius: 8px; color: var(--muted); font-size: .92rem;
  transition: all .15s;
}
.nav-links a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav-links a.active { color: #fff; background: var(--panel2); }
.status-bar { padding-bottom: 10px; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border);
  font-size: .82rem; color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }

/* ---------- Hero ---------- */
.hero { padding: 48px 0 24px; }
.hero .badge { margin-bottom: 18px; }
.hero h1 { font-size: 2.4rem; max-width: 760px; line-height: 1.15; letter-spacing: -.02em; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 720px; margin-top: 14px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 28px 0; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-align: center;
}
.stat .num { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--purple)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---------- Panel ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}

/* ---------- KPI card ---------- */
.kpi-card { display: flex; flex-direction: column; gap: 12px; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-name { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.kpi-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; }
.kpi-value .unit { font-size: .9rem; color: var(--muted); font-weight: 500; margin-left: 4px; }
.kpi-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .82rem; color: var(--muted); }
.trend { font-weight: 700; }
.trend.up { color: var(--verde); }
.trend.down { color: var(--rojo); }
.trend.flat { color: var(--muted); }
.bar { height: 6px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 4px; transition: width .4s; }

/* ---------- Semáforo ---------- */
.semaforo { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 600; }
.semaforo .dot { width: 10px; height: 10px; }
.semaforo.verde .dot { background: var(--verde); box-shadow: 0 0 8px var(--verde); }
.semaforo.ambar .dot { background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
.semaforo.rojo .dot { background: var(--rojo); box-shadow: 0 0 8px var(--rojo); }
.semaforo.neutral .dot { background: var(--muted); }
.semaforo.verde { color: var(--verde); }
.semaforo.ambar { color: var(--ambar); }
.semaforo.rojo { color: var(--rojo); }
.semaforo.neutral { color: var(--muted); }

/* ---------- Force card ---------- */
.force-card { display: flex; flex-direction: column; gap: 8px; }
.fc-head { display: flex; align-items: center; justify-content: space-between; }
.fc-id { font-weight: 800; font-size: 1.1rem; color: var(--accent2); }
.fc-name { font-weight: 700; font-size: 1rem; }
.fc-q { color: var(--muted); font-size: .88rem; font-style: italic; }
.fc-kpis { font-size: .85rem; }
.fc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.fc-model { font-size: .82rem; color: var(--muted); }

/* ---------- Matriz ---------- */
.matriz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 14px; border-radius: var(--radius); text-align: center;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
}
.cell.verde { border-left-color: var(--verde); }
.cell.ambar { border-left-color: var(--ambar); }
.cell.rojo { border-left-color: var(--rojo); }
.cell-id { font-weight: 800; font-size: 1.3rem; }
.cell-name { font-size: .88rem; color: var(--muted); }

/* ---------- Form ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  font-size: .92rem; outline: none; transition: border .15s;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 14px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 9px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  font-size: .92rem; font-weight: 600; transition: all .15s;
}
.btn:hover { background: #22304a; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--purple)); border: none; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.sm { padding: 6px 12px; font-size: .82rem; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; }

/* ---------- Chart ---------- */
.chart-box { position: relative; height: 280px; }

/* ---------- Alertas ---------- */
.alerta {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius); margin-bottom: 10px;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
}
.alerta.critica { border-left-color: var(--rojo); }
.alerta.alta { border-left-color: var(--rojo); }
.alerta.media { border-left-color: var(--ambar); }
.alerta.baja, .alerta.info { border-left-color: var(--accent); }
.alerta.resuelta { opacity: .55; }
.a-icon { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.alerta.critica .a-icon, .alerta.alta .a-icon { background: var(--rojo); box-shadow: 0 0 8px var(--rojo); }
.alerta.media .a-icon { background: var(--ambar); box-shadow: 0 0 8px var(--ambar); }
.alerta.baja .a-icon, .alerta.info .a-icon { background: var(--accent); }
.a-body { flex: 1; }
.a-msg { font-weight: 600; }
.a-meta { font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* ---------- Loader ---------- */
.loader { display: flex; align-items: center; gap: 12px; padding: 24px; color: var(--muted); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
#toast-box { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: .9rem; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  opacity: 0; transform: translateY(10px); transition: all .3s; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-left: 4px solid var(--verde); }
.toast.err { border-left: 4px solid var(--rojo); }

/* ---------- Footer ---------- */
.footer { margin-top: auto; border-top: 1px solid var(--border); padding: 18px 0; }
.footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; font-size: .85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid.cols-2, .grid.cols-3, .matriz, .stats { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 1.8rem; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grid.cols-2, .grid.cols-3, .matriz, .stats { grid-template-columns: 1fr; }
  .nav { justify-content: center; }
}
