/* ============================================================
   Panel de Proyectos — NeuroEngine Systems
   Paleta validada (dataviz): azul #2a78d6, naranja #eb6834
   Estados: good #0ca30c · warning #fab219 · critical #d03b3b
   ============================================================ */
:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --accent: #2a78d6;
  --accent-dark: #1c5cab;
  --series-2: #eb6834;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --critical: #d03b3b;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Nav ---------- */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--grid);
  display: flex; align-items: center; gap: 4px;
  padding: 0 20px; height: 56px;
  position: sticky; top: 0; z-index: 10;
}
.nav .brand { font-weight: 700; margin-right: 20px; color: var(--ink); font-size: 15px; }
.nav .brand span { color: var(--accent); }
.nav a.item {
  padding: 6px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500;
}
.nav a.item:hover { background: var(--page); text-decoration: none; color: var(--ink); }
.nav a.item.active { background: #e8f0fb; color: var(--accent-dark); }
.nav .spacer { flex: 1; }
.nav .who { color: var(--muted); font-size: 13px; margin-right: 10px; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------- Tarjetas / stats ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.card .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.card .value { font-size: 26px; font-weight: 700; }
.card .sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.card.alert .value { color: var(--critical); }
.card.ok .value { color: var(--good-text); }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 16px; }
.panel h2 .hint { font-weight: 400; color: var(--muted); font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.atrasado   { background: #fbeaea; color: #a22525; border-color: #f0c9c9; }
.badge.en-riesgo  { background: #fdf3dc; color: #7a5600; border-color: #f2ddab; }
.badge.al-dia     { background: #e8f6e8; color: var(--good-text); border-color: #c8e8c8; }
.badge.neutral    { background: var(--page); color: var(--ink-2); border-color: var(--grid); }
.badge.estado-borrador { background: var(--page); color: var(--ink-2); border-color: var(--grid); }
.badge.estado-enviada  { background: #e8f0fb; color: var(--accent-dark); border-color: #c8dcf5; }
.badge.estado-pagada   { background: #e8f6e8; color: var(--good-text); border-color: #c8e8c8; }

/* ---------- Barras de progreso ---------- */
.progress { display: flex; align-items: center; gap: 10px; }
.progress .track {
  flex: 1; height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden;
}
.progress .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.progress .fill.atrasado { background: var(--critical); }
.progress .fill.en-riesgo { background: var(--warning); }
.progress .pct { font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Tablas ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--baseline);
}
td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--page); }

/* ---------- Formularios ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--baseline); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec5f4; border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--baseline); }
.btn.secondary:hover { background: var(--page); }
.btn.danger { background: transparent; color: var(--critical); border: 1px solid #f0c9c9; }
.btn.danger:hover { background: #fbeaea; }
.btn.small { padding: 4px 10px; font-size: 13px; }
form.inline { display: inline; }

/* ---------- Flash ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: #e8f6e8; color: var(--good-text); border: 1px solid #c8e8c8; }
.flash.warn { background: #fdf3dc; color: #7a5600; border: 1px solid #f2ddab; }

/* ---------- Actividad ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.feed li:last-child { border-bottom: none; }
.feed .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex-shrink: 0; }
.feed .dot.entrega { background: var(--good); }
.feed .dot.sync { background: var(--series-2); }
.feed .dot.incidencia { background: var(--critical); }
.feed .meta { color: var(--muted); font-size: 12px; }

/* ---------- Commits ---------- */
.commit { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 13px; align-items: baseline; }
.commit:last-child { border-bottom: none; }
.commit .sha { font-family: ui-monospace, monospace; color: var(--accent-dark); flex-shrink: 0; }
.commit .msg { flex: 1; }
.commit .when { color: var(--muted); white-space: nowrap; }

/* ---------- Gráfico de barras (comparación) ---------- */
.chart { margin-top: 6px; }
.chart .row { margin-bottom: 14px; }
.chart .row .name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.chart .bars { display: grid; gap: 2px; }
.chart .bar { height: 16px; border-radius: 0 4px 4px 0; min-width: 2px; position: relative; }
.chart .bar.charged { background: var(--accent); }
.chart .bar.market { background: var(--series-2); }
.chart .bar .val {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.legend { display: flex; gap: 18px; margin-bottom: 14px; font-size: 13px; color: var(--ink-2); }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--page); }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 34px; width: 360px; }
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-error { color: var(--critical); font-size: 13px; margin-bottom: 10px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
