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

/* Geist, self-hosted (public/fonts, SIL Open Font License) and preloaded by
   AppLayout. `optional`: a preloaded font that is ready within ~100ms is used
   from the first paint; one that isn't (a cold first visit) leaves that page
   in the fallback font instead of swapping mid-view and shifting the layout. */
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
}

/* Every page is a separate document. Cross-fade between them instead of
   flashing white (Chrome/Edge, Safari 18.2+; others just navigate), and keep
   the scrollbar's space reserved so short and long pages are the same width. */
@view-transition {
  navigation: auto;
}

::view-transition-group(*) {
  animation-duration: 150ms;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
}

html {
  scrollbar-gutter: stable;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f5f6fa;
  color: #2c3e50;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.app-footer {
  margin-top: 48px;
  padding: 20px 0 28px;
  border-top: 1px solid #e2e8f0;
  font-size: 12px;
  color: #718096;
}

.app-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.app-footer a {
  color: #718096;
  text-decoration: none;
}

.app-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

@media (max-width: 640px) {
  .app-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

.app-footer a:hover {
  color: #2c3e50;
}

.app-header {
  background-color: #fff;
  margin-bottom: 24px;
  /* Its own snapshot in page transitions, so it stays put while the content
     cross-fades. view-transition-name makes the header a stacking context;
     the z-index keeps its dropdowns above the page content. */
  view-transition-name: app-header;
  position: relative;
  z-index: 30;
}

/* Reserve room for the page's content while its scripts load it, so the
   footer doesn't jump up and back down on every navigation. */
body > main {
  min-height: 60vh;
}

.app-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.2;
}

/* Row 1: brand + perspective tabs + auth */
.app-header-bar {
  border-bottom: 1px solid #e6e8eb;
}

.app-header-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
}

.app-header-bar-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #1a202c;
  text-decoration: none;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1a202c;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Perspective tabs with count badges, merged into the brand row */
.perspective-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.perspective-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #718096;
  text-decoration: none;
  padding: 14px 14px;
  position: relative;
  line-height: 1.2;
  transition: color 0.12s;
}

.perspective-tab:first-child {
  padding-left: 0;
}

.perspective-tab:hover {
  color: #2c3e50;
}

.perspective-tab.active {
  color: #1a202c;
}

.perspective-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #1a202c;
  border-radius: 1px;
}

.perspective-tab:first-child.active::after {
  left: 0;
  right: 0;
}

.perspective-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #edf2f7;
  color: #4a5568;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.perspective-tab.active .perspective-tab-count {
  background: #e0e7ff;
  color: #312e81;
}

.perspective-tab-count[hidden] {
  display: none;
}

/* Row 3: page title + List/Stats subnav */
.app-header-title {
  background: #fafbfc;
  border-bottom: 1px solid #e6e8eb;
}

.app-header-title-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.subnav-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Shown by navbar.js only when the company's actionsEnabled setting is on. */
[data-requires-actions][hidden] {
  display: none;
}

.subnav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #718096;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.subnav-tab-icon {
  flex-shrink: 0;
}

/* Settings "Teach AI": a subnav tab that opens a small menu of pages. */
.subnav-menu {
  position: relative;
}

button.subnav-tab {
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.subnav-menu-chevron {
  flex-shrink: 0;
  transition: transform 0.12s;
}

.subnav-menu button[aria-expanded="true"] .subnav-menu-chevron {
  transform: rotate(180deg);
}

.subnav-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  z-index: 20;
}

.subnav-menu-list[hidden] {
  display: none;
}

.subnav-menu-item {
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: #2d3748;
  text-decoration: none;
  white-space: nowrap;
}

.subnav-menu-item:hover,
.subnav-menu-item:focus-visible {
  background: #f5f6fa;
  outline: none;
}

.subnav-menu-item.active {
  background: #edf2f7;
  color: #1a202c;
  font-weight: 600;
}

.subnav-tab:hover {
  color: #2c3e50;
}

.subnav-tab.active {
  background: #fff;
  color: #1a202c;
  border-color: #d8dde3;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.header-nav-link {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  text-decoration: none;
}

.header-nav-link:hover {
  background: #f1f3f5;
  color: #1a202c;
}

.header-nav-link.active {
  background: #2c3e50;
  color: #fff;
}

.auth-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
}

/* Keep the avatar's space while auth.js is still filling the slot, so the
   header doesn't shift when it appears. */
.auth-slot:empty {
  min-width: 32px;
  min-height: 32px;
}

.auth-menu {
  position: relative;
}

.auth-avatar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
}

.auth-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2c3e50;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.auth-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-avatar-btn:hover .auth-avatar {
  box-shadow: 0 0 0 2px #cbd5e0;
}

.auth-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 4px;
  z-index: 20;
}

.auth-menu-dropdown.hidden {
  display: none;
}

.auth-menu-email {
  padding: 8px 10px 6px;
  font-size: 12px;
  color: #718096;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid #edf2f7;
  margin-bottom: 4px;
}

.auth-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #2d3748;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: inherit;
}

.auth-menu-item:hover {
  background: #f5f6fa;
}

.chart-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 40px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  height: 440px;
}

.chart-card-pie {
  height: 560px;
}

.stats-section-title {
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  margin: 0 0 16px;
}

.stats-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-range-label {
  font-size: 13px;
  color: #4a5568;
  font-weight: 500;
}

.stats-range-select {
  width: auto;
  min-width: 180px;
  margin-bottom: 0;
}

.stats-pie-date {
  width: auto;
  min-width: 160px;
  margin-bottom: 0;
}

.stats-controls .filter-refresh {
  margin-left: auto;
}

.subtitle {
  color: #718096;
  margin-top: 4px;
  font-size: 14px;
}

.filter-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.date-input {
  background: #fff;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #2c3e50;
}

.date-input:focus {
  outline: 2px solid #2c3e50;
  outline-offset: 1px;
}

.date-separator {
  color: #a0aec0;
  font-size: 16px;
}

.filter-select {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #2c3e50;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23718096' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  margin-bottom: 12px;
}

.filter-select:focus {
  outline: 2px solid #2c3e50;
  outline-offset: 1px;
}

.filter-clear {
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  font-size: 13px;
  color: #718096;
  font-family: inherit;
}

.filter-clear:hover:not(:disabled) {
  color: #2c3e50;
}

.filter-clear:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.filter-refresh {
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  margin-left: 12px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.filter-refresh:hover {
  background: #1a202c;
}

.issues-layout,
.clusters-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 40px;
}

.clusters-layout {
  grid-template-columns: var(--sidebar-width, 390px) 1fr;
}

.clusters-layout .sidebar {
  position: sticky;
  top: 16px;
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -12px;
  bottom: 0;
  width: 12px;
  cursor: col-resize;
  z-index: 5;
  touch-action: none;
}

.sidebar-resize-handle::before {
  content: "";
  display: block;
  width: 2px;
  height: 100%;
  margin: 0 auto;
  background: transparent;
  border-radius: 2px;
  transition: background-color 0.15s;
}

.sidebar-resize-handle:hover::before,
body.sidebar-resizing .sidebar-resize-handle::before {
  background: #2c3e50;
}

body.sidebar-resizing,
body.sidebar-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.sidebar {
  background: #fff;
  border-radius: 10px;
  padding: 16px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 16px;
}

.sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #718096;
  padding: 4px 12px 2px;
}

.sidebar-heading-lenses {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  color: #4a5568;
}

.sidebar-heading-icon {
  flex-shrink: 0;
  color: #718096;
}

.sidebar-subheading {
  font-size: 12px;
  line-height: 1.4;
  color: #94a3b8;
  padding: 0 12px;
  margin: 0 0 16px;
}

.sidebar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.sidebar-footer-divider {
  border: 0;
  border-top: 1px solid #edf2f7;
  margin: 8px 4px 10px;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  text-align: left;
  padding: 6px 12px;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
}

.sidebar-footer-link:hover {
  color: #2d3748;
}

.sidebar-footer-icon {
  flex-shrink: 0;
}

.sidebar-help-text {
  font-size: 12px;
  line-height: 1.5;
  color: #718096;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 6px 12px 0;
}

.sidebar-item {
  display: block;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #2d3748;
  line-height: 1.35;
  transition: background-color 0.12s;
}

.sidebar-item:hover {
  background: #f5f6fa;
}

.sidebar-item.active {
  background: #f3d98b;
  color: #1a202c;
  font-weight: 700;
}

.sidebar-item .sidebar-label {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.sidebar-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.range-group {
  display: inline-flex;
  align-items: center;
  background: #f5f6fa;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.range-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #718096;
  cursor: pointer;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.range-btn:hover {
  color: #2c3e50;
}

.range-btn.active {
  background: #fff;
  color: #1a202c;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.state-tabs-card {
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.state-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 22px;
}

.state-tab-dropdown {
  position: relative;
}

.state-tab {
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.state-tab:hover {
  color: #1a202c;
}

.state-tab.active {
  background: #fff;
  border-color: #e2e8f0;
  color: #1a202c;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.state-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.state-tab-count-amber {
  background: #f6c343;
  color: #7c4a03;
}

.state-tab-count-green {
  background: #9ae6b4;
  color: #22543d;
}

.state-tab-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  z-index: 20;
}

.state-tab-menu.hidden {
  display: none;
}

.state-tab-menu-item {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: #2d3748;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.state-tab-menu-item:hover {
  background: #f5f6fa;
}

.state-tab-menu-item.active {
  background: #edf2f7;
  color: #1a202c;
  font-weight: 600;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 160px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 7px 14px 7px 34px;
  font-size: 13px;
  font-family: inherit;
  color: #2c3e50;
}

.search-input:focus {
  outline: none;
  border-color: #cbd5e0;
  box-shadow: 0 0 0 3px rgba(203, 213, 224, 0.4);
}

.search-input::placeholder {
  color: #a0aec0;
}

.toolbar-refresh {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #718096;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}

.toolbar-refresh:hover {
  color: #2c3e50;
  border-color: #cbd5e0;
}

.toolbar-btn {
  background: #2c3e50;
  color: #fff;
  border: 1px solid #2c3e50;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.12s, border-color 0.12s;
}

.toolbar-btn:hover {
  background: #1a202c;
  border-color: #1a202c;
}

.toolbar-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.25);
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 6px;
}

.sidebar-section-head .sidebar-heading {
  padding: 0;
}

.sidebar-section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.sidebar-section-toggle:hover .sidebar-heading {
  color: #2c3e50;
}

.sidebar-section-chevron {
  color: #a0aec0;
  flex-shrink: 0;
  transition: transform 120ms ease;
}

.sidebar-section-toggle[aria-expanded="false"] .sidebar-section-chevron {
  transform: rotate(-90deg);
}

.sidebar-section-head.is-collapsed {
  padding-bottom: 4px;
}

.sidebar-section-head.is-collapsed .sidebar-bulk {
  display: none;
}

.sidebar-checklist.is-collapsed {
  display: none;
}

.sidebar-bulk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sidebar-bulk-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 11px;
  color: #718096;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sidebar-bulk-btn:hover {
  color: #2c3e50;
  text-decoration: underline;
}

.sidebar-bulk-sep {
  color: #cbd5e0;
  font-size: 11px;
}

.sidebar-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 4px;
}

.sidebar-checklist-item {
  border-radius: 6px;
}

.sidebar-checklist-item:hover {
  background: #f5f6fa;
}

.sidebar-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: #2d3748;
  cursor: pointer;
  user-select: none;
}

.sidebar-checkbox {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #2c3e50;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-check-label .sidebar-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-checklist-empty {
  padding: 8px 12px;
  font-size: 13px;
  color: #a0aec0;
  font-style: italic;
}

.clusters-toolbar {
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .issues-layout,
  .clusters-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
  }
  .sidebar-checklist {
    max-height: 40vh;
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .search-box {
    flex-basis: 100%;
    order: 10;
  }
}

.issues-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.load-more-btn {
  background: #fff;
  color: #2c3e50;
  border: 1px solid #cbd5e0;
  border-radius: 999px;
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}

.load-more-btn:hover:not(:disabled) {
  background: #f5f6fa;
  border-color: #a0aec0;
}

.load-more-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
}

.pagination-indicator {
  font-size: 13px;
  color: #718096;
}

.issue-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  border-left: 4px solid #ccc;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.issue-card-deep-linked {
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5), 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.4s ease-out;
}

.issue-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.issue-header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.issue-header-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.issue-cluster-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #4a5568;
  font-size: 13px;
}

.issue-cluster-line-icon {
  display: inline-flex;
  color: #a0aec0;
  flex-shrink: 0;
}

.issue-cluster-line-name {
  font-weight: 500;
  color: #2c3e50;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-cluster-line-name-empty {
  color: #a0aec0;
  font-style: italic;
  font-weight: 400;
}

.issue-cluster-match-confidence {
  color: #a0aec0;
  font-size: 12px;
  flex-shrink: 0;
}

.issue-tag {
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.issue-id {
  color: #718096;
  font-size: 12px;
  font-family: "SF Mono", Monaco, Consolas, monospace;
}

.issue-confidence {
  color: #a0aec0;
  font-size: 12px;
  flex-shrink: 0;
}

.issue-importance {
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.issue-importance-low {
  color: #718096;
}

.issue-importance-medium {
  color: #dd6b20;
}

.issue-importance-high {
  color: #e53e3e;
}

.issue-id-link {
  color: #2c5282;
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.issue-id-link:hover {
  color: #1a365d;
}

.issue-id-link-icon {
  display: inline-flex;
  align-items: center;
}

.issue-id-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: -6px;
  border-radius: 4px;
  color: #a0aec0;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.issue-id-copy:hover {
  background: #f1f3f5;
  color: #2c3e50;
}

.issue-id-copy:focus-visible {
  outline: 2px solid #2c3e50;
  outline-offset: 1px;
}

.issue-id-copy.copied {
  color: #27ae60;
}

.issue-id-copy-icon {
  display: block;
}

.issue-state-badge {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid #a0aec0;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: #4a5568;
}

.issue-cluster-badge-empty {
  background: transparent;
  color: #a0aec0;
  border-color: #e2e8f0;
  border-style: dashed;
  font-style: italic;
  font-weight: 400;
}

.issue-analyzed-at {
  color: #a0aec0;
  font-size: 12px;
}

.issue-description {
  color: #2c3e50;
  font-size: 14px;
  line-height: 1.6;
}

.issue-types-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.issue-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: #f7fafc;
  color: #4a5568;
  border: 1px solid #e2e8f0;
}

.issue-type-chip-removing {
  opacity: 0.5;
}

.issue-type-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.issue-type-chip-remove:hover {
  background: #e2e8f0;
  color: #4a5568;
}

.issue-type-chip-remove:disabled {
  cursor: default;
}

.issue-comment-row {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.issue-comment-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #718096;
  margin-bottom: 6px;
}

.issue-comment-body {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.issue-comment-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: #2c3e50;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.issue-comment-empty {
  color: #a0aec0;
  font-style: italic;
}

.issue-comment-edit-btn {
  flex-shrink: 0;
}

.issue-comment-edit {
  display: block;
}

.issue-comment-input {
  margin-top: 0;
}

.issue-comment-input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.issue-actions-area {
  margin-top: 14px;
}

.issue-show-conv-section {
  display: flex;
}

.issue-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.issue-status-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 0;
  padding: 14px 20px;
  border-radius: 10px;
}

/* "1. Tracker classic" palette: warm amber/purple on the two attention
   queues, cool blue/green/grey on the rest. */
.issue-status-bar-new {
  background: #faeeda;
  justify-content: space-between;
}

.issue-status-bar-label {
  font-size: 13px;
  font-weight: 500;
  color: #78716c;
}

.issue-status-bar-verified {
  background: #e1f5ee;
  justify-content: space-between;
}

.issue-status-bar-reported {
  background: #e6f1fb;
  justify-content: space-between;
}

.issue-status-bar-closed {
  background: #eeedfe;
  justify-content: space-between;
}

.issue-status-bar-rejected {
  background: #f1efe8;
}

.issue-status-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  background: #fff;
  color: #4a5568;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.action-btn-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.action-btn-label {
  display: inline-block;
}

.action-btn:hover:not(:disabled) {
  background: #f1f3f5;
  border-color: #a0aec0;
  color: #2c3e50;
}

.action-btn:focus-visible {
  outline: 2px solid #2c3e50;
  outline-offset: 2px;
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.action-btn-primary {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.action-btn-primary:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.action-btn-trello {
  background: #0079bf;
  color: #fff;
  border-color: #0079bf;
}

.action-btn-trello:hover:not(:disabled) {
  background: #026aa7;
  border-color: #026aa7;
  color: #fff;
}

.action-btn-close {
  background: #475569;
  color: #fff;
  border-color: #475569;
}

.action-btn-close:hover:not(:disabled) {
  background: #334155;
  border-color: #334155;
  color: #fff;
}

/* Pill shape shared by every status-bar action button (Approve/Reject,
   Report to Trello/See in Trello, Close) so all signal states read as one
   consistent button style. */
.action-btn-pill {
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
}

.action-btn-approve {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}

.action-btn-approve:hover:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

.action-btn-reject {
  background: #a63d31;
  color: #fff;
  border-color: #a63d31;
}

.action-btn-reject:hover:not(:disabled) {
  background: #8a3128;
  border-color: #8a3128;
  color: #fff;
}

.action-btn-show-conv {
  background: transparent;
  border-color: transparent;
  color: #2d3748;
  font-weight: 400;
  text-decoration: underline;
  padding: 0;
}

.action-btn-show-conv .action-btn-icon {
  display: none;
}

.action-btn-show-conv:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  color: #1a202c;
}

.action-btn-danger {
  color: #c0392b;
  border-color: #f1c1bb;
}

.action-btn-danger:hover:not(:disabled) {
  background: #fdf2f1;
  border-color: #e2998f;
  color: #a93226;
}

.action-btn-error {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
}

.action-btn.success {
  background: #eafaf1;
  color: #27ae60;
  border-color: #27ae60;
}

.action-btn.error {
  background: #fdecea;
  color: #c0392b;
  border-color: #c0392b;
}

.trello-comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.trello-comment-input {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  padding: 8px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  color: #2c3e50;
  background: #fff;
}

.trello-comment-input:focus {
  outline: 2px solid #2c3e50;
  outline-offset: 1px;
}

.trello-comment-buttons {
  display: flex;
  gap: 8px;
}

.trello-comment-bug {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4a5568;
  cursor: pointer;
  user-select: none;
  align-self: flex-start;
}

.trello-comment-bug-checkbox {
  margin: 0;
  cursor: pointer;
}

.reject-signal-form {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.reject-signal-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a202c;
}

.reject-signal-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: #718096;
}

.reject-signal-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.reject-signal-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.reject-signal-option:hover {
  border-color: #cbd5e0;
}

.reject-signal-option.selected {
  background: #eafaf1;
  border-color: #7fcb9a;
}

.reject-signal-radio {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  cursor: pointer;
  accent-color: #1e7e42;
}

.reject-signal-option-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.reject-signal-option-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a202c;
}

.reject-signal-option-desc {
  font-size: 12px;
  color: #718096;
}

.reject-signal-other-input {
  width: 100%;
  min-height: 44px;
  resize: vertical;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  color: #2c3e50;
  background: #fff;
  cursor: text;
}

.reject-signal-other-input:focus {
  outline: none;
  border-color: #a0aec0;
  box-shadow: 0 0 0 3px rgba(203, 213, 224, 0.4);
}

.reject-signal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.reject-signal-cancel {
  background: none;
  border: none;
  padding: 6px 4px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
}

.reject-signal-cancel:hover:not(:disabled) {
  color: #2c3e50;
  text-decoration: underline;
}

.reject-signal-cancel:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.reject-signal-submit {
  background: #16a34a;
  color: #fff;
  border: 1px solid #16a34a;
  border-radius: 8px;
  padding: 8px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.reject-signal-submit:hover:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
}

.reject-signal-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.reject-signal-submit.error {
  background: #c0392b;
  border-color: #c0392b;
}

.issue-reported-label {
  font-size: 13px;
  font-weight: 600;
  color: #2d3748;
}

.issue-transcript {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e1e4e8;
  display: flex;
  flex-direction: column;
}

.transcript-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #718096;
  margin-bottom: 12px;
}

.transcript-message {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  max-width: 75%;
}

.transcript-message.user {
  align-self: flex-end;
}

.transcript-message.bot {
  align-self: flex-start;
}

.transcript-role {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #718096;
  margin-bottom: 3px;
  padding: 0 4px;
}

.transcript-message.user .transcript-role {
  text-align: right;
}

.transcript-text {
  background: #f1f3f5;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #2c3e50;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.transcript-message.user .transcript-text {
  background: #2c3e50;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.transcript-message.bot .transcript-text {
  border-bottom-left-radius: 4px;
}

.transcript-text a {
  color: inherit;
  text-decoration: underline;
  word-break: break-word;
}

.transcript-text a:hover {
  opacity: 0.8;
}

.transcript-message.highlighted .transcript-text {
  box-shadow: 0 0 0 2px #f39c12, 0 0 0 5px rgba(243, 156, 18, 0.2);
}

.transcript-message.highlighted.bot .transcript-text,
.transcript-message.highlighted.user .transcript-text {
  background: #fff6e5;
  color: #2c3e50;
}

.transcript-message.highlighted .transcript-role::after {
  content: " · flagged";
  color: #d68910;
  font-weight: 600;
}

.transcript-reveal {
  align-self: center;
  background: #fff;
  border: 1px dashed #cbd5e0;
  color: #718096;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  margin: 6px 0;
}

.transcript-reveal:hover {
  background: #f1f3f5;
  color: #2c3e50;
  border-color: #a0aec0;
}

.transcript-reveal:focus-visible {
  outline: 2px solid #2c3e50;
  outline-offset: 2px;
}

.transcript-loading,
.transcript-empty {
  color: #718096;
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

.empty-state,
.status {
  text-align: center;
  padding: 32px;
  color: #718096;
  background: #fff;
  border-radius: 8px;
  font-size: 14px;
}

/* Informational banner, e.g. "Grouping signals into clusters…" on Clusters. */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #ebf4fb;
  border: 1px solid #c3dcef;
  border-radius: 8px;
  color: #1f4e79;
}

.info-box.hidden {
  display: none;
}

/* Small spinner in the current text color, for waiting states (installing,
   connecting Intercom…). On buttons, add .is-loading instead of an element. */
.spinner,
.is-loading::before {
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spinner-rotate 0.8s linear infinite;
}

.spinner[hidden] {
  display: none;
}

.is-loading::before {
  content: "";
  margin-right: 8px;
}

/* A busy button is disabled, but should look like it's working, not unavailable. */
.modal-btn.is-loading:disabled,
.modal-btn.is-loading:disabled:hover {
  opacity: 0.85;
  cursor: progress;
}

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

/* Slower rather than stopped, so it doesn't look frozen. */
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .is-loading::before {
    animation-duration: 2.4s;
  }
}

/* Claim page: centered card confirming an Intercom App Store install. */
.claim-card {
  max-width: 480px;
  margin: 32px auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.claim-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 32px 24px;
}

.claim-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #a0aec0;
}

.claim-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
}

.claim-logo-cuelens {
  background: #2c3e50;
  color: #fff;
}

.claim-logo-intercom {
  background: #edf0f5;
  color: #2c3e50;
}

.claim-title {
  margin-top: 4px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #1a202c;
}

.claim-message {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: -8px;
  text-align: center;
  font-size: 14px;
  color: #718096;
}

.claim-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: #f7f9fb;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
}

.claim-detail {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.claim-detail dt {
  color: #718096;
}

.claim-detail dd {
  font-weight: 700;
  color: #1a202c;
  text-align: right;
  overflow-wrap: anywhere;
}

.claim-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.claim-btn {
  display: block;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.claim-btn.hidden {
  display: none;
}

.claim-cancel {
  align-self: center;
  font-size: 14px;
  font-weight: 600;
  color: #718096;
  text-decoration: none;
}

.claim-cancel:hover {
  color: #1a202c;
}

.claim-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: #718096;
}

.claim-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.claim-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 14px 32px;
  background: #f7f9fb;
  border-top: 1px solid #e2e8f0;
  font-size: 13px;
  color: #718096;
}

.claim-footer a {
  font-weight: 600;
  color: #2c3e50;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.claim-footer a:hover {
  color: #1a202c;
}

@media (max-width: 520px) {
  .claim-body {
    padding: 24px 16px 20px;
  }

  .claim-footer {
    padding: 14px 16px;
    justify-content: flex-start;
  }
}

.info-box-spinner {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 2px solid #c3dcef;
  border-top-color: #2980b9;
  border-radius: 50%;
  animation: info-box-spin 0.9s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .info-box-spinner { animation: none; }
}

.info-box-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.info-box-text {
  margin: 2px 0 0;
  font-size: 13px;
  color: #2c5f8a;
}

.info-box-body {
  flex: 1;
  min-width: 0;
}

/* Signals: "Your free analysis is complete — contact us to subscribe". */
.subscribe-banner-btn {
  margin-top: 10px;
}

.subscribe-banner-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0 4px;
  font-size: 20px;
  line-height: 1;
  color: #2c5f8a;
  cursor: pointer;
}

.subscribe-banner-dismiss:hover,
.subscribe-banner-dismiss:focus-visible {
  color: #1f4e79;
}

.intercom-disconnect-btn {
  margin-left: 12px;
  padding: 4px 12px;
  font-size: 12px;
}

.intercom-disconnect-btn[hidden] {
  display: none;
}

.intercom-workspace-id {
  margin-left: 8px;
}

.intercom-workspace-id[hidden] {
  display: none;
}

.account-plan-link {
  margin-left: 8px;
  font-weight: 500;
}

.history-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 32px;
  margin-bottom: 16px;
  background: #fff;
  border-radius: 8px;
  text-align: center;
}

.history-cta.hidden {
  display: none;
}

.history-cta-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a202c;
}

.history-cta-text {
  margin: 0;
  max-width: 480px;
  font-size: 14px;
  color: #4a5568;
}

.history-cta-btn {
  padding: 10px 22px;
  font-size: 14px;
}

.history-cta-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.history-cta-note {
  margin: 0;
  max-width: 480px;
  font-size: 12px;
  color: #718096;
}

.history-cta-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 360px;
}

.history-cta-bar {
  width: 100%;
  height: 8px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.history-cta-bar-fill {
  width: 0;
  height: 100%;
  background: #B08A1E;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.history-cta-progress-label {
  font-size: 13px;
  color: #4a5568;
  font-variant-numeric: tabular-nums;
}

.status.error {
  color: #c0392b;
  background: #fdecea;
}

.hidden {
  display: none;
}

.clusters-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}

/* Clusters have no category, so every card uses the same neutral accent. */
.cluster-card {
  border-left-color: #7f8c8d;
}

.cluster-header-static {
  cursor: default;
}

.cluster-title {
  font-weight: 600;
  color: #1a202c;
  font-size: 15px;
  flex: 1;
  min-width: 0;
}

.cluster-size-badge {
  font-variant-numeric: tabular-nums;
}

.issue-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #27ae60;
  background: #eafaf1;
  border: 1px solid #27ae60;
  white-space: nowrap;
  flex-shrink: 0;
}

.cluster-verified-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #27ae60;
  flex-shrink: 0;
}

.cluster-verified-dot[hidden] {
  display: none;
}

.cluster-open-count {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #fef5e7;
  color: #b7791f;
  border: 1px solid #f6d68f;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.cluster-open-count-zero {
  background: #f1f3f5;
  color: #a0aec0;
  border-color: #e2e8f0;
  font-weight: 500;
}

.cluster-open-count-loading {
  background: #f1f3f5;
  color: #a0aec0;
  border-color: #e2e8f0;
  font-weight: 500;
  opacity: 0.7;
}

.cluster-new-count {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #e6f4ea;
  color: #1f7a3d;
  border: 1px solid #b5dec3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cluster-new-count[hidden] {
  display: none;
}

.cluster-description {
  color: #4a5568;
  font-size: 13px;
  line-height: 1.55;
  margin-top: 6px;
}

.cluster-description-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
}

.cluster-description-row .cluster-description {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

.cluster-description-empty {
  color: #a0aec0;
  font-style: italic;
}

.cluster-description-edit-btn {
  flex-shrink: 0;
}

.cluster-description-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.cluster-description-input {
  width: 100%;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: #2c3e50;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #fff;
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
}

.cluster-description-input:focus {
  outline: none;
  border-color: #a0aec0;
  box-shadow: 0 0 0 3px rgba(203, 213, 224, 0.4);
}

.cluster-description-edit-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cluster-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cluster-edit-btn,
.cluster-refresh-btn {
  background: transparent;
  border: none;
  color: #a0aec0;
  padding: 2px;
  margin: 0 2px 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}

.cluster-edit-btn:hover:not(:disabled) {
  color: #2c3e50;
  background: #f1f3f5;
}

.cluster-edit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cluster-title-edit {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.cluster-title-input {
  padding: 4px 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #fff;
  min-width: 220px;
}

.cluster-title-input:focus {
  outline: none;
  border-color: #a0aec0;
  box-shadow: 0 0 0 3px rgba(203, 213, 224, 0.4);
}

.cluster-title-save,
.cluster-title-cancel {
  background: #fff;
  color: #4a5568;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.cluster-title-save {
  background: #2c3e50;
  color: #fff;
  border-color: #2c3e50;
}

.cluster-title-save:hover:not(:disabled) {
  background: #1a202c;
  border-color: #1a202c;
}

.cluster-title-cancel:hover:not(:disabled) {
  background: #f1f3f5;
  border-color: #a0aec0;
}

.cluster-title-save:disabled,
.cluster-title-cancel:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cluster-title-error {
  font-size: 12px;
  color: #c0392b;
}

.cluster-refresh-btn:hover:not(:disabled) {
  color: #2c3e50;
  background: #f1f3f5;
}

.cluster-refresh-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cluster-refresh-btn.is-spinning svg {
  animation: cluster-refresh-spin 0.7s linear infinite;
}

.cluster-refresh-btn-error {
  color: #c0392b;
}

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

.cluster-toggle-btn-inline {
  background: transparent;
  border: 1px solid #cbd5e0;
  color: #4a5568;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.cluster-toggle-btn-inline:hover:not(:disabled) {
  background: #f5f6fa;
  border-color: #a0aec0;
  color: #1a202c;
}

.cluster-toggle-btn-inline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cluster-toggle-btn-inline:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(203, 213, 224, 0.5);
}

.cluster-action-btn {
  background: #fff;
  color: #4a5568;
  border: 1px solid #cbd5e0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.cluster-action-btn:hover:not(:disabled) {
  background: #f5f6fa;
  border-color: #a0aec0;
}

.cluster-action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Wraps a paid-only action so its tooltip shows even though the button is disabled. */
.cluster-action-locked {
  display: inline-flex;
  cursor: not-allowed;
}

.cluster-action-locked .action-btn:disabled {
  pointer-events: none;
}

.cluster-action-btn-primary {
  background: #2c3e50;
  color: #fff;
  border-color: #2c3e50;
}

.cluster-action-btn-primary:hover:not(:disabled) {
  background: #1a202c;
  border-color: #1a202c;
}

.cluster-action-btn-trello {
  background: #0079bf;
  color: #fff;
  border-color: #0079bf;
}

.cluster-action-btn-trello:hover:not(:disabled) {
  background: #026aa7;
  border-color: #026aa7;
}

.cluster-action-btn-danger {
  color: #c0392b;
  border-color: #f1c1bb;
}

.cluster-action-btn-danger:hover:not(:disabled) {
  background: #fdf2f1;
  border-color: #e2998f;
  color: #a93226;
}

.cluster-action-btn-error {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
}

.cluster-query-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.cluster-query-input {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  padding: 8px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  color: #2c3e50;
  background: #fff;
}

.cluster-query-input:focus {
  outline: 2px solid #2c3e50;
  outline-offset: 1px;
}

.cluster-query-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cluster-analyze-prompt-label {
  margin: 0;
  font-size: 12px;
  color: #4a5568;
}

.cluster-query-counter {
  margin-left: auto;
  font-size: 11px;
  color: #a0aec0;
}

.cluster-query-result {
  padding: 12px 14px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 13px;
  color: #2c3e50;
  word-wrap: break-word;
  line-height: 1.55;
}

.cluster-query-result-p {
  margin: 0 0 10px;
}

.cluster-query-result-p:last-child {
  margin-bottom: 0;
}

.cluster-query-result-list {
  margin: 0 0 10px;
  padding-left: 20px;
}

.cluster-query-result-list:last-child {
  margin-bottom: 0;
}

.cluster-query-result-list li {
  margin-bottom: 6px;
}

.cluster-query-result-list li:last-child {
  margin-bottom: 0;
}

.cluster-query-result strong {
  color: #1a202c;
  font-weight: 600;
}

.cluster-query-result-error {
  background: #fdf2f1;
  border-color: #f1c1bb;
  color: #c0392b;
}

.cluster-query-result-error strong {
  color: #a93226;
}

.cluster-query-history-header {
  display: flex;
  justify-content: flex-end;
}

.cluster-query-history-toggle {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: #cbd5e0;
  text-underline-offset: 3px;
}

.cluster-query-history-toggle:hover {
  color: #1a202c;
  text-decoration-color: #1a202c;
}

.cluster-query-history {
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  background: #fff;
  max-height: 280px;
  overflow-y: auto;
}

.cluster-query-history-loading,
.cluster-query-history-empty,
.cluster-query-history-error {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  color: #718096;
}

.cluster-query-history-error {
  color: #c0392b;
}

.cluster-query-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cluster-query-history-item + .cluster-query-history-item {
  border-top: 1px solid #edf0f3;
}

.cluster-query-history-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: #2c3e50;
}

.cluster-query-history-head:hover {
  background: #f8fafc;
}

.cluster-query-history-when {
  flex-shrink: 0;
  font-size: 11px;
  color: #a0aec0;
  font-variant-numeric: tabular-nums;
  min-width: 64px;
}

.cluster-query-history-q {
  flex: 1;
  font-size: 13px;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-query-history-chevron {
  flex-shrink: 0;
  display: inline-flex;
  color: #a0aec0;
  transition: transform 0.15s;
}

.cluster-query-history-item.is-open .cluster-query-history-chevron {
  transform: rotate(180deg);
  color: #4a5568;
}

.cluster-query-history-body {
  padding: 4px 12px 12px 12px;
  font-size: 13px;
  color: #2c3e50;
  background: #f8fafc;
  border-top: 1px dashed #e1e4e8;
  line-height: 1.55;
}

.cluster-query-history-body .cluster-query-result-p,
.cluster-query-history-body .cluster-query-result-list {
  margin: 8px 0 0;
}

.cluster-query-history-body .cluster-query-result-p:first-child,
.cluster-query-history-body .cluster-query-result-list:first-child {
  margin-top: 8px;
}

/* Static dialogs (e.g. Settings > Danger zone) toggle the hidden attribute. */
.modal-overlay[hidden] {
  display: none;
}

.account-card {
  max-width: 560px;
  gap: 14px;
}

.account-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 24px;
  margin: 0;
  font-size: 14px;
}

.account-details dt {
  color: #718096;
  font-weight: 500;
}

.account-details dd {
  margin: 0;
  color: #1a202c;
  overflow-wrap: anywhere;
}

.account-details a {
  color: #2c3e50;
}

.account-actions {
  justify-content: flex-start;
}

/* Settings > Billing: conversations used this period. */
.billing-usage-bar {
  display: block;
  height: 6px;
  margin-top: 6px;
  max-width: 280px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.billing-usage-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: #2c3e50;
}

.billing-usage-bar > span.billing-usage-full {
  background: #c53030;
}

.error-page-card {
  max-width: 560px;
  gap: 12px;
  padding: 32px;
}

.error-page-code {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  color: #B08A1E;
  font-variant-numeric: tabular-nums;
}

.error-page-text {
  margin: 0;
  font-size: 14px;
  color: #4a5568;
}

.error-page-actions {
  justify-content: flex-start;
}

.danger-card {
  max-width: 560px;
  border: 1px solid #f5c6c0;
  gap: 14px;
}

.danger-card .rule-name {
  color: #c0392b;
}

.danger-counts {
  margin: 0;
  padding: 10px 14px 10px 30px;
  background: #fdecea;
  border-radius: 6px;
  color: #922b21;
  font-size: 13px;
  line-height: 1.6;
}

.danger-actions {
  justify-content: flex-start;
}

.subnav-tab-danger,
.subnav-tab-danger:hover,
.subnav-tab-danger.active {
  color: #c0392b;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 32, 44, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modal-fade-in 0.15s ease-out;
  padding: 20px;
}

.modal-dialog {
  background: #fff;
  border-radius: 12px;
  padding: 24px 24px 20px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), 0 4px 12px rgba(0, 0, 0, 0.08);
  animation: modal-pop 0.18s ease-out;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 8px;
}

.modal-body {
  font-size: 14px;
  color: #4a5568;
  line-height: 1.55;
  margin-bottom: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}

.modal-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.25);
}

.modal-btn-secondary {
  background: #fff;
  border-color: #cbd5e0;
  color: #4a5568;
}

.modal-btn-secondary:hover {
  background: #f5f6fa;
  border-color: #a0aec0;
  color: #1a202c;
}

.modal-btn-primary {
  background: #2c3e50;
  color: #fff;
}

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

.modal-btn-danger {
  background: #e74c3c;
  color: #fff;
}

.modal-btn-danger:hover {
  background: #c0392b;
}

.modal-btn-danger:focus-visible {
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
}

.modal-btn:disabled,
.modal-btn:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal-btn-danger:disabled:hover {
  background: #e74c3c;
}

.modal-btn-primary:disabled:hover {
  background: #2c3e50;
}

.modal-field-hint {
  font-size: 12px;
  color: #718096;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-dialog-form {
  max-width: 480px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form .modal-actions {
  margin-top: 4px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field-label {
  font-size: 11px;
  font-weight: 600;
  color: #718096;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.modal-input {
  font: inherit;
  font-size: 13px;
  color: #2c3e50;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
  font-family: inherit;
}

.modal-input:focus {
  outline: none;
  border-color: #a0aec0;
  box-shadow: 0 0 0 3px rgba(203, 213, 224, 0.4);
}

.modal-input:disabled {
  background: #f5f6fa;
  color: #718096;
  cursor: not-allowed;
}

.modal-textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.5;
}

select.modal-input {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23718096' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.modal-error {
  color: #c0392b;
  font-size: 12px;
  background: #fdf2f1;
  border: 1px solid #f1c1bb;
  border-radius: 6px;
  padding: 8px 12px;
  line-height: 1.4;
}

.modal-field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.modal-field-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.onboarding-legal {
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
  color: #4a5568;
}

.onboarding-legal input[type="checkbox"] {
  margin-top: 2px;
}

.onboarding-legal a {
  color: inherit;
  text-decoration: underline;
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signal-type-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.signal-type-code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: #718096;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.rule-name {
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.rule-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.rule-switch-track {
  position: absolute;
  inset: 0;
  background: #cbd5e0;
  border-radius: 999px;
  transition: background-color 0.15s;
  pointer-events: none;
}

.rule-switch-track::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.rule-switch input:checked + .rule-switch-track {
  background: #27ae60;
}

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

.rule-switch input:disabled {
  cursor: not-allowed;
}

.rule-switch input:disabled + .rule-switch-track {
  opacity: 0.5;
}

.rule-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rule-btn {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #718096;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}

.rule-btn:hover:not(:disabled) {
  color: #2c3e50;
  border-color: #cbd5e0;
}

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

.rule-btn-danger:hover:not(:disabled) {
  color: #c0392b;
  border-color: #f1c1bb;
}

.rule-patterns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rule-pattern {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f5f6fa;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #4a5568;
}

.rule-pattern-label {
  font-family: inherit;
  font-weight: 600;
  color: #a0aec0;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.rule-criterion {
  font-size: 13px;
  color: #4a5568;
  line-height: 1.5;
}

.rule-criterion-label {
  font-weight: 600;
  color: #a0aec0;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.03em;
  margin-right: 6px;
}

.rule-meta {
  font-size: 11px;
  color: #a0aec0;
}

.rule-failed-signals {
  border-top: 1px solid #edf1f5;
  padding-top: 10px;
}

.rule-failed-toggle {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #2980b9;
  cursor: pointer;
}

.rule-failed-toggle:hover {
  text-decoration: underline;
}

.rule-failed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.rule-failed-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 6px;
}

.rule-failed-row-id {
  flex-shrink: 0;
  font-weight: 500;
}

.rule-failed-row-reason {
  color: #4a5568;
  line-height: 1.4;
  flex: 1;
}

.rule-failed-row-replay {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #d3dce6;
  border-radius: 5px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #2980b9;
  cursor: pointer;
}

.rule-failed-row-replay:hover:not(:disabled) {
  background: #eaf3fb;
  border-color: #2980b9;
}

.rule-failed-row-replay:disabled {
  color: #a0aec0;
  border-color: #edf1f5;
  cursor: default;
}

.rule-failed-row-remove {
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #d3dce6;
  border-radius: 5px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #e74c3c;
  cursor: pointer;
}

.rule-failed-row-remove:hover:not(:disabled) {
  background: #fdecea;
  border-color: #e74c3c;
}

.rule-failed-row-remove:disabled {
  color: #a0aec0;
  border-color: #edf1f5;
  cursor: default;
}

.rule-failed-status {
  font-size: 12px;
  color: #a0aec0;
}

.rule-failed-error {
  color: #e74c3c;
}

.cluster-issues {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf0f3;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cluster-issues.hidden {
  display: none;
}

.cluster-issues-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #718096;
  margin-bottom: 2px;
}

.cluster-issue-row {
  background: #f7f9fb;
  border-radius: 6px;
  padding: 10px 12px;
}

.cluster-issue-id-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.cluster-issue-show-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #2c5282;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.cluster-issue-show-btn:hover {
  background: #ebf4ff;
  border-color: #a0aec0;
  color: #1a365d;
}

.cluster-issue-show-btn:focus {
  outline: none;
  border-color: #a0aec0;
  box-shadow: 0 0 0 3px rgba(203, 213, 224, 0.4);
}

.cluster-issue-explanation {
  font-size: 13px;
  line-height: 1.5;
  color: #2c3e50;
}

.cluster-issues-empty {
  font-size: 13px;
  color: #718096;
  font-style: italic;
}

@media (max-width: 600px) {
  .app-header h1 {
    font-size: 22px;
  }
  .app-header-bar-inner,
  .app-header-title-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
  .app-header-bar-inner {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .app-header-bar-left {
    gap: 16px;
  }
  .app-header-title-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .filter-card {
    padding: 16px;
  }
  .issue-card {
    padding: 14px 16px;
  }
}

/* ------------------------------------------------------------------ */
/* Cluster Trends                                                      */
/* ------------------------------------------------------------------ */

.trends-main {
  padding-top: 28px;
  padding-bottom: 60px;
}

.trends-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.trends-heading {
  font-size: 22px;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.25;
}

.trends-subheading {
  font-size: 13px;
  color: #718096;
  margin-top: 3px;
}

.trends-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.trends-section {
  margin-bottom: 32px;
}

.trends-section-header {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 0 0 10px;
  border-left: 3px solid #ccc;
  margin-bottom: 10px;
}

.trends-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #4a5568;
}

.trends-section-dot {
  color: #a0aec0;
  font-size: 11px;
  margin: 0 6px;
}

.trends-section-sublabel {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #718096;
}

.trends-section-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trend-card {
  background: #fff;
  border-radius: 8px;
  border-left: 4px solid #ccc;
  padding: 14px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.trend-card--accelerating { border-left-color: #e74c3c; }
.trend-card--stable       { border-left-color: #b8992c; }
.trend-card--resolving    { border-left-color: #27ae60; }

.trend-card-body {
  display: flex;
  align-items: center;
  gap: 16px;
}

.trend-card-info {
  flex: 1;
  min-width: 0;
}

.trend-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
  line-height: 1.3;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trend-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trend-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
  color: #4a5568;
  background: #f1f3f5;
}

.trend-signal-count {
  font-size: 13px;
  color: #718096;
  white-space: nowrap;
}

.trend-sparkline-wrap {
  flex-shrink: 0;
  width: 130px;
  height: 44px;
  position: relative;
}

.trend-sparkline-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.trend-card-stat {
  flex-shrink: 0;
  text-align: right;
  min-width: 76px;
}

.trend-change {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.trend-change--up     { color: #e74c3c; }
.trend-change--stable { color: #718096; font-weight: 500; }
.trend-change--down   { color: #27ae60; }

.trend-last {
  font-size: 11px;
  color: #a0aec0;
  margin-top: 3px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .trends-page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .trend-sparkline-wrap {
    display: none;
  }
}

a.modal-btn {
  display: inline-block;
  text-decoration: none;
}

.trello-settings-card {
  max-width: 560px;
  gap: 14px;
}

.trello-badge {
  font-size: 11px;
  font-weight: 600;
  color: #718096;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 2px 10px;
  flex-shrink: 0;
}

.trello-badge-on {
  color: #1e7e4a;
  background: #eaf7ef;
  border-color: #bfe5cd;
}

.trello-actions {
  align-items: center;
}

.trello-saved {
  font-size: 12px;
  color: #1e7e4a;
}

.trello-help-link,
.trello-help-back {
  font-weight: 600;
  color: #2c3e50;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.trello-help-link:hover,
.trello-help-back:hover {
  color: #1a202c;
}

.trello-help-back {
  align-self: flex-start;
  font-size: 13px;
}

.trello-help-heading {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #2d3748;
}

.trello-help-list {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: #4a5568;
  line-height: 1.5;
}

.trello-help-list li + li {
  margin-top: 6px;
}

.trello-help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #4a5568;
  line-height: 1.4;
}

.trello-help-table th,
.trello-help-table td {
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
}

.trello-help-table th {
  font-size: 10px;
  font-weight: 600;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.trello-help code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  background: #f7fafc;
  border: 1px solid #edf2f7;
  border-radius: 4px;
  padding: 0 4px;
}

.trello-disconnect-btn {
  margin-right: auto;
}

.trello-disconnect-btn[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Audit report                                                         */
/* ------------------------------------------------------------------ */

.audit-report {
  --audit-ink: #16181D;
  --audit-text-2: #464B54;
  --audit-muted: #555A63;
  --audit-ground: #F4F4F1;
  --audit-card: #FFFFFF;
  --audit-line: #E4E5E9;
  --audit-track: #ECEDF0;
  --audit-accent: #2B44C9;
  --audit-accent-dark: #1D2F8F;
  --audit-on-dark-muted: #C9CCD2;
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 24px;
  color: var(--audit-ink);
}

.audit-report.hidden { display: none; }

.audit-mono { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.audit-meta { font-size: 13px; color: var(--audit-muted); }

.audit-card { background: var(--audit-card); border-radius: 16px; padding: 40px; }
.audit-hero { padding: 48px; display: flex; flex-direction: column; gap: 20px; }
.audit-eyebrow { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--audit-accent); }
.audit-headline { line-height: 1.1; letter-spacing: -0.02em; font-weight: 600; max-width: 820px; }
.audit-lede { font-size: 19px; line-height: 1.55; color: var(--audit-text-2); max-width: 720px; }
.audit-lede.hidden { display: none; }

.audit-stats { display: flex; flex-wrap: wrap; gap: 16px; }
.audit-stat { flex: 1 1 200px; background: var(--audit-card); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.audit-stat-num { font-size: 40px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.audit-stat-num small { font-size: 20px; color: var(--audit-muted); font-weight: 500; }
.audit-stat-label { font-size: 15px; color: var(--audit-muted); }
.audit-stat-dark { background: var(--audit-ink); color: #fff; }
.audit-stat-dark .audit-stat-label { color: var(--audit-on-dark-muted); }

.audit-section-head { display: flex; flex-direction: column; gap: 6px; }
.audit-report h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.audit-report .audit-headline { font-size: 44px; }
.audit-section-head p { font-size: 16px; color: var(--audit-muted); }
.audit-loose-head { padding: 0 4px; }

.audit-lenses { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.audit-lens-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.audit-lens-name { flex: 0 0 220px; font-size: 16px; font-weight: 500; }
.audit-lens-track { flex: 1 1 280px; height: 14px; background: var(--audit-track); border-radius: 7px; overflow: hidden; }
.audit-lens-bar { height: 100%; background: var(--audit-accent); border-radius: 7px; }
.audit-lens-count { flex: 0 0 40px; font-size: 15px; text-align: right; }

.audit-cluster-section { display: flex; flex-direction: column; gap: 16px; }
.audit-clusters { display: flex; flex-wrap: wrap; gap: 16px; }
.audit-cluster { flex: 1 1 300px; background: var(--audit-card); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.audit-cluster-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; color: var(--audit-muted); }
.audit-cluster-count { color: var(--audit-ink); }
.audit-cluster h3 { font-size: 21px; line-height: 1.3; font-weight: 600; }
.audit-cluster blockquote { padding: 14px 16px; background: var(--audit-ground); border-radius: 10px; font-size: 15px; line-height: 1.5; color: #30343B; }

.audit-moments { margin-top: 24px; }
.audit-moment { display: flex; flex-wrap: wrap; gap: 12px 32px; padding: 20px 0; border-top: 1px solid var(--audit-line); }
.audit-moment-lens { flex: 0 0 200px; font-size: 13px; color: var(--audit-muted); padding-top: 3px; }
.audit-moment-body { flex: 1 1 420px; display: flex; flex-direction: column; gap: 8px; }
.audit-moment-quote { font-size: 18px; line-height: 1.45; font-weight: 500; }
.audit-moment-fin { font-size: 15px; color: var(--audit-muted); }

.audit-cta { background: var(--audit-ink); color: #fff; border-radius: 16px; padding: 44px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 28px; }
.audit-cta-text { flex: 1 1 420px; display: flex; flex-direction: column; gap: 10px; }
.audit-report .audit-cta h2 { font-size: 28px; }
.audit-cta p { font-size: 17px; line-height: 1.55; color: var(--audit-on-dark-muted); }
.audit-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.audit-btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; border-radius: 10px; font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer; }
.audit-btn.hidden { display: none; }
.audit-btn-primary { background: var(--audit-accent); color: #fff; border: 0; }
.audit-btn-primary:hover { background: var(--audit-accent-dark); color: #fff; }
.audit-btn-ghost { background: transparent; color: #fff; border: 1px solid #4A4E57; font-weight: 500; }
.audit-btn-ghost:hover { border-color: #8A8F99; color: #fff; }

.audit-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 1.6; color: var(--audit-muted); padding: 0 4px; }
.audit-foot div:first-child { max-width: 640px; }

@media (max-width: 640px) {
  .audit-card, .audit-hero, .audit-cta { padding: 24px; }
  .audit-report .audit-headline { font-size: 30px; }
  .audit-lede { font-size: 17px; }
  .audit-lens-name, .audit-moment-lens { flex-basis: 100%; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body:has(.audit-report) { background: #fff; }
  body:has(.audit-report) .app-header,
  body:has(.audit-report) .app-footer { display: none; }
  .audit-report { gap: 16px; margin-top: 0; }
  .audit-card, .audit-stat, .audit-cluster { border: 1px solid var(--audit-line); }
  .audit-hero { padding: 24px; }
  .audit-report .audit-headline { font-size: 30px; }
  .audit-no-print { display: none !important; }
  .audit-cta { background: #fff; color: var(--audit-ink); border: 1px solid var(--audit-line); padding: 24px; }
  .audit-cta p { color: var(--audit-text-2); }
  .audit-stat-dark { background: #fff; color: var(--audit-ink); }
  .audit-stat-dark .audit-stat-label { color: var(--audit-muted); }
  .audit-card, .audit-stat, .audit-cluster, .audit-moment, .audit-cta { break-inside: avoid; }
  .audit-report * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ------------------------------------------------------------------ */
/* Refreshed UI — tokens and components shared by the redesigned        */
/* screens (Clusters, Signals). Pages opt in with AppLayout `refreshed`, */
/* which sets body[data-ui="refresh"] and loads Geist.                  */
/* ------------------------------------------------------------------ */

body[data-ui="refresh"] {
  --ui-ground: #FAFAF8;
  --ui-card: #FFFFFF;
  --ui-line: #E8E8E3;
  --ui-line-strong: #DCDCD6;
  --ui-line-soft: #EEEEEA;
  --ui-ink: #14161B;
  --ui-text: #343843;
  --ui-muted: #5A606C;
  --ui-faint: #6B7280;
  --ui-accent: #2F4BD8;
  --ui-accent-hover: #1E36A8;
  --ui-open: #E0A100;
  --ui-chip: #EFEFEC;
  --ui-font: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ui-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--ui-ground);
}

/* Header: title, summary line, view switcher and "New cluster". */
body[data-ui="refresh"] .app-header-title {
  background: var(--ui-ground);
  border-bottom: 0;
  font-family: var(--ui-font);
  color: var(--ui-ink);
}

body[data-ui="refresh"] .app-header-title-inner {
  flex-wrap: wrap;
  align-items: flex-end;
  padding-top: 28px;
  padding-bottom: 4px;
}

body[data-ui="refresh"] .app-header-title h1 {
  font-size: 32px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ui-ink);
}

body[data-ui="refresh"] .app-header-title .subtitle {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ui-muted);
}

.ui-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

body[data-ui="refresh"] .subnav-tabs {
  padding: 4px;
  background: var(--ui-chip);
  border-radius: 10px;
}

body[data-ui="refresh"] .subnav-tab {
  min-height: 36px;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ui-muted);
}

body[data-ui="refresh"] .subnav-tab:hover {
  color: var(--ui-ink);
}

body[data-ui="refresh"] .subnav-tab.active {
  background: var(--ui-card);
  color: var(--ui-ink);
  font-weight: 550;
  box-shadow: 0 1px 2px rgba(20, 22, 27, 0.08);
}

.ui-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Buttons */
.ui-btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 550;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

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

.ui-btn-icon {
  display: inline-flex;
}

.ui-btn-grow {
  flex: 1;
}

.ui-btn-primary {
  border: 0;
  background: var(--ui-accent);
  color: #fff;
  font-weight: 600;
}

.ui-btn-primary:hover:not(:disabled) {
  background: var(--ui-accent-hover);
}

.ui-btn-secondary {
  border: 1px solid var(--ui-line-strong);
  background: var(--ui-card);
  color: var(--ui-ink);
}

.ui-btn-secondary:hover:not(:disabled) {
  background: #F4F4F1;
}

.ui-btn-dark {
  border: 0;
  background: var(--ui-ink);
  color: #fff;
  font-weight: 600;
  padding: 0 18px;
}

.ui-btn-dark:hover {
  background: #2A2D35;
}

.ui-icon-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--ui-line-strong);
  border-radius: 9px;
  background: var(--ui-card);
  color: var(--ui-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ui-icon-btn:hover:not(:disabled) {
  background: #F4F4F1;
}

.ui-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ui-icon-btn-filled {
  border: 0;
  background: #F2F2EF;
}

.ui-icon-btn-lg {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.ui-search {
  width: 240px;
  max-width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background: var(--ui-card);
  font-family: var(--ui-font);
  font-size: 14px;
  color: var(--ui-ink);
}

.ui-mono {
  font-family: var(--ui-mono);
  overflow-wrap: anywhere;
}

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

@media (max-width: 720px) {
  .ui-search {
    width: 100%;
  }
}

/* Segmented control, e.g. a period picker: buttons with aria-pressed. */
.ui-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--ui-chip);
  border-radius: 10px;
}

.ui-segmented button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-family: var(--ui-font);
  font-size: 13px;
  color: var(--ui-muted);
  cursor: pointer;
}

.ui-segmented button:hover {
  color: var(--ui-ink);
}

.ui-segmented button[aria-pressed="true"] {
  background: var(--ui-card);
  color: var(--ui-ink);
  font-weight: 550;
  box-shadow: 0 1px 2px rgba(20, 22, 27, 0.08);
}

/* Native <select> styled as a button, with its own chevron. */
.ui-select {
  position: relative;
  display: inline-flex;
}

.ui-select select {
  appearance: none;
  min-height: 44px;
  padding: 0 34px 0 14px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background: var(--ui-card);
  font-family: var(--ui-font);
  font-size: 13px;
  color: var(--ui-ink);
  cursor: pointer;
}

.ui-select::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.6px solid var(--ui-muted);
  border-bottom: 1.6px solid var(--ui-muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.ui-segmented button:focus-visible,
.ui-select select:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}

/* Neutral outline chip (lenses never get colours), with an optional remove
   button whose hit area is enlarged to 44px without changing the chip. */
.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid #E2E2DC;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  color: #4B505B;
  background: var(--ui-card);
}

.ui-chip.is-removing {
  opacity: 0.5;
}

.ui-chip-remove {
  position: relative;
  width: 16px;
  height: 16px;
  margin-right: -4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ui-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ui-chip-remove::before {
  content: "";
  position: absolute;
  inset: -14px;
}

.ui-chip-remove:hover {
  background: #EDEDE8;
  color: var(--ui-ink);
}

.ui-chip-remove:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 1px;
}

/* ------------------------------------------------------------------ */
/* Refreshed UI — the older pages' components (Overview, Trends,        */
/* Settings, onboarding, error pages) in the same tokens. Markup and JS */
/* are unchanged; these only restyle the existing classes.              */
/* ------------------------------------------------------------------ */

body[data-ui="refresh"] {
  font-family: var(--ui-font);
  color: var(--ui-ink);
}

/* Cards */
body[data-ui="refresh"] .filter-card,
body[data-ui="refresh"] .rule-card,
body[data-ui="refresh"] .chart-card,
body[data-ui="refresh"] .issue-card,
body[data-ui="refresh"] .trend-card,
body[data-ui="refresh"] .history-cta,
body[data-ui="refresh"] .claim-card,
body[data-ui="refresh"] .account-card,
body[data-ui="refresh"] .trello-settings-card,
body[data-ui="refresh"] .error-page-card {
  background: var(--ui-card);
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(20, 22, 27, 0.03);
}

/* Lenses never get colours: no coloured stripe on the older cards. */
body[data-ui="refresh"] .issue-card,
body[data-ui="refresh"] .trend-card {
  border-left-width: 1px;
  border-left-color: var(--ui-line) !important;
}

body[data-ui="refresh"] .danger-card {
  border-color: #F1D3CC;
}

body[data-ui="refresh"] .toolbar,
body[data-ui="refresh"] .status {
  background: var(--ui-card);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  box-shadow: none;
}

body[data-ui="refresh"] .status {
  color: var(--ui-muted);
}

body[data-ui="refresh"] .info-box {
  background: #EEF1FF;
  border: 0;
  border-radius: 14px;
  color: #2A3FA8;
}

body[data-ui="refresh"] .modal-dialog {
  border-radius: 18px;
}

/* Headings and secondary text */
body[data-ui="refresh"] .stats-section-title,
body[data-ui="refresh"] .trends-heading,
body[data-ui="refresh"] .modal-title {
  color: var(--ui-ink);
  letter-spacing: -0.01em;
}

body[data-ui="refresh"] .modal-field-label,
body[data-ui="refresh"] .rule-criterion-label,
body[data-ui="refresh"] .rule-pattern-label,
body[data-ui="refresh"] .stats-range-label {
  color: var(--ui-muted);
}

body[data-ui="refresh"] .modal-field-hint {
  color: var(--ui-faint);
}

/* Buttons: accent for the main action, white outline for the others,
   ink for page-level "New …" actions, red only for destructive ones. */
body[data-ui="refresh"] .modal-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* The display above outranks the plain .hidden the scripts toggle. */
body[data-ui="refresh"] .modal-btn.hidden {
  display: none;
}

body[data-ui="refresh"] .modal-btn-primary {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: #fff;
}

body[data-ui="refresh"] .modal-btn-primary:hover:not(:disabled) {
  background: var(--ui-accent-hover);
  border-color: var(--ui-accent-hover);
}

body[data-ui="refresh"] .modal-btn-secondary {
  background: var(--ui-card);
  border-color: var(--ui-line-strong);
  color: var(--ui-ink);
}

body[data-ui="refresh"] .modal-btn-secondary:hover:not(:disabled) {
  background: #F4F4F1;
  border-color: var(--ui-line-strong);
}

body[data-ui="refresh"] .modal-btn-danger {
  background: #A8321F;
  border-color: #A8321F;
  color: #fff;
}

body[data-ui="refresh"] .modal-btn-danger:hover:not(:disabled) {
  background: #8E2918;
  border-color: #8E2918;
}

body[data-ui="refresh"] .toolbar-btn,
body[data-ui="refresh"] .filter-refresh {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--ui-ink);
  color: #fff;
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 600;
}

body[data-ui="refresh"] .toolbar-btn:hover,
body[data-ui="refresh"] .filter-refresh:hover {
  background: #2A2D35;
}

body[data-ui="refresh"] .load-more-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background: var(--ui-card);
  color: var(--ui-ink);
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 550;
}

body[data-ui="refresh"] .toolbar-refresh,
body[data-ui="refresh"] .rule-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 9px;
  background: var(--ui-card);
  color: var(--ui-ink);
}

body[data-ui="refresh"] .toolbar-refresh {
  min-width: 44px;
  height: 44px;
  border-radius: 10px;
}

body[data-ui="refresh"] .toolbar-refresh:hover,
body[data-ui="refresh"] .rule-btn:hover:not(:disabled) {
  background: #F4F4F1;
  border-color: var(--ui-line-strong);
  color: var(--ui-ink);
}

body[data-ui="refresh"] .rule-btn-danger:hover:not(:disabled) {
  color: #A8321F;
}

/* Fields */
body[data-ui="refresh"] .modal-input,
body[data-ui="refresh"] .filter-select {
  min-height: 44px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background-color: var(--ui-card);
  font-family: var(--ui-font);
  font-size: 14px;
  color: var(--ui-ink);
}

body[data-ui="refresh"] .modal-input:focus,
body[data-ui="refresh"] .filter-select:focus {
  outline: 2px solid var(--ui-accent);
  outline-offset: 1px;
  border-color: var(--ui-line-strong);
  box-shadow: none;
}

/* Segmented range buttons, like the period control on Signals. */
body[data-ui="refresh"] .range-group {
  background: var(--ui-chip);
  border-radius: 10px;
  padding: 3px;
}

body[data-ui="refresh"] .range-btn {
  min-height: 38px;
  border-radius: 7px;
  font-family: var(--ui-font);
  font-weight: 400;
  color: var(--ui-muted);
}

body[data-ui="refresh"] .range-btn.active {
  background: var(--ui-card);
  color: var(--ui-ink);
  font-weight: 550;
  box-shadow: 0 1px 2px rgba(20, 22, 27, 0.08);
}

/* Rule toggle: on is the same green as Approve. */
body[data-ui="refresh"] .rule-switch input:checked + .rule-switch-track {
  background: #1F7A45;
}

body[data-ui="refresh"] .rule-switch input:focus-visible + .rule-switch-track {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}

/* Badges and chips */
body[data-ui="refresh"] .trello-badge {
  border: 0;
  background: #F2F2EF;
  color: var(--ui-text);
}

/* Configured: a positive state, tinted like the Action needed pill. */
body[data-ui="refresh"] .trello-badge-on {
  background: #D5F0DF;
  color: #155E36;
}

/* Settings › Danger zone keeps its red: it leads to a destructive action. */
body[data-ui="refresh"] .subnav-tab-danger,
body[data-ui="refresh"] .subnav-tab-danger:hover,
body[data-ui="refresh"] .subnav-tab-danger.active {
  color: #A8321F;
}

body[data-ui="refresh"] .trend-category-badge {
  padding: 3px 9px;
  border: 1px solid #E2E2DC;
  border-radius: 999px;
  background: var(--ui-card);
  color: #4B505B;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

body[data-ui="refresh"] .issue-tag {
  background: var(--ui-card) !important;
  border: 1px solid #E2E2DC;
  color: #4B505B;
  text-transform: none;
  font-weight: 400;
}

/* Links */
body[data-ui="refresh"] .trello-help-link,
body[data-ui="refresh"] .account-plan-link,
body[data-ui="refresh"] .claim-logos-link,
body[data-ui="refresh"] .issue-id-link {
  color: var(--ui-accent);
}

body[data-ui="refresh"] .rule-failed-toggle {
  color: var(--ui-accent);
}

body[data-ui="refresh"] .app-footer {
  border-top-color: var(--ui-line);
  color: var(--ui-muted);
}

body[data-ui="refresh"] .app-footer a {
  color: var(--ui-muted);
}

body[data-ui="refresh"] .app-footer a:hover {
  color: var(--ui-ink);
}

/* ------------------------------------------------------------------ */
/* Clusters — cards grid and detail drawer (clusters.html)              */
/* ------------------------------------------------------------------ */


body.cl-drawer-open {
  overflow: hidden;
}

/* Page */
.cl-page {
  font-family: var(--ui-font);
  color: var(--ui-ink);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cl-page [hidden],
.cl-drawer-root[hidden] {
  display: none;
}

.cl-create-tile:focus-visible,
.cl-explainer-close:focus-visible,
.cl-more-item:focus-visible,
.cl-page a:focus-visible,
.cl-drawer a:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}

/* Explainer banner */
.cl-explainer {
  background: var(--ui-ink);
  color: #fff;
  border-radius: 18px;
  padding: 24px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}

.cl-explainer-text {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cl-explainer-text h2 {
  font-size: 18px;
  font-weight: 600;
}

.cl-explainer-text p {
  font-size: 14px;
  line-height: 1.55;
  color: #C9CCD3;
}

.cl-explainer-steps {
  flex: 2 1 480px;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.cl-explainer-steps li {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cl-explainer-steps li.is-current {
  background: #fff;
  color: var(--ui-ink);
}

.cl-step-num {
  font-family: var(--ui-mono);
  font-size: 12px;
  color: #9AA3B5;
}

.is-current .cl-step-num {
  color: var(--ui-accent);
}

.cl-step-name {
  font-size: 14px;
  font-weight: 600;
}

.cl-step-desc {
  font-size: 12px;
  color: #C9CCD3;
}

.is-current .cl-step-desc {
  color: var(--ui-muted);
}

.cl-explainer-close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cl-explainer-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Filter row */
.cl-filters {
  display: flex;
  justify-content: flex-end;
}

.cl-empty {
  font-size: 14px;
  color: var(--ui-muted);
}

/* Card grid */
.cl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 16px;
}

.cl-card {
  background: var(--ui-card);
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 1px 2px rgba(20, 22, 27, 0.03);
  min-width: 0;
}

.cl-card-last {
  font-size: 12px;
  color: var(--ui-faint);
}

.cl-card-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cl-card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cl-card-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ui-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cl-stats {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--ui-ground);
  border-radius: 12px;
}

.cl-stats-nums {
  display: flex;
  gap: 22px;
}

.cl-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cl-stat-value {
  font-size: 26px;
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cl-stat-label {
  font-size: 12px;
  color: var(--ui-muted);
}

.cl-trend {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.cl-trend .cl-stat-label {
  font-size: 11px;
}

.cl-spark polyline {
  fill: none;
  stroke: var(--ui-accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.cl-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.cl-create-tile {
  min-height: 320px;
  border: 1.5px dashed #CFCFC8;
  border-radius: 18px;
  background: transparent;
  color: var(--ui-muted);
  font-family: var(--ui-font);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 22px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.cl-create-tile:hover {
  border-color: var(--ui-muted);
  background: rgba(255, 255, 255, 0.6);
}

.cl-create-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ui-ink);
}

.cl-create-text {
  font-size: 13px;
  line-height: 1.5;
  max-width: 240px;
  text-align: center;
}

/* Drawer */
.cl-drawer-root {
  position: fixed;
  inset: 0;
  z-index: 900; /* below .modal-overlay (1000), so confirmations sit on top */
  display: flex;
  justify-content: flex-end;
  font-family: var(--ui-font);
  color: var(--ui-ink);
}

.cl-drawer-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(20, 22, 27, 0.32);
  cursor: default;
  animation: cl-fade-in 0.2s ease-out;
}

.cl-drawer {
  position: relative;
  width: min(600px, 100%);
  height: 100%;
  background: var(--ui-card);
  box-shadow: -12px 0 40px rgba(20, 22, 27, 0.16);
  display: flex;
  flex-direction: column;
  outline: none;
  animation: cl-slide-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cl-fade-in {
  from { opacity: 0; }
}

@keyframes cl-slide-in {
  from { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .cl-drawer,
  .cl-drawer-scrim {
    animation: none;
  }
}

.cl-drawer-bar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--ui-line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.cl-drawer-nav {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cl-drawer-pos {
  font-size: 13px;
  color: var(--ui-muted);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.cl-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cl-drawer-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cl-drawer-meta {
  font-size: 12px;
  color: var(--ui-faint);
}

.cl-drawer-title {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.cl-drawer-desc {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ui-text);
  white-space: pre-line;
}

.cl-drawer-desc.cluster-description-empty {
  color: var(--ui-faint);
  font-style: italic;
}

.cl-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cl-tile {
  padding: 12px 14px;
  background: var(--ui-ground);
  border-radius: 12px;
  justify-content: space-between;
}

.cl-tile .cl-stat-value {
  font-size: 22px;
}

.cl-tile.cl-trend {
  align-items: stretch;
  gap: 4px;
}

.cl-tile.cl-trend .cl-stat-label {
  font-size: 12px;
}

.cl-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Trello and Analyze flows replace the buttons and take the full row. */
.cl-drawer-actions > .cluster-query-form,
.cl-drawer-actions > .trello-comment-form {
  flex: 1 1 100%;
}

.cl-more {
  position: relative;
}

.cl-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  min-width: 190px;
  padding: 4px;
  background: var(--ui-card);
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 22, 27, 0.12);
  display: flex;
  flex-direction: column;
}

.cl-more-menu[hidden] {
  display: none;
}

.cl-more-item {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-family: var(--ui-font);
  font-size: 14px;
  color: var(--ui-ink);
  text-align: left;
  cursor: pointer;
}

.cl-more-item:hover,
.cl-more-item:focus-visible {
  background: #F4F4F1;
}

.cl-more-item-danger {
  color: #B42318;
}

.cl-signals {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--ui-line-soft);
}

.cl-signals-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ui-muted);
}

.cl-signals-note {
  font-size: 14px;
  color: var(--ui-muted);
}

.cl-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.cl-timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 14px;
}

.cl-timeline-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cl-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ui-open);
  margin-top: 6px;
  flex-shrink: 0;
}

.cl-timeline-line {
  flex: 1;
  width: 2px;
  background: var(--ui-line-soft);
  margin-top: 6px;
}

.cl-timeline-item:last-child .cl-timeline-line {
  visibility: hidden;
}

.cl-timeline-body {
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cl-timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--ui-faint);
}

.cl-drawer a {
  color: var(--ui-accent);
}

.cl-drawer a:hover {
  color: var(--ui-accent-hover);
}

.cl-timeline-text {
  font-size: 14px;
  line-height: 1.55;
  color: #22252C;
}

.cl-timeline-link {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 550;
  padding: 2px 0;
}

@media (max-width: 720px) {
  .cl-explainer {
    padding: 20px;
  }

  .cl-explainer-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cl-explainer-close {
    order: -1;
    margin-left: auto;
  }

  .cl-stats {
    flex-wrap: wrap;
  }

  .cl-drawer-bar {
    padding: 12px 16px;
  }

  .cl-drawer-body {
    padding: 20px 16px 24px;
  }

  .cl-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cl-tiles .cl-trend {
    grid-column: 1 / -1;
  }
}

/* ------------------------------------------------------------------ */
/* Signals — tabs, lens sidebar, toolbar and signal cards (index.html)  */
/* ------------------------------------------------------------------ */

.sg-page {
  font-family: var(--ui-font);
  color: var(--ui-ink);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sg-page [hidden] {
  display: none;
}

.sg-page a:focus-visible,
.sg-page button:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}

/* State tabs: full-width row with an ink underline under the active tab. */
.sg-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--ui-line);
}

.sg-tab {
  min-height: 46px;
  padding: 0 14px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-family: var(--ui-font);
  font-size: 14px;
  color: var(--ui-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.sg-tab:hover {
  color: var(--ui-ink);
}

.sg-tab[aria-selected="true"] {
  color: var(--ui-ink);
  font-weight: 600;
  border-bottom-color: var(--ui-ink);
}

.sg-tab-count {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.sg-tab-count-new { background: #FFE7A3; color: #6B4A00; }
.sg-tab-count-verified { background: #D5F0DF; color: #155E36; }
.sg-tab-count-reported { background: #E3E8FF; color: #2A3FA8; }

.sg-tab-dropdown {
  position: relative;
}

.sg-tab-chevron {
  transition: transform 0.12s;
}

.sg-tab[aria-expanded="true"] .sg-tab-chevron {
  transform: rotate(180deg);
}

.sg-tab-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 190px;
  padding: 4px;
  background: var(--ui-card);
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 22, 27, 0.12);
  display: flex;
  flex-direction: column;
}

.sg-tab-menu[hidden] {
  display: none;
}

.sg-tab-menu-item {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-family: var(--ui-font);
  font-size: 14px;
  color: var(--ui-ink);
  text-align: left;
  cursor: pointer;
}

.sg-tab-menu-item:hover,
.sg-tab-menu-item:focus-visible {
  background: #F4F4F1;
}

.sg-tab-menu-item[aria-checked="true"] {
  font-weight: 600;
}

/* Two columns that wrap on narrow screens. */
.sg-body {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.sg-lenses {
  flex: 1 1 240px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sg-lenses-heading {
  margin: 0 0 4px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ui-muted);
}

.sg-lens-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sg-lens {
  width: 100%;
  min-height: 44px;
  padding: 6px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-family: var(--ui-font);
  font-size: 14px;
  line-height: 1.35;
  color: var(--ui-text);
  text-align: left;
  cursor: pointer;
}

.sg-lens:hover {
  background: #F2F2EF;
}

.sg-lens[aria-pressed="true"] {
  background: var(--ui-ink);
  color: #fff;
  font-weight: 600;
}

.sg-lenses-divider {
  border: 0;
  height: 1px;
  background: var(--ui-line);
  margin: 10px 12px;
}

.sg-lens-extra {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  font-family: var(--ui-font);
  font-size: 14px;
  text-align: left;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--ui-muted);
  cursor: pointer;
}

.sg-lens-extra:hover {
  color: var(--ui-ink);
}

.sg-lens-help {
  color: var(--ui-accent);
}

.sg-lens-help:hover {
  color: var(--ui-accent-hover);
}

.sg-lenses-help {
  padding: 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ui-muted);
}

.sg-main {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.sg-toolbar-filters,
.sg-toolbar-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sg-toolbar-search .ui-search {
  width: 260px;
}

/* Learning-loop line */
.sg-learning {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ui-card);
  border: 1px solid var(--ui-line);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ui-text);
}

.sg-learning svg {
  flex-shrink: 0;
  color: var(--ui-accent);
}

.sg-learning strong {
  color: var(--ui-ink);
}

.sg-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sg-empty {
  font-size: 14px;
  color: var(--ui-muted);
  padding: 8px 0;
}

.sg-page .load-more-wrap {
  display: flex;
  justify-content: center;
}

.sg-page .load-more-wrap.hidden {
  display: none;
}

@media (max-width: 720px) {
  /* The lens list becomes one scrollable row instead of a tall column. */
  .sg-lenses {
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .sg-lenses-heading {
    flex: 1 1 100%;
  }

  .sg-lens-list {
    flex: 1 1 100%;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 2px;
  }

  .sg-lens {
    width: auto;
    white-space: nowrap;
  }

  .sg-lenses-divider {
    display: none;
  }

  .sg-lenses-help {
    flex: 1 1 100%;
  }

  .sg-toolbar-search {
    flex: 1 1 100%;
    flex-wrap: nowrap;
  }

  .sg-toolbar-search .ui-search {
    width: auto;
    flex: 1;
    min-width: 0;
  }
}

/* Signal card */
.sg-card {
  background: var(--ui-card);
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 1px 2px rgba(20, 22, 27, 0.03);
  min-width: 0;
  transition: box-shadow 0.3s;
}

.sg-card-deep-linked {
  box-shadow: 0 0 0 3px rgba(47, 75, 216, 0.25);
}

.sg-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 10px;
  align-items: center;
  font-size: 13px;
  color: var(--ui-muted);
}

.sg-card-meta-left {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  min-width: 0;
}

/* Wide screens: the time stays top-right and the rest wraps beside it. */
@media (min-width: 721px) {
  .sg-card-meta {
    flex-wrap: nowrap;
    align-items: flex-start;
  }

  .sg-card-meta-left {
    flex: 1;
  }

  .sg-card-time {
    flex-shrink: 0;
    line-height: 20px;
  }

  .sg-card-meta-left {
    min-height: 20px;
  }
}

.sg-importance {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.sg-importance-bars {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
}

.sg-importance-bar {
  width: 4px;
  border-radius: 2px;
  background: var(--ui-line-strong);
}

.sg-importance-bar.is-filled {
  background: var(--ui-ink);
}

.sg-importance-bar-1 { height: 8px; }
.sg-importance-bar-2 { height: 12px; }
.sg-importance-bar-3 { height: 16px; }

.sg-importance-label {
  font-weight: 550;
  color: var(--ui-ink);
}

.sg-conv-link {
  font-size: 12px;
  color: var(--ui-accent);
  overflow-wrap: anywhere;
}

.sg-conv-link:hover {
  color: var(--ui-accent-hover);
}

.sg-card-time {
  white-space: nowrap;
}

.sg-summary-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.sg-summary {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 500;
  color: var(--ui-ink);
  overflow-wrap: anywhere;
}

.sg-edit-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin: -10px -12px -10px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ui-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

.sg-card:hover .sg-edit-btn,
.sg-edit-btn:focus-visible {
  opacity: 1;
}

.sg-edit-btn:hover {
  background: #F2F2EF;
  color: var(--ui-ink);
}

/* Touch screens have no hover: keep the pencil visible. */
@media (hover: none) {
  .sg-edit-btn {
    opacity: 1;
  }
}

.sg-evidence {
  margin: 0;
  background: var(--ui-ground);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sg-evidence-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ui-muted);
}

.sg-evidence-quote {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ui-text);
  white-space: pre-line;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sg-evidence-quote mark {
  background: #FFE9A8;
  color: var(--ui-ink);
  padding: 1px 3px;
  border-radius: 3px;
}

.sg-context {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
  font-size: 13px;
  color: var(--ui-muted);
}

.sg-meta-cluster {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  min-width: 0;
}

.sg-meta-cluster svg {
  flex-shrink: 0;
}

.sg-cluster-link {
  color: var(--ui-ink);
  font-weight: 550;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.sg-cluster-link:hover {
  color: var(--ui-accent);
  text-decoration: underline;
}

.sg-muted {
  color: var(--ui-faint);
}

.sg-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sg-link-btn {
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  font-family: var(--ui-font);
  font-size: 13px;
  font-weight: 550;
  color: var(--ui-accent);
  cursor: pointer;
}

.sg-link-btn:hover {
  color: var(--ui-accent-hover);
  text-decoration: underline;
}

.sg-context-end {
  margin-left: auto;
}

/* State panel, tinted by lifecycle state. */
.sg-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 12px 12px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
}

.sg-panel-review { background: #FBF1DC; color: #5B4300; }
.sg-panel-action { background: #E6F3EB; color: #155E36; }
.sg-panel-progress { background: #EEF1FF; color: #2A3FA8; }
.sg-panel-neutral { background: #F2F2EF; color: var(--ui-text); }
.sg-panel-done { background: #F2F2EF; color: var(--ui-text); font-weight: 400; }

.sg-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sg-pill {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 999px;
  background: var(--ui-card);
  font-family: var(--ui-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ui-ink);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
}

.sg-pill:hover:not(:disabled) {
  background: #F7F7F4;
}

.sg-pill:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sg-pill-icon {
  display: inline-flex;
}

.sg-pill-approve {
  border-color: transparent;
  background: #1F7A45;
  color: #fff;
}

.sg-pill-approve:hover:not(:disabled) {
  background: #18663A;
}

.sg-pill-dismiss {
  border-color: transparent;
  background: #A8321F;
  color: #fff;
}

.sg-pill-dismiss:hover:not(:disabled) {
  background: #8E2918;
}

/* The Dismiss reason form and the Trello form replace the panel. */
.sg-actions > .reject-signal-form,
.sg-actions > .trello-comment-form {
  background: var(--ui-ground);
  border-radius: 14px;
  padding: 16px;
}

.sg-card .issue-transcript {
  margin: 0;
}

/* The existing comment / reason row and its editor, in the card's style. */
.sg-card .issue-comment-row {
  margin: 0;
  padding: 12px 16px;
  background: var(--ui-ground);
  border: 0;
  border-radius: 12px;
}

.sg-card .issue-comment-label {
  font-size: 12px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ui-muted);
}

.sg-card .issue-comment-text {
  font-size: 14px;
  color: var(--ui-text);
}

.sg-card .issue-comment-edit-btn {
  width: 44px;
  height: 44px;
  margin: -12px -12px -12px 0;
  border-radius: 10px;
}

@media (max-width: 720px) {
  .sg-tabs {
    gap: 0;
  }

  .sg-tab {
    padding: 0 10px;
  }

  .sg-card {
    padding: 18px 16px;
  }

  .sg-panel {
    padding: 12px;
  }

  .sg-panel-actions,
  .sg-panel-actions .sg-pill {
    flex: 1 1 auto;
    justify-content: center;
  }
}
