:root {
  --rojo: #b71c1c;
  --rojo-oscuro: #8e1414;
  --fondo: #f6f7f9;
  --tarjeta: #ffffff;
  --texto: #111827;
  --texto-2: #4b5563;
  --texto-3: #6b7280;
  --borde: #e5e7eb;
  --exito: #16a34a;
  --peligro: #dc2626;
  --aviso: #d97706;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(17, 24, 39, 0.06), 0 8px 24px rgba(17, 24, 39, 0.06);
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--fuente); font-size: 15px; line-height: 1.5; color: var(--texto); background: var(--fondo); }
[hidden] { display: none !important; }
a { color: var(--rojo); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--borde); background: #fff; color: var(--texto); cursor: pointer; text-decoration: none; }
.btn:hover { background: #f3f4f6; }
.btn:disabled { opacity: .6; cursor: default; }
.btn--primario { background: var(--rojo); border-color: var(--rojo); color: #fff; font-weight: 600; }
.btn--primario:hover { background: var(--rojo-oscuro); }
.btn--peligro { color: var(--peligro); border-color: #fecaca; }
.btn--chico { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--texto-2); }
.campo input, .campo select, .campo textarea { min-height: 44px; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: #fff; }
.campo textarea { min-height: 96px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid rgba(183, 28, 28, .35); outline-offset: 1px; border-color: var(--rojo); }
.ayuda { font-size: 12.5px; color: var(--texto-3); }

.alerta { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; border: 1px solid transparent; }
.alerta--error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alerta--ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alerta--info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f3f4f6; color: var(--texto-2); }
.chip--ok { background: #dcfce7; color: #166534; }
.chip--off { background: #fee2e2; color: #991b1b; }
.chip--aviso { background: #fef3c7; color: #92400e; }
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { padding: 10px 0; border-top: 1px solid var(--borde); }
.lista li:first-child { border-top: 0; padding-top: 0; }
.reciente { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.reciente__icono { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.reciente__icono svg { width: 16px; height: 16px; }
.reciente__nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reciente__fecha { margin-left: auto; font-size: 12px; color: var(--texto-3); white-space: nowrap; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--borde); }
.topbar .btn { min-height: 44px; }
.topbar__marca { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--texto); text-decoration: none; white-space: nowrap; }
.topbar__logo { width: 32px; height: 32px; border-radius: 8px; background: var(--rojo); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; letter-spacing: .5px; }
.topbar__buscar { flex: 1; max-width: 420px; }
.topbar__buscar input { width: 100%; min-height: 44px; padding: 8px 12px 8px 36px; border: 1px solid var(--borde); border-radius: 999px; background: #f9fafb url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2' viewBox='0 0 24 24'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") no-repeat 12px center; }
.topbar__acciones { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icono-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid transparent; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--texto-2); }
.icono-btn:hover { background: #f3f4f6; }
.icono-btn__badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--rojo); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #fee2e2; color: var(--rojo); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.menu { position: absolute; right: 12px; top: 58px; min-width: 240px; background: #fff; border: 1px solid var(--borde); border-radius: 12px; box-shadow: var(--sombra); padding: 8px; z-index: 30; }
.menu__cab { padding: 8px 10px 10px; border-bottom: 1px solid var(--borde); margin-bottom: 6px; }
.menu__nombre { font-weight: 600; }
.menu__sub { font-size: 12.5px; color: var(--texto-3); }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 8px; color: var(--texto); text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: #f3f4f6; }
.btn:focus-visible, .icono-btn:focus-visible, .menu a:focus-visible, .menu button:focus-visible, .app-tile:focus-visible, .aviso__cab:focus-visible { outline: 2px solid rgba(183, 28, 28, .45); outline-offset: 2px; }
.contenido { max-width: 1200px; margin: 0 auto; padding: 20px 16px 40px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th, .tabla td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--texto-3); }
.tabla-wrap { overflow-x: auto; }
dialog { border: 0; border-radius: 14px; padding: 0; max-width: 520px; width: calc(100% - 32px); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 17, 21, .5); }
.dialogo__cuerpo { padding: 20px; }
.dialogo__pie { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; flex-wrap: wrap; }
.codigo { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; background: #f3f4f6; padding: 8px 10px; border-radius: 8px; word-break: break-all; }
.centrado { text-align: center; padding: 32px; }
/* Clases para el diálogo de inactividad: la CSP bloquea atributos style="" en el HTML (los cambios vía CSSOM, p. ej. el.style.x, sí están permitidos). */
.idle-overlay { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; background: rgba(15, 17, 21, .55); }
.idle-card { background: #fff; max-width: 420px; width: calc(100% - 32px); border-radius: 16px; padding: 28px 26px; box-shadow: 0 24px 60px rgba(0, 0, 0, .28); }
.idle-card h2 { font-size: 1.15rem; }
.idle-card p { color: var(--texto-2); margin-bottom: 18px; }
.idle-countdown { color: var(--rojo); }
.idle-card__acciones { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 720px) {
  .topbar { padding: 8px 10px; }
  .topbar__buscar { max-width: none; }
  .topbar__marca span:not(.topbar__logo) { display: none; }
}
