:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #151923;
  --muted: #667085;
  --line: #d8dee8;
  --sidebar: #111318;
  --accent: #16a36f;
  --accent-weak: #dff7ec;
  --warn: #b7791f;
  --danger: #c2413c;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
select,
input {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 252px;
  background: var(--sidebar);
  color: #f7f9fc;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
  background: #20242d;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #9ba3af;
  margin-top: 2px;
  font-size: 12px;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.sidebar a {
  color: inherit;
  text-decoration: none;
}

.sidebar nav a {
  border-radius: 8px;
  padding: 11px 12px;
  color: #cbd2dc;
}

.sidebar nav a:hover {
  background: #20242d;
  color: #ffffff;
}

.cache-note {
  margin-top: auto;
  padding: 12px;
  border-radius: 8px;
  background: #20242d;
  color: #cbd2dc;
  font-size: 12px;
  line-height: 1.6;
}

.shell {
  margin-left: 252px;
  padding: 28px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

.top-status,
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-status {
  flex-direction: column;
  align-items: flex-end;
}

.timestamp {
  color: var(--muted);
  font-size: 13px;
}

button,
select,
input {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  min-height: 38px;
}

.section {
  margin-bottom: 22px;
}

.panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  padding: 18px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 16px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.segmented button {
  border: 0;
  background: transparent;
  min-height: 32px;
  padding: 7px 12px;
  cursor: pointer;
}

.segmented button.active {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

th {
  color: #475467;
  background: #f9fafb;
  font-weight: 700;
}

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

.muted {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill.ok {
  background: var(--accent-weak);
  color: #087443;
}

.pill.partial {
  background: #fff4d8;
  color: var(--warn);
}

.pill.unsupported,
.pill.error {
  background: #ffe4e2;
  color: var(--danger);
}

.pos {
  color: #087443;
}

.neg {
  color: var(--danger);
}

.split-grid,
.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mini-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.mini-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.stat-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stat-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.stat-list strong {
  color: var(--text);
}

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

.scan-metrics {
  margin-bottom: 14px;
}

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

.source-card h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-card .stat-list strong {
  max-width: 58%;
  text-align: right;
}

.source-description {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.scan-layout {
  align-items: start;
}

.compact-table table {
  min-width: 520px;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.endpoint-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.endpoint-wide {
  grid-column: 1 / -1;
}

.endpoint-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.endpoint-head code {
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.method {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-weak);
  color: #087443;
  font-size: 12px;
  font-weight: 800;
}

.endpoint-panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.endpoint-panel p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.endpoint-panel pre {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #111318;
  color: #eef2f7;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.55;
}

.endpoint-panel code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.policy-grid,
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.flow-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.flow-list li {
  color: var(--muted);
  line-height: 1.55;
}

.flow-list strong,
.flow-list span {
  display: block;
}

.flow-list strong {
  color: var(--text);
  margin-bottom: 2px;
}

.route-list {
  margin-bottom: 12px;
}

.config-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.config-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.config-title h3 {
  margin: 0;
  font-size: 16px;
}

.config-card label,
.settings-strip label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.config-card input,
.config-card select,
.settings-strip input {
  width: 100%;
}

.switch-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  color: var(--text) !important;
  font-weight: 700;
}

.switch-row input {
  width: auto;
  min-height: auto;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.settings-strip label {
  grid-template-columns: 1fr auto;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-soft);
}

.settings-strip input {
  grid-column: 1 / -1;
}

.settings-strip span {
  grid-column: 2;
  grid-row: 1;
  color: var(--text);
  font-weight: 700;
}

.config-table {
  min-width: 980px;
}

.inline-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-input input {
  width: 96px;
}

.inline-input span {
  color: var(--muted);
}

.small-number {
  width: 76px;
}

.source-url {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.about {
  line-height: 1.75;
}

.about p {
  margin: 0 0 10px;
  color: #344054;
}

footer {
  padding: 18px 4px 6px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

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

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

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-status {
    align-items: flex-start;
  }

    .metric-grid,
    .split-grid,
    .diagnostic-grid,
    .source-grid,
    .endpoint-grid,
    .policy-grid,
    .config-grid,
  .settings-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .sidebar nav {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 23px;
  }

  select {
    width: 100%;
  }

  .endpoint-wide {
    grid-column: auto;
  }
}
