:root {
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e6e5df;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --nav: #10243a;
  --nav-2: #163a5f;
  --nav-ink: #c9d6e3;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --pci: #2a78d6;
  --iso: #eb6834;
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 36, 58, .06), 0 4px 16px rgba(16, 36, 58, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--pci), #1c5cab); display: grid; place-items: center; }
.brand b { color: #fff; font-size: 14px; display: block; }
.brand span { font-size: 11px; color: #8fa3b8; }
.nav { padding: 10px 10px; overflow-y: auto; flex: 1; }
.nav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f86a0; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--nav-ink); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.on { background: var(--nav-2); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; background: var(--critical); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.me { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #2b4c70; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.me .who { flex: 1; min-width: 0; }
.me .who b { color: #fff; display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 11px; color: #8fa3b8; text-transform: capitalize; }
.me button { background: none; border: 0; color: #8fa3b8; cursor: pointer; padding: 6px; border-radius: 6px; }
.me button:hover { color: #fff; background: rgba(255,255,255,.08); }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 32px 6px; flex-wrap: wrap; }
.top .sub { color: var(--ink-2); margin-top: 4px; font-size: 13px; }
.content { padding: 16px 32px 48px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(11,11,11,.05); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-h .hint { font-size: 12px; color: var(--muted); }
.card-b { padding: 14px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.g-3 { grid-template-columns: 1.3fr 1fr; }
@media (max-width: 1100px) { .g-3 { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 30px; font-weight: 650; letter-spacing: -.02em; }
.kpi .val small { font-size: 15px; color: var(--muted); font-weight: 500; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.kpi .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.hero { display: flex; gap: 24px; align-items: center; padding: 20px 22px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .c b { font-size: 28px; font-weight: 650; letter-spacing: -.02em; display: block; }
.ring .c span { font-size: 11px; color: var(--muted); }
.norm-rows { flex: 1; display: grid; gap: 14px; }
.norm-row .t { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.norm-row .t b { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.bar { height: 8px; background: #efeee9; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; }
.subbars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.subbars .bar { height: 5px; }
.subbars .l { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; margin-bottom: 3px; }

/* hbar list */
.hbars { display: grid; gap: 10px; }
.hb { display: grid; grid-template-columns: 170px 1fr 54px; gap: 12px; align-items: center; cursor: default; }
.hb .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.hb .track { height: 16px; background: #f2f1ec; border-radius: 4px; position: relative; overflow: hidden; }
.hb .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--accent); }
.hb .v { text-align: right; font-weight: 600; }
.hb:hover .track i { filter: brightness(.92); }

/* heatmap */
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.heat .cell { border-radius: 8px; padding: 10px 11px; min-height: 66px; display: flex; flex-direction: column; justify-content: space-between; cursor: default; border: 1px solid rgba(11,11,11,.06); }
.heat .cell .d { font-size: 11.5px; line-height: 1.25; }
.heat .cell .p { font-size: 18px; font-weight: 650; }
.heat .cell.na { background: repeating-linear-gradient(45deg, #f4f3ef, #f4f3ef 5px, #ebeae4 5px, #ebeae4 10px); color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.scale { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.scale i { width: 22px; height: 10px; display: inline-block; border-radius: 2px; }

/* ---------- tables ---------- */
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
.t td { padding: 10px 12px; border-bottom: 1px solid #f0efea; vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: #f7f9fc; }
.t td.r, .t th.r { text-align: right; }
.tbl-wrap { overflow: auto; max-height: 70vh; border-radius: 0 0 var(--radius) var(--radius); }
.minibar { display: inline-block; width: 70px; height: 6px; background: #efeee9; border-radius: 3px; vertical-align: middle; margin-right: 8px; overflow: hidden; }
.minibar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 550; white-space: nowrap; border: 1px solid transparent; }
.chip svg { width: 12px; height: 12px; }
.st-pendiente { background: #eef3fb; color: #1c5cab; border-color: #d5e3f6; }
.st-en_revision { background: #fff6e0; color: #7a5200; border-color: #f7e0a6; }
.st-aprobada { background: #e7f6e7; color: var(--good-ink); border-color: #c4e7c4; }
.st-rechazada { background: #fdeee7; color: #9a3d16; border-color: #f6cdb9; }
.st-vencida { background: #fbe8e8; color: #9e2222; border-color: #f2c4c4; }
.nchip { font-size: 11px; padding: 1px 7px; border-radius: 5px; font-weight: 600; color: #fff; }
.nchip.PCI { background: var(--pci); }
.nchip.ISO27001 { background: var(--iso); }
.ctrl { display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px 3px 4px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; margin: 0 4px 4px 0; }
.ctrl b { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }
.tag { white-space: nowrap; font-size: 11px; background: #eef0f3; color: var(--ink-2); border-radius: 4px; padding: 1px 6px; }

/* ---------- forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 550; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn:hover { background: #f5f5f2; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pri:hover { background: var(--accent-ink); }
.btn.ok { background: var(--good-ink); border-color: var(--good-ink); color: #fff; }
.btn.bad { background: #fff; border-color: #f0c2c2; color: #9e2222; }
.btn.bad:hover { background: #fdf0f0; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
input, select, textarea { font: inherit; border: 1px solid #d9d8d1; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(42,120,214,.35); border-color: var(--accent); }
input[type=checkbox] { width: auto; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); font-weight: 550; }
.form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters label.f { min-width: 150px; }
.seg { display: inline-flex; background: #ecebe6; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font: inherit; font-weight: 550; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16,36,58,.38); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .12s; }
.modal { background: #fff; border-radius: 14px; width: min(760px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(1040px, 100%); }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-b { padding: 20px 22px; overflow: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
@keyframes fade { from { opacity: 0; } }

.drop { border: 2px dashed #c9d5e4; border-radius: 12px; padding: 26px; text-align: center; color: var(--ink-2); background: #f8fafd; cursor: pointer; transition: .15s; }
.drop.over { border-color: var(--accent); background: #eef4fc; }
.drop b { color: var(--accent-ink); }

.ev { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; align-items: start; margin-bottom: 8px; }
.ev .ic { width: 36px; height: 36px; border-radius: 8px; background: #eef3fb; color: var(--accent-ink); display: grid; place-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.ev .rv { margin-top: 6px; font-size: 12px; padding: 6px 10px; border-radius: 6px; background: var(--surface-2); }
.timeline { display: flex; gap: 0; margin: 4px 0 18px; }
.timeline div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); position: relative; padding-top: 18px; }
.timeline div::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 2px; background: #e5e4de; }
.timeline div::after { content: ""; position: absolute; top: 0; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #d5d4cd; }
.timeline div.on { color: var(--ink); font-weight: 600; }
.timeline div.on::after { border-color: var(--accent); background: var(--accent); }
.timeline div.bad::after { border-color: var(--critical); background: var(--critical); }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dh { padding: 8px; font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .d { min-height: 118px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; background: #fff; }
.cal .d.out { background: #fafaf8; }
.cal .d.out .dn { color: #c3c2b7; }
.cal .d.today { background: #f5f9ff; }
.cal .d.today .dn { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; }
.cal .dn { font-size: 12px; font-weight: 600; color: var(--ink-2); align-self: flex-start; margin-bottom: 2px; }
.cal .ev-c { font-size: 11px; padding: 3px 6px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; }
.cal .ev-c:hover { filter: brightness(.96); }
.cal .more { font-size: 11px; color: var(--accent-ink); cursor: pointer; padding-left: 4px; }

/* ---------- explorer ---------- */
.tree { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .tree { grid-template-columns: 1fr; } }
.folder { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.folder:hover { background: #f4f6f9; }
.folder.on { background: #e9f1fb; }
.folder .fi { width: 18px; flex: none; }
.folder .cnt { margin-left: auto; font-size: 11px; }
.dom-h { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 10px 4px; }
.path { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #10243a; color: #c9d6e3; padding: 9px 12px; border-radius: 8px; word-break: break-all; }

/* ---------- matrix ---------- */
.hom { display: grid; grid-template-columns: 290px 1fr 1fr; border-bottom: 1px solid #f0efea; }
.hom > div { padding: 12px 14px; }
.hom .hh b { display: block; margin-bottom: 4px; }
.hom-head { background: var(--surface-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login .art { display: none; } }
.login .art { background: radial-gradient(1000px 500px at 10% 10%, #1c5cab 0%, transparent 60%), linear-gradient(160deg, #10243a, #0b1a2b); color: #dce6f1; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login .art h1 { font-size: 34px; color: #fff; line-height: 1.15; max-width: 460px; }
.login .art p { color: #9fb3c8; max-width: 440px; line-height: 1.55; }
.login .feat { display: grid; gap: 14px; margin-top: 30px; }
.login .feat div { display: flex; gap: 12px; align-items: flex-start; color: #c9d6e3; }
.login .feat i { width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.08); display: grid; place-items: center; font-style: normal; flex: none; }
.login .frm { display: grid; place-items: center; padding: 40px; background: #fff; }
.login form { width: min(360px, 100%); display: grid; gap: 16px; }
.err { color: #9e2222; background: #fbe8e8; padding: 8px 12px; border-radius: 8px; font-size: 13px; }

/* ---------- misc ---------- */
.tooltip { position: fixed; z-index: 100; background: #10243a; color: #fff; padding: 8px 11px; border-radius: 8px; font-size: 12px; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 280px; line-height: 1.45; }
.tooltip b { color: #fff; }
.tooltip .tl { color: #9fb3c8; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; }
.toast { background: #10243a; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13px; max-width: 380px; animation: fade .2s; }
.toast.e { background: #9e2222; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.countdown { font-size: 12px; font-weight: 600; }
.countdown.late { color: #9e2222; }
.countdown.soon { color: #8a5a00; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.sugg { background: #f5f9ff; border: 1px solid #dbe7f7; border-radius: 10px; padding: 12px 14px; font-size: 13px; color: #1c3f6b; }
.linechart text { font-size: 11px; fill: var(--muted); }
.ctl-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.ctl-list label { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 6px; font-size: 12.5px; cursor: pointer; }
.ctl-list label:hover { background: #f5f5f2; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d3d2cb; border-radius: 20px; cursor: pointer; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--good-ink); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- matriz de riesgos ---------- */
.mx { display: grid; grid-template-columns: 22px repeat(5, minmax(0, 1fr)); gap: 4px; flex: 1; min-width: 0; }
.mx-c { aspect-ratio: 1.5; min-width: 0; border-radius: 6px; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 3px; padding: 4px; cursor: default; border: 1px solid rgba(11,11,11,.05); }
.mx-r { font-size: 10.5px; font-weight: 700; background: #fff; border-radius: 4px; padding: 1px 5px; color: #0b0b0b; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.mx-ax { font-size: 11px; color: var(--muted); display: grid; place-items: center; }
.mx-yl { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; color: var(--muted); text-align: center; }
.ring svg circle { transition: stroke-dasharray .4s; }
