:root {
  --page: #f4f6f9;
  --bg: #ffffff;
  --panel: #ffffff;
  --hover: #f1f4f8;
  --border: #e3e7ee;
  --text: #1f2733;
  --muted: #667085;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
}

* {
  box-sizing: border-box;
}

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

/* Focus rings on the search inputs */
.cat-tags:focus-within,
#ort:focus,
.options select:focus,
.pw-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

h1 {
  margin-bottom: 4px;
  font-size: 28px;
}

.subtitle {
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 28px;
}

#search-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

#ort {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.search-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.cat-field {
  position: relative;
  flex: 1 1 260px;
}
#ort {
  flex: 1 1 200px;
}

/* Multi-select category tags */
.cat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 48px;
  cursor: text;
}
#category {
  flex: 1 1 120px;
  min-width: 120px;
  border: none;
  background: transparent;
  padding: 4px;
  font-size: 16px;
  color: var(--text);
  outline: none;
}
#category:disabled {
  cursor: not-allowed;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79, 140, 255, 0.15);
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 6px;
  padding: 3px 6px 3px 9px;
  font-size: 13px;
  white-space: nowrap;
}
.cat-chip button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}
.cat-chip button:hover {
  color: var(--text);
}
.cat-suggestions[hidden] { display: none; }
.cat-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}
.cat-item {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.cat-item:hover,
.cat-item.active {
  background: var(--hover);
}

.fields {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px 14px;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.fields legend {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 6px;
}

.fields label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

.atmos-tag {
  color: #b45309;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
}

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

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.options select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  margin-left: 6px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  transition: background 0.15s ease;
}

button:hover {
  background: var(--accent-hover);
}

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

#status {
  color: var(--muted);
  min-height: 20px;
}

#results-container {
  margin-top: 24px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

#export-button,
#verify-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  font-weight: 500;
}

#export-button:hover,
#verify-button:hover {
  background: var(--hover);
}

.verify-confirm[hidden] {
  display: none;
}

.verify-confirm {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 14px;
}

.verify-confirm span {
  color: var(--text);
  flex: 1;
}

#verify-confirm-yes {
  background: var(--accent);
  color: white;
  padding: 6px 14px;
}

#verify-confirm-yes:hover {
  background: var(--accent-hover);
}

#verify-confirm-no {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
}

#verify-confirm-no:hover {
  background: var(--hover);
}

.verify-status.confirmed {
  color: #059669;
}

.verify-status.warning {
  color: #b45309;
}

.verify-status.pending {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
}

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

td a {
  color: var(--accent);
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

/* 3-step guide */
.steps {
  list-style: none;
  margin: 0 0 24px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
}
.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Field hints */
.field-hint {
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.legend-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}
.results-hint {
  color: var(--muted);
  font-size: 13px;
}

/* Pre-search "no website" filter (in the search form) */
.prefilter {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(79, 140, 255, 0.08);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
}
.prefilter:hover {
  background: rgba(79, 140, 255, 0.14);
}
.prefilter input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.prefilter-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.prefilter-text strong {
  font-size: 15px;
  color: var(--text);
}
.prefilter-text small {
  font-size: 13px;
  color: var(--muted);
}

/* Prominent "no website" filter callout */
.filter-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 16px;
  background: rgba(79, 140, 255, 0.08);
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
}
.filter-callout:hover {
  background: rgba(79, 140, 255, 0.14);
}
.filter-callout input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.filter-callout-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.filter-callout-text strong {
  font-size: 15px;
  color: var(--text);
}
.filter-callout-text small {
  font-size: 13px;
  color: var(--muted);
}

/* Optional verify/AI action row */
.ai-actions[hidden] { display: none; }
.ai-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.ai-actions-hint {
  font-size: 13px;
  color: var(--muted);
}

/* AI (Claude) check */
#ai-button {
  background: transparent;
  border: 1px solid #8b5cf6;
  color: #7c3aed;
  padding: 8px 14px;
  font-weight: 500;
}
#ai-button:hover {
  background: rgba(139, 92, 246, 0.12);
}
#ai-confirm-yes {
  background: #8b5cf6;
  color: white;
  padding: 6px 14px;
}
#ai-confirm-yes:hover {
  background: #7c3aed;
}
#ai-confirm-no {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
}

.ai-status.searching {
  color: #7c3aed;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-status.no-website {
  color: #059669;
}
.ai-status.has-website {
  color: #b45309;
}
.ai-status.error {
  color: #dc2626;
}
.ai-status .reason {
  color: var(--muted);
  font-size: 12px;
}

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(124, 58, 237, 0.25);
  border-top-color: #7c3aed;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.claude-usage .usage-label { color: #7c3aed; }
#claude-cost { color: #7c3aed; font-weight: 600; }
#claude-checks { font-weight: 600; color: var(--text); }

/* Password overlay */
.pw-overlay[hidden] { display: none; }
.pw-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.pw-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 26px;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pw-box h2 { margin: 0; font-size: 20px; }
.pw-box p { margin: 0; color: var(--muted); font-size: 14px; }
.pw-box #pw-msg.error { color: #f2994a; }
.pw-box input {
  padding: 12px 14px;
  font-size: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

/* Usage Bar */
.usage-bar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.usage-bar-inner {}
.usage-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
.usage-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
.usage-sep { color: var(--border); }
#usage-calls { font-weight: 600; color: var(--text); }
#usage-cost { color: var(--accent); font-weight: 600; }
#usage-free { color: #059669; font-weight: 600; }
.usage-track {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.usage-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #4caf7d, #4f8cff);
  transition: width 0.5s ease, background 0.5s ease;
}
.usage-fill.warn { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.usage-limits {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.usage-warn-label {
  color: #f59e0b;
  font-weight: 700;
  font-size: 12px;
}
