/* CP SiteCheck — styles
   Brand: CivicPlus
   Primary red:    #A50019
   Charcoal:       #383838
   Light gray:     #F4F4F4
   White:          #FFFFFF
*/

/* ---- Reset ---- */

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

/* ---- Base ---- */

html {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #F4F4F4;
  color: #383838;
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Header ---- */

.app-header {
  background: #383838;
  color: #fff;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.header-logo {
  height: 28px;
  width: auto;
  display: block;
}

.header-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.header-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}

.header-nav-link:first-of-type {
  margin-left: auto;
}

.header-nav-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.header-nav-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
}

/* ---- App shell (two-panel) ---- */

.app-shell {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 54px);
}

/* ---- Sidebar ---- */

.sidebar {
  width: 288px;
  min-width: 288px;
  background: #fff;
  border-right: 1px solid #e2e2e2;
  flex-shrink: 0;
}

.sidebar-inner {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 54px; /* align with header height */
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #f0f0f0;
}

/* ---- Sidebar form ---- */

.sidebar-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.02em;
}

.optional {
  font-weight: 400;
  color: #aaa;
}

input[type="text"],
input[type="url"] {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  font-size: 0.875rem;
  color: #383838;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}

input[type="text"]:focus,
input[type="url"]:focus {
  outline: none;
  border-color: #A50019;
  background: #fff;
}

.hint {
  font-size: 0.72rem;
  color: #aaa;
  line-height: 1.4;
}

/* ---- Scan type select ---- */

.scan-type-select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  font-size: 0.875rem;
  color: #383838;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}

.scan-type-select:focus {
  outline: none;
  border-color: #A50019;
  background: #fff;
}

/* ---- Category checkboxes ---- */

.categories-fieldset {
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 0.65rem 0.75rem 0.75rem;
}

.categories-fieldset legend {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #999;
  padding: 0 0.2rem;
}

.category-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.875rem;
  color: #383838;
  cursor: pointer;
  user-select: none;
}

.category-check-label input[type="checkbox"] {
  accent-color: #A50019;
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---- Buttons ---- */

.btn-primary {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: #A50019;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
  line-height: 1.4;
}

.btn-primary:hover {
  background: #8a0015;
}

.btn-full {
  width: 100%;
  display: block;
}

.btn-secondary {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  background: #fff;
  color: #A50019;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid #A50019;
  border-radius: 5px;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
  line-height: 1.4;
}

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

/* ---- Sidebar scan meta (scanning + result pages) ---- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-scanning {
  background: #fffbea;
  color: #7a5c00;
  border: 1px solid #f0c040;
}

.status-complete {
  background: #edfbf0;
  color: #1a6b35;
  border: 1px solid #a8ddb8;
}

.meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.meta-item {}

.meta-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #aaa;
  margin-bottom: 0.15rem;
}

.meta-value {
  font-size: 0.85rem;
  color: #383838;
  word-break: break-all;
  line-height: 1.4;
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.15rem;
}

.category-tag {
  display: inline-block;
  background: #f3f3f3;
  color: #555;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 500;
}

/* ---- Main panel ---- */

.main-panel {
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

.main-inner {
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---- Empty state (index.html right panel) ---- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  text-align: center;
  gap: 0.6rem;
  color: #bbb;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ccc;
}

.empty-state-body {
  font-size: 0.875rem;
  color: #bbb;
  max-width: 280px;
  line-height: 1.6;
}

.empty-state-body strong {
  color: #aaa;
}

/* ---- Error box ---- */

.error-box {
  background: #fff3f3;
  border: 1px solid #f5c0c0;
  border-radius: 6px;
  padding: 0.85rem 1rem;
  color: #b02020;
  font-size: 0.875rem;
}

.error-box ul {
  padding-left: 1.1rem;
}

.error-box li + li {
  margin-top: 0.3rem;
}

/* ---- Warning box (duplicate scan) ---- */

.warning-box {
  background: #fffbea;
  border: 1px solid #f0c040;
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  color: #7a5c00;
  font-size: 0.825rem;
  line-height: 1.5;
}

/* ---- Loading / scanning state ---- */

.scan-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 3rem 2rem;
  text-align: center;
  min-height: 320px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e0e0e0;
  border-top-color: #A50019;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.scan-progress-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #383838;
}

.scan-progress-body {
  font-size: 0.875rem;
  color: #777;
  line-height: 1.65;
  max-width: 360px;
}

/* ---- Result cards ---- */

.result-card {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.result-card h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #383838;
}

.scanned-url {
  font-size: 0.8rem;
  color: #777;
  word-break: break-all;
}

.saved-path {
  font-size: 0.75rem;
  color: #aaa;
}

.saved-path code {
  font-size: 0.75rem;
  background: #f3f4f6;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* ---- Score gauges (Lighthouse-style circular) ---- */

.score-gauges {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
}

.gauge-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.gauge-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.gauge-pair {
  display: flex;
  gap: 0.75rem;
}

.gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.gauge-svg {
  width: 72px;
  height: 72px;
}

.gauge-bg {
  fill: none;
  stroke: #eeeeee;
  stroke-width: 8;
}

.gauge-arc {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.gauge-arc.gauge-good { stroke: #0cce6b; }
.gauge-arc.gauge-fair { stroke: #ffa400; }
.gauge-arc.gauge-poor { stroke: #ff4e42; }

.gauge-score {
  font-size: 24px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  fill: #383838;
}

.gauge-label {
  font-size: 0.67rem;
  color: #999;
  font-weight: 500;
  text-align: center;
}

/* ---- Filter buttons (issues table) ---- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0 0.25rem;
}

.filter-btn {
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid #d0d0d0;
  border-radius: 20px;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  line-height: 1.5;
}

.filter-btn:hover {
  border-color: #A50019;
  color: #A50019;
}

.filter-btn.active {
  background: #A50019;
  color: #fff;
  border-color: #A50019;
}

/* ---- Screenshot thumbnail ---- */

.screenshot-wrapper {
  margin-top: 0.25rem;
}

.screenshot-thumb {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  object-position: top;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  cursor: zoom-in;
  transition: opacity 0.15s;
  display: block;
}

.screenshot-thumb:hover {
  opacity: 0.88;
}

/* ---- Issues section ---- */

.issues-section {
  margin-top: 0.25rem;
}

.issues-summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #383838;
  padding: 0.35rem 0;
  list-style: none;
  user-select: none;
}

.issues-summary::-webkit-details-marker {
  display: none;
}

.issues-summary::before {
  content: "\25B6\00A0";
  font-size: 0.65rem;
  color: #999;
  display: inline-block;
  transition: transform 0.15s;
}

details[open] .issues-summary::before {
  transform: rotate(90deg);
}

.issues-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

.issues-table th {
  text-align: left;
  padding: 0.45rem 0.7rem;
  background: #f5f5f5;
  border-bottom: 2px solid #e2e2e2;
  font-size: 0.72rem;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.issues-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #f2f2f2;
  vertical-align: top;
}

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

.issues-table tbody tr:hover td {
  background: #fafafa;
}

.issue-title {
  font-weight: 600;
  color: #383838;
  display: block;
}

.issue-desc {
  margin-top: 0.2rem;
  color: #777;
  font-size: 0.77rem;
  line-height: 1.5;
}

.category-cell {
  width: 110px;
  min-width: 90px;
}

.wcag-cell {
  width: 150px;
  min-width: 110px;
}

.wcag-tag {
  display: inline-block;
  background: #eef2ff;
  color: #3558e8;
  border: 1px solid #c7d2fe;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  font-size: 0.72rem;
  font-family: monospace;
  margin: 0.1rem 0.1rem 0.1rem 0;
  white-space: nowrap;
}

.found-on-cell {
  white-space: nowrap;
  color: #666;
  width: 130px;
  min-width: 100px;
}

.no-issues {
  font-size: 0.875rem;
  color: #2a7a4a;
  font-weight: 500;
  padding: 0.25rem 0;
}

/* ---- Success box ---- */

.success-box {
  background: #edfbf0;
  border: 1px solid #a8ddb8;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: #1a6b35;
  font-size: 0.825rem;
}

/* ---- Output settings (sidebar collapsible) ---- */

.settings-details {
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  overflow: hidden;
}

.settings-summary {
  cursor: pointer;
  padding: 0.6rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #999;
  list-style: none;
  user-select: none;
  background: #fafafa;
}

.settings-summary::-webkit-details-marker { display: none; }

.settings-summary::before {
  content: "\25B6\00A0";
  font-size: 0.6rem;
  color: #ccc;
  display: inline-block;
  transition: transform 0.15s;
}

details[open].settings-details .settings-summary::before {
  transform: rotate(90deg);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem;
  border-top: 1px solid #f0f0f0;
}

/* ---- Modal ---- */

body.modal-open {
  overflow: hidden;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal.visible {
  display: flex;
}

.modal-inner {
  position: relative;
  background: #fff;
  border-radius: 8px;
  max-width: 95vw;
  max-height: 90vh;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal-close {
  align-self: flex-end;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #666;
  padding: 0.2rem 0.45rem;
  line-height: 1;
}

.modal-close:hover {
  color: #383838;
}

.modal-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #383838;
}

.modal-inner img {
  max-width: 100%;
  border-radius: 4px;
  display: block;
}

/* ---- Resolved checkbox (issues table) ---- */

.resolved-col-header {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.resolved-cell {
  text-align: center;
  width: 44px;
  min-width: 44px;
}

.resolved-checkbox {
  accent-color: #0cce6b;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.resolved-row td {
  opacity: 0.45;
}

.resolved-row td.resolved-cell {
  opacity: 1;
}

/* ---- Responsibility cell ---- */

.responsibility-cell {
  white-space: nowrap;
}

/* ---- Ask AI button (issues table) ---- */

.ask-ai-cell {
  width: 72px;
  min-width: 60px;
  white-space: nowrap;
}

.ask-ai-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: #fff;
  color: #A50019;
  border: 1px solid #A50019;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.ask-ai-btn:hover {
  background: #A50019;
  color: #fff;
}

/* ---- Chat toggle button (sidebar) ---- */

.chat-toggle-btn {
  display: block;
  width: 100%;
  padding: 0.55rem 1.1rem;
  background: #fff;
  color: #383838;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.chat-toggle-btn:hover {
  border-color: #383838;
  background: #f5f5f5;
}

.chat-toggle-btn.active {
  background: #383838;
  color: #fff;
  border-color: #383838;
}

/* ---- Chat overlay ---- */

.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 800;
}

.chat-overlay.active {
  display: block;
}

/* ---- Chat panel (right-side drawer) ---- */

.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 92vw;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.chat-panel.open {
  transform: translateX(0);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 54px;
  background: #383838;
  color: #fff;
  flex-shrink: 0;
}

.chat-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chat-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
}

.chat-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #F4F4F4;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message {
  display: flex;
}

.chat-message-user {
  justify-content: flex-end;
}

.chat-message-assistant {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  font-size: 0.83rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message-user .chat-bubble {
  background: #383838;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.chat-message-assistant .chat-bubble {
  background: #fff;
  color: #383838;
  border: 1px solid #e2e2e2;
  border-bottom-left-radius: 3px;
}

/* Typing indicator dots */

.chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.65rem 0.85rem;
}

.chat-typing-indicator span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aaa;
  animation: chat-dot-bounce 1.1s infinite ease-in-out both;
}

.chat-typing-indicator span:nth-child(1) { animation-delay: 0s; }
.chat-typing-indicator span:nth-child(2) { animation-delay: 0.18s; }
.chat-typing-indicator span:nth-child(3) { animation-delay: 0.36s; }

@keyframes chat-dot-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%            { transform: scale(1);   opacity: 1;   }
}

/* Chat input row */

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #e2e2e2;
  background: #fff;
  flex-shrink: 0;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #383838;
  background: #fafafa;
  resize: none;
  line-height: 1.45;
  transition: border-color 0.15s, background 0.15s;
}

.chat-input:focus {
  outline: none;
  border-color: #383838;
  background: #fff;
}

.chat-input:disabled {
  opacity: 0.55;
}

.chat-send-btn {
  padding: 0.5rem 1rem;
  background: #A50019;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  align-self: flex-end;
}

.chat-send-btn:hover {
  background: #8a0015;
}

.chat-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- WCAG badge (issues table) ---- */

.wcag-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  background-color: #e8f0fe;
  color: #1a3c6e;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.4;
}

.wcag-badge-criterion {
  font-weight: 600;
}

.wcag-badge-level {
  font-size: 11px;
  opacity: 0.85;
}

/* ---- Analyze All Accessibility Issues button ---- */

.analyze-all-btn {
  display: inline-block;
  margin-bottom: 12px;
  padding: 9px 18px;
  background-color: #ffffff;
  color: #A50019;
  border: 2px solid #A50019;
  border-radius: 4px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.analyze-all-btn:hover {
  background-color: #A50019;
  color: #ffffff;
}

.analyze-all-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- History groups ---- */

.history-list {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  overflow: hidden;
}

.history-group {
  border-bottom: 1px solid #e2e2e2;
}

.history-group:last-child {
  border-bottom: none;
}

.history-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: #fff;
  transition: background 0.1s;
}

.history-group-header::-webkit-details-marker {
  display: none;
}

.history-group-header:hover {
  background: #fafafa;
}

.history-group-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #383838;
}

.history-group-name::before {
  content: "\25B6\00A0";
  font-size: 0.6rem;
  color: #999;
  display: inline-block;
  transition: transform 0.15s;
}

details[open] .history-group-name::before {
  transform: rotate(90deg);
}

.history-group-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: #999;
}

/* ---- History table ---- */

.history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.83rem;
  border-top: 1px solid #f0f0f0;
}

.history-table th {
  text-align: left;
  padding: 0.6rem 0.85rem;
  background: #f5f5f5;
  border-bottom: 2px solid #e2e2e2;
  font-size: 0.72rem;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.history-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #f2f2f2;
  vertical-align: middle;
}

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

.history-table tbody tr:hover td {
  background: #fafafa;
}

.history-client {
  font-weight: 600;
  color: #383838;
  white-space: nowrap;
}

.history-date {
  white-space: nowrap;
  color: #666;
}

.history-time {
  display: block;
  font-size: 0.72rem;
  color: #aaa;
}

.history-url {
  color: #777;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.history-issues {
  white-space: nowrap;
  font-weight: 600;
}

.resolved-count {
  color: #1a6b35;
}

.history-scores {
  white-space: nowrap;
}

.score-pill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 0.2rem;
}

.score-pill.score-good {
  background: #e6f9ed;
  color: #1a6b35;
}

.score-pill.score-fair {
  background: #fff7e0;
  color: #7a5c00;
}

.score-pill.score-poor {
  background: #fff0f0;
  color: #b02020;
}

.history-view-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: #A50019;
  text-decoration: none;
}

.history-actions {
  white-space: nowrap;
}

.history-view-link:hover {
  text-decoration: underline;
}

.history-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.15rem 0.35rem;
  margin-left: 0.4rem;
  opacity: 0.35;
  transition: opacity 0.15s;
  vertical-align: middle;
}

.history-delete-btn:hover {
  opacity: 1;
}

.history-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.history-search {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  font-size: 0.875rem;
  color: #383838;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s;
}

.history-search:focus {
  outline: none;
  border-color: #A50019;
  background: #fff;
}

.history-type-filter {
  padding: 0.55rem 0.75rem;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  font-size: 0.875rem;
  color: #383838;
  background: #fafafa;
  min-width: 140px;
}

.history-type-filter:focus {
  outline: none;
  border-color: #A50019;
  background: #fff;
}

.history-type {
  white-space: nowrap;
  color: #666;
  font-size: 0.78rem;
}

.history-no-results {
  padding: 2rem 1rem;
  text-align: center;
  color: #aaa;
  font-size: 0.85rem;
  display: none;
}
