:root {
  --bg: #0d0d0f;
  --card-bg: #1a1a1d;
  --card-bg-raised: #212124;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f2f3;
  --text-muted: #9a9aa0;
  --text-faint: #6c6c72;
  --accent: #ffffff;
  --accent-hover: #d9d9db;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.14);
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.14);
  --radius-card: 20px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-lg) 1.5rem calc(var(--space-lg) * 2);
}

.app-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 var(--space-lg);
}

.intro {
  color: var(--text-muted);
  margin: 0 0 var(--space-lg);
}

/* Text input / textarea */
.text-input {
  width: 100%;
  margin-top: var(--space-lg);
  background: var(--card-bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.8rem 1rem;
  resize: vertical;
}

.text-input::placeholder {
  color: var(--text-faint);
}

.text-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-error {
  display: block;
  color: var(--danger);
  margin-top: var(--space-sm);
  font-size: 0.88rem;
}

/* Filter cards: bordered row with a checkbox indicator, Chakra checkbox-card style */
.filter-card-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-sm);
}

.filter-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  width: auto;
  min-height: 44px;
  padding: 0.6rem 1.25rem;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.filter-card-label {
  font-weight: 500;
}

.filter-card-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  color: transparent;
  background: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}


.filter-card[aria-pressed="true"] .filter-card-checkbox {
  background: #ffffff;
  border-color: #ffffff;
  color: #0d0d0f;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: #ffffff;
  color: #0d0d0f;
}

.btn-primary:hover {
  background: #e4e4e5;
}

.btn-primary:disabled {
  background: #3a3a3f;
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--card-bg-raised);
}

.btn-block {
  display: flex;
  width: 100%;
  margin-top: var(--space-lg);
}

.btn-block[aria-busy="true"] {
  cursor: progress;
}

/* Split button + dropdown */
.split-button {
  display: inline-flex;
}

.split-button .btn-primary:not(.dropdown-toggle) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.split-button details.dropdown {
  position: relative;
}

.dropdown-toggle {
  height: 100%;
  padding: 0.75rem 0.9rem;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  list-style: none;
}

.dropdown-toggle::-webkit-details-marker {
  display: none;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 12rem;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: var(--card-bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.dropdown-menu li + li {
  margin-top: 0.15rem;
}

.dropdown-menu a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: calc(var(--radius-control) - 4px);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

/* Loading screen */
#loadingScreen {
  min-height: 55vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.progress-track {
  width: 16rem;
  height: 0.4rem;
  background: var(--card-bg-raised);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {

  .spinner,
  .progress-fill {
    animation: none;
    transition: none;
  }
}

/* Results screen */
#resultsHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.results-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

#resultsActions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.results-table-card {
  overflow-x: auto;
}

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

table.results-table th {
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

table.results-table td {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.results-table tr:last-child td {
  border-bottom: none;
}

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.status-pill.blocked {
  background: var(--danger-bg);
  color: var(--danger);
}

.status-pill.unblocked {
  background: var(--success-bg);
  color: var(--success);
}

.status-pill.unknown,
.status-pill.error,
.status-pill.not-checked {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.category-desc {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Error banner */
.error-banner {
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: var(--text);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-control);
  margin-bottom: var(--space-md);
  font-size: 0.92rem;
}
