:root {
  color-scheme: light;
  --accent: #fdae27;
  --accent-strong: #de8500;
  --accent-soft: rgba(253, 174, 39, 0.14);
  --ink: #17202b;
  --muted: #626b76;
  --page: #f5f6f8;
  --panel: #ffffff;
  --surface: #f2f4f7;
  --surface-strong: #e5e7eb;
  --line: #d0d5dd;
  --line-soft: #e5e7eb;
  --white: #ffffff;
  --link: #235f9f;
  --danger: #9f1d20;
  --success: #13795b;
  --warning: #916400;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--page);
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand,
.topbar-actions,
.action-row,
.toolbar-actions,
.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  gap: 12px;
}

.brand-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex: 0 0 auto;
}

.brand h1,
.panel-heading h2,
.results-heading h2,
.detail-title {
  margin: 0;
  line-height: 1.15;
}

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

.brand p,
.panel-heading p,
.results-heading p,
.check-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.check-item .check-evidence {
  color: var(--ink);
  font-weight: 600;
}

.workspace {
  width: min(1600px, calc(100% - 36px));
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 18px;
  margin: 18px auto 56px;
}

.input-panel,
.results-panel,
.detail-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.input-panel {
  padding: 18px;
}

.panel-heading,
.panel-actions,
.results-toolbar,
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h2,
.results-heading h2 {
  font-size: 15px;
}

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

.field {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.field-name,
.field-phone,
.field-website {
  grid-column: span 4;
}

.field-address,
.field-description {
  grid-column: span 6;
}

.field-aliases {
  grid-column: 1 / -1;
}

.field-render {
  display: none;
  grid-column: span 4;
}

.field-full {
  grid-column: 1 / -1;
}

.field span,
.metrics span,
.detail-section-title,
.schema-grid div:nth-child(odd) {
  color: #4f5964;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
}

input,
select {
  min-height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 42px;
  resize: vertical;
  padding: 10px;
  line-height: 1.45;
}

textarea::placeholder,
input::placeholder {
  color: #89919d;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(253, 174, 39, 0.35);
  outline-offset: 2px;
}

.panel-actions {
  margin-top: 14px;
}

.progress-track {
  height: 3px;
  margin: 14px -18px -18px;
  overflow: hidden;
  background: var(--surface);
}

.progress-track[hidden] {
  display: none;
}

.progress-track div {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.18s ease;
}

.note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(253, 174, 39, 0.38);
  border-radius: 999px;
  background: var(--accent-soft);
  color: #6f4b00;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

button {
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

.primary-button,
.secondary-button,
.icon-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button {
  padding: 0 14px;
  background: var(--ink);
  color: var(--white);
}

.primary-button:not(:disabled):hover {
  background: #263242;
}

.secondary-button,
.icon-button {
  background: var(--surface-strong);
  color: var(--ink);
}

.secondary-button {
  padding: 0 13px;
}

.button-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.secondary-button:not(:disabled):hover,
.icon-button:not(:disabled):hover {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.results-panel {
  position: relative;
}

.results-toolbar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.results-heading {
  display: grid;
  gap: 3px;
}

.toolbar-actions select {
  width: 156px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  border-bottom: 1px solid var(--line);
}

.metrics button {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border-radius: 0;
  border-right: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

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

.metrics button:hover,
.metrics button[aria-pressed="true"] {
  background: var(--panel);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.metrics strong {
  min-width: 0;
  font-size: 20px;
  line-height: 1;
}

.table-wrap {
  min-height: 280px;
  overflow: auto;
  background: var(--white);
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}

th {
  color: #4f5964;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sort-button {
  width: 100%;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  text-transform: inherit;
}

.sort-button::after {
  content: "";
  width: 0;
  height: 0;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  opacity: 0;
}

.sort-button:hover::after,
.sort-button[data-sort-direction="asc"]::after {
  border-bottom: 6px solid currentColor;
  opacity: 0.75;
}

.sort-button[data-sort-direction="desc"]::after {
  border-top: 6px solid currentColor;
  border-bottom: 0;
  opacity: 0.75;
}

td {
  font-size: 13px;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--white);
  box-shadow: 1px 0 0 var(--line-soft);
}

thead th:first-child {
  z-index: 4;
  background: var(--surface);
}

.url-cell {
  width: 300px;
}

.url-link {
  max-width: 100%;
  display: inline;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--link);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.url-link:hover {
  text-decoration: underline;
}

.url-cell span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.badge-button {
  display: inline-flex;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  text-align: left;
}

.badge-button:hover .badge {
  box-shadow: inset 0 0 0 1px currentColor;
}

.badge.match,
.badge.ok,
.badge.rendered {
  background: rgba(19, 121, 91, 0.1);
  color: var(--success);
}

.badge.close,
.badge.redirected {
  background: rgba(253, 174, 39, 0.16);
  color: var(--warning);
}

.badge.ambiguous,
.badge.needs-browser,
.badge.login-required {
  background: rgba(35, 95, 159, 0.1);
  color: var(--link);
}

.badge.mismatch,
.badge.not-found,
.badge.error,
.badge.blocked,
.badge.bot-blocked,
.badge.hosting-error,
.badge.geo-suspected,
.badge.soft-404,
.badge.fetch-failed,
.badge.not-accessible,
.badge.server-error,
.badge.not-html {
  background: rgba(159, 29, 32, 0.08);
  color: var(--danger);
}

.badge.not-provided,
.badge.not-checked {
  background: var(--surface-strong);
  color: var(--muted);
}

.empty-row td {
  padding: 42px 12px;
  color: var(--muted);
  text-align: center;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(560px, 100%);
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
  box-shadow: -20px 0 55px rgba(23, 32, 43, 0.2);
}

.detail-panel[hidden] {
  display: none;
}

.detail-header {
  min-height: 70px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-title {
  max-width: 430px;
  font-size: 16px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

#detailContent {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.check-list {
  display: grid;
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.check-item strong {
  color: #4f5964;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.detail-section {
  margin-top: 16px;
}

.detail-section-first {
  margin-top: 0;
  margin-bottom: 16px;
}

.snippet {
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid rgba(253, 174, 39, 0.38);
  border-radius: 8px;
  background: var(--accent-soft);
  color: #6f4b00;
  font-size: 13px;
  line-height: 1.45;
}

.snippet-hit {
  color: var(--ink);
  font-weight: 800;
}

.schema-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line-soft);
  font-size: 13px;
}

.schema-grid div {
  min-width: 0;
  padding: 9px 10px;
  background: var(--panel);
  overflow-wrap: anywhere;
}

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

  .field-name,
  .field-phone,
  .field-website,
  .field-address,
  .field-description {
    grid-column: span 1;
  }

  .field-aliases,
  .field-render,
  .field-full {
    grid-column: 1 / -1;
  }

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

  .metrics button:nth-child(2) {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .workspace {
    width: calc(100% - 24px);
    gap: 12px;
    margin-top: 12px;
  }

  .input-panel {
    padding: 14px;
  }

  .progress-track {
    margin: 14px -14px -14px;
  }

  .panel-heading,
  .panel-actions,
  .results-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .field-name,
  .field-phone,
  .field-website,
  .field-address,
  .field-description,
  .field-aliases,
  .field-render,
  .field-full {
    grid-column: 1 / -1;
  }

  .metrics button {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .metrics button:last-child {
    border-bottom: 0;
  }

  .action-row,
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .icon-button,
  .toolbar-actions select {
    width: 100%;
  }

  .detail-panel {
    width: 100%;
  }

  .check-item,
  .schema-grid {
    grid-template-columns: 1fr;
  }
}
