/* ============================================================
   Tema corporativo — DiagnosticoIA (sobre Bootstrap 5)
   Identidad: entidad certificadora, sobria y profesional.
   ============================================================ */
:root {
  --navy: #14263d;
  --navy-2: #1d3a5f;
  --navy-3: #0e1b2c;
  --accent: #2e6bd6;
  --accent-2: #1f4fa8;
  --cta: #3d7bff;
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #24303e;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #1e7a4d;
  --warn: #b07f10;
  --bad: #b03a3a;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 54, .06), 0 1px 6px rgba(16, 32, 54, .05);
  --shadow-md: 0 6px 18px rgba(16, 32, 54, .09), 0 2px 6px rgba(16, 32, 54, .06);
  --shadow-lg: 0 16px 40px rgba(16, 32, 54, .14);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 15.5px;
}

h1 { font-size: 1.55rem; font-weight: 700; color: var(--navy); letter-spacing: -.01em; margin-bottom: .35rem; }
h2 { font-size: 1.12rem; font-weight: 650; color: var(--navy-2); margin: 1.4rem 0 .7rem; }
.page-sub { color: var(--muted); margin-bottom: 1.6rem; }
a { color: var(--accent); }

/* Animación de entrada sutil */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeUp .35s ease-out both; }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

/* ---------- Marca ---------- */
.brand, .sidebar-brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; font-size: 1.25rem; color: #fff;
  background: linear-gradient(135deg, var(--cta), var(--accent-2));
  box-shadow: 0 4px 12px rgba(46, 107, 214, .35);
}
.brand-text { color: #fff; font-weight: 700; line-height: 1.15; font-size: 1.06rem; letter-spacing: .2px; }
.brand-text small { display: block; font-weight: 400; font-size: .68rem; color: #9db3d0; letter-spacing: .8px; text-transform: uppercase; }

/* ---------- Navbar pública / cliente ---------- */
.site-nav {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-3) 100%);
  padding: .8rem 0; box-shadow: var(--shadow-md);
}
.site-nav .nav-link { color: #d6e1f0; font-size: .93rem; transition: color .15s; }
.site-nav .nav-link:hover { color: #fff; }
.site-nav .navbar-toggler { border-color: rgba(255,255,255,.25); }
.site-nav .navbar-toggler-icon { filter: invert(1); }
.nav-user { color: #8fa5c2; font-size: .88rem; display: flex; align-items: center; gap: .4rem; padding: .5rem .6rem; }

.page-main { padding-top: 2.2rem; padding-bottom: 3.5rem; min-height: 62vh; }

/* ---------- Botones ---------- */
.btn { border-radius: 9px; font-weight: 600; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:active { transform: scale(.98); }

/* Botón por defecto del sistema (clase .btn sola) y CTA */
.btn:not([class*="btn-outline"]):not(.btn-secundario):not(.btn-toggle):not(.navbar-toggler) {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; padding: .58rem 1.3rem;
  box-shadow: 0 3px 10px rgba(46, 107, 214, .3);
  margin-top: .9rem;
}
.btn:not([class*="btn-outline"]):not(.btn-secundario):hover {
  color: #fff; box-shadow: 0 6px 16px rgba(46, 107, 214, .42); transform: translateY(-1px);
}
.btn-cta { background: linear-gradient(135deg, var(--cta), var(--accent)); margin-top: 0 !important; }
.btn-secundario {
  background: #fff; color: var(--navy-2); border: 1px solid var(--border);
  padding: .58rem 1.2rem; margin-top: .9rem; box-shadow: var(--shadow-sm);
}
.btn-secundario:hover { background: #f4f7fb; color: var(--navy); border-color: #c9d4e2; transform: translateY(-1px); }
.btn-small { padding: .34rem .85rem !important; font-size: .86rem; margin-top: 0 !important; box-shadow: none !important; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem 1.75rem; margin-bottom: 1.4rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card h2:first-child, .card h1:first-child { margin-top: 0; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .86rem; margin: .9rem 0 .3rem; color: var(--navy-2); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 9px;
  font: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(46, 107, 214, .16);
}
.form-hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.form-narrow { max-width: 470px; margin-left: auto; margin-right: auto; }

/* ---------- Alertas heredadas ---------- */
.alert { border-radius: 10px; }
.alert-ok { background: #e7f3ec; color: var(--ok); border: 1px solid #bcdcc9; padding: .8rem 1rem; margin-bottom: 1.2rem; }
.alert-error { background: #f8e9e9; color: var(--bad); border: 1px solid #e3bcbc; padding: .8rem 1rem; margin-bottom: 1.2rem; }

/* ---------- Tablas ---------- */
table.tabla {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.tabla th {
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff; text-align: left; padding: .72rem .85rem;
  font-size: .8rem; letter-spacing: .4px; text-transform: uppercase; font-weight: 600;
}
.tabla td { padding: .72rem .85rem; border-top: 1px solid var(--border); vertical-align: top; font-size: .92rem; }
.tabla tr:first-child td { border-top: none; }
.tabla tbody tr, .tabla tr { transition: background .12s; }
.tabla tr:hover td { background: #f6f9fd; }

/* ---------- Badges ---------- */
.badge { padding: .3em .8em; border-radius: 20px; font-size: .76rem; font-weight: 600; letter-spacing: .2px; }
.badge-verde { background: #e2f2e9; color: var(--ok); }
.badge-ambar { background: #f9f1da; color: var(--warn); }
.badge-rojo  { background: #f8e6e6; color: var(--bad); }
.badge-gris  { background: #edf0f4; color: var(--muted); }
.badge-azul  { background: #e4edfb; color: var(--accent-2); }

/* ---------- Utilidades ---------- */
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.acciones { display: flex; gap: .6rem; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Hero (landing) ---------- */
.hero {
  text-align: center; color: #fff; border-radius: 18px;
  padding: 3.6rem 2rem 3.2rem; margin-bottom: 1.8rem;
  background:
    radial-gradient(1100px 420px at 15% -20%, rgba(61, 123, 255, .35), transparent 60%),
    radial-gradient(900px 400px at 95% 130%, rgba(46, 107, 214, .3), transparent 55%),
    linear-gradient(150deg, var(--navy-2) 0%, var(--navy-3) 85%);
  box-shadow: var(--shadow-lg);
}
.hero h1 { color: #fff; font-size: 2.05rem; max-width: 760px; margin: 0 auto .6rem; }
.hero p { max-width: 660px; margin: .7rem auto; color: #c6d4e6; }
.hero .small { color: #8fa5c2; }
.hero .btn-secundario { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.hero .btn-secundario:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ---------- Tarjetas de estadísticas (admin) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.stat-icon.verde { background: linear-gradient(135deg, #2ea56c, #1e7a4d); }
.stat-icon.ambar { background: linear-gradient(135deg, #d9a624, #b07f10); }
.stat-num { font-size: 1.45rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--muted); }

/* ============================================================
   Panel de administración (sidebar estilo AdminLTE)
   ============================================================ */
.admin-body { background: var(--bg); }
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px; flex: none; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-3) 100%);
  color: #d6e1f0; position: sticky; top: 0; height: 100vh;
  box-shadow: 2px 0 14px rgba(10, 22, 38, .18); z-index: 1040;
}
.sidebar-brand { padding: 1.1rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-nav { padding: .9rem .7rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; overflow-y: auto; }
.sidebar-link {
  display: flex; align-items: center; gap: .8rem;
  color: #aebdd2; text-decoration: none; font-size: .92rem;
  padding: .62rem .85rem; border-radius: 9px; border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(61,123,255,.22), rgba(61,123,255,.06));
  color: #fff; border-left-color: var(--cta); font-weight: 600;
}
.sidebar-foot { padding: .8rem .7rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: .6rem; color: #8fa5c2; font-size: .85rem; padding: .4rem .85rem .7rem; }
.sidebar-user i { font-size: 1.2rem; }

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  background: #fff; display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.6rem; box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 1030;
}
.topbar-title { font-weight: 650; color: var(--navy); font-size: 1.02rem; }
.btn-toggle {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  width: 38px; height: 38px; font-size: 1.15rem; color: var(--navy-2);
  display: none; align-items: center; justify-content: center; cursor: pointer;
}
.admin-content { padding: 1.8rem 1.9rem 3rem; max-width: 1240px; width: 100%; }
/* Dentro del panel admin los formularios angostos se alinean a la izquierda
   (el centrado de .form-narrow es para páginas sin sidebar, como los login) */
.admin-content .form-narrow { margin-left: 0; margin-right: auto; }
.admin-footer { margin-top: auto; padding: .9rem 1.9rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); background: #fff; }

@media (max-width: 991px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: none; }
  .btn-toggle { display: inline-flex; }
}

/* ---------- Checklist ---------- */
.punto-item {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1.1rem 1.2rem; margin-bottom: 1rem; background: #fbfcfe;
  transition: border-color .2s, background .2s;
}
.punto-item.punto-ok { border-color: #bcdcc9; background: #f7fcf9; }
.punto-titulo { margin-bottom: .2rem; color: var(--navy); }
.opcion-radio {
  display: flex; gap: .6rem; align-items: flex-start;
  font-weight: 400; font-size: .92rem; margin: .35rem 0; cursor: pointer;
  padding: .45rem .6rem; border-radius: 8px; transition: background .12s;
}
.opcion-radio:hover { background: #eef3fa; }
.opcion-radio input { width: auto; margin-top: .22rem; accent-color: var(--accent); }
.progress { border-radius: 20px; background: #e4e9f1; }

/* ---------- Chat de perfilamiento ---------- */
.chat-card { padding: 0 0 1rem; overflow: hidden; max-width: 780px; margin: 0 auto 1.4rem; }
.chat-cabecera {
  display: flex; align-items: center; gap: .8rem;
  padding: 1rem 1.4rem; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfcfe, #f4f7fb);
}
.chat-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
.chat-avatar-bot { background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: #fff; }
.chat-avatar-user { background: #dfe7f2; color: var(--accent-2); }
.chat-box {
  max-height: 460px; min-height: 260px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 1rem; padding: 1.4rem 1.4rem .6rem; background: #f7f9fc;
  scroll-behavior: smooth;
}
.msg { display: flex; gap: .6rem; align-items: flex-end; animation: fadeUp .25s ease-out both; }
.msg-bot { justify-content: flex-start; }
.msg-user { justify-content: flex-end; }
.msg .chat-avatar { width: 32px; height: 32px; font-size: .9rem; }
.burbuja {
  max-width: 72%; padding: .8rem 1.05rem 1.15rem; border-radius: 16px;
  font-size: .94rem; line-height: 1.55; position: relative;
}
.burbuja-bot {
  background: #fff; color: var(--text);
  border-bottom-left-radius: 4px; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.burbuja-user {
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-bottom-right-radius: 4px; box-shadow: 0 3px 10px rgba(46,107,214,.25);
}
.msg-hora {
  position: absolute; right: .8rem; bottom: .28rem;
  font-size: .64rem; opacity: .6;
}
.typing { display: flex; gap: 5px; align-items: center; padding: 1rem 1.1rem; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9db3d0;
  animation: puntito 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }
@keyframes puntito { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat-form {
  display: flex; gap: .7rem; align-items: center;
  padding: 1rem 1.4rem 0; border-top: 1px solid var(--border); margin-top: .4rem;
}
.chat-form input[type=text] { flex: 1; border-radius: 24px; padding: .7rem 1.2rem; background: #f4f7fb; }
.chat-form input[type=text]:focus { background: #fff; }
.chat-enviar {
  width: 46px; height: 46px; border-radius: 50%; border: none; flex: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(46,107,214,.35); transition: transform .15s, box-shadow .15s;
}
.chat-enviar:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(46,107,214,.45); }
.chat-enviar:disabled { opacity: .55; }

/* ---------- Motor de preguntas (estilo motor de certificación) ---------- */
.exam-shell {
  max-width: 980px; margin: 0 auto; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); overflow: hidden; position: relative;
  display: flex; flex-direction: column; min-height: 560px;
}
.exam-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  color: #fff; padding: .75rem 1.3rem; font-size: .93rem;
}
.exam-header-izq { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.exam-header-der { display: flex; align-items: center; gap: .7rem; color: #cdd9ea; font-size: .88rem; }
.exam-sep { opacity: .4; }
.exam-progress { height: 5px; background: #e4e9f1; }
.exam-progress > div { height: 100%; background: linear-gradient(90deg, var(--cta), var(--accent)); transition: width .3s; }
.exam-toolbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: #eef2f8; border-bottom: 1px solid var(--border); padding: .5rem 1.3rem;
}
.exam-tool {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--border); background: #fff; border-radius: 7px;
  padding: .35rem .8rem; font-size: .84rem; font-weight: 600; color: var(--navy-2);
  cursor: pointer; transition: all .15s;
}
.exam-tool:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.exam-tool:disabled { opacity: .45; cursor: default; }
.exam-bloque { font-size: .8rem; font-weight: 600; color: var(--accent-2); text-transform: uppercase; letter-spacing: .5px; }
.exam-guardado { margin-left: auto; font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.exam-guardado .bi-check-circle-fill { color: var(--ok); }

.exam-body { flex: 1; padding: 2rem 2.4rem; overflow-y: auto; }
@media (max-width: 640px) { .exam-body { padding: 1.3rem 1.1rem; } }
.exam-codigo { font-size: .8rem; font-weight: 700; color: var(--accent-2); letter-spacing: .5px; margin-bottom: .3rem; }
.exam-titulo { font-size: 1.35rem; font-weight: 700; color: var(--navy); line-height: 1.35; margin: 0 0 .35rem; }
@media (max-width: 640px) { .exam-titulo { font-size: 1.1rem; } }
.exam-desc { color: var(--muted); margin-bottom: 1.5rem; }
.exam-opciones { max-width: 760px; }
.exam-opcion {
  display: flex; align-items: flex-start; gap: .8rem; width: 100%;
  border: 1.5px solid transparent; border-bottom: 1px solid var(--border); border-radius: 8px;
  padding: .8rem .9rem; cursor: pointer; font-weight: 400; font-size: .95rem; margin: 0 0 .15rem;
  transition: background .13s, border-color .13s;
}
.exam-opcion:hover { background: #f2f7ff; }
.exam-opcion.sel { background: #eaf2ff; border-color: var(--accent); border-radius: 8px; }
.exam-opcion input { width: auto; margin-top: .3rem; accent-color: var(--accent); flex: none; }
.exam-letra {
  width: 25px; height: 25px; flex: none; border-radius: 6px; border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: var(--muted); background: #fff; margin-top: .1rem;
}
.exam-opcion.sel .exam-letra { background: var(--accent); border-color: var(--accent); color: #fff; }
.exam-tiene-decl { font-size: .8rem; color: var(--ok); margin-top: 1rem; }

.exam-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  padding: .7rem 1.3rem;
}
.exam-info-btn {
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); color: #dbe4f0;
  border-radius: 7px; padding: .42rem .95rem; font-size: .86rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.exam-info-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.exam-nav { display: flex; gap: .6rem; }
.exam-nav-btn {
  border: none; background: #fff; color: var(--navy-2); border-radius: 7px;
  padding: .45rem 1.1rem; font-size: .9rem; font-weight: 700; cursor: pointer;
  transition: all .15s; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.exam-nav-btn:hover:not(:disabled) { transform: translateY(-1px); background: #eef4ff; }
.exam-nav-btn:disabled { opacity: .4; cursor: default; }

/* Modal de salida del cuestionario */
.salida-overlay {
  position: fixed; inset: 0; background: rgba(16, 32, 54, .55);
  display: flex; align-items: center; justify-content: center; z-index: 1060;
  padding: 1rem; backdrop-filter: blur(2px);
}
.salida-modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  max-width: 460px; width: 100%; padding: 1.8rem 1.9rem; text-align: center;
  animation: fadeUp .22s ease-out both;
}
.salida-icono {
  width: 58px; height: 58px; border-radius: 50%; margin: 0 auto .8rem;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.salida-icono.alerta { background: linear-gradient(135deg, #d9a624, #b07f10); }
.salida-modal h3 { font-size: 1.15rem; font-weight: 700; color: var(--navy); margin-bottom: .5rem; }
.salida-acciones { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-top: 1.2rem; }

/* Bloc de declaración flotante (scratch pad) */
.scratch {
  position: absolute; top: 120px; right: 26px; width: 380px; max-width: calc(100% - 32px);
  background: #fff; border: 1px solid var(--navy-2); border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 50; display: flex; flex-direction: column;
}
.scratch-head {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  background: linear-gradient(180deg, var(--navy-2), var(--navy)); color: #fff;
  border-radius: 9px 9px 0 0; padding: .5rem .8rem; font-size: .84rem; font-weight: 600;
  cursor: move; user-select: none;
}
.scratch-cerrar {
  border: none; background: transparent; color: #cdd9ea; cursor: pointer; font-size: .85rem;
  padding: .1rem .3rem; border-radius: 5px;
}
.scratch-cerrar:hover { background: rgba(255,255,255,.15); color: #fff; }
.scratch textarea {
  border: none; border-radius: 0; min-height: 170px; resize: vertical; font-size: .9rem;
}
.scratch textarea:focus { box-shadow: none; }
.scratch-foot {
  font-size: .72rem; color: var(--muted); padding: .4rem .8rem;
  border-top: 1px solid var(--border); background: #f7f9fc; border-radius: 0 0 9px 9px;
}
.wiz-resumen-item {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; font: inherit;
  background: #fbfcfe; border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .95rem; margin-bottom: .5rem; cursor: pointer; transition: border-color .15s, background .15s;
}
.wiz-resumen-item:hover { border-color: var(--accent); background: #f2f7ff; }
.wiz-resumen-titulo { flex: 1; font-size: .92rem; color: var(--text); }
.wiz-resumen-bloque { font-size: .95rem; font-weight: 650; color: var(--navy-2); margin: 1.1rem 0 .5rem; }
.wiz-declaracion summary { color: var(--accent); font-size: .88rem; cursor: pointer; margin-top: .4rem; }

/* ---------- Informe ---------- */
.informe-doc { padding: 2.2rem 2.5rem; }
.informe-encabezado {
  display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  border-bottom: 2px solid var(--navy); padding-bottom: 1rem; margin-bottom: 1.4rem;
}
.informe-marca { font-weight: 700; color: var(--navy); font-size: 1.15rem; margin-bottom: .2rem; }
.informe-h3 { font-size: 1rem; font-weight: 650; color: var(--navy-2); margin: 1rem 0 .3rem; }
.informe-pie { border-top: 1px solid var(--border); padding-top: .9rem; margin-top: 1.6rem; }
.btn-link-inline { background: none; border: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }

@media print {
  .site-nav, .footer, .solo-pantalla, .alert { display: none !important; }
  body { background: #fff; }
  .page-main { padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  .informe-doc { padding: 0; }
}

/* ---------- Dashboard del cliente ---------- */
.dash-cabecera { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.6rem; }
.dash-avatar {
  width: 54px; height: 54px; border-radius: 16px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--navy-2), var(--navy));
  box-shadow: var(--shadow-md);
}
.dash-principal { padding: 1.9rem 2.1rem; }
.dash-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #f1f5fa; border: 1px solid var(--border); border-radius: 20px;
  padding: .3rem .85rem; font-size: .8rem; color: var(--muted);
}
.chip i { color: var(--accent-2); }

/* Línea de progreso del proceso */
.journey { display: flex; align-items: flex-start; margin: 1.4rem 0 1.8rem; }
.paso { display: flex; flex-direction: column; align-items: center; gap: .45rem; min-width: 84px; }
.paso-icono {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
  background: #eef2f8; color: var(--muted); border: 2px solid var(--border);
  transition: all .2s;
}
.paso-nombre { font-size: .76rem; color: var(--muted); text-align: center; font-weight: 600; }
.paso.done .paso-icono { background: linear-gradient(135deg, #2ea56c, #1e7a4d); border-color: transparent; color: #fff; }
.paso.done .paso-nombre { color: var(--ok); }
.paso.actual .paso-icono {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff;
  box-shadow: 0 0 0 5px rgba(46,107,214,.16); animation: latido 2s infinite;
}
.paso.actual .paso-nombre { color: var(--accent-2); }
@keyframes latido { 0%,100% { box-shadow: 0 0 0 5px rgba(46,107,214,.16); } 50% { box-shadow: 0 0 0 9px rgba(46,107,214,.08); } }
.journey-linea { flex: 1; height: 3px; background: var(--border); margin-top: 21px; border-radius: 2px; }
.journey-linea.done { background: linear-gradient(90deg, #2ea56c, var(--accent)); }
@media (max-width: 640px) { .paso { min-width: 62px; } .paso-nombre { font-size: .66rem; } }

/* CTA del siguiente paso */
.dash-cta {
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
  background: linear-gradient(135deg, #f4f8ff 0%, #fdfefe 60%);
  border: 1.5px solid #c8d9f4; border-radius: 12px; padding: 1.3rem 1.5rem;
}
.dash-cta-titulo { font-size: 1.05rem; font-weight: 650; color: var(--navy); margin: 0 0 .2rem; }
.dash-cta .btn { white-space: nowrap; }

/* Nivel global + tarjetas de acción */
.dash-nivel { display: flex; align-items: baseline; gap: .8rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.dash-nivel-num { font-size: 1.7rem; font-weight: 800; color: var(--accent-2); letter-spacing: -.01em; }
.accion-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1rem; }
.accion-card {
  position: relative; display: flex; flex-direction: column; gap: .3rem;
  background: #fbfcfe; border: 1.5px solid var(--border); border-radius: 12px;
  padding: 1.2rem 1.3rem 1.1rem; text-decoration: none; color: var(--text);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.accion-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent); color: var(--text); }
.accion-card.destacada { background: linear-gradient(135deg, #eef5ff 0%, #fbfcfe 70%); border-color: #c8d9f4; }
.accion-icono {
  width: 42px; height: 42px; border-radius: 11px; margin-bottom: .35rem;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 3px 10px rgba(46,107,214,.28);
}
.accion-titulo { font-weight: 700; color: var(--navy); }
.accion-desc { font-size: .82rem; color: var(--muted); }
.accion-flecha {
  position: absolute; top: 1.1rem; right: 1.1rem; color: var(--accent);
  opacity: 0; transform: translateX(-4px); transition: all .16s ease;
}
.accion-card:hover .accion-flecha { opacity: 1; transform: none; }

/* Estado emitido */
.dash-emitido { display: flex; gap: 1.4rem; align-items: stretch; flex-wrap: wrap; }
.dash-mini-sello {
  display: flex; align-items: center; gap: 1rem; min-width: 230px;
  border: 2px solid var(--navy); border-radius: 14px; padding: 1.2rem 1.5rem;
  background: linear-gradient(180deg, #fff 0%, #f4f7fb 100%);
}
.dash-mini-sello > i { font-size: 2.3rem; color: var(--navy-2); }

/* Hero de inicio */
.hero-diag { background: linear-gradient(135deg, #f4f8ff 0%, #ffffff 55%); border-color: #c8d9f4; }
.hero-diag-icono {
  width: 76px; height: 76px; border-radius: 22px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px rgba(46,107,214,.35);
}

/* ---------- Tarjeta de emisión ---------- */
.emitir-card {
  border: 1.5px solid #c8d9f4;
  background: linear-gradient(135deg, #f4f8ff 0%, #ffffff 55%);
}
.emitir-card.emitida { border-color: #bcdcc9; background: linear-gradient(135deg, #f2fbf6 0%, #ffffff 55%); }
.emitir-inner { display: flex; gap: 1.2rem; align-items: flex-start; }
.emitir-icono {
  width: 58px; height: 58px; border-radius: 16px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.7rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px rgba(46,107,214,.3);
}
.emitir-icono.ok { background: linear-gradient(135deg, #2ea56c, #1e7a4d); box-shadow: 0 6px 16px rgba(30,122,77,.3); }
.emitir-acciones { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.2rem; padding-left: calc(58px + 1.2rem); }
@media (max-width: 640px) { .emitir-acciones { padding-left: 0; } }

/* ---------- Sello ---------- */
.sello-visual {
  display: inline-flex; flex-direction: column; align-items: center; gap: .45rem;
  border: 2px solid var(--navy); border-radius: 14px; padding: 1.6rem 2.2rem; margin: .5rem auto;
  background: linear-gradient(180deg, #fff 0%, #f4f7fb 100%);
}
.sello-marca { font-weight: 700; color: var(--navy); letter-spacing: .5px; }
.sello-titulo { font-size: .8rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); }
.sello-nivel { font-size: 1.5rem; font-weight: 700; color: var(--accent-2); }
.sello-empresa { font-size: .95rem; color: var(--text); }
.sello-qr { padding: .6rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.sello-fechas { font-size: .78rem; color: var(--muted); }

/* ---------- Login admin ---------- */
.login-admin { padding: 0; overflow: hidden; }
.login-admin-cabecera {
  display: flex; align-items: center; gap: 1rem; padding: 1.6rem 1.8rem;
  background: linear-gradient(150deg, var(--navy-2) 0%, var(--navy-3) 90%);
}
.login-admin-cabecera h1 { font-size: 1.3rem; }
.login-admin-cuerpo { padding: 1.4rem 1.8rem 1.8rem; }

/* ---------- Ponderaciones ---------- */
.peso-control { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.peso-preset {
  border: 1.5px solid var(--border); background: #fff; border-radius: 8px;
  padding: .28rem .6rem; font-size: .8rem; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all .13s;
}
.peso-preset:hover { border-color: var(--accent); color: var(--accent); }
.peso-preset.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.peso-input { width: 78px !important; padding: .32rem .5rem !important; font-size: .86rem; }
tr.fila-peso-distinto td { background: #f0f6ff !important; }
tr.fila-peso-distinto td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.peso-guardar {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; background: rgba(255,255,255,.94); backdrop-filter: blur(4px);
  border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1.2rem; margin-top: 1rem;
  box-shadow: var(--shadow-md); z-index: 10;
}

/* ---------- Selector de bloques (catálogo) ---------- */
.bloque-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.bloque-pill {
  display: inline-flex; align-items: center; gap: .5rem; text-decoration: none;
  border: 1.5px solid var(--border); background: #fff; border-radius: 24px;
  padding: .45rem 1rem; font-size: .88rem; font-weight: 600; color: var(--navy-2);
  transition: all .15s;
}
.bloque-pill:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.bloque-pill.sel { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.bloque-pill .contador {
  background: rgba(0,0,0,.08); border-radius: 12px; padding: .05rem .5rem; font-size: .74rem;
}
.bloque-pill.sel .contador { background: rgba(255,255,255,.22); }

/* ---------- Editor de punto: niveles a color ---------- */
.nivel-etiqueta {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .8rem; font-weight: 700; padding: .22rem .7rem; border-radius: 14px; margin-bottom: .25rem;
}
.nivel-0 { background: #f8e6e6; color: var(--bad); }
.nivel-1 { background: #f9f1da; color: var(--warn); }
.nivel-2 { background: #e4edfb; color: var(--accent-2); }
.nivel-3 { background: #e2f2e9; color: var(--ok); }

/* ---------- Filtros de diagnósticos ---------- */
.filtro-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }

/* ---------- Pie público ---------- */
.footer { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-3) 100%); color: #aebdd2; padding: 2.2rem 0 1.4rem; font-size: .87rem; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; margin-bottom: 1rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand { color: #fff; font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.footer-legal { color: #8fa5c2; font-size: .78rem; }
.footer-copy { border-top: 1px solid rgba(255,255,255,.1); padding-top: .9rem; color: #7d92b0; font-size: .78rem; }
.footer-copy a { color: #9db3d0; text-decoration: none; }
.footer-copy a:hover { color: #fff; }
.footer p { margin: .25rem 0 .6rem; }
