* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1f2933;
  background: #f5f7fa;
  line-height: 1.45;
  font-size: 13px;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #1f2933; color: #fff; padding: 0 24px; height: 56px;
}
.topbar .brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 18px; }
.topbar nav a { color: #cbd2d9; margin-left: 18px; }
.topbar nav a:hover { color: #fff; }

.container { max-width: 1200px; margin: 28px auto; padding: 0 20px; }
h1 { font-size: 21px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 20px 0 9px; color: #52606d; }
.muted { color: #7b8794; }
.small { font-size: 11px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.value { word-break: break-all; max-width: 360px; }
.sub { font-size: 12px; color: #9aa5b1; }

/* Tablas */
table { width: 100%; border-collapse: collapse; background: #fff; }
.groups, .records { border: 1px solid #e4e7eb; border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 5px 9px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: #7b8794; background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
.status-cell { width: 44px; text-align: center; }
.col-filter {
  display: block; margin-top: 6px; width: 100%; max-width: 220px;
  padding: 5px 8px; font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0;
  border: 1px solid #cbd2d9; border-radius: 6px;
}
.row-ok { border-left: 4px solid #10b981; }
.row-fail { border-left: 4px solid #ef4444; }
.row-pending { border-left: 4px solid #cbd2d9; }

/* Badges */
.badge {
  display: inline-block; min-width: 22px; text-align: center;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff;
}
.badge-ok { background: #10b981; }
.badge-fail { background: #ef4444; }
.badge-warn { background: #f59e0b; }
.badge-pending { background: #cbd2d9; color: #3e4c59; }

/* Botones */
button, .btn, .btn-primary, .btn-danger {
  font: inherit; cursor: pointer; border: 1px solid #cbd2d9; background: #fff; color: #1f2933;
  padding: 5px 11px; border-radius: 6px;
}
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #fff; border-color: #ef4444; color: #ef4444; }
.btn-danger:hover { background: #ef4444; color: #fff; }
.btn-mini { padding: 3px 9px; border-radius: 5px; font-size: 13px; }
.btn-ok { border-color: #10b981; color: #059669; }
.btn-ok:hover { background: #10b981; color: #fff; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0px 0px; line-height: 0; color: #52606d; text-decoration: none; }
.icon-btn svg { display: block; }
.icon-btn:hover { color: #2563eb; }
.icon-btn.icon-lg { padding: 3px; }
.btn-copy { display: inline-flex; align-items: center; justify-content: center; border: none; background: none; color: #52606d; cursor: pointer; padding: 2px 4px; margin-left: 4px; line-height: 0; }
.btn-copy:hover { color: #2563eb; }
.resolved-mismatch { color: #ef4444; }
.value-error { color: #ef4444; font-weight: 700; }
.nowrap { white-space: nowrap; }
.sortable { cursor: pointer; user-select: none; }
.sortable::after { content: ""; display: inline-block; width: 10px; margin-left: 3px; opacity: .35; }
.sortable.sort-asc::after { content: "▲"; opacity: 1; font-size: 9px; }
.sortable.sort-desc::after { content: "▼"; opacity: 1; font-size: 9px; }
.ellipsis { max-width: 1px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.elapsed { white-space: nowrap; color: #52606d; font-variant-numeric: tabular-nums; }

/* Columna de acciones por registro (admin) */
.row-actions { white-space: nowrap; width: 1%; vertical-align: top; }
.row-actions form { display: inline; }
.row-actions > form, .row-actions > button { margin-left: 4px; }
.edit-row td { background: #f3f6fb; }
.edit-row .record-form { margin: 4px 0; }
.edit-type { font-weight: 700; color: #52606d; min-width: 48px; }

/* Formularios */
.card { background: #fff; border: 1px solid #e4e7eb; border-radius: 10px; padding: 20px; margin: 18px 0; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-form label, .login-box label { display: flex; flex-direction: column; font-size: 13px; color: #52606d; gap: 5px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cbd2d9; border-radius: 6px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
.form-actions form { margin-left: auto; }
.record-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.record-form input { flex: 1; min-width: 120px; }
textarea.autosize { resize: none; overflow: hidden; white-space: pre-wrap; word-break: break-all; line-height: 1.4; }
.field-fill { width: 100%; box-sizing: border-box; }

/* Formulario en una sola fila (grupo) */
.row-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.row-form label { display: flex; flex-direction: column; font-size: 12px; color: #52606d; gap: 5px; }
.row-form .grow-2 { flex: 2; min-width: 160px; }
.row-form .grow-3 { flex: 3; min-width: 200px; }
.row-form .grow-0 { flex: 0 0 120px; }
.row-form .btn-primary { height: 36px; }

.detail-head, .public-head { }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.actions { display: flex; gap: 10px; align-items: center; }
.actions form { display: inline; }

/* Cabecera de tarjeta con acción a la derecha (toggle enable/disable) */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.toggle-form { display: flex; align-items: center; gap: 10px; }
.state-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.state-chip.on { background: #d1fae5; color: #065f46; }
.state-chip.off { background: #fee2e2; color: #991b1b; }

/* Pantalla de mensaje centrado (test no disponible) */
.center-screen { min-height: 65vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.unavailable-msg { font-size: 18px; color: #52606d; }

/* Login */
.login-box { max-width: 320px; margin: 60px auto; background: #fff; padding: 28px; border-radius: 10px; border: 1px solid #e4e7eb; }
.login-box form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* Banners y alerts */
.banner { padding: 12px 16px; border-radius: 8px; margin: 14px 0; font-weight: 600; }
.banner-ok { background: #d1fae5; color: #065f46; }
.banner-fail { background: #fee2e2; color: #991b1b; }
.banner-pending { background: #eef1f4; color: #3e4c59; }
.alert { color: #991b1b; }
.alert-ok { color: #065f46; }
.recheck { display: flex; gap: 14px; align-items: center; margin: 14px 0; }

/* Modal de confirmación */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  animation: fadeIn .12s ease-out;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative; background: #fff; border-radius: 12px; width: 420px; max-width: calc(100vw - 32px);
  padding: 24px 24px 18px; box-shadow: 0 20px 50px rgba(15, 23, 42, .28);
  animation: popIn .14s ease-out;
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal .modal-body { margin: 0 0 20px; color: #52606d; font-size: 13px; }
.modal-close {
  position: absolute; top: 10px; right: 10px; border: none; background: transparent;
  font-size: 22px; line-height: 1; color: #9aa5b1; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: #f0f2f5; color: #3e4c59; }
.modal-actions { display: flex; justify-content: space-between; align-items: center; }
.modal-actions .btn { color: #52606d; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
