/* Pre-Auditor NIST CSF 2.0 — estilos base del MVP */

:root {
  --primary: #0b3d62;
  --accent: #1e88e5;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #5f6b76;
  --border: #d9e2ec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { font-size: 1.05rem; letter-spacing: 0.02em; }

.badge {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  font-size: 0.8rem;
}

.container {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

h1 { font-size: 1.5rem; margin-top: 0; color: var(--primary); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary:hover { filter: brightness(1.08); }

.alert {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #7a5c00;
}

.alert.error {
  background: #fdecea;
  border-color: #f5c6cb;
  color: #8a1f2d;
}

.alert.error ul { margin: 0; padding-left: 1.2rem; }

/* ---------- Formulario de perfilamiento (Paso 1) ---------- */

.step-label {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.25rem;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 0 0 1.25rem;
}

legend {
  font-weight: 600;
  color: var(--primary);
  padding: 0 0.4rem;
  font-size: 0.95rem;
}

form label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 500;
  font-size: 0.92rem;
}

form input[type="text"],
form input[type="email"],
form input[type="number"],
form select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

form input:focus, form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

label.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 400;
}

label.check input { margin-top: 0.2rem; }

.optional { color: var(--muted); font-weight: 400; }

.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  margin-left: 0.5rem;
}

/* ---------- Resumen del alcance (Paso 2) ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1rem; }

.chip {
  background: #e8f1fb;
  color: var(--primary);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
}

.explanation { font-size: 1.02rem; line-height: 1.55; }

h2 { font-size: 1.05rem; color: var(--primary); margin: 1.5rem 0 0.5rem; }

.functions {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.functions li {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
}

.fn-code {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  margin-right: 0.4rem;
}

.note { color: var(--muted); font-size: 0.9rem; }

/* ---------- Cuestionario (Paso 3) ---------- */

.stepper { display: flex; gap: 0.4rem; margin: 0.5rem 0 1rem; flex-wrap: wrap; }

.step {
  display: inline-block;
  min-width: 2.4rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.step.done { background: #e6f4ea; border-color: #b7dfc2; color: #1e7a3c; }
.step.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.progress {
  height: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.save-status { font-style: italic; }

.question {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: #fff;
}

.q-text { font-weight: 600; margin: 0 0 0.35rem; line-height: 1.45; }
.q-num { color: var(--accent); margin-right: 0.25rem; }
.q-help { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.75rem; }

.options { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.opt {
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.opt:hover { border-color: var(--accent); }

.opt-yes.selected     { background: #e6f4ea; border-color: #1e7a3c; color: #1e7a3c; font-weight: 700; }
.opt-partial.selected { background: #fff8e1; border-color: #b58900; color: #7a5c00; font-weight: 700; }
.opt-no.selected      { background: #fdecea; border-color: #c0392b; color: #8a1f2d; font-weight: 700; }
.opt-unknown.selected { background: #ececf3; border-color: #6c6f85; color: #494c62; font-weight: 700; }

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
}

.nav .btn-secondary { margin-left: 0; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1.25rem;
}

/* ---------- Reporte (Paso 4-5) ---------- */

.report-actions { display: flex; justify-content: flex-end; margin-bottom: 0.5rem; }

.report-header h1 { margin-bottom: 0.15rem; }
.report-meta { color: var(--muted); font-size: 0.9rem; margin-top: 0; }

.score-panel {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0 1.5rem;
}

.score-ring {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 6px solid var(--accent);
  display: flex;
  align-items: baseline;
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
  background: #fff;
}

.score-number { font-size: 2.3rem; font-weight: 800; color: var(--primary); }
.score-max { font-size: 0.95rem; color: var(--muted); }
.score-level { font-size: 1.1rem; margin: 0 0 0.35rem; }
.score-desc { margin: 0; color: var(--muted); }

.radar-wrap { height: 320px; max-width: 460px; margin: 0 auto; }

.fn-scores {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}

.fn-score {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
}

.fn-score strong { margin-left: auto; color: var(--primary); }

table.findings {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0.5rem 0 1rem;
}

.findings th {
  background: var(--primary);
  color: #fff;
  text-align: left;
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
}

.findings td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
  vertical-align: top;
  line-height: 1.4;
}

.findings tbody tr:nth-child(even) { background: #fafbfc; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; white-space: nowrap; }
.center { text-align: center; }

.badge {
  display: inline-block;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-CRITICO { background: #8a1f2d; color: #fff; }
.badge-ALTO    { background: #fdecea; color: #8a1f2d; border: 1px solid #f5c6cb; }
.badge-MEDIO   { background: #fff8e1; color: #7a5c00; border: 1px solid #ffe082; }
.badge-BAJO    { background: #e6f4ea; color: #1e7a3c; border: 1px solid #b7dfc2; }
.badge-VIS     { background: #ececf3; color: #494c62; border: 1px solid #c9cbdd; margin-top: 0.25rem; }

.roadmap { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }

.phase {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.phase h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--primary); }
.phase ul { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; line-height: 1.5; }
.phase li { margin-bottom: 0.3rem; }

.cta {
  margin-top: 1.75rem;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
}

.cta h2 { color: #fff; margin-top: 0; }

.services { list-style: none; padding: 0; margin: 0.75rem 0 1.25rem; }

.services li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.92rem;
}

.svc-count {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.cta-btn { display: inline-block; text-decoration: none; background: var(--accent); }

.print-only { display: none; }

/* ---------- Panel de la consultora (Fase 5) ---------- */

.container-wide { max-width: 1080px; }

.login-card { max-width: 420px; margin: 3rem auto; }

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.admin-head h1 { margin: 0; color: var(--primary); font-size: 1.4rem; }

.container-wide .card { margin-bottom: 1.25rem; overflow-x: auto; }

.invite-form {
  display: grid;
  grid-template-columns: 2fr 2fr auto;
  gap: 0.6rem;
  align-items: start;
}

.invite-form input {
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.invite-ok { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.invite-ok .mono { word-break: break-all; white-space: normal; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th {
  text-align: left;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid var(--border);
}

.admin-table td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.url-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.82rem; margin-left: 0; }

.score-pill {
  display: inline-block;
  min-width: 2.2rem;
  text-align: center;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-weight: 700;
  font-size: 0.85rem;
}

.score-high { background: #e6f4ea; color: #1e7a3c; }
.score-mid  { background: #fff8e1; color: #7a5c00; }
.score-low  { background: #fdecea; color: #8a1f2d; }

@media (max-width: 640px) {
  .invite-form { grid-template-columns: 1fr; }
}

/* Reporte imprimible (Fase 4): print CSS es suficiente para el MVP */
@media print {
  .topbar, .footer, .no-print { display: none !important; }
  .print-only { display: block; color: #fff; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; }
  .findings th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge, .cta, .score-ring, .step, .fn-code {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .findings tr, .phase, .question { break-inside: avoid; }
  h2 { break-after: avoid; }
  .radar-wrap { height: 300px; }
}
