:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1e3a8a;
  --brand-2: #2563eb;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
a { color: var(--brand-2); text-decoration: none; }

/* ---------- topbar ---------- */
.topbar {
  background: var(--brand);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar .logo { font-weight: 700; font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; opacity: .9; text-align: right; }
.topbar .who b { display: block; font-size: 14px; opacity: 1; }
.topbar a.salir {
  color: #fff; border: 1px solid rgba(255,255,255,.4);
  padding: 6px 14px; border-radius: 8px; font-size: 13px;
}
.topbar a.salir:hover { background: rgba(255,255,255,.12); }

.wrap { max-width: 1400px; margin: 20px auto; padding: 0 16px; }

/* ---------- tarjetas de resumen ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border-radius: var(--radius); padding: 12px 14px;
  border-left: 4px solid var(--c, var(--muted)); box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }

/* ---------- filtros ---------- */
.filtros {
  background: var(--panel); border-radius: var(--radius); padding: 12px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 16px;
}
.filtros label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .03em; }
.filtros select, .filtros input[type=text] {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; min-width: 120px;
}
.filtros input[type=text] { min-width: 220px; }
.btn {
  background: var(--brand-2); color: #fff; border: none; padding: 8px 16px;
  border-radius: 8px; font-size: 13px; cursor: pointer; font-weight: 600;
}
.btn:hover { filter: brightness(1.1); }
.btn.gris { background: #94a3b8; }

/* ---------- tabla ---------- */
.tabla-wrap { background: var(--panel); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.06); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line);
  background: #f8fafc; position: sticky; top: 0;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #f8fafc; }
tr.resaltado td { background: #fef9c3; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white);
  border: 1px solid color-mix(in srgb, var(--c) 30%, white); white-space: nowrap;
}
/* Se ve como enlace, pero es <button> porque copia en vez de navegar. */
.wa {
  white-space: nowrap; background: none; border: none; padding: 0; margin: 0;
  cursor: pointer; color: var(--brand-2); font: inherit; text-decoration: none;
  appearance: none; -webkit-appearance: none;
}
.wa:hover { text-decoration: underline; }
.wa.copiado { color: #16a34a; }
.wa.error-copia { color: #dc2626; }

.folio { font-weight: 700; }
.mini { font-size: 12px; color: var(--muted); }

/* ---------- login ---------- */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a, #0f172a); }
.login-card { background: #fff; padding: 36px; border-radius: 14px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card p.sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card label { font-size: 12px; color: var(--muted); display: block; margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.login-card .btn { width: 100%; margin-top: 18px; padding: 11px; }
.error { background: #fee2e2; color: #b91c1c; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }
.ok { background: #dcfce7; color: #15803d; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }

/* ---------- detalle de caso ---------- */
.grid-caso { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-caso { grid-template-columns: 1fr; } }
.card { background: var(--panel); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.06); margin-bottom: 16px; }
.card h2 { font-size: 15px; margin-bottom: 12px; color: var(--brand); }
.datos dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 10px; }
.datos dd { font-size: 14px; margin-top: 2px; }
.acciones select, .acciones textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; margin-bottom: 10px; background: #fff;
}
.acciones textarea { min-height: 70px; resize: vertical; font-family: inherit; }

/* ---------- timeline ---------- */
.timeline { list-style: none; }
.timeline li { border-left: 3px solid var(--line); padding: 0 0 14px 14px; position: relative; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 3px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--brand-2); border: 2px solid #fff;
}
.timeline li.t-estatus_pf::before { background: #7c3aed; }
.timeline li.t-estatus_ma::before { background: #ea580c; }
.timeline li.t-asignacion::before { background: #16a34a; }
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline .texto { margin-top: 2px; }

.volver { display: inline-block; margin-bottom: 12px; font-size: 13px; }
.paginacion { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.paginacion a, .paginacion span {
  padding: 6px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 13px;
}
.paginacion span.actual { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.refresco { font-size: 12px; color: var(--muted); margin-left: auto; align-self: center; }
