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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  color: #1a1a1a;
  background: #fff;
  width: 320px;
  min-width: 280px;
  max-height: 560px;
  overflow-y: auto;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #e5e7eb;
}

.title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
}

/* ── Stats ──────────────────────────────────────────────── */
.stats {
  padding: 8px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  line-height: 1.8;
}

.stat-label {
  color: #6b7280;
}

.stat-value {
  font-weight: 500;
}

.dupe-label {
  color: #dc2626;
}

.dupe-value {
  color: #dc2626;
  font-weight: 600;
}

/* ── Preview ────────────────────────────────────────────── */
.section-title {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
}

#preview-container {
  padding: 0 14px 4px;
}

.category-section {
  margin-bottom: 8px;
}

.category-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  padding: 4px 0 2px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 2px;
}

/* Coloured dots matching Chrome tab group colours */
.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cat-dot-Code    { background: #1a73e8; } /* Chrome "blue"   */
.cat-dot-Ops     { background: #e8710a; } /* Chrome "orange" */
.cat-dot-Comms   { background: #188038; } /* Chrome "green"  */
.cat-dot-Product { background: #007b83; } /* Chrome "cyan"   */
.cat-dot-Docs    { background: #8430ce; } /* Chrome "purple" */
.cat-dot-Other   { background: #80868b; } /* Chrome "grey"   */

.tab-list {
  padding-left: 4px;
}

.tab-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  min-height: 20px;
}

.favicon {
  flex-shrink: 0;
  border-radius: 2px;
  opacity: 0.85;
}

.tab-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #374151;
  font-size: 12px;
}

.tab-row.duplicate .tab-label {
  text-decoration: line-through;
  color: #dc2626;
  opacity: 0.7;
}

.dupe-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  color: #dc2626;
  background: #fee2e2;
  border-radius: 3px;
  padding: 0 4px;
  line-height: 16px;
}

.toggle-btn {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 11px;
  cursor: pointer;
  padding: 1px 4px;
  margin-top: 1px;
  border-radius: 3px;
}

.toggle-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ── Error ──────────────────────────────────────────────── */
.error-msg {
  margin: 4px 14px;
  padding: 6px 8px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 4px;
  font-size: 11px;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  position: sticky;
  bottom: 0;
}

.btn {
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s;
}

.btn-secondary {
  background: #fff;
  border-color: #d1d5db;
  color: #374151;
}

.btn-secondary:hover {
  background: #f3f4f6;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}
