/* Painel de monitoramento: indicadores, graficos SVG, tabelas e logs. */

.mon-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(12, 18, 26, 0.55);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}

.mon-panel {
  width: min(1180px, 100%);
  border-radius: 14px;
  background: var(--bg, #f7f9fc);
  color: var(--text, #1c2430);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  padding: 18px 20px 24px;
}

.mon-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mon-panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.mon-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.mon-btn,
.mon-select,
.mon-input {
  font: inherit;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #d4dae3);
  background: var(--surface, #fff);
  color: var(--text, #1c2430);
  cursor: pointer;
}

.mon-input {
  cursor: text;
  min-width: 200px;
}

.mon-btn:hover,
.mon-select:hover {
  border-color: var(--accent, #2f7dd1);
}

.mon-btn:focus-visible,
.mon-select:focus-visible,
.mon-input:focus-visible {
  outline: 2px solid var(--accent, #2f7dd1);
  outline-offset: 2px;
}

.mon-btn-danger {
  border-color: #d9534f;
  color: #b02a26;
}

.mon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.mon-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border, #d4dae3);
  border-left: 4px solid var(--accent, #2f7dd1);
  border-radius: 10px;
  background: var(--surface, #fff);
}

.mon-card.ok { border-left-color: #2fa36b; }
.mon-card.warn { border-left-color: #d97706; }
.mon-card.danger { border-left-color: #d9534f; }

.mon-card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
}

.mon-card-value {
  font-size: 22px;
  line-height: 1.2;
}

.mon-card-hint {
  font-size: 12px;
  color: var(--muted, #64748b);
}

.mon-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.mon-chart {
  border: 1px solid var(--border, #d4dae3);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface, #fff);
}

.mon-chart svg {
  width: 100%;
  height: 110px;
  display: block;
}

.mon-chart-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.mon-chart-foot,
.mon-chart-empty {
  display: block;
  font-size: 11px;
  color: var(--muted, #64748b);
}

.mon-section {
  margin-bottom: 20px;
}

.mon-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.mon-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.mon-section-head h3 {
  margin: 0;
  flex: 1 1 220px;
}

.mon-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #d4dae3);
  border-radius: 10px;
  background: var(--surface, #fff);
  margin-bottom: 10px;
}

.mon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mon-table th,
.mon-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border, #eef1f5);
  white-space: nowrap;
}

.mon-table th {
  background: var(--surface-alt, #f5f7fa);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mon-table tbody tr:last-child td { border-bottom: none; }
.mon-table tr.tone-warn { background: rgba(217, 119, 6, 0.08); }
.mon-table tr.tone-danger { background: rgba(217, 83, 79, 0.1); }

.mon-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}

.mon-log {
  border: 1px solid var(--border, #d4dae3);
  border-left: 4px solid var(--muted, #94a3b8);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface, #fff);
}

.mon-log-info { border-left-color: #2f7dd1; }
.mon-log-debug { border-left-color: #94a3b8; }
.mon-log-warn { border-left-color: #d97706; }
.mon-log-error { border-left-color: #d9534f; }

.mon-log-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted, #64748b);
}

.mon-log-level { font-weight: 700; }

.mon-log-msg {
  margin: 4px 0 0;
  font-size: 13px;
}

.mon-log-meta {
  margin: 6px 0 0;
  font-size: 11px;
  background: var(--surface-alt, #f5f7fa);
  padding: 6px 8px;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.mon-empty {
  margin: 0;
  padding: 14px;
  font-size: 13px;
  color: var(--muted, #64748b);
}

.mon-error {
  border: 1px solid #d9534f;
  border-radius: 10px;
  padding: 14px 16px;
  background: rgba(217, 83, 79, 0.08);
}

.mon-updated {
  font-size: 12px;
  color: var(--muted, #64748b);
  text-align: right;
}

@media (prefers-color-scheme: dark) {
  .mon-panel { background: var(--bg, #0f151d); color: var(--text, #e6ebf2); }

  .mon-card,
  .mon-chart,
  .mon-table-wrap,
  .mon-log,
  .mon-btn,
  .mon-select,
  .mon-input {
    background: var(--surface, #161d27);
    border-color: var(--border, #2b3543);
    color: var(--text, #e6ebf2);
  }

  .mon-table th { background: var(--surface-alt, #1d2632); }
  .mon-log-meta { background: var(--surface-alt, #1d2632); }
}

@media print {
  .mon-overlay { position: static; background: none; padding: 0; }
  .mon-panel { box-shadow: none; width: 100%; }
  .mon-toolbar,
  .mon-section-head .mon-btn,
  .mon-section-head .mon-select,
  .mon-section-head .mon-input { display: none; }

  .mon-log-list { max-height: none; overflow: visible; }
}
