/* Prevención 3 Volcanes · hoja de estilos sin compilación */
:root {
  --ink: #14202b; --muted: #5b6876; --line: #dfe4ea; --bg: #f4f2ee; --card: #fff;
  --brand: #1f2d3a; --brand-2: #2b3c4c; --accent: #c2410c; --accent-ink: #fff; --link: #0b5f8a;
  --ok: #15803d; --ok-bg: #e8f6ed; --warn: #b45309; --warn-bg: #fdf3e2; --bad: #b91c1c; --bad-bg: #fdecec; --info-bg: #e7f1f8;
  --critico: #991b1b; --alto: #c2410c; --medio: #a16207; --bajo: #15803d;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,32,43,.06), 0 4px 14px rgba(20,32,43,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--link); }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .5rem; }
small, .muted { color: var(--muted); }
.wrap { display: flex; min-height: 100vh; }

/* Sidebar */
.side { width: 250px; flex: none; background: var(--brand); color: #d6dee6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: .6rem; padding: 1rem; border-bottom: 1px solid rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.side .brand img { height: 34px; }
.side .brand b { display: block; font-size: 1rem; }
.side .brand span { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #9fb0c0; }
.side nav { padding: .75rem .5rem; flex: 1; }
.side .grp { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #8396a8; margin: .9rem .6rem .3rem; }
.side nav a { display: flex; align-items: center; gap: .6rem; padding: .5rem .65rem; border-radius: 10px; color: #d6dee6; text-decoration: none; font-size: .92rem; }
.side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side nav a.on { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 #fb923c; }
.side nav a .cnt { margin-left: auto; background: var(--bad); color: #fff; font-size: .7rem; border-radius: 99px; padding: 0 .45rem; }
.side svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side .user { padding: .9rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.side .user button { background: none; border: 0; color: #fca5a5; padding: 0; cursor: pointer; font: inherit; }
main { flex: 1; min-width: 0; padding: 1.5rem; max-width: 1280px; }
.topbar { display: none; }
.menu-btn { display: none; }

/* Cabecera de página */
.head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.25rem; }
.head .eyebrow { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.head .sub { color: var(--muted); margin-top: .25rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Tarjetas y grillas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1.1rem; }
.card > h2:first-child { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1.1rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; position: relative; overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #cbd5e1; }
.kpi.bad::before { background: var(--bad); } .kpi.warn::before { background: #f59e0b; } .kpi.ok::before { background: var(--ok); } .kpi.info::before { background: #0284c7; }
.kpi .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi .v { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi.bad .v { color: var(--bad); }
.kpi .h { font-size: .75rem; color: var(--muted); }

/* Tablas */
.tbl { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f7f8fa; }
th, td { padding: .6rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #fbfbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Etiquetas */
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .12rem .5rem; border-radius: 99px; background: #eef1f4; color: #334155; white-space: nowrap; }
.tag.critico { background: #fde2e2; color: var(--critico); } .tag.alto { background: #ffedd5; color: var(--alto); }
.tag.medio { background: #fef3c7; color: var(--medio); } .tag.bajo { background: #dcfce7; color: var(--bajo); }
.tag.ok { background: var(--ok-bg); color: var(--ok); } .tag.bad { background: var(--bad-bg); color: var(--bad); } .tag.warn { background: var(--warn-bg); color: var(--warn); } .tag.info { background: var(--info-bg); color: #075985; }

/* Alertas */
.alert { border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert.ok { background: var(--ok-bg); border-color: #bfe5cc; color: #14532d; }
.alert.bad { background: var(--bad-bg); border-color: #f5c2c2; color: #7f1d1d; }
.alert.warn { background: var(--warn-bg); border-color: #f3d9a8; color: #78350f; }
.alert.info { background: var(--info-bg); border-color: #c4ddee; color: #0c4a6e; }
.alert ul { margin: 0; padding-left: 1.1rem; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 .9rem/1.2 inherit; text-decoration: none; cursor: pointer; min-height: 40px; }
.btn:hover { border-color: #c5ced8; background: #f8fafc; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.pri:hover { filter: brightness(1.07); }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { padding: .3rem .65rem; min-height: 32px; font-size: .8rem; }

/* Formularios */
label { display: block; font-size: .85rem; font-weight: 600; color: #334155; }
label .hint { font-weight: 400; color: var(--muted); font-size: .78rem; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem; border: 1px solid #cbd3dc; border-radius: 10px; font: 400 .95rem/1.35 inherit; background: #fff; color: var(--ink); min-height: 42px; }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; min-height: 0; margin: 0 .35rem 0 0; vertical-align: middle; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid #0284c7; outline-offset: 1px; }
.form { display: grid; gap: .9rem; }
.form .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: .35rem; font-weight: 500; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .9rem; margin: 0; }
legend { font-weight: 700; padding: 0 .35rem; }
details > summary { cursor: pointer; }
details.box { border: 1px dashed #c5ced8; border-radius: 12px; padding: .75rem 1rem; margin-top: .75rem; background: #fcfcfd; }
details.box[open] { border-style: solid; }
details.box > summary { font-weight: 600; }

/* Checklist de inspección */
.punto { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-bottom: .6rem; background: #fff; }
.punto.crit { border-left: 4px solid var(--critico); }
.punto .opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-top: .5rem; }
.punto .opts label { border: 1px solid #cbd3dc; border-radius: 10px; padding: .55rem; text-align: center; font-weight: 600; cursor: pointer; }
.punto .opts input { position: absolute; opacity: 0; pointer-events: none; }
.punto .opts label:has(input:checked).c { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.punto .opts label:has(input:checked).n { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.punto .opts label:has(input:checked).a { background: #eef1f4; border-color: #94a3b8; }
.punto .hz { display: none; margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.punto.nc .hz { display: grid; }

/* Matriz de calor */
.heat { border-collapse: separate; border-spacing: 3px; width: auto; }
.heat td, .heat th { width: 46px; height: 38px; text-align: center; border: 0; border-radius: 6px; padding: 0; font-weight: 700; }
.heat th { background: none; }
.h-bajo { background: #dcfce7; } .h-medio { background: #fef3c7; } .h-alto { background: #fed7aa; } .h-critico { background: #fecaca; }

/* Listas y línea de tiempo */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .65rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .75rem; justify-content: space-between; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.timeline li { padding: .45rem 0 .45rem 1rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; position: absolute; left: -5px; top: .8rem; }
.fotos { display: flex; flex-wrap: wrap; gap: .5rem; }
.fotos a img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.doc { display: inline-flex; gap: .3rem; align-items: center; font-size: .85rem; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: #fff; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.bar { height: 8px; background: #e5e9ee; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: .5rem; }
.chart .c { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: .7rem; color: var(--muted); }
.chart .c span { width: 100%; max-width: 34px; background: #fb923c; border-radius: 6px 6px 0 0; min-height: 2px; }
.pag { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .75rem; }
.pag a, .pag span { padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: .85rem; background: #fff; }
.pag .cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { flex: 1 1 150px; }
.filters .btn { flex: none; }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { padding: .4rem .8rem; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); background: #fff; font-size: .85rem; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.disclaimer { font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .75rem; margin-top: 1.5rem; }
.fab { display: none; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, #1f2d3a 0%, #2b3c4c 60%, #7c2d12 140%); }
.login .card { width: 100%; max-width: 400px; padding: 1.75rem; }

/* Móvil */
@media (max-width: 900px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .side { transform: none; }
  body.nav-open .veil { display: block; }
  .veil { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; padding: .6rem 1rem; }
  .topbar img { height: 26px; }
  .menu-btn { display: inline-flex; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 8px; padding: .35rem .55rem; font: inherit; }
  main { padding: 1rem; }
  h1 { font-size: 1.25rem; }
  .fab { display: flex; position: fixed; right: 1rem; bottom: 1rem; z-index: 25; box-shadow: 0 6px 20px rgba(194,65,12,.4); border-radius: 99px; padding: .8rem 1.2rem; }
  table.resp thead { display: none; }
  table.resp tr { display: block; border: 1px solid var(--line); border-radius: 12px; margin-bottom: .6rem; background: #fff; padding: .35rem .2rem; }
  table.resp td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .3rem .6rem; text-align: right; }
  table.resp td::before { content: attr(data-l); color: var(--muted); font-size: .78rem; text-align: left; font-weight: 600; }
  table.resp td.wide { display: block; text-align: left; }
  table.resp td.wide::before { display: block; }
}
@media print { .side, .topbar, .fab, .actions, form { display: none !important; } main { padding: 0; } .card { box-shadow: none; } }
