:root {
  color-scheme: light;
  --bg: #f4f2ea;
  --bg-secondary: #fffdf8;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --border: rgba(20, 32, 48, 0.1);
  --border-strong: rgba(20, 32, 48, 0.18);
  --text: #142030;
  --muted: #687689;
  --accent: #0e8f84;
  --accent-soft: rgba(14, 143, 132, 0.12);
  --warn: #e48a16;
  --warn-soft: rgba(228, 138, 22, 0.12);
  --danger: #d04a45;
  --danger-soft: rgba(208, 74, 69, 0.12);
  --ok: #0d9a59;
  --ok-soft: rgba(13, 154, 89, 0.12);
  --ai: #6f3cff;
  --ai-soft: rgba(111, 60, 255, 0.12);
  --bank: #1e63d2;
  --bank-soft: rgba(30, 99, 210, 0.12);
  --crypto: #f26d21;
  --crypto-soft: rgba(242, 109, 33, 0.12);
  --asia: #0b8f67;
  --asia-soft: rgba(11, 143, 103, 0.12);
  --global: #3848b5;
  --global-soft: rgba(56, 72, 181, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 24px 60px rgba(25, 35, 58, 0.08);
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Sora", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(14, 143, 132, 0.1), transparent 30%),
    radial-gradient(circle at 85% 12%, rgba(111, 60, 255, 0.08), transparent 26%),
    linear-gradient(180deg, #f8f6ef 0%, #f2efe7 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 32, 48, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 48, 0.025) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 92%);
}

code,
select,
textarea,
button,
.count-pill,
.summary-note,
.status-badge,
.run-stamp,
.cell-subline,
.trace-subline,
.geo-subline,
.website-subline,
.distribution-meta,
.distribution-foot {
  font-family: var(--mono);
}

.page-shell {
  width: min(1640px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(360px, 0.9fr);
  gap: 24px;
  padding: 30px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(111, 60, 255, 0.08), transparent 24%),
    radial-gradient(circle at bottom left, rgba(14, 143, 132, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 252, 244, 0.92));
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--warn);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar h1,
.panel-heading h2 {
  margin: 0;
  letter-spacing: -0.05em;
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.02;
}

.topbar-text {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.topbar-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  justify-content: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.82rem;
}

.status-badge--idle {
  background: rgba(20, 32, 48, 0.06);
  color: var(--muted);
  border-color: var(--border);
}

.status-badge--running {
  background: var(--warn-soft);
  color: #8a560c;
  border-color: rgba(228, 138, 22, 0.2);
}

.status-badge--done {
  background: var(--ok-soft);
  color: #0b6d3f;
  border-color: rgba(13, 154, 89, 0.18);
}

.status-badge--error {
  background: var(--danger-soft);
  color: #9f2f2a;
  border-color: rgba(208, 74, 69, 0.2);
}

.run-stamp {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-button {
  background: linear-gradient(135deg, #0f9b8d 0%, #2ab79f 100%);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(14, 143, 132, 0.18);
}

.secondary-button {
  background: rgba(20, 32, 48, 0.06);
  border-color: var(--border);
  color: var(--text);
}

.ghost-button {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--muted);
}

.dashboard {
  display: grid;
  gap: 18px;
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 18%);
}

.panel-heading {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(20, 32, 48, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
}

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

.summary-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(20, 32, 48, 0.08);
  background: linear-gradient(180deg, #fffef9, #ffffff);
}

.summary-card:first-child {
  background:
    radial-gradient(circle at top right, rgba(14, 143, 132, 0.12), transparent 35%),
    linear-gradient(180deg, #fffef9, #ffffff);
}

.summary-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.5rem, 2vw, 2.3rem);
}

.summary-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.8rem;
}

.empty-state {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  padding: 20px;
  border: 1px dashed rgba(20, 32, 48, 0.14);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.distribution-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.distribution-card {
  position: relative;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(20, 32, 48, 0.08);
  background: linear-gradient(180deg, #fffef9, #ffffff);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.distribution-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 5px;
  background: linear-gradient(180deg, #0e8f84 0%, #6f3cff 100%);
}

.distribution-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(25, 35, 58, 0.08);
}

.distribution-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.distribution-kicker {
  color: var(--muted);
  font-size: 0.8rem;
}

.distribution-ip {
  margin-top: 8px;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.distribution-meta,
.distribution-foot {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.distribution-bar {
  margin-top: 14px;
  height: 10px;
  border-radius: 999px;
  background: rgba(20, 32, 48, 0.08);
  overflow: hidden;
}

.distribution-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0e8f84 0%, #6f3cff 100%);
}

.table-wrap {
  position: relative;
  z-index: 1;
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1280px;
}

.results-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 16px 18px;
  text-align: left;
  font-size: 0.84rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #fbfaf5;
  border-bottom: 1px solid var(--border-strong);
}

.results-table thead th:first-child {
  left: 0;
  z-index: 4;
}

.result-row td {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(20, 32, 48, 0.08);
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.66);
}

.results-table tbody tr:nth-child(even) td {
  background: rgba(252, 250, 244, 0.92);
}

.result-row:hover td {
  background: rgba(255, 255, 255, 0.92);
}

.result-row td:first-child,
.results-table thead th:first-child {
  position: sticky;
  left: 0;
  background-clip: padding-box;
}

.result-row td:first-child {
  z-index: 2;
  box-shadow: 14px 0 22px -22px rgba(20, 32, 48, 0.18);
}

.website-cell,
.ip-cell,
.geo-cell,
.trace-cell {
  display: flex;
  gap: 12px;
  align-items: center;
}

.website-meta,
.geo-cell,
.trace-cell {
  min-width: 0;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 8px;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.tone-ai {
  color: var(--ai);
  background: var(--ai-soft);
}

.tone-asia {
  color: var(--asia);
  background: var(--asia-soft);
}

.tone-bank {
  color: var(--bank);
  background: var(--bank-soft);
}

.tone-crypto {
  color: var(--crypto);
  background: var(--crypto-soft);
}

.tone-global {
  color: var(--global);
  background: var(--global-soft);
}

.website-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.website-name {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.02rem;
}

.website-subline,
.cell-subline,
.geo-subline,
.trace-subline,
.muted-cell {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.74rem;
}

.tag-default {
  color: var(--muted);
  background: rgba(20, 32, 48, 0.06);
  border-color: rgba(20, 32, 48, 0.08);
}

.tag-domestic {
  color: var(--bank);
  background: rgba(30, 99, 210, 0.1);
  border-color: rgba(30, 99, 210, 0.14);
}

.tag-ai {
  color: var(--ai);
  background: var(--ai-soft);
  border-color: rgba(111, 60, 255, 0.16);
}

.tag-bank {
  color: var(--bank);
  background: var(--bank-soft);
  border-color: rgba(30, 99, 210, 0.16);
}

.tag-crypto {
  color: var(--crypto);
  background: var(--crypto-soft);
  border-color: rgba(242, 109, 33, 0.16);
}

.tag-watch {
  color: #8a560c;
  background: var(--warn-soft);
  border-color: rgba(228, 138, 22, 0.18);
}

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.state-pill--pending {
  color: #8a560c;
  background: var(--warn-soft);
}

.state-pill--fail {
  color: #9f2f2a;
  background: var(--danger-soft);
}

.flag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(20, 32, 48, 0.04);
  font-size: 1.2rem;
}

.mono-line {
  font-family: var(--mono);
  font-size: 1rem;
}

.geo-title,
.trace-title {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.5;
}

.geo-cell,
.trace-cell {
  align-items: flex-start;
}

.row-pending td {
  background: rgba(255, 252, 244, 0.8);
}

.row-fail td {
  background: rgba(255, 245, 244, 0.82);
}

.control-form {
  position: relative;
  z-index: 1;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field--stacked {
  margin-top: 16px;
}

.field-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.toggle-field {
  justify-content: space-between;
  min-height: 84px;
  padding: 16px;
  border: 1px solid rgba(20, 32, 48, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.7);
}

select,
textarea,
input[type="checkbox"] {
  font: inherit;
}

select,
textarea {
  width: 100%;
  border: 1px solid rgba(20, 32, 48, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
}

select {
  min-height: 50px;
  padding: 0 14px;
}

textarea {
  min-height: 180px;
  resize: vertical;
  padding: 14px;
  line-height: 1.65;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.hint,
.footer {
  color: var(--muted);
  line-height: 1.65;
}

.hint {
  margin: 14px 0 0;
}

.form-errors {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  border: 1px solid rgba(208, 74, 69, 0.18);
  color: #9f2f2a;
  line-height: 1.6;
}

.footer {
  padding: 18px 4px 0;
  font-size: 0.9rem;
}

@media (max-width: 1100px) {
  .topbar,
  .summary-strip,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: relative;
    top: 0;
  }

  .page-shell {
    width: min(100% - 20px, 1640px);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 18px;
  }

  .topbar,
  .panel {
    padding: 18px;
  }

  .topbar {
    position: relative;
    top: 0;
  }

  .panel-heading,
  .distribution-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .button-row {
    width: 100%;
  }

  button {
    width: 100%;
  }

  .result-row td:first-child,
  .results-table thead th:first-child {
    position: static;
    box-shadow: none;
  }
}
