:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f3;
  color: #1d2522;
  --ink: #1d2522;
  --muted: #69756e;
  --line: #dce3dc;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --warn-bg: #fff3cd;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --wait: #52525b;
  --wait-bg: #f4f4f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.10), rgba(246, 247, 243, 0) 360px),
    #f6f7f3;
}

a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 32px clamp(18px, 4vw, 56px) 20px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.25rem;
  letter-spacing: 0;
}

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

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.20);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover {
  border-color: #afbbb3;
  background: #f9faf7;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  padding: 0;
  background: #fff;
  color: var(--ink);
  font-size: 1.35rem;
}

.primary-button:disabled,
.secondary-button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 28px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.metric {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.metric strong {
  font-size: 2rem;
}

.section-block {
  margin-bottom: 30px;
}

.section-heading {
  margin-bottom: 12px;
}

.table-heading {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
}

.search-box {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.search-box input {
  width: min(280px, 48vw);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.news-card {
  border: 1px solid #f0c36a;
  border-radius: 8px;
  padding: 16px;
  background: var(--warn-bg);
}

.news-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.empty-state {
  border: 1px dashed #cbd5ce;
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #40504a;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #f9faf7;
}

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

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-mudou {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-erro,
.status-bloqueado,
.status-indisponivel {
  background: var(--error-bg);
  color: var(--error);
}

.status-aguardando {
  background: var(--wait-bg);
  color: var(--wait);
}

.footer {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 30px;
  color: var(--muted);
  font-size: 0.92rem;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(360px, calc(100vw - 32px));
  border-radius: 8px;
  padding: 12px 14px;
  background: #1f2937;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.config-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.config-dialog::backdrop {
  background: rgba(29, 37, 34, 0.42);
}

.config-panel {
  display: grid;
  max-height: min(760px, calc(100vh - 28px));
  grid-template-rows: auto auto auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dialog-header {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.config-fields {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.5fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.config-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.config-fields input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.config-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.config-list {
  overflow: auto;
}

.config-item {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.config-item:last-child {
  border-bottom: 0;
}

.config-name {
  font-weight: 800;
}

.config-url {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.mini-button,
.danger-button {
  min-height: 34px;
  border-radius: 8px;
  padding: 0 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
}

.mini-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-button {
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: var(--error);
}

@media (max-width: 720px) {
  .topbar,
  .table-heading,
  .footer {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding-top: 22px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .search-box input {
    width: 100%;
  }

  .topbar-actions,
  .form-actions {
    justify-content: stretch;
  }

  .topbar-actions > *,
  .form-actions > * {
    flex: 1;
  }

  .config-fields,
  .config-item {
    grid-template-columns: 1fr;
  }

  .config-actions {
    justify-content: stretch;
  }

  .config-actions > * {
    flex: 1;
  }
}
