/* AJ System — estilos de la aplicación. Sin dependencias externas: fuente Ubuntu Sans alojada en /static/fonts. */
@font-face { font-family: "Ubuntu Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ubuntu-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Ubuntu Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ubuntu-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Ubuntu Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ubuntu-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Ubuntu Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ubuntu-sans-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Ubuntu Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/ubuntu-sans-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Ubuntu Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ubuntu-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Ubuntu Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ubuntu-sans-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #121826; --muted: #5b6475; --line: #cfd6e3; --label-bg: #f2f5fa;
  --navy: #0b1020; --navy-2: #151c33; --cyan: #1ec8f5; --violet: #a24cf0; --page-bg: #e9edf3;
  --surface: #fff; --primary: #0b1020; --accent: #6a5cf0;
  --ok: #157a46; --warn: #a35200; --danger: #b3261e; --focus: #1ec8f5;
  --grad: linear-gradient(90deg, var(--cyan), var(--violet));
  --radius: 10px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 18px rgba(15,23,42,.06);
  font-family: "Ubuntu Sans", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page-bg); color: var(--ink); line-height: 1.5; font-size: 15px; min-height: 100vh; display: flex; flex-direction: column; }
button, input, select, textarea { font-family: inherit; }
a { color: #4a3fd6; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: .9em; }
img { max-width: 100%; }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; background: var(--navy); color: #fff; padding: 8px 20px; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { height: 38px; width: auto; display: block; }
.brand-sub { font-size: .72rem; color: #9aa6c4; line-height: 1.2; max-width: 9rem; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
.nav a { color: #d6ddef; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a[aria-current="page"] { background: rgba(30,200,245,.14); color: #fff; box-shadow: inset 0 -2px 0 var(--cyan); }
.userbox { display: flex; align-items: center; gap: 12px; }
.who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.who small { color: #9aa6c4; }
.link-small { color: #cdd6ea; font-size: .85rem; }
.nav-toggle { display: none; }
.userbox .btn-ghost { color: #fff; border-color: #39435c; }

/* ---------- Estructura ---------- */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 22px 18px 40px; flex: 1; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: .8rem; padding: 14px 20px; border-top: 1px solid var(--line); background: #fff; }
.footer b { color: var(--ink); }
h1 { font-size: 1.55rem; margin: .1em 0 .5em; letter-spacing: .01em; }
h2 { font-size: 1.1rem; margin: 1.1em 0 .5em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin: 16px 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.narrow { max-width: 440px; margin: 40px auto; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.pre { white-space: pre-wrap; word-break: break-word; }
.nowrap { white-space: nowrap; }
.notice { background: #fff8e1; border: 1px solid #f0d58a; border-radius: 8px; padding: 8px 12px; }
.notice-info { background: #eef6ff; border-color: #b8d4f5; }

/* Inicio: contenido a la izquierda y panel lateral a la derecha */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.layout > main, .layout > .main { min-width: 0; }
.aside { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.aside .card { margin: 0; }
.aside h3 { font-size: .95rem; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .05em; color: #2a3346; }
.hero { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 20px 22px; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: linear-gradient(180deg, var(--cyan), var(--violet)); }
.hero h1 { margin: 0 0 4px; font-size: 1.4rem; }
.hero p { margin: 0; color: #b8c2dc; }
.hero .actions { margin-top: 14px; }
.quick { display: grid; gap: 8px; }
.quick .btn { justify-content: flex-start; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { padding: 7px 0; border-bottom: 1px solid var(--label-bg); font-size: .9rem; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list small { display: block; color: var(--muted); }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 4px; }
.empty .btn { margin-top: 10px; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #b5bfd0; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(30,200,245,.2); outline: none; }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="file"] { padding: 7px; background: var(--label-bg); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.req { color: var(--danger); }
.help { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.field-error { color: var(--danger); font-size: .85rem; margin: 4px 0 0; font-weight: 600; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.inline select, .inline input { width: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.filters, .grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 16px; align-items: end; }
.filter-actions { display: flex; gap: 8px; align-items: center; padding-top: 12px; }
.role-form { display: flex; margin: 6px 0; } .role-form label { margin: 0; min-width: 120px; } .role-form input { max-width: 320px; }
.user-create-form { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; }
/* Usuarios: una ficha desplegable por usuario, con las acciones agrupadas */
.user-list { display: grid; gap: 8px; }
.user-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .9fr); gap: 4px 14px; align-items: center; padding: 10px 14px; }
.user-row-head { background: var(--navy); color: #fff; border-radius: 8px; font-size: .82rem; font-weight: 600; padding: 8px 14px; }
.user-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.user-card[open] { border-color: #9fb3d6; box-shadow: var(--shadow); }
.user-card > summary { cursor: pointer; list-style: none; border-radius: 8px; }
.user-card > summary::-webkit-details-marker { display: none; }
.user-card > summary:hover { background: #f8fafd; }
.user-card .user-name::before { content: "▸"; color: var(--muted); display: inline-block; width: 1.1em; transition: transform .15s; }
.user-card[open] .user-name::before { transform: rotate(90deg); }
.user-name { overflow-wrap: anywhere; }
.user-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; padding: 4px 14px 14px; border-top: 1px solid var(--label-bg); }
.user-panel { background: #f8fafd; border: 1px solid var(--label-bg); border-radius: 8px; padding: 10px 14px 14px; min-width: 0; }
.user-panel h3 { margin: 2px 0 4px; font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: #2a3346; }
.user-panel label { margin-top: 10px; font-size: .88rem; }
.user-panel .actions { margin-top: 12px; }
.user-panel form > .btn { margin-top: 8px; }
.field-row { display: flex; gap: 6px; align-items: center; }
.field-row input, .field-row select { flex: 1 1 auto; min-width: 0; }
.field-row .btn { flex: 0 0 auto; }
.danger-panel { background: #fff7f6; border-color: #f3c9c5; }
.danger-panel h3 { color: var(--danger); }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.status-pill.is-active { color: #157a46; background: #e9f7ef; }
.status-pill.is-inactive { color: #8a4600; background: #fff4e5; }
.password-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: stretch; }
.password-reveal { border: 1px solid #b5bfd0; border-radius: 8px; background: #f7f9fc; color: #354055; padding: 0 11px; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; }
.password-reveal:hover { border-color: var(--cyan); background: #eefaff; }
.profile-card { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(250px, .8fr); gap: 28px; align-items: start; }
.profile-signature-form { max-width: 560px; }
.profile-signature-form .btn { margin-top: 12px; }
.signature-preview { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #f8fafd; }
.signature-preview h3 { margin: 0 0 10px; font-size: 1rem; }
.signature-preview img { display: block; width: 100%; max-height: 150px; object-fit: contain; padding: 8px; border: 1px dashed #b5bfd0; border-radius: 8px; background: #fff; }
.signature-preview .empty { padding: 18px 10px; }
.event-detail summary { cursor: pointer; color: #4a3fd6; font-weight: 600; white-space: nowrap; }
.event-detail .detail-content { max-height: 8rem; max-width: 24rem; overflow: auto; padding: 5px 8px; background: #f7f9fc; border-radius: 6px; }
.event-detail .detail-content div { white-space: normal; overflow-wrap: anywhere; }
.invitation-card > p { margin-bottom: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 15px; border-radius: 8px; border: 1px solid #b5bfd0; background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; min-height: 40px; }
.btn:hover { border-color: var(--cyan); background: #f6fbff; }
.btn-primary { background: var(--grad); color: #fff; border: 0; }
.btn-primary:hover { background: var(--grad); filter: brightness(1.06); }
.btn-dark { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-dark:hover { background: var(--navy-2); }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn:hover { background: #7a3d00; }
.btn-danger { background: #fff; border-color: #e6a6a1; color: var(--danger); }
.btn-ghost { background: transparent; border-color: #9aa7b3; color: inherit; }
.btn-sm { padding: 4px 10px; min-height: 32px; font-size: .85rem; }
.btn-block { width: 100%; margin-top: 16px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }

.flashes { margin-bottom: 12px; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 6px 0; border: 1px solid; }
.flash-success { background: #e9f7ef; border-color: #9fd3b0; color: var(--ok); }
.flash-error { background: #fdecec; border-color: #f0a8a8; color: var(--danger); }
.flash-info { background: #eef6ff; border-color: #a9c3ea; color: #23408e; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid; vertical-align: middle; white-space: nowrap; }
.badge-en_elaboracion { background: #eef6ff; color: #23408e; border-color: #a9c3ea; }
.badge-cerrado { background: #fff4e5; color: #8a4600; border-color: #f0c48a; }
.badge-reabierto { background: #f6e9fb; color: #6a1b8a; border-color: #d3a8e6; }
.badge-firmado { background: #e3f6ea; color: var(--ok); border-color: #7cc898; }
.badge-firmado::before { content: "✓ "; }
.badge-val-registrado { background: #e3f6ea; color: var(--ok); border-color: #7cc898; }
.badge-val-parcial { background: #eef6ff; color: #23408e; border-color: #a9c3ea; }
.badge-val-duplicado { background: #fdecec; color: var(--danger); border-color: #f0a8a8; }
.badge-val-pendiente { background: #fff4e5; color: #8a4600; border-color: #f0c48a; }
.badge-val-sin_serial { background: #f1f2f6; color: #555e72; border-color: #cdd2de; }
.badge-dict-optimo { background: #e6f0fa; color: #1565a8; border-color: #a9c8e8; }
.badge-dict-observaciones { background: #fff4e5; color: #8a4600; border-color: #f0c48a; }
.badge-dict-no_apto { background: #fdecec; color: var(--danger); border-color: #f0a8a8; }
.badge-dict-sin_evidencia, .badge-dict-en_auditoria, .badge-dict-pendiente, .badge-dict-sin_serial { background: #f1f2f6; color: #555e72; border-color: #cdd2de; }
.badge-sev-3 { background: #fdecec; color: var(--danger); border-color: #f0a8a8; }
.badge-sev-2 { background: #fff4e5; color: #8a4600; border-color: #f0c48a; }
.badge-sev-1 { background: #f1f2f6; color: #555e72; border-color: #cdd2de; }
.dict-why { display: block; margin-top: 2px; }
.badge-out-exito { background: #e9f7ef; color: var(--ok); border-color: #9fd3b0; }
.badge-out-fallo, .badge-out-error { background: #fdecec; color: var(--danger); border-color: #f0a8a8; }
.badge-out-denegado { background: #fff4e5; color: #8a4600; border-color: #f0c48a; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad); opacity: .8; }
.stat-n { font-size: 1.8rem; font-weight: 800; }
.stat-l { color: var(--muted); }
.stat-firmado { border-color: #9fd3b0; background: #f2fbf5; }
.stat-firmado .stat-n { color: var(--ok); }
.stat-firmado::after { background: linear-gradient(90deg, #3ccf7a, var(--ok)); }
.sign-batch { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
.col-check { width: 2.4rem; text-align: center; }
.col-check input { width: 1.1rem; height: 1.1rem; cursor: pointer; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--label-bg); vertical-align: top; }
.table thead th { background: var(--navy); color: #fff; font-size: .82rem; font-weight: 600; letter-spacing: .02em; }
.table tbody tr:hover { background: #f8fafd; }
.table-dense td, .table-dense th { padding: 5px 8px; font-size: .84rem; }
.detail div { white-space: pre-wrap; word-break: break-word; max-width: 360px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; }
.versions { font-size: .9rem; }
.inline-details { display: inline-block; margin-left: 6px; }
.inline-details summary { cursor: pointer; font-size: .85rem; color: #4a3fd6; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); border-image: var(--grad) 1; border-bottom: 3px solid; }

/* ---------- Inicio de sesión ---------- */
.login-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.login { width: 100%; max-width: 420px; background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(11,16,32,.18); overflow: hidden; }
.login-head { background: var(--navy); padding: 22px; text-align: center; position: relative; }
.login-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad); }
.login-head img { height: 64px; width: auto; }
.login form { padding: 8px 24px 24px; }
.login h1 { font-size: 1.2rem; margin: 18px 24px 0; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; }
  .user-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-card { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar { padding: 8px 14px; }
  .brand-sub { display: none; }
  .nav-toggle { display: inline-flex; margin-left: auto; background: transparent; color: #fff; border: 1px solid #39435c; border-radius: 8px; padding: 6px 12px; font: inherit; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; }
  .nav.open { display: flex; }
  .userbox { flex-basis: 100%; justify-content: space-between; }
  .who { text-align: left; }
  .container { padding: 14px 12px 32px; }
  .user-create-form { grid-template-columns: minmax(0, 1fr); }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 2px solid var(--line); padding: 6px 0; }
  .table td { border: 0; padding: 3px 10px; }
  .table td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--muted); }
  .table-wrap { overflow-x: visible; }
  .user-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .user-row .user-name { grid-column: 1 / -1; }
  .user-row > span:nth-child(2), .user-row > span:nth-child(5) { display: none; }
  .user-row-head { display: none; }
  .actions .btn { flex: 1 1 auto; }
}
@media print { .topbar, .footer, .actions, form, .no-print { display: none !important; } body { background: #fff; } }
.steps { padding-left: 18px; margin: 0; }

/* ---------- Gráficas (SVG del servidor) ---------- */
.chart-tip { position: absolute; z-index: 60; pointer-events: none; background: var(--navy); color: #fff; font-size: .8rem; font-weight: 500; padding: 6px 10px; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.3); border: 1px solid #2b3555; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.count-pill { display: inline-block; min-width: 1.6em; padding: 0 8px; border-radius: 999px; background: var(--grad); color: #fff; font-size: .8rem; font-weight: 700; text-align: center; vertical-align: middle; }
.heatmap-scroll { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: block; width: 100%; min-width: 640px; height: auto; font-family: inherit; }
.heatmap:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.heatmap.matrix { width: auto; min-width: 0; max-width: none; }
.heatmap.matrix .hm-wd { font-size: 11px; fill: var(--muted); }
.hm-month, .hm-wd { font-size: 9px; fill: #9aa6c4; }
.hm-cell, .hm-key { fill: #1b2440; background: #1b2440; stroke: rgba(255,255,255,.04); }
.hm-cell:hover { stroke: #fff; stroke-width: 1.2; }
.hm-cell.l1, .hm-key.l1 { fill: #12506e; background: #12506e; }
.hm-cell.l2, .hm-key.l2 { fill: #1e9ccc; background: #1e9ccc; }
.hm-cell.l3, .hm-key.l3 { fill: #6a6cf0; background: #6a6cf0; }
.hm-cell.l4, .hm-key.l4 { fill: #b45cff; background: #b45cff; }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; font-size: .75rem; color: #9aa6c4; margin-top: 6px; }
.hm-legend span { margin: 0 4px; }
.hm-key { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }

/* Panel de actividad del técnico (Inicio) */
.activity-card { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px 20px 14px; margin: 16px 0; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.activity-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad); }
.activity-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 8px; }
.activity-head h2 { margin: 0; font-size: 1.05rem; }
.activity-head p { margin: 0; color: #b8c2dc; font-size: .9rem; }
.activity-head b { color: var(--cyan); }
.activity-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 16px; margin: 10px 0 0; }
.activity-stats div { border-left: 2px solid #2b3555; padding-left: 10px; }
.activity-stats dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #9aa6c4; }
.activity-stats dd { margin: 0; font-weight: 700; font-size: .95rem; }

/* ---------- Tablero ejecutivo ---------- */
.exec-hero p b { color: #fff; }
.val-report { white-space: nowrap; margin: 2px 0; }
.exec-filters { display: grid; gap: 8px; }
.exec-filters .presets { display: flex; flex-wrap: wrap; gap: 6px; }
.exec-filters label { margin-top: 4px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 16px 0; }
.kpi { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 14px 16px 16px; display: flex; flex-direction: column; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grad); }
.kpi.is-warn::after { background: linear-gradient(90deg, #ffb35c, var(--warn)); }
.kpi.is-accent::after { background: linear-gradient(90deg, var(--violet), #ff5ca8); }
.kpi.is-ok::after { background: linear-gradient(90deg, #3ccf7a, var(--ok)); }
.kpi.is-danger::after { background: linear-gradient(90deg, #ff7a6e, var(--danger)); }
.kpi small a { color: #8fe3ff; }
.kpi-n { font-size: 1.75rem; font-weight: 800; line-height: 1.15; }
.kpi-l { font-weight: 600; color: #d6ddef; }
.kpi small { color: #9aa6c4; margin-top: 4px; font-size: .78rem; }
.exec-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.exec-grid .card { margin: 0 0 16px; }
.exec-wide { grid-column: span 2; }
.chart { display: block; width: 100%; height: auto; font-family: inherit; }
.chart-days { min-width: 560px; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis { font-size: 11px; fill: var(--muted); }
.chart .bar { fill: #1e9ccc; }
.chart .bar.zero { fill: transparent; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(30,200,245,.08); }
.chart .trend { fill: none; stroke: var(--violet); stroke-width: 2.2; stroke-linejoin: round; pointer-events: none; }
.chart-key { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.chart-key i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: -8px; }
.chart-key .k-bar { background: #1e9ccc; height: 10px; }
.chart-key .k-trend { background: var(--violet); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .88rem; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { width: 100%; height: 12px; display: block; }
.hb-bg { fill: var(--label-bg); }
.hb-fill { fill: #1e9ccc; }
.is-ranking .hbars li:nth-child(1) .hb-fill { fill: #6a6cf0; }
.hbars li.is-missing .hb-fill { fill: #9aa7b3; }
.hbars li.is-missing .hb-label { color: var(--muted); font-style: italic; }
.hb-n { font-weight: 700; text-align: right; white-space: nowrap; }
.hb-n small { color: var(--muted); font-weight: 500; }
.donut-wrap { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.donut { width: 150px; height: 150px; flex: 0 0 auto; }
.donut-ring { fill: none; stroke: var(--label-bg); stroke-width: 6; }
.donut-seg { fill: none; stroke-width: 6; }
.donut-seg:hover { stroke-width: 7.5; }
.donut-n { font-size: 8px; font-weight: 800; text-anchor: middle; fill: var(--ink); }
.donut-l { font-size: 3.2px; text-anchor: middle; fill: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; font-size: .88rem; display: grid; gap: 4px; }
.donut-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.s-en_elaboracion { stroke: #1e9ccc; background: #1e9ccc; }
.s-reabierto { stroke: #b45cff; background: #b45cff; }
.s-cerrado { stroke: #f0a23c; background: #f0a23c; }
.s-firmado { stroke: #2fb36a; background: #2fb36a; }
.s-optimo { stroke: #1565a8; background: #1565a8; }
.s-observaciones { stroke: #c77700; background: #c77700; }
.s-no_apto { stroke: #b3261e; background: #b3261e; }
.s-sin_evidencia { stroke: #6f7a8f; background: #6f7a8f; }
.s-en_auditoria { stroke: #9aa6b8; background: #9aa6b8; }
.s-pendiente { stroke: #c8d0dc; background: #c8d0dc; }
.s-sin_serial { stroke: #e1e5ec; background: #e1e5ec; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-head h2 { margin: 0; }
.report-summary p { margin: 10px 0 0; line-height: 1.55; }
.report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.highlights { list-style: none; margin: 0; padding: 0; }
.highlights li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.highlights li:first-child { border-top: 0; padding-top: 0; }
.highlights .badge { flex: 0 0 auto; min-width: 72px; text-align: center; }
.highlights p { margin: 4px 0 0; overflow-wrap: anywhere; }
.exec-details summary { cursor: pointer; list-style: none; }
.exec-details summary::-webkit-details-marker { display: none; }
.exec-details summary h2 { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.exec-details summary h2::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.exec-details[open] summary h2::before { transform: rotate(90deg); }
.exec-details[open] summary { margin-bottom: 10px; }
th[data-sort] { cursor: pointer; user-select: none; }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
@media (max-width: 1080px) {
  .exec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .exec-grid { grid-template-columns: minmax(0, 1fr); }
  .exec-wide { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-n { font-size: 1.4rem; }
  .hbars li { grid-template-columns: minmax(80px, 40%) minmax(0, 1fr) auto; }
}

@media (max-width: 760px) { .report-grid { grid-template-columns: minmax(0, 1fr); } }
@media print {
  .exec-report { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .exec-report .card, .exec-report .kpi, .highlights li { box-shadow: none; break-inside: avoid; }
  .exec-report .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .exec-report .table-wrap { overflow: visible; }
  .exec-report .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exec-report .table { display: table; width: 100%; font-size: .78rem; }
  .exec-report .table thead { display: table-header-group; }
  .exec-report .table tbody { display: table-row-group; }
  .exec-report .table tr { display: table-row; }
  .exec-report .table td, .exec-report .table th { display: table-cell; width: auto; }
  .exec-report .table td[data-label]::before { content: none; }
  .exec-report tr { break-inside: avoid; }
  .flashes { display: none; }
  @page { size: A4; margin: 12mm; }
}
