:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dde5;
  --text: #18202f;
  --muted: #667085;
  --strong: #0f172a;
  --accent: #0f766e;
  --accent-soft: #d9f4ee;
  --critical: #b42318;
  --critical-bg: #fde7e4;
  --high: #b54708;
  --high-bg: #fff0d8;
  --medium: #175cd3;
  --medium-bg: #e5efff;
  --low: #067647;
  --low-bg: #ddf8e8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  min-height: 136px;
  padding: 24px 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  background: #101828;
  color: #fff;
}

.eyebrow {
  margin: 0 0 6px;
  color: #b8c0cc;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.sync {
  min-width: 260px;
  display: grid;
  gap: 6px;
  justify-items: end;
  color: #d5dae3;
}

.sync strong {
  color: #fff;
  font-size: 15px;
}

.live-sync {
  color: #b8c0cc;
  font-size: 13px;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--strong);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.sync button {
  border-color: #40516b;
  background: #1f2a3d;
  color: #fff;
}

main {
  padding: 20px 28px 40px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.audit-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.process {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.processHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.process h2 {
  margin: 0;
  color: var(--strong);
  font-size: 18px;
}

.processHead strong {
  color: var(--accent);
  font-size: 18px;
}

.progressTrack {
  height: 8px;
  margin: 12px 0;
  border-radius: 999px;
  background: #e6e9ef;
  overflow: hidden;
}

.progressTrack span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

#syncLog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px;
  max-height: 160px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

#syncLog li {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

#syncLog li.running {
  color: #175cd3;
  background: #e5efff;
}

#syncLog li.done {
  color: #067647;
  background: #ddf8e8;
}

#syncLog li.error {
  color: #b42318;
  background: #fde7e4;
}

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

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--strong);
  font-size: 28px;
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.search {
  display: grid;
  gap: 6px;
  min-width: min(420px, 100%);
}

.search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input[type="search"] {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel);
}

.segments {
  display: inline-flex;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  overflow: hidden;
}

.segments button {
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
  min-height: 38px;
}

.segments button:last-child {
  border-right: 0;
}

.segments button.active {
  background: var(--accent-soft);
  color: #064e46;
  font-weight: 700;
}

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

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f4fbf9;
}

.domain {
  display: block;
  color: var(--strong);
  font-weight: 800;
  margin-bottom: 4px;
}

.iconButton {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

.syncSiteButton {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #b9e6dc;
}

.syncSiteButton.isSyncing {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.Critical {
  background: var(--critical-bg);
  color: var(--critical);
}

.High {
  background: var(--high-bg);
  color: var(--high);
}

.Medium {
  background: var(--medium-bg);
  color: var(--medium);
}

.Low {
  background: var(--low-bg);
  color: var(--low);
}

.liveBadge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.okLive {
  background: #e7f7ed;
  color: #126a3b;
}

.warnLive {
  background: #fff4d8;
  color: #8a5a00;
}

.badLive {
  background: #fde8e8;
  color: #9b1c1c;
}

.mutedLive {
  background: #eef1f5;
  color: var(--muted);
}

.details {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.details h2 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: 0;
}

.detailGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.detailBlock h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.detailBlock ul {
  margin: 0;
  padding-left: 18px;
}

.detailBlock li {
  margin: 0 0 6px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

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

  .sync {
    justify-items: start;
    width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .topbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 28px;
  }

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

  .segments {
    width: 100%;
    overflow-x: auto;
  }
}
