* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Light theme (default DevTools) */
:root {
  --bg: #fff;
  --bg-subtle: #f5f5f5;
  --bg-hover: #eee;
  --text: #1a1a1a;
  --text-dim: #666;
  --accent: oklch(48% 0.25 350);
  --accent-dim: oklch(40% 0.18 350);
  --border: #ddd;
  --radius: 6px;
}

/* Dark theme (set via JS from chrome.devtools.panels.themeName) */
.theme-dark {
  --bg: #1a1a1a;
  --bg-subtle: #242424;
  --bg-hover: #2a2a2a;
  --text: #f5f3ef;
  --text-dim: #999;
  --accent: oklch(55% 0.25 350);
  --accent-dim: oklch(45% 0.18 350);
  --border: #333;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  line-height: 1.5;
  overflow-y: auto;
  height: 100vh;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.logo {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.7;
}

h1 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  display: none;
}

.badge.visible {
  display: inline-block;
}

/* Tool buttons */
.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.tool-btn.inactive {
  opacity: 0.4;
}

/* Findings */
#findings-container {
  padding: 8px;
}

.finding-group {
  margin-bottom: 2px;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.group-header:hover {
  background: var(--bg-hover);
}

.group-chevron {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.15s;
  width: 12px;
  flex-shrink: 0;
}

.group-header.collapsed .group-chevron {
  transform: rotate(-90deg);
}

.group-name {
  font-weight: 600;
  font-size: 12px;
  flex: 1;
  min-width: 0;
}

.group-count {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.group-items {
  overflow: hidden;
}

.group-header.collapsed + .group-items {
  display: none;
}

.finding-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px 5px 28px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.finding-item:hover {
  background: var(--bg-hover);
}

.finding-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.finding-row .finding-selector {
  flex: 1;
  min-width: 0;
}

.finding-copy {
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.finding-item:hover .finding-copy {
  display: flex;
}

.finding-copy:hover {
  background: var(--bg);
  color: var(--accent);
}

.finding-copy.copied {
  color: var(--accent);
}

.tool-btn.copied {
  color: var(--accent);
}

.finding-selector {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finding-detail {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finding-description {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.7;
  line-height: 1.4;
  padding: 2px 0 4px;
  display: none;
}

.finding-item:hover .finding-description {
  display: block;
}

/* Finding tags (page-level, hidden, etc.) */
.finding-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
}

.tag-page {
  color: var(--accent-dim);
  background: transparent;
}

.tag-hidden {
  color: var(--text-dim);
  background: var(--bg-hover);
}

.finding-item.is-hidden {
  opacity: 0.55;
  cursor: default;
}

.finding-item.is-hidden:hover {
  background: transparent;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  font-size: 32px;
  font-weight: 500;
  opacity: 0.3;
  margin-bottom: 12px;
}

.empty-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.empty-hint {
  font-size: 12px;
  color: var(--text-dim);
}

/* Category sections */
.category-section {
  margin-bottom: 4px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 4px;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-dot-slop {
  background: oklch(55% 0.25 350);
}

.category-dot-quality {
  background: var(--text-dim);
}

.category-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.category-count {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

/* Settings */
#settings-container {
  border-bottom: 1px solid var(--border);
  padding: 0 8px 8px;
}

.settings-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 8px 6px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 12px;
  padding-bottom: 8px;
}

#settings-list .settings-header {
  padding: 8px 8px 4px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
  gap: 12px;
}

.setting-label {
  font-size: 11px;
  color: var(--text);
}

.setting-segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.setting-segmented button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: inherit;
  border-right: 1px solid var(--border);
}

.setting-segmented button:last-child {
  border-right: none;
}

.setting-segmented button:hover {
  color: var(--text);
}

.setting-segmented button.active {
  background: var(--accent);
  color: white;
}

.setting-switch {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.setting-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.setting-switch-track {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 8px;
  transition: background 0.15s ease;
}

.setting-switch-track::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--bg);
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.setting-switch input:checked + .setting-switch-track {
  background: var(--accent);
}

.setting-switch input:checked + .setting-switch-track::before {
  transform: translateX(12px);
}

.setting-rule {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}

.setting-rule:hover {
  background: var(--bg-hover);
}

.setting-rule input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
}

/* Scanning state */
.scanning-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  color: var(--text-dim);
  font-size: 12px;
}

.scanning-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
