
:root {
  --navy: #061d49;
  --navy2: #0b2f63;
  --bg: #eaf2f8;
  --card: #ffffff;
  --text: #10223b;
  --muted: #66778d;
  --border: #d6e1ec;
  --thead: #edf4f9;
  --shadow: 0 8px 24px rgba(8, 42, 79, 0.07);
}

html[data-theme="dark"] {
  --navy: #03132f;
  --navy2: #08244c;
  --bg: #071625;
  --card: #0d2135;
  --text: #eef6ff;
  --muted: #9db0c5;
  --border: #223a52;
  --thead: #0a1a2b;
  --shadow: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  min-height: 86px;
  padding: 13px 28px;
  background: linear-gradient(105deg, var(--navy), var(--navy2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

.topbar-left,
.actions,
.login-brand {
  display: flex;
  align-items: center;
}

.topbar-left { gap: 32px; }

.topbar-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

 .logo-jrc {
  width: 110px;
  height: 58px;

  object-fit: cover;

  /* aumenta o conteúdo dentro da imagem */
  object-position: 50% 50%;

  border-radius: 10px;

  display: block;
  flex-shrink: 0;

  /* aproxima visualmente o logo */
  transform: scale(1.08);

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.15;
}

.top-meta {
  font-size: 12px;
  color: #d9e7f5;
  line-height: 1.4;
}

.top-separator { margin: 0 5px; }

.actions { gap: 10px; }

.top-btn,
.top-link {
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.06);
  color: #fff;
  padding: 10px 14px;
  border-radius: 9px;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  text-align: left;
  min-height: 124px;
  padding: 17px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.summary-card:hover { transform: translateY(-1px); }

.summary-value {
  font-size: 30px;
  font-weight: 900;
}

.summary-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.summary-action {
  margin-top: 21px;
  font-size: 12px;
  font-weight: 800;
}

.summary-connected .summary-action { color: #139b53; }
.summary-connecting .summary-action { color: #d98b00; }
.summary-disconnected .summary-action { color: #e03131; }
.summary-unknown .summary-action { color: #7c55c7; }

.filters-card {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 220px 220px 110px;
  gap: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

input,
select,
.clear-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 11px;
}

.clear-btn {
  cursor: pointer;
  font-weight: 800;
}

.status-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px 13px 0 0;
}

.status-tab {
  padding: 14px 8px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  font-weight: 800;
  cursor: pointer;
}

.status-tab.active {
  color: #1268d7;
  border-bottom-color: #1268d7;
}

.status-tab:disabled { cursor: default; }

.grouped-instances {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.source-section {
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0 0 13px 13px;
  box-shadow: var(--shadow);
}

.source-section + .source-section { border-radius: 13px; }

.source-section-head {
  padding: 13px 16px;
  background: var(--thead);
  border-bottom: 1px solid var(--border);
}

.source-section-head h3 {
  margin: 0;
  font-size: 17px;
}

.source-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.clients-list {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.client-card {
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.client-card summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background: var(--thead);
}

.client-card summary::-webkit-details-marker {
  display: none;
}

.client-title { font-weight: 900; }

.client-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot-filter {
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
  font-weight: 800;
}

.dot-filter:hover,
.dot-filter.selected {
  background: rgba(36,93,138,.12);
}

.chevron {
  margin-left: 4px;
  color: var(--muted);
  font-size: 18px;
}

.group-details {
  border-top: 1px solid var(--border);
}

.client-table-wrap { overflow: auto; }

.client-table {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
  border-collapse: collapse;
}

.client-table th:nth-child(1),
.client-table td:nth-child(1) { width: 31%; }

.client-table th:nth-child(2),
.client-table td:nth-child(2) { width: 27%; }

.client-table th:nth-child(3),
.client-table td:nth-child(3) { width: 22%; }

.client-table th:nth-child(4),
.client-table td:nth-child(4) { width: 20%; }

.client-table th,
.client-table td {
  padding: 11px 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.client-table th {
  background: var(--thead);
  font-weight: 800;
}

.client-table tr:last-child td {
  border-bottom: 0;
}

.primary-cell { font-weight: 800; }

.secondary-cell {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.status { font-weight: 900; }

.no-group-results,
.empty-card {
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

.legend-bottom {
  margin: 18px 0 30px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.legend-bottom summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
}

.legend-bottom summary::-webkit-details-marker {
  display: none;
}

.legend-toggle {
  color: #1268d7;
  font-size: 12px;
}

.legend-content {
  padding: 0 18px 18px;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding-top: 8px;
}

.legend-grid > div {
  padding: 10px;
  border-right: 1px solid var(--border);
}

.legend-grid > div:last-child {
  border-right: 0;
}

.legend-grid strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.legend-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.legend-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--thead);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(5,30,67,.82), rgba(7,49,91,.76)),
    url("/static/jrc-institucional.jpeg") center / cover fixed;
}

.login-card {
  width: min(430px, 100%);
  padding: 30px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.24);
}

.login-brand {
  gap: 18px;
  margin-bottom: 28px;
}

.login-logo {
  width: 120px;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
}

.login-brand strong { display: block; }

.login-brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.login-card h1 { margin: 0 0 6px; }

.login-card label {
  display: block;
  margin: 15px 0 6px;
  font-size: 13px;
  font-weight: 800;
}

.login-card input { width: 100%; }

.login-submit {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background: var(--navy2);
  color: #fff;
  border: 0;
  border-radius: 9px;
  font-weight: 800;
  cursor: pointer;
}

.alert {
  margin: 12px 0;
  padding: 10px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 9px;
}

.muted { color: var(--muted); }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .filters-card { grid-template-columns: 1fr 1fr; }
  .status-tabs { grid-template-columns: repeat(3, 1fr); }
  .legend-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-left { gap: 16px; }

  .logo-jrc {
    width: 82px;
    height: 52px;
  }

  .summary-grid { grid-template-columns: 1fr 1fr; }
  .filters-card { grid-template-columns: 1fr; }
  .status-tabs { grid-template-columns: 1fr 1fr; }
  .legend-grid { grid-template-columns: 1fr; }
  .container { padding: 14px; }
}
