:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --bg-soft: #eef5f3;
  --surface: #ffffff;
  --surface-2: #f8fbfa;
  --ink: #172126;
  --muted: #65747b;
  --line: #dce6e4;
  --line-soft: #eef3f2;
  --accent: #0f766e;
  --accent-strong: #0b5e58;
  --accent-soft: #e0f3ef;
  --amber: #b7791f;
  --amber-soft: #fff3d7;
  --red: #b42318;
  --red-soft: #ffe8e5;
  --green: #117a43;
  --green-soft: #e5f7ed;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --shadow: 0 16px 42px rgba(23, 33, 38, 0.07);
  --shadow-soft: 0 8px 24px rgba(23, 33, 38, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--bg-soft) 0, var(--bg) 220px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  padding: 0 16px;
  transition:
    background 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

button:hover {
  background: var(--accent-strong);
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.18);
  transform: translateY(-1px);
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.app-shell {
  min-height: 100vh;
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #123d3a, #0f766e);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.24);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel-title h2 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px 28px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(220, 230, 228, 0.84);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  backdrop-filter: blur(10px);
}

.topbar-controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 28px;
  letter-spacing: 0;
}

.range-control {
  display: inline-grid;
  grid-template-columns: repeat(2, 72px);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.range-button {
  min-height: 40px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  border-right: 1px solid var(--line);
  box-shadow: none;
  padding: 0;
}

.range-button:hover {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

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

.range-button.active {
  background: var(--accent);
  color: #fff;
}

.inline-filter,
.domain-search {
  min-width: 156px;
}

.refresh-control {
  display: grid;
  gap: 6px;
  min-width: 168px;
}

.refresh-button {
  width: 100%;
}

.refresh-button.is-loading {
  cursor: wait;
  opacity: 0.76;
}

#refresh-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  min-height: 16px;
  text-align: right;
}

.domain-search {
  width: min(320px, 42vw);
}

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

.metric-card,
.panel,
.table-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  min-height: 116px;
  overflow: hidden;
  padding: 18px 18px 16px;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.metric-primary::before {
  background: var(--blue);
}

.metric-neutral::before {
  background: #64748b;
}

.metric-success::before {
  background: var(--green);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 16px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.metric-primary::after {
  background: var(--blue-soft);
}

.metric-neutral::after {
  background: var(--line-soft);
}

.metric-success::after {
  background: var(--green-soft);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.metric-card strong {
  display: block;
  margin-top: 16px;
  font-size: 34px;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel,
.table-panel {
  padding: 20px;
}

.panel.compact {
  box-shadow: none;
}

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

.table-title {
  align-items: end;
}

.panel-title h2 {
  font-size: 17px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.domain-form {
  display: grid;
  gap: 12px;
}

.domain-form {
  grid-template-columns: 1.1fr 1.4fr auto;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hidden {
  display: none;
}

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

table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}

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

th {
  background: var(--surface-2);
  color: #52636b;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

td:nth-child(n + 3) {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: #fbfdfc;
}

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

.empty-state {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench,
  .domain-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-controls,
  .table-title {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .inline-filter,
  .refresh-control,
  .domain-search {
    width: 100%;
  }

  #refresh-status {
    text-align: left;
  }

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

  .range-control {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }
}
