:root {
  --bg: #f6f8fa; --card: #fff; --text: #1a2332; --muted: #667085; --border: #e2e6ea;
  --accent: #1a6cb8; --on-accent: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5; }
.top { display: flex; align-items: center; gap: .8rem; background: #0b0f14; color: #fff; padding: .7rem 1rem; }
.brand { font-family: monospace; font-weight: 700; font-size: 1.2rem; color: #3d92dd; }
.brand span { color: #fff; }
.topttl { font-weight: 600; font-size: 1rem; }
main { max-width: 780px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.intro { color: var(--muted); font-size: .92rem; margin: .3rem 0 1.1rem; }

.meta { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .7rem; }
.meta label { display: flex; flex-direction: column; font-size: .74rem; color: var(--muted); gap: .2rem; }
.meta input { padding: .45rem .6rem; border: 1px solid var(--border); border-radius: .45rem; font-size: 1rem;
  background: #fff; color: var(--text); width: 130px; text-transform: uppercase; }
.meta input[type=date] { text-transform: none; }

.afrow { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.afbtn { background: #eaf3fb; color: #1a6cb8; border: 1px solid #b9d6ee; border-radius: .5rem;
  padding: .5rem .9rem; font-size: .9rem; font-weight: 600; cursor: pointer; }
.afbtn:hover:not(:disabled) { background: #dcecf9; }
.afbtn:disabled { opacity: .55; cursor: default; }
.afmsg { font-size: .8rem; color: var(--muted); flex: 1; min-width: 200px; }
.loading { color: var(--muted); }

.section { border: 1px solid var(--border); border-radius: .7rem; padding: .4rem 1rem 1rem; margin-bottom: 1rem; background: var(--card); }
.sec-title { font-size: 1.05rem; margin: .7rem 0 .6rem; display: flex; align-items: center; gap: .45rem; }
.q { padding: .55rem 0; border-top: 1px solid #eef1f4; }
.q:first-of-type { border-top: none; }
.q-text { font-size: .95rem; margin-bottom: .5rem; }
.opts { display: flex; flex-wrap: wrap; gap: .45rem; }
.opt { border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: .5rem;
  padding: .45rem .75rem; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.opt:hover { border-color: var(--accent); }
.opt .pts { font-size: .72rem; font-weight: 700; opacity: .65; }
.opt.active { color: #fff; border-color: transparent; font-weight: 600; }
.opt.active.r_ok { background: #1a7f37; } .opt.active.r_mid { background: #b8860b; }
.opt.active.r_hi { background: #c2410c; } .opt.active.r_crit { background: #b42318; }

/* Panel de resultado — fijo abajo en mobile, lateral en desktop */
.result { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card);
  border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(0,0,0,.12);
  padding: .8rem 1rem 1rem; z-index: 20; max-height: 62vh; overflow: auto; }
.band { border-radius: .6rem; padding: .7rem 1rem; color: #fff; text-align: center; }
.band.verde { background: linear-gradient(135deg,#1a7f37,#15692e); }
.band.amarillo { background: linear-gradient(135deg,#c99700,#a97e00); }
.band.rojo { background: linear-gradient(135deg,#c2261a,#9d1b12); }
.band-label { font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; opacity: .95; }
.band-score { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.band-score small { font-size: .85rem; font-weight: 600; opacity: .85; }
.band-barwrap { height: 6px; background: rgba(255,255,255,.3); border-radius: 3px; overflow: hidden; margin: .35rem 0 .25rem; }
.band-bar { height: 100%; background: rgba(255,255,255,.92); width: 0; }
.band-prog { font-size: .72rem; opacity: .9; }
.crit { margin-top: .6rem; background: #fde8e6; border: 1px solid #f1b0aa; color: #8a1c12;
  border-radius: .5rem; padding: .5rem .7rem; font-size: .84rem; font-weight: 600; }
.band-msg { font-size: .85rem; margin: .6rem 0; }
.factors { border: 1px solid var(--border); border-radius: .55rem; padding: .5rem .6rem; margin-bottom: .7rem; }
.factors-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .35rem; }
.factor { display: flex; align-items: baseline; gap: .4rem; font-size: .82rem; padding: .16rem 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; position: relative; top: 1px; }
.dot.mid { background: #b8860b; } .dot.hi { background: #c2410c; } .dot.crit { background: #b42318; }
.factor-q { flex: 1; } .factor-sel { color: var(--muted); white-space: nowrap; }
.ractions { display: flex; gap: .5rem; }
.printbtn { flex: 1; background: var(--accent); color: #fff; border: none; padding: .55rem; border-radius: .45rem; font-weight: 600; cursor: pointer; }
.resetbtn { background: none; border: 1px solid var(--border); color: var(--muted); padding: .55rem .8rem; border-radius: .45rem; cursor: pointer; }
.disclaimer { margin: .7rem 0 0; font-size: .72rem; color: var(--muted); }
main { padding-bottom: 40vh; }
.foot { text-align: center; color: var(--muted); font-size: .74rem; padding: 1rem; }

@media (min-width: 900px) {
  main { max-width: 700px; margin-left: max(1rem, calc(50% - 560px)); }
  .result { position: fixed; left: auto; right: 1.5rem; bottom: auto; top: 1.5rem; width: 300px;
    border: 1px solid var(--border); border-radius: .8rem; box-shadow: 0 4px 20px rgba(0,0,0,.08); max-height: none; }
  main { padding-bottom: 2rem; }
}
@media print {
  .top, .afrow, .ractions, .foot, .opt:not(.active), .meta input { display: none !important; }
  .result { position: static; box-shadow: none; border: 1px solid #999; }
  .opt.active { color: #000 !important; background: none !important; border: 1px solid #333 !important; }
}
