:root {
  --bg: #0f172a;
  --surface: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #1d4ed8;
  --accent2: #2563eb;
  --danger: #b91c1c;
  --ok: #059669;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 100%);
  color: var(--text);
  min-height: 100dvh;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-logo,
.top-logo,
.login-logo {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.login-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.login-logo {
  width: min(168px, 42vw);
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(45, 106, 62, 0.2));
}

.top-logo {
  border-radius: 10px;
}

.login-body--monitor .top-brand-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.1rem;
}

.topbar .meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  margin-bottom: 16px;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.nav-grid a {
  display: block;
  padding: 20px;
  border-radius: var(--radius);
  background: #f1f5f9;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border: 2px solid transparent;
}

.nav-grid a:hover {
  border-color: var(--accent2);
}

.nav-grid a.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  min-height: 44px;
}

.btn-primary {
  background: linear-gradient(145deg, var(--accent2), var(--accent));
  color: #fff;
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: var(--muted);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th,
table.data td {
  padding: 10px 8px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

table.data th {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #dbeafe;
  color: #1e40af;
}

.msg-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 8px 0;
}

.hidden {
  display: none !important;
}

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.login-google-mount {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  margin: 0.35rem 0 1rem;
}

.login-google-fallback {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}

.login-note-ti {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted, #64748b);
}

.login-note-ti a {
  color: var(--accent, #2d6a3e);
  font-weight: 600;
}

.login-intro-monitor {
  font-size: 0.88rem;
  color: var(--muted, #64748b);
  line-height: 1.5;
  margin: 0 0 18px;
}

.revision-hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.45;
}

.field-help {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.lista-archivos-sel {
  list-style: none;
  margin: 10px 0 0;
  padding: 12px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 0.88rem;
}

.lista-archivos-sel li {
  padding: 4px 0;
}

.lista-archivos-sel .muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.field-evidencias input[type="file"] {
  padding: 10px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.btn-sm {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 0.82rem;
}

/* ----- Reportes ----- */
.reportes-section-head {
  margin-bottom: 16px;
}

.reportes-section-head h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.reportes-section-sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.reportes-filtros-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.reportes-filtros-actions {
  display: flex;
  align-items: flex-end;
}

.reportes-msg {
  margin: 12px 0 0;
  font-size: 0.88rem;
}

.reportes-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.reportes-table thead th {
  background: #f1f5f9;
  position: sticky;
  top: 0;
  z-index: 1;
}

.reportes-table tbody tr:hover {
  background: #f8fafc;
}

.reportes-td-fecha time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reportes-td-equipo strong {
  font-weight: 700;
}

.reportes-td-user {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 140px;
}

.reportes-td-ev {
  min-width: 200px;
}

.reportes-td-acciones {
  white-space: nowrap;
  width: 1%;
}

.reportes-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reportes-sin-evidencia {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.reporte-estado {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.reporte-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.reporte-badge--ok {
  background: #d1fae5;
  color: #065f46;
}

.reporte-badge--warn {
  background: #fef3c7;
  color: #92400e;
}

.reporte-badge--crit {
  background: #fee2e2;
  color: #991b1b;
}

.reporte-estado-pct {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.reportes-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  background: #f8fafc;
  border-radius: 10px;
  margin-top: 12px;
}

.ev-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.ev-thumb-btn {
  position: relative;
  display: block;
  padding: 0;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  cursor: zoom-in;
  width: 88px;
  height: 66px;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.ev-thumb-btn:hover {
  border-color: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.18);
}

.ev-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ev-thumb-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 3px 4px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.85));
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ev-thumb-btn:hover .ev-thumb-overlay,
.ev-thumb-btn:focus-visible .ev-thumb-overlay {
  opacity: 1;
}

.ev-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 180px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ev-file-chip:hover {
  border-color: var(--accent2);
  background: #eff6ff;
}

.ev-file-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}

.ev-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.ev-modal-open {
  overflow: hidden;
}

.ev-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
}

.ev-modal.hidden {
  display: none !important;
}

.ev-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
}

.ev-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.ev-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.ev-modal-body {
  flex: 1;
  min-height: 200px;
  background: #0f172a;
  display: grid;
  place-items: center;
  overflow: auto;
}

.ev-modal-img {
  max-width: 100%;
  max-height: min(70vh, 720px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.ev-modal-footer {
  padding: 14px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ev-modal-caption {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.ev-modal-drive {
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .reportes-filtros-grid {
    grid-template-columns: 1fr 1fr;
  }

  .reportes-filtros-actions {
    grid-column: 1 / -1;
  }

  .reportes-filtros-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .reportes-filtros-grid {
    grid-template-columns: 1fr;
  }

  .reportes-table thead {
    display: none;
  }

  .reportes-table tbody tr {
    display: block;
    padding: 14px;
    border-bottom: 1px solid #e2e8f0;
  }

  .reportes-table tbody tr:hover {
    background: transparent;
  }

  .reportes-table td {
    display: block;
    border: none;
    padding: 6px 0;
  }

  .reportes-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 2px;
  }

  .reportes-td-acciones {
    padding-top: 10px;
  }
}

.hint-box {
  font-size: 0.82rem;
  color: var(--muted);
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  line-height: 1.5;
}

.analisis-intro {
  margin-top: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
}

.kpi-card--destacado {
  border-color: #93c5fd;
  background: linear-gradient(165deg, #eff6ff 0%, #f8fafc 100%);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.35;
}

.kpi-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  margin-top: 10px;
  overflow: hidden;
}

.kpi-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #059669, #10b981);
  transition: width 0.35s ease;
}

.kpi-bar-fill--warn {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}

.kpi-bar-fill--crit {
  background: linear-gradient(90deg, #b91c1c, #ef4444);
}

.analisis-insights {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analisis-insight {
  font-size: 0.88rem;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 4px solid #94a3b8;
  background: #f8fafc;
  line-height: 1.45;
  margin: 0;
}

.analisis-insight--ok {
  border-left-color: var(--ok);
  background: #ecfdf5;
}

.analisis-insight--warn {
  border-left-color: #d97706;
  background: #fffbeb;
}

.analisis-insight--crit {
  border-left-color: var(--danger);
  background: #fef2f2;
}

.analisis-riesgo h3 {
  margin: 18px 0 10px;
  font-size: 0.95rem;
}

.analisis-riesgo-lista {
  list-style: none;
  margin: 0;
  padding: 0;
}

.analisis-riesgo-lista li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.88rem;
}

.analisis-riesgo-lista li:last-child {
  border-bottom: none;
}

.analisis-riesgo-pct {
  font-weight: 700;
  color: var(--danger);
}
