/* SIDCA: capa visual complementaria, compatible con el legado Bootstrap 2. */
body.mrj-system-sidca {
  --sidca-blue: #0f5c9f;
  --sidca-cyan: #0f93b8;
  --sidca-navy: #173a56;
  --sidca-green: #4d963d;
  --sidca-gold: #d89a17;
  --sidca-red: #c94a43;
  --sidca-line: #cfe3ec;
  --sidca-soft: #f3f8fb;
  --sidca-shadow: 0 12px 30px rgba(18, 73, 105, .10);
}

body.mrj-system-sidca .btn i,
body.mrj-system-sidca .btn [class^="icon-"],
body.mrj-system-sidca .btn [class*=" icon-"],
body.mrj-system-sidca .nav a i,
body.mrj-system-sidca .mrj-menu-icon {
  color: currentColor !important;
  line-height: 1;
  text-shadow: none !important;
}

body.mrj-system-sidca .btn {
  align-items: center;
  box-sizing: border-box;
  display: inline-flex;
  gap: 6px;
  justify-content: center;
  min-height: 32px;
  vertical-align: middle;
}

/* Bootstrap 2 declara .oculto antes de los botones. La mayor especificidad de
   esta capa no debe volver visibles disparadores técnicos como "Ver". */
body.mrj-system-sidca .oculto,
body.mrj-system-sidca .capa,
body.mrj-system-sidca .btn.oculto,
body.mrj-system-sidca a.oculto {
  display: none !important;
}

body.mrj-system-sidca legend {
  align-items: center;
  border-bottom-color: var(--sidca-line);
  color: var(--sidca-navy);
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  line-height: 1.25;
  padding-bottom: 7px;
}

body.mrj-system-sidca legend > i,
body.mrj-system-sidca legend > span > i {
  color: var(--sidca-cyan) !important;
}

body.mrj-system-sidca .mrj-visual-table-scroll {
  background: #fff;
  border: 1px solid var(--sidca-line);
  border-radius: 12px;
  box-shadow: 0 7px 18px rgba(18, 73, 105, .06);
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-color: #8fb2c1 #edf6f9;
  scrollbar-width: thin;
}

body.mrj-system-sidca .mrj-visual-table-scroll .mrj-visual-table-scroll,
body.mrj-system-sidca .mrj-visual-table-scroll.sidca-nested-scroll {
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  overflow: visible !important;
}

body.mrj-system-sidca .sidca-native-scroll {
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible !important;
}

body.mrj-system-sidca .mrj-visual-table-scroll::-webkit-scrollbar {
  height: 11px;
}

body.mrj-system-sidca .mrj-visual-table-scroll::-webkit-scrollbar-track {
  background: #edf6f9;
  border-radius: 8px;
}

body.mrj-system-sidca .mrj-visual-table-scroll::-webkit-scrollbar-thumb {
  background: #8fb2c1;
  border: 2px solid #edf6f9;
  border-radius: 8px;
}

body.mrj-system-sidca table.tablesorter thead th,
body.mrj-system-sidca table.tablesorter thead td {
  background: #eef6fa !important;
  color: #173a56 !important;
  font-weight: 700;
  line-height: 1.18;
  vertical-align: middle;
}

body.mrj-system-sidca table.tablesorter tbody td {
  color: #243f53;
  line-height: 1.24;
  vertical-align: middle;
}

body.mrj-system-sidca table.tablesorter tbody tr:nth-child(even) td {
  background-color: #f8fbfd;
}

body.mrj-system-sidca table.tablesorter tbody tr:hover td {
  background-color: #edf8fb !important;
}

body.mrj-system-sidca table.tablesorter input,
body.mrj-system-sidca table.tablesorter select,
body.mrj-system-sidca table.tablesorter textarea {
  box-sizing: border-box;
  max-width: 100%;
}

body.mrj-system-sidca table.tablesorter,
body.mrj-system-sidca table.table {
  box-sizing: border-box;
  margin-bottom: 0;
}

body.mrj-system-sidca table.tablesorter-pager {
  display: table !important;
  width: 100% !important;
}

body.mrj-system-sidca .sidca-email-cell {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: lowercase;
  white-space: nowrap;
}

body.mrj-system-sidca .sidca-code-cell {
  color: #0d4f79;
  font-size: 1.12em;
  font-weight: 700;
  letter-spacing: .01em;
}

body.mrj-system-sidca .sidca-date-line,
body.mrj-system-sidca .sidca-time-line {
  display: block;
  text-align: center;
  white-space: nowrap;
}

body.mrj-system-sidca .sidca-time-line {
  color: #60798b;
  font-size: .86em;
  margin-top: 2px;
}

body.mrj-system-sidca .sidca-status-badge {
  align-items: center;
  background: #eef5f8;
  border: 1px solid #b9d1dc;
  border-radius: 999px;
  color: #36566b;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  gap: 5px;
  line-height: 1.15;
  padding: 4px 8px;
  white-space: nowrap;
}

body.mrj-system-sidca .sidca-status-badge.is-ok {
  background: #eef9f0;
  border-color: #9bd0a3;
  color: #276a36;
}

body.mrj-system-sidca .sidca-status-badge.is-waiting {
  animation: sidca-status-breathe 2.8s ease-in-out infinite;
  background: #fff8e8;
  border-color: #e7c56a;
  color: #855c00;
}

body.mrj-system-sidca .sidca-status-badge.is-alert {
  background: #fff0ee;
  border-color: #e5aaa5;
  color: #a33a34;
}

@keyframes sidca-status-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(216, 154, 23, 0); }
  50% { box-shadow: 0 0 0 4px rgba(216, 154, 23, .12); }
}

body.mrj-system-sidca table tfoot .ts-pager,
body.mrj-system-sidca table tfoot .tablesorter-pager {
  background: #f5f9fb !important;
  box-sizing: border-box;
  display: table-cell !important;
  min-height: 38px;
  padding: 6px 8px !important;
  text-align: left !important;
  vertical-align: middle !important;
  white-space: normal !important;
}

body.mrj-system-sidca table tfoot .ts-pager > *,
body.mrj-system-sidca table tfoot .tablesorter-pager > * {
  display: inline-flex;
  float: none !important;
  margin: 2px 3px !important;
  vertical-align: middle;
}

body.mrj-system-sidca table tfoot .ts-pager .pagedisplay,
body.mrj-system-sidca table tfoot .tablesorter-pager .pagedisplay {
  align-items: center;
  font-weight: 700;
  min-height: 30px;
  white-space: nowrap;
}

/* Formularios heredados: títulos legibles, sin desplazarse al borde derecho. */
body.mrj-system-sidca .row-fluid .border-top,
body.mrj-system-sidca .row-fluid .radius-top {
  box-sizing: border-box;
  line-height: 1.25;
  margin-bottom: 3px !important;
  min-height: 32px;
  overflow-wrap: anywhere;
  padding: 7px 9px;
  text-align: left !important;
  white-space: normal;
}

body.mrj-system-sidca .white p,
body.mrj-system-sidca .celeste,
body.mrj-system-sidca .roja {
  box-sizing: border-box;
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
}

body.mrj-system-sidca .white p {
  font-size: 13px;
}

body.mrj-system-sidca .row-fluid [class*="span"] {
  box-sizing: border-box;
}

body.mrj-system-sidca .loading {
  background: radial-gradient(circle at 50% 40%, rgba(35, 191, 216, .24), rgba(35, 191, 216, 0) 34%), rgba(17, 29, 43, .54) !important;
  color: var(--sidca-navy);
  box-sizing: border-box;
  height: 100vh !important;
  margin: 0 !important;
  max-height: none !important;
  max-width: none !important;
  min-height: 100vh !important;
  min-width: 100vw !important;
  padding: 22px !important;
  width: 100vw !important;
}

body.mrj-system-sidca .loading-body {
  animation: sidca-loading-panel-in .16s ease .06s forwards;
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: 8px;
  box-shadow: 0 24px 55px rgba(10, 31, 55, .26), 0 2px 6px rgba(10, 31, 55, .12);
  box-sizing: border-box;
  left: 50% !important;
  max-width: calc(100% - 44px);
  min-width: 0;
  opacity: 0;
  overflow: hidden;
  padding: 28px 30px 24px;
  position: absolute !important;
  text-align: center;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 286px;
}

body.mrj-system-sidca .loading-body:before {
  animation: none;
  background: linear-gradient(90deg, #1d70d6, #23bfd8, #54d6a6);
  border: 0;
  border-radius: 0;
  content: "";
  display: block;
  height: 4px;
  left: 0;
  margin: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

body.mrj-system-sidca .loading-mark {
  border-radius: 50%;
  height: 58px;
  margin: 0 auto 16px;
  position: relative;
  width: 58px;
}

body.mrj-system-sidca .loading-mark:before,
body.mrj-system-sidca .loading-mark:after {
  border-radius: 50%;
  content: "";
  position: absolute;
}

body.mrj-system-sidca .loading-mark:before {
  background: #fff;
  bottom: 12px;
  box-shadow: inset 0 0 0 1px rgba(29, 112, 214, .08);
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 2;
}

body.mrj-system-sidca .loading-mark:after {
  animation: loading-spin .72s linear infinite;
  border: 4px solid rgba(29, 112, 214, .15);
  border-right-color: #23bfd8;
  border-top-color: #1d70d6;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  z-index: 1;
}

body.mrj-system-sidca .loading-bar {
  background: #e6eef6;
  border-radius: 999px;
  height: 4px;
  margin: 18px auto 0;
  overflow: hidden;
  position: relative;
  width: 100%;
}

body.mrj-system-sidca .loading-bar:before {
  animation: sidca-loading-bar 1.25s ease-in-out infinite;
  background: linear-gradient(90deg, rgba(29, 112, 214, 0), #23bfd8, #1d70d6);
  border-radius: 999px;
  bottom: 0;
  content: "";
  left: -45%;
  position: absolute;
  top: 0;
  width: 45%;
}

body.mrj-system-sidca .loading-brand {
  color: #8a95a5;
  font-size: 11px;
  margin-top: 13px;
}

@keyframes sidca-loading-bar {
  to { left: 100%; }
}

@keyframes sidca-loading-panel-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 5px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

html.page-loading body.mrj-system-sidca .loading {
  opacity: 1 !important;
}

/* Panel de inicio */
.sidca-dashboard-shell {
  box-sizing: border-box;
  margin: 22px auto 6px;
  max-width: 1560px;
  padding: 0 18px;
  width: 100%;
}

.sidca-dashboard {
  color: var(--sidca-navy);
}

.sidca-dashboard-hero {
  align-items: center;
  background:
    radial-gradient(circle at 84% 18%, rgba(216, 154, 23, .24), transparent 26%),
    linear-gradient(135deg, #0f5c9f 0%, #0f93b8 58%, #4d963d 100%);
  border-radius: 18px;
  box-shadow: 0 17px 38px rgba(15, 92, 159, .20);
  color: #fff;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 17px;
  min-height: 122px;
  overflow: hidden;
  padding: 22px 27px;
  position: relative;
}

.sidca-dashboard-hero:after {
  border: 34px solid rgba(255,255,255,.08);
  border-radius: 50%;
  content: "";
  height: 135px;
  position: absolute;
  right: -42px;
  top: -80px;
  width: 135px;
}

.sidca-dashboard-eyebrow {
  color: #d9f3fb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.sidca-dashboard-hero h1 {
  color: #fff;
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 7px;
  text-shadow: 0 2px 6px rgba(0, 30, 60, .16);
}

.sidca-dashboard-hero p {
  color: #eefaff;
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
  max-width: 760px;
}

.sidca-dashboard-date {
  align-items: center;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 13px;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  padding: 11px 14px;
  position: relative;
  z-index: 1;
}

.sidca-dashboard-date i {
  color: #fff2b7;
  font-size: 20px;
}

.sidca-dashboard-date strong,
.sidca-dashboard-date span {
  display: block;
  white-space: nowrap;
}

.sidca-dashboard-date span {
  color: #d9f3fb;
  font-size: 11px;
}

.sidca-kpi-grid {
  display: grid;
  gap: 13px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 17px;
}

.sidca-kpi-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--sidca-line);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(18, 73, 105, .07);
  display: flex;
  gap: 13px;
  min-height: 82px;
  padding: 13px 15px;
  transition: transform .16s ease, box-shadow .16s ease;
}

a.sidca-kpi-card {
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

a.sidca-kpi-card:focus,
a.sidca-kpi-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(15, 155, 188, .24), 0 13px 28px rgba(18, 73, 105, .12);
  outline: 2px solid transparent;
  transform: translateY(-2px);
}

.sidca-kpi-card:hover {
  box-shadow: 0 13px 28px rgba(18, 73, 105, .12);
  transform: translateY(-2px);
}

.sidca-kpi-card.is-disabled {
  cursor: not-allowed;
  opacity: .72;
}

.sidca-kpi-card.is-disabled:hover {
  box-shadow: 0 8px 22px rgba(18, 73, 105, .06);
  transform: none;
}

.sidca-kpi-copy {
  min-width: 0;
}

.sidca-kpi-arrow {
  color: #58a8bd;
  font-size: 12px;
  margin-left: auto;
  opacity: .78;
}

.sidca-kpi-icon {
  align-items: center;
  background: #eaf6fb;
  border-radius: 12px;
  color: var(--sidca-cyan);
  display: flex;
  flex: 0 0 48px;
  font-size: 20px;
  height: 48px;
  justify-content: center;
}

.sidca-kpi-card.is-green .sidca-kpi-icon { background: #edf8ed; color: var(--sidca-green); }
.sidca-kpi-card.is-gold .sidca-kpi-icon { background: #fff6df; color: var(--sidca-gold); }
.sidca-kpi-card.is-red .sidca-kpi-icon { background: #fff0ee; color: var(--sidca-red); }

.sidca-kpi-value {
  color: var(--sidca-navy);
  display: block;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 5px;
}

.sidca-kpi-label {
  color: #547085;
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.sidca-dashboard-grid {
  display: grid;
  gap: 17px;
  grid-template-columns: minmax(0, 1.28fr) minmax(360px, .72fr);
  margin-bottom: 17px;
}

.sidca-dashboard-card {
  background: #fff;
  border: 1px solid var(--sidca-line);
  border-radius: 15px;
  box-shadow: var(--sidca-shadow);
  box-sizing: border-box;
  min-width: 0;
  padding: 18px;
}

.sidca-card-heading {
  align-items: center;
  border-bottom: 1px solid #e0edf2;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 11px;
}

.sidca-card-heading h2 {
  color: var(--sidca-navy);
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
}

.sidca-card-heading h2 i {
  color: var(--sidca-cyan);
  margin-right: 7px;
}

.sidca-card-heading span {
  color: #708899;
  font-size: 11px;
}

.sidca-health-row {
  margin: 12px 0 16px;
}

.sidca-health-label {
  align-items: center;
  display: flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sidca-health-track {
  background: #e8f0f4;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.sidca-health-fill {
  background: linear-gradient(90deg, var(--sidca-blue), var(--sidca-cyan));
  border-radius: inherit;
  display: block;
  height: 100%;
  min-width: 3px;
}

.sidca-health-fill.is-green { background: linear-gradient(90deg, #398a3d, #77b84e); }
.sidca-health-fill.is-gold { background: linear-gradient(90deg, #c88700, #e6b83a); }

.sidca-alert-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 13px;
}

.sidca-alert-item {
  background: #f6fafc;
  border: 1px solid #dceaf0;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.sidca-alert-item strong {
  color: var(--sidca-navy);
  display: block;
  font-size: 18px;
}

.sidca-alert-item span {
  color: #617b8c;
  font-size: 11px;
}

.sidca-activity-list,
.sidca-contractor-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidca-activity-item,
.sidca-contractor-item {
  align-items: center;
  border-bottom: 1px solid #e6eff3;
  display: flex;
  gap: 10px;
  min-height: 43px;
  padding: 8px 0;
}

.sidca-activity-item:last-child,
.sidca-contractor-item:last-child { border-bottom: 0; }

.sidca-activity-icon {
  align-items: center;
  background: #eaf6fb;
  border-radius: 50%;
  color: var(--sidca-cyan);
  display: flex;
  flex: 0 0 34px;
  height: 34px;
  justify-content: center;
}

.sidca-activity-icon.is-exit { background: #fff3e4; color: #b87500; }

.sidca-activity-copy {
  min-width: 0;
}

.sidca-activity-copy strong,
.sidca-activity-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidca-activity-copy strong { color: #294a60; font-size: 12px; }
.sidca-activity-copy span { color: #738999; font-size: 10px; margin-top: 2px; }

.sidca-contractor-item {
  justify-content: space-between;
}

.sidca-contractor-name {
  color: #294a60;
  font-size: 12px;
  font-weight: 700;
  max-width: calc(100% - 65px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidca-contractor-count {
  background: #edf7fb;
  border-radius: 999px;
  color: #0b6f92;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
}

.sidca-quick-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sidca-quick-link {
  align-items: center;
  background: #f7fbfd;
  border: 1px solid #d7e8ef;
  border-radius: 11px;
  box-sizing: border-box;
  color: #244d67 !important;
  display: flex;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  text-decoration: none !important;
  transition: all .15s ease;
}

.sidca-quick-link:hover {
  background: linear-gradient(135deg, var(--sidca-blue), var(--sidca-cyan));
  border-color: var(--sidca-cyan);
  box-shadow: 0 8px 18px rgba(15, 92, 159, .17);
  color: #fff !important;
  transform: translateY(-1px);
}

.sidca-quick-link i {
  color: currentColor !important;
  font-size: 17px;
  width: 20px;
}

.sidca-quick-link strong,
.sidca-quick-link small {
  display: block;
  line-height: 1.2;
}

.sidca-quick-link small {
  color: #718797;
  font-size: 10px;
  margin-top: 2px;
}

.sidca-quick-link:hover small { color: #e2f4f9; }

.sidca-empty-state {
  color: #748a99;
  font-size: 12px;
  padding: 20px 8px;
  text-align: center;
}

@media (max-width: 1180px) {
  .sidca-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidca-dashboard-grid { grid-template-columns: 1fr; }
  .sidca-quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .sidca-dashboard-shell { margin-top: 13px; padding: 0 9px; }
  .sidca-dashboard-hero { align-items: flex-start; display: block; padding: 19px; }
  .sidca-dashboard-hero h1 { font-size: 23px; }
  .sidca-dashboard-date { display: inline-flex; margin-top: 14px; }
  .sidca-kpi-grid,
  .sidca-alert-grid,
  .sidca-quick-grid { grid-template-columns: 1fr; }
  .sidca-kpi-card { min-height: 70px; }
  .sidca-dashboard-card { padding: 13px; }
  body.mrj-system-sidca .sidca-email-cell { max-width: 170px; }
}

@media (prefers-reduced-motion: reduce) {
  body.mrj-system-sidca .sidca-status-badge.is-waiting,
  .sidca-kpi-card,
  .sidca-quick-link {
    animation: none !important;
    transition: none !important;
  }
}

/* Estación simplificada panel.php */
body.sidca-standalone-scan {
  background: linear-gradient(145deg, #eef7fb 0%, #f8fbfd 55%, #fff8e8 100%);
  min-height: 100vh;
  padding: 28px 14px;
}

.sidca-scan-shell {
  margin: 0 auto;
  max-width: 920px;
}

.sidca-scan-heading {
  align-items: center;
  display: flex;
  gap: 15px;
  margin-bottom: 14px;
}

.sidca-scan-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--sidca-blue), var(--sidca-cyan));
  border-radius: 13px;
  box-shadow: 0 9px 20px rgba(15, 92, 159, .20);
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 800;
  height: 52px;
  justify-content: center;
  letter-spacing: .06em;
  width: 70px;
}

.sidca-scan-heading h1 {
  color: var(--sidca-navy);
  font-size: 25px;
  line-height: 1.15;
  margin: 0 0 3px;
}

.sidca-scan-heading p {
  color: #687f8f;
  margin: 0;
}

.sidca-scan-card {
  background: #fff;
  border: 1px solid var(--sidca-line);
  border-radius: 16px;
  box-shadow: var(--sidca-shadow);
  padding: 22px;
}

.sidca-scan-card form {
  background: #f5fafc;
  border: 1px solid #dbeaf0;
  border-radius: 12px;
  padding: 15px;
}

.sidca-scan-card input[type="text"] {
  box-sizing: border-box;
  font-size: 20px;
  font-weight: 700;
  height: 42px;
  text-align: center;
}

.sidca-scan-card #btn {
  font-size: 14px;
  font-weight: 700;
  height: 42px;
}

.sidca-scan-table {
  border: 1px solid var(--sidca-line);
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
}

.sidca-scan-table th,
.sidca-scan-table td {
  font-size: 16px;
  padding: 11px !important;
  text-align: center !important;
}

@media (max-width: 760px) {
  body.sidca-standalone-scan { padding: 14px 7px; }
  .sidca-scan-card { padding: 12px; }
  .sidca-scan-card .row-fluid [class*="span"] { margin: 5px 0; width: 100%; }
}
