/* RTGEO — Central de Configurações e Saúde do Sistema */

.system-status-view {
  overflow-y: auto;
  padding: 28px clamp(16px, 3vw, 42px) 56px;
  background: var(--bg-app);
}

.system-status-shell {
  width: min(100%, 1220px);
  margin: 0 auto;
}

.system-status-header,
.system-status-toolbar,
.system-section-heading,
.system-card-header,
.system-panel-heading,
.system-setting-row,
.system-integration-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.system-status-header {
  align-items: center;
  margin-bottom: 18px;
}

.system-status-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.system-status-title {
  margin: 0;
  color: var(--text-main);
  font-size: clamp(23px, 3vw, 31px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.1;
}

.system-status-subtitle {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.system-health-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.system-health-dot,
.system-status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-light);
}

.system-health-badge.status-ok,
.system-status-card.status-ok {
  border-color: rgba(22, 163, 74, .24);
}

.system-health-badge.status-ok,
.system-status-card.status-ok .system-card-title {
  color: #166534;
}

.system-health-badge.status-ok .system-health-dot,
.system-status-card.status-ok .system-status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .11);
}

.system-health-badge.status-active,
.system-status-card.status-active {
  border-color: rgba(39, 76, 138, .25);
}

.system-health-badge.status-active,
.system-status-card.status-active .system-card-title {
  color: var(--primary);
}

.system-health-badge.status-active .system-health-dot,
.system-status-card.status-active .system-status-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(39, 76, 138, .11);
  animation: systemStatusPulse 1.4s ease-in-out infinite;
}

.system-health-badge.status-warning,
.system-status-card.status-warning {
  border-color: rgba(217, 119, 6, .28);
}

.system-health-badge.status-warning,
.system-status-card.status-warning .system-card-title {
  color: #92400e;
}

.system-health-badge.status-warning .system-health-dot,
.system-status-card.status-warning .system-status-dot {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(217, 119, 6, .11);
}

.system-health-badge.status-error,
.system-status-card.status-error {
  border-color: rgba(239, 68, 68, .28);
}

.system-health-badge.status-error,
.system-status-card.status-error .system-card-title {
  color: #b91c1c;
}

.system-health-badge.status-error .system-health-dot,
.system-status-card.status-error .system-status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .11);
}

.system-health-badge.status-info,
.system-status-card.status-info {
  border-color: var(--border);
}

.system-health-badge.status-info .system-health-dot,
.system-status-card.status-info .system-status-dot {
  background: var(--text-muted);
}

.system-health-badge.status-pending .system-health-dot {
  background: var(--text-light);
  animation: systemStatusPulse 1.4s ease-in-out infinite;
}

@keyframes systemStatusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.system-status-toolbar {
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.system-status-meta,
.system-status-notice {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.system-status-notice {
  min-height: 18px;
  margin-top: 3px;
  color: var(--primary);
  font-weight: 600;
}

.system-status-notice.error {
  color: var(--danger);
}

.system-status-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.system-status-actions .pill-btn {
  min-height: 40px;
  padding: 8px 13px;
}

.system-link-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--primary);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
  white-space: nowrap;
}

.system-link-button:hover {
  border-color: var(--border-focus);
  background: var(--primary-light);
}

.system-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 26px;
}

.system-kpi {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.system-kpi-label {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.system-kpi-value {
  display: block;
  margin-top: 7px;
  color: var(--text-main);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.system-kpi-detail {
  display: block;
  min-height: 18px;
  margin-top: 6px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-section {
  margin-top: 24px;
}

.system-section-heading {
  align-items: flex-end;
  margin-bottom: 11px;
}

.system-section-title,
.system-panel-title {
  margin: 0;
  color: var(--text-main);
  font-size: 15px;
  font-weight: 800;
}

.system-section-description,
.system-panel-description {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.system-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 11px;
}

.system-status-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.system-card-header {
  align-items: center;
}

.system-card-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.system-card-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-card-state {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.system-card-detail {
  min-height: 38px;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.system-card-meta {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.system-card-link {
  display: inline-block;
  max-width: 100%;
  margin-top: 11px;
  overflow: hidden;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}

.system-card-link:hover {
  text-decoration: underline;
}

.system-columns {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: 12px;
  margin-top: 24px;
}

.system-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.system-panel-heading {
  align-items: flex-start;
  margin-bottom: 16px;
}

.system-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
}

.system-panel-icon svg {
  width: 16px;
  height: 16px;
}

.system-settings-form {
  display: grid;
  gap: 13px;
}

.system-setting-row {
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
}

.system-setting-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.system-setting-copy {
  min-width: 0;
}

.system-setting-label {
  display: block;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
}

.system-setting-help {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.system-setting-control,
.system-setting-select {
  min-height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-app);
  color: var(--text-main);
  font: inherit;
  font-size: 12px;
}

.system-setting-select {
  min-width: 150px;
  padding: 8px 10px;
}

.system-setting-control {
  position: relative;
  width: 44px;
  height: 24px;
  min-height: 24px;
  appearance: none;
  border-radius: var(--radius-full);
  background: var(--border);
  cursor: pointer;
  transition: background-color .15s ease;
}

.system-setting-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  content: "";
  transition: transform .15s ease;
}

.system-setting-control:checked {
  background: var(--primary);
}

.system-setting-control:checked::after {
  transform: translateX(20px);
}

.system-setting-control:focus-visible,
.system-setting-select:focus-visible,
.system-link-button:focus-visible,
.system-card-link:focus-visible {
  outline: 3px solid rgba(39, 76, 138, .22);
  outline-offset: 2px;
}

.system-integration-list {
  display: grid;
  gap: 0;
}

.system-integration-row {
  align-items: center;
  min-height: 48px;
  padding: 9px 0;
  border-top: 1px solid var(--border-light);
}

.system-integration-row:first-child {
  border-top: 0;
}

.system-integration-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.system-integration-value {
  max-width: 68%;
  overflow: hidden;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-crawler-panel {
  margin-top: 24px;
}

.system-progress-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  margin: 15px 0 17px;
}

.system-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--primary-light);
}

.system-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width .35s ease;
}

.system-progress-value {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.system-crawler-summary {
  margin: 0 0 15px;
  color: var(--text-muted);
  font-size: 12px;
}

.system-crawler-sites {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 9px;
}

.system-crawler-site {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-app);
}

.system-crawler-site-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.system-crawler-site-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-crawler-site-city {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10.5px;
}

.system-crawler-site-state {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.system-crawler-site .system-progress-track {
  height: 7px;
  margin-top: 13px;
  background: var(--border);
}

.system-crawler-site .system-progress-fill {
  background: var(--oportunidade);
}

.system-crawler-site-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 11px;
  color: var(--text-muted);
  font-size: 10px;
}

.system-crawler-site-meta strong {
  display: block;
  color: var(--text-main);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.system-crawler-site-note {
  margin: 9px 0 0;
  color: var(--warning);
  font-size: 10.5px;
  line-height: 1.4;
}

.system-technical {
  display: none;
}

.system-status-view.show-technical .system-technical {
  display: block;
}

.system-footnote {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .system-health-badge.status-active .system-health-dot,
  .system-status-card.status-active .system-status-dot {
    animation: none;
  }

  .system-progress-fill,
  .system-setting-control,
  .system-setting-control::after,
  .system-link-button {
    transition: none;
  }
}

@media (max-width: 900px) {
  .system-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .system-status-view {
    padding: 21px 14px 42px;
  }

  .system-status-header,
  .system-status-toolbar,
  .system-section-heading {
    display: block;
  }

  .system-health-badge {
    margin-top: 14px;
  }

  .system-status-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .system-setting-row {
    align-items: flex-start;
  }

  .system-setting-select {
    min-width: 132px;
  }
}

@media (max-width: 420px) {
  .system-kpis {
    grid-template-columns: 1fr;
  }

  .system-status-actions .pill-btn,
  .system-status-actions .system-link-button {
    width: 100%;
    justify-content: center;
  }

  .system-integration-row {
    display: block;
  }

  .system-integration-value {
    display: block;
    max-width: 100%;
    margin-top: 3px;
  }
}
